sx1276-FskMisc.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. /*
  2. * THE FOLLOWING FIRMWARE IS PROVIDED: (1) "AS IS" WITH NO WARRANTY; AND
  3. * (2)TO ENABLE ACCESS TO CODING INFORMATION TO GUIDE AND FACILITATE CUSTOMER.
  4. * CONSEQUENTLY, SEMTECH SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR
  5. * CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
  6. * OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
  7. * CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  8. *
  9. * Copyright (C) SEMTECH S.A.
  10. */
  11. /*!
  12. * \file sx1276-FskMisc.h
  13. * \brief SX1276 RF chip high level functions driver
  14. *
  15. * \remark Optional support functions.
  16. * These functions are defined only to easy the change of the
  17. * parameters.
  18. * For a final firmware the radio parameters will be known so
  19. * there is no need to support all possible parameters.
  20. * Removing these functions will greatly reduce the final firmware
  21. * size.
  22. *
  23. * \version 2.0.B2
  24. * \date May 6 2013
  25. * \author Gregory Cristian
  26. *
  27. * Last modified by Miguel Luis on Jun 19 2013
  28. */
  29. #ifndef __SX1276_FSK_MISC_H__
  30. #define __SX1276_FSK_MISC_H__
  31. /*!
  32. * \brief Writes the new RF frequency value
  33. *
  34. * \param [IN] freq New RF frequency value in [Hz]
  35. */
  36. void SX1276FskSetRFFrequency( uint32_t freq );
  37. /*!
  38. * \brief Reads the current RF frequency value
  39. *
  40. * \retval freq Current RF frequency value in [Hz]
  41. */
  42. uint32_t SX1276FskGetRFFrequency( void );
  43. /*!
  44. * \brief Calibrate RSSI and I/Q mismatch for HF
  45. *
  46. * \retval none
  47. */
  48. void SX1276FskRxCalibrate( void );
  49. /*!
  50. * \brief Writes the new bitrate value
  51. *
  52. * \param [IN] bitrate New bitrate value in [bps]
  53. */
  54. void SX1276FskSetBitrate( uint32_t bitrate );
  55. /*!
  56. * \brief Reads the current bitrate value
  57. *
  58. * \retval bitrate Current bitrate value in [bps]
  59. */
  60. uint32_t SX1276FskGetBitrate( void );
  61. /*!
  62. * \brief Writes the new frequency deviation value
  63. *
  64. * \param [IN] fdev New frequency deviation value in [Hz]
  65. */
  66. void SX1276FskSetFdev( uint32_t fdev );
  67. /*!
  68. * \brief Reads the current frequency deviation value
  69. *
  70. * \retval fdev Current frequency deviation value in [Hz]
  71. */
  72. uint32_t SX1276FskGetFdev( void );
  73. /*!
  74. * \brief Writes the new RF output power value
  75. *
  76. * \param [IN] power New output power value in [dBm]
  77. */
  78. void SX1276FskSetRFPower( int8_t power );
  79. /*!
  80. * \brief Reads the current RF output power value
  81. *
  82. * \retval power Current output power value in [dBm]
  83. */
  84. int8_t SX1276FskGetRFPower( void );
  85. /*!
  86. * \brief Writes the DC offset canceller and Rx bandwidth values
  87. *
  88. * \remark For SX1276 there is no DCC setting. dccValue should be 0
  89. * ie: SX1276SetDccBw( &SX1276.RegRxBw, 0, 62500 );
  90. *
  91. * \param [IN] reg Register pointer to either SX1231.RegRxBw or SX1231.RegAfcBw
  92. * \param [IN] dccValue New DC offset canceller value in [Hz] ( SX1231 only )
  93. * \param [IN] rxBwValue New Rx bandwidth value in [Hz]
  94. */
  95. void SX1276FskSetDccBw( uint8_t* reg, uint32_t dccValue, uint32_t rxBwValue );
  96. /*!
  97. * \brief Reads the current bandwidth setting
  98. *
  99. * \param [IN] reg Register pointer to either SX1231.RegRxBw or SX1231.RegAfcBw
  100. *
  101. * \retval bandwidth Bandwidth value
  102. */
  103. uint32_t SX1276FskGetBw( uint8_t* reg );
  104. /*!
  105. * \brief Enables/Disables CRC
  106. *
  107. * \param [IN] enable CRC enable/disable
  108. */
  109. void SX1276FskSetPacketCrcOn( bool enable );
  110. /*!
  111. * \brief Reads the current CRC Enable/Disbale value
  112. *
  113. * \retval enable Current CRC Enable/Disbale value
  114. */
  115. bool SX1276FskGetPacketCrcOn( void );
  116. /*!
  117. * \brief Enables/Disables AFC
  118. *
  119. * \param [IN] enable AFC enable/disable
  120. */
  121. void SX1276FskSetAfcOn( bool enable );
  122. /*!
  123. * \brief Reads the current AFC Enable/Disbale value
  124. *
  125. * \retval enable Current AFC Enable/Disbale value
  126. */
  127. bool SX1276FskGetAfcOn( void );
  128. /*!
  129. * \brief Writes the new payload length value
  130. *
  131. * \param [IN] value New payload length value
  132. */
  133. void SX1276FskSetPayloadLength( uint8_t value );
  134. /*!
  135. * \brief Reads the current payload length value
  136. *
  137. * \retval value Current payload length value
  138. */
  139. uint8_t SX1276FskGetPayloadLength( void );
  140. /*!
  141. * \brief Enables/Disables the 20 dBm PA
  142. *
  143. * \param [IN] enable [true, false]
  144. */
  145. void SX1276FskSetPa20dBm( bool enale );
  146. /*!
  147. * \brief Gets the current 20 dBm PA status
  148. *
  149. * \retval enable [true, false]
  150. */
  151. bool SX1276FskGetPa20dBm( void );
  152. /*!
  153. * \brief Set the RF Output pin
  154. *
  155. * \param [IN] RF_PACONFIG_PASELECT_PABOOST or RF_PACONFIG_PASELECT_RFO
  156. */
  157. void SX1276FskSetPAOutput( uint8_t outputPin );
  158. /*!
  159. * \brief Gets the used RF Ouptu pin
  160. *
  161. * \retval RF_PACONFIG_PASELECT_PABOOST or RF_PACONFIG_PASELECT_RFO
  162. */
  163. uint8_t SX1276FskGetPAOutput( void );
  164. /*!
  165. * \brief Writes the new PA rise/fall time of ramp up/down value
  166. *
  167. * \param [IN] value New PaRamp value
  168. */
  169. void SX1276FskSetPaRamp( uint8_t value );
  170. /*!
  171. * \brief Reads the current PA rise/fall time of ramp up/down value
  172. *
  173. * \retval value Current PaRamp value
  174. */
  175. uint8_t SX1276FskGetPaRamp( void );
  176. /*!
  177. * \brief Applies an offset to the RSSI. Compensates board components
  178. *
  179. * \param [IN] offset Offset to be applied (+/-)
  180. */
  181. void SX1276FskSetRssiOffset( int8_t offset );
  182. /*!
  183. * \brief Gets the current RSSI offset.
  184. *
  185. * \retval offset Current offset (+/-)
  186. */
  187. int8_t SX1276FskGetRssiOffset( void );
  188. /*!
  189. * \brief Writes the new value for the preamble size
  190. *
  191. * \param [IN] size New value of pramble size
  192. */
  193. void SX1276FskSetPreambleSize( uint16_t size );
  194. /*!
  195. * Reads the raw temperature
  196. * \retval temperature New raw temperature reading in 2's complement format
  197. */
  198. int8_t SX1276FskGetRawTemp( void );
  199. /*!
  200. * Computes the temperature compensation factor
  201. * \param [IN] actualTemp Actual temperature measured by an external device
  202. * \retval compensationFactor Computed compensation factor
  203. */
  204. int8_t SX1276FskCalibreateTemp( int8_t actualTemp );
  205. /*!
  206. * Gets the actual compensated temperature
  207. * \param [IN] compensationFactor Return value of the calibration function
  208. * \retval New compensated temperature value
  209. */
  210. int8_t SX1276FskGetTemp( int8_t compensationFactor );
  211. #endif //__SX1276_FSK_MISC_H__