Python LT8900 via SPI

Artifact [518ba22cf5]
Login

Artifact [518ba22cf5]

Artifact 518ba22cf568844761179e02c938ab2013f38bf75d24acc899d8e024ca92a6ff:

Wiki page [Python LT8900 via SPI] by rkeene on 2020-04-28 18:09:22.
D 2020-04-28T18:09:22.424
L Python\sLT8900\svia\sSPI
N text/x-markdown
P 7e830dcec5b518b6b7a7217d23e69435a280fb3414948619244125b8af991375
U rkeene
W 973
Python LT8900 via SPI
=====================

This Python module enables a Python to talk to an LT8900 radio attached to an serial peripheral interface (SPI).

Example
-------

    #! /usr/bin/env python3
    
    import time

    import gpiozero
    import lt8900_spi
    
    # Need to keep this attached to drive the line high -- if the object disappears then
    # the GPIO port gets reconfigured as an input port
    # Note broadcom pin numbers are used
    reset_gpio = gpiozero.LED(24)
    reset_gpio.on()
    def reset_module_via_gpio():    
    	reset_gpio.off()
    	time.sleep(0.1)
    	reset_gpio.on()
    	time.sleep(0.1)

    radio = lt8900_spi.radio(0, 0, {
    	'reset_command': reset_module_via_gpio
    })
    
    if not radio.initialize():
    	raise ValueError('Initialize failed')

    radio.set_syncword([0x258B, 0x147A])

    radio.multi_transmit([0xB0, 0x51, 0xF0, 0x00, 0x00, 0x01, 212], [9, 40, 71], delay = 0.5)
Z f1b31bdd0bd0aa839367639173b47dbc