SX126x_board.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*!
  2. * \file sx126x-board.h
  3. *
  4. * \brief Target board SX126x driver implementation
  5. *
  6. * \copyright Revised BSD License, see section \ref LICENSE.
  7. *
  8. * \code
  9. * ______ _
  10. * / _____) _ | |
  11. * ( (____ _____ ____ _| |_ _____ ____| |__
  12. * \____ \| ___ | (_ _) ___ |/ ___) _ \
  13. * _____) ) ____| | | || |_| ____( (___| | | |
  14. * (______/|_____)_|_|_| \__)_____)\____)_| |_|
  15. * (C)2013-2017 Semtech
  16. *
  17. * \endcode
  18. *
  19. * \author Miguel Luis ( Semtech )
  20. *
  21. * \author Gregory Cristian ( Semtech )
  22. */
  23. #ifndef __SX126x_BOARD_H__
  24. #define __SX126x_BOARD_H__
  25. #ifdef __cplusplus
  26. extern "C"
  27. {
  28. #endif
  29. #include <stdint.h>
  30. #include <stdbool.h>
  31. #include "sx126x.h"
  32. //进入和退出临界区保护方法
  33. #if HAVE_OS
  34. #define CRITICAL_SECTION_BEGIN( ) vPortEnterCritical()
  35. #define CRITICAL_SECTION_END( ) vPortExitCritical()
  36. #else
  37. #define CRITICAL_SECTION_BEGIN( )
  38. #define CRITICAL_SECTION_END( )
  39. #endif
  40. /*!
  41. * \brief Initializes the radio I/Os pins interface
  42. */
  43. void SX126xIoInit( void );
  44. /*!
  45. * \brief Initializes DIO IRQ handlers
  46. *
  47. * \param [IN] irqHandlers Array containing the IRQ callback functions
  48. */
  49. void SX126xIoIrqInit( DioIrqHandler dioIrq );
  50. /*!
  51. * \brief De-initializes the radio I/Os pins interface.
  52. *
  53. * \remark Useful when going in MCU low power modes
  54. */
  55. void SX126xIoDeInit( void );
  56. /*!
  57. * \brief Initializes the radio debug pins.
  58. */
  59. void SX126xIoDbgInit( void );
  60. /*!
  61. * \brief HW Reset of the radio
  62. */
  63. void SX126xReset( void );
  64. /*!
  65. * \brief Blocking loop to wait while the Busy pin in high
  66. */
  67. void SX126xWaitOnBusy( void );
  68. /*!
  69. * \brief Checks if the given RF frequency is supported by the hardware
  70. *
  71. * \param [IN] frequency RF frequency to be checked
  72. * \retval isSupported [true: supported, false: unsupported]
  73. */
  74. bool SX126xCheckRfFrequency( uint32_t frequency );
  75. void SX126xDelayMs(uint32_t ms);
  76. /*
  77. * 定时器初始化
  78. */
  79. void SX126xTimerInit(void);
  80. void SX126xSetTxTimerValue(uint32_t nMs);
  81. void SX126xTxTimerStart(void);
  82. void SX126xTxTimerStop(void);
  83. void SX126xSetRxTimerValue(uint32_t nMs);
  84. void SX126xRxTimerStart(void);
  85. void SX126xRxTimerStop(void);
  86. void SX126xSetNss(uint8_t lev );
  87. uint8_t SX126xSpiInOut(uint8_t data);
  88. /*!
  89. * Radio hardware and global parameters
  90. */
  91. extern SX126x_t SX126x;
  92. #ifdef __cplusplus
  93. }
  94. #endif
  95. #endif // __SX126x_BOARD_H__