Browse Source

examples: set output power levels to invert signals

https://github.com/fphammerle/python-cc1101/issues/27#issuecomment-766020245
https://github.com/fphammerle/python-cc1101/issues/30#issuecomment-766094920
Fabian Peter Hammerle 3 years ago
parent
commit
4ae9169f0e

+ 1 - 0
examples/asynchronous_gpio_transmit.py

@@ -15,6 +15,7 @@ GPIO.setup(_GDO0_PIN, GPIO.OUT, initial=GPIO.LOW)
 with cc1101.CC1101() as transceiver:
     transceiver.set_base_frequency_hertz(433.92e6)
     transceiver.set_symbol_rate_baud(600)
+    transceiver.set_output_power_levels((0, 0xC0))  # OOK modulation: (off, on)
     print(transceiver)
     print("starting transmission")
     with transceiver.asynchronous_transmission():

+ 1 - 0
examples/transmit_fixed_length.py

@@ -12,5 +12,6 @@ with cc1101.CC1101() as transceiver:
     transceiver.set_packet_length_mode(cc1101.PacketLengthMode.FIXED)
     transceiver.set_packet_length_bytes(4)
     transceiver.disable_checksum()
+    transceiver.set_output_power_levels((0, 0xC0))  # OOK modulation: (off, on)
     print(transceiver)
     transceiver.transmit(b"\xff\x00\xaa\xff")

+ 2 - 0
examples/transmit_variable_length.py

@@ -14,6 +14,7 @@ with cc1101.CC1101(lock_spi_device=True) as transceiver:
     # transceiver.set_preamble_length_bytes(2)
     # transceiver.set_sync_word(b"\x12\x34")
     # transceiver.disable_checksum()
+    transceiver.set_output_power_levels((0, 0xC0))  # OOK modulation: (off, on)
     print(transceiver)
     print("state", transceiver.get_marc_state().name)
     print("base frequency", transceiver.get_base_frequency_hertz(), "Hz")
@@ -24,6 +25,7 @@ with cc1101.CC1101(lock_spi_device=True) as transceiver:
     if sync_mode != cc1101.SyncMode.NO_PREAMBLE_AND_SYNC_WORD:
         print("preamble length", transceiver.get_preamble_length_bytes(), "bytes")
         print("sync word", transceiver.get_sync_word())
+    print("output power level settings", transceiver.get_output_power_levels())
     print("\nstarting transmission")
     transceiver.transmit(b"\xff\xaa\x00 message")
     time.sleep(1.0)