1
0

options.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # python-cc1101 - Python Library to Transmit RF Signals via CC1101 Transceivers
  2. #
  3. # Copyright (C) 2020 Fabian Peter Hammerle <fabian@hammerle.me>
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. import enum
  18. class GDOSignalSelection(enum.IntEnum):
  19. """
  20. 0x00-0x02 IOCFG{2..0}.GDO?_CFG
  21. Table 41: GDOx Signal Selection (x = 0, 1, or 2)
  22. """
  23. # > Associated to the RX FIFO:
  24. # > Asserts when RX FIFO is filled at or above the RX FIFO threshold
  25. # > or the end of packet is reached. De-asserts when the RX FIFO is empty.
  26. RX_FIFO_AT_OR_ABOVE_THRESHOLD_OR_PACKET_END_REACHED = 0x01
  27. class _TransceiveMode(enum.IntEnum):
  28. """
  29. 0x08 PKTCTRL0.PKT_FORMAT
  30. """
  31. FIFO = 0b00
  32. SYNCHRONOUS_SERIAL = 0b01
  33. RANDOM_TRANSMISSION = 0b10
  34. ASYNCHRONOUS_SERIAL = 0b11
  35. class PacketLengthMode(enum.IntEnum):
  36. """
  37. 0x08 PKTCTRL0.LENGTH_CONFIG
  38. """
  39. FIXED = 0b00
  40. VARIABLE = 0b01
  41. # INFINITE = 0b10
  42. class ModulationFormat(enum.IntEnum):
  43. """
  44. 0x12 MDMCFG2.MOD_FORMAT
  45. """
  46. FSK2 = 0b000
  47. GFSK = 0b001
  48. ASK_OOK = 0b011
  49. FSK4 = 0b100
  50. MSK = 0b111
  51. class SyncMode(enum.IntEnum):
  52. """
  53. 0x12 MDMCFG2.SYNC_MODE
  54. see "14.3 Byte Synchronization"
  55. """
  56. NO_PREAMBLE_AND_SYNC_WORD = 0b00
  57. TRANSMIT_16_MATCH_15_BITS = 0b01
  58. TRANSMIT_16_MATCH_16_BITS = 0b10
  59. TRANSMIT_32_MATCH_30_BITS = 0b11