Implement a secure ICS protocol targeting LoRa Node151 microcontroller for controlling irrigation.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

132 lines
2.6 KiB

  1. /*
  2. / _____) _ | |
  3. ( (____ _____ ____ _| |_ _____ ____| |__
  4. \____ \| ___ | (_ _) ___ |/ ___) _ \
  5. _____) ) ____| | | || |_| ____( (___| | | |
  6. (______/|_____)_|_|_| \__)_____)\____)_| |_|
  7. (C) 2014 Semtech
  8. Description: -
  9. License: Revised BSD License, see LICENSE.TXT file include in the project
  10. Maintainers: Miguel Luis, Gregory Cristian and Nicolas Huguenin
  11. */
  12. #ifndef __ENUMS_H__
  13. #define __ENUMS_H__
  14. /*!
  15. * Radio driver internal state machine states definition
  16. */
  17. typedef enum RadioState
  18. {
  19. RF_IDLE = 0,
  20. RF_RX_RUNNING,
  21. RF_TX_RUNNING,
  22. RF_CAD,
  23. }RadioState_t;
  24. /*!
  25. * Type of the modem. [LORA / FSK]
  26. */
  27. typedef enum ModemType
  28. {
  29. MODEM_FSK = 0,
  30. MODEM_LORA
  31. }RadioModems_t;
  32. /*!
  33. * Type of the supported board. [SX1276MB1MAS / SX1276MB1LAS]
  34. */
  35. typedef enum BoardType
  36. {
  37. SX1276MB1MAS = 0,
  38. SX1276MB1LAS,
  39. UNKNOWN
  40. }BoardType_t;
  41. /*!
  42. * Radio FSK modem parameters
  43. */
  44. typedef struct
  45. {
  46. int8_t Power;
  47. uint32_t Fdev;
  48. uint32_t Bandwidth;
  49. uint32_t BandwidthAfc;
  50. uint32_t Datarate;
  51. uint16_t PreambleLen;
  52. bool FixLen;
  53. uint8_t PayloadLen;
  54. bool CrcOn;
  55. bool IqInverted;
  56. bool RxContinuous;
  57. uint32_t TxTimeout;
  58. uint32_t RxSingleTimeout;
  59. }RadioFskSettings_t;
  60. /*!
  61. * Radio FSK packet handler state
  62. */
  63. typedef struct
  64. {
  65. uint8_t PreambleDetected;
  66. uint8_t SyncWordDetected;
  67. int8_t RssiValue;
  68. int32_t AfcValue;
  69. uint8_t RxGain;
  70. uint16_t Size;
  71. uint16_t NbBytes;
  72. uint8_t FifoThresh;
  73. uint8_t ChunkSize;
  74. }RadioFskPacketHandler_t;
  75. /*!
  76. * Radio LoRa modem parameters
  77. */
  78. typedef struct
  79. {
  80. int8_t Power;
  81. uint32_t Bandwidth;
  82. uint32_t Datarate;
  83. bool LowDatarateOptimize;
  84. uint8_t Coderate;
  85. uint16_t PreambleLen;
  86. bool FixLen;
  87. uint8_t PayloadLen;
  88. bool CrcOn;
  89. bool FreqHopOn;
  90. uint8_t HopPeriod;
  91. bool IqInverted;
  92. bool RxContinuous;
  93. uint32_t TxTimeout;
  94. bool PublicNetwork;
  95. }RadioLoRaSettings_t;
  96. /*!
  97. * Radio LoRa packet handler state
  98. */
  99. typedef struct
  100. {
  101. int8_t SnrValue;
  102. int8_t RssiValue;
  103. uint8_t Size;
  104. }RadioLoRaPacketHandler_t;
  105. /*!
  106. * Radio Settings
  107. */
  108. typedef struct
  109. {
  110. RadioState State;
  111. ModemType Modem;
  112. uint32_t Channel;
  113. RadioFskSettings_t Fsk;
  114. RadioFskPacketHandler_t FskPacketHandler;
  115. RadioLoRaSettings_t LoRa;
  116. RadioLoRaPacketHandler_t LoRaPacketHandler;
  117. }RadioSettings_t;
  118. #endif //__ENUMS_H__