sx126x-board.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. ______ _
  3. / _____) _ | |
  4. ( (____ _____ ____ _| |_ _____ ____| |__
  5. \____ \| ___ | (_ _) ___ |/ ___) _ \
  6. _____) ) ____| | | || |_| ____( (___| | | |
  7. (______/|_____)_|_|_| \__)_____)\____)_| |_|
  8. (C)2013 Semtech
  9. Description: SX126x driver specific target board functions implementation
  10. License: Revised BSD License, see LICENSE.TXT file include in the project
  11. Maintainer: Miguel Luis and Gregory Cristian
  12. */
  13. #ifndef __SX126x_ARCH_H__
  14. #define __SX126x_ARCH_H__
  15. #include "sx126x.h"
  16. #include "stdint.h"
  17. void HAL_Delay_nMS(uint32_t time_ms);
  18. /*!
  19. * \brief Initializes the radio I/Os pins interface
  20. */
  21. //void SX126xIoInit( void );
  22. /*!
  23. * \brief Initializes DIO IRQ handlers
  24. *
  25. * \param [IN] irqHandlers Array containing the IRQ callback functions
  26. */
  27. //void SX126xIoIrqInit( DioIrqHandler dioIrq );
  28. /*!
  29. * \brief De-initializes the radio I/Os pins interface.
  30. *
  31. * \remark Useful when going in MCU low power modes
  32. */
  33. //void SX126xIoDeInit( void );
  34. /*!
  35. * \brief HW Reset of the radio
  36. */
  37. void SX126xReset( void );
  38. /*!
  39. * \brief Blocking loop to wait while the Busy pin in high
  40. */
  41. void SX126xWaitOnBusy( void );
  42. /*!
  43. * \brief Wakes up the radio
  44. */
  45. void SX126xWakeup( void );
  46. /*!
  47. * \brief Send a command that write data to the radio
  48. *
  49. * \param [in] opcode Opcode of the command
  50. * \param [in] buffer Buffer to be send to the radio
  51. * \param [in] size Size of the buffer to send
  52. */
  53. void SX126xWriteCommand( RadioCommands_t opcode, uint8_t *buffer, uint16_t size );
  54. /*!
  55. * \brief Send a command that read data from the radio
  56. *
  57. * \param [in] opcode Opcode of the command
  58. * \param [out] buffer Buffer holding data from the radio
  59. * \param [in] size Size of the buffer
  60. */
  61. void SX126xReadCommand( RadioCommands_t opcode, uint8_t *buffer, uint16_t size );
  62. /*!
  63. * \brief Write a single byte of data to the radio memory
  64. *
  65. * \param [in] address The address of the first byte to write in the radio
  66. * \param [in] value The data to be written in radio's memory
  67. */
  68. void SX126xWriteRegister( uint16_t address, uint8_t value );
  69. /*!
  70. * \brief Read a single byte of data from the radio memory
  71. *
  72. * \param [in] address The address of the first byte to write in the radio
  73. *
  74. * \retval value The value of the byte at the given address in radio's memory
  75. */
  76. uint8_t SX126xReadRegister( uint16_t address );
  77. /*!
  78. * \brief Sets the radio output power.
  79. *
  80. * \param [IN] power Sets the RF output power
  81. */
  82. void SX126xSetRfTxPower( int8_t power );
  83. /*!
  84. * \brief Gets the board PA selection configuration
  85. *
  86. * \param [IN] channel Channel frequency in Hz
  87. * \retval PaSelect RegPaConfig PaSelect value
  88. */
  89. uint8_t SX126xGetPaSelect( uint32_t channel );
  90. /*!
  91. * \brief Initializes the RF Switch I/Os pins interface
  92. */
  93. void SX126xAntSwOn( void );
  94. /*!
  95. * \brief De-initializes the RF Switch I/Os pins interface
  96. *
  97. * \remark Needed to decrease the power consumption in MCU low power modes
  98. */
  99. void SX126xAntSwOff( void );
  100. /*!
  101. * \brief Checks if the given RF frequency is supported by the hardware
  102. *
  103. * \param [IN] frequency RF frequency to be checked
  104. * \retval isSupported [true: supported, false: unsupported]
  105. */
  106. bool SX126xCheckRfFrequency( uint32_t frequency );
  107. /*!
  108. * Radio hardware and global parameters
  109. */
  110. extern volatile SX126x_t SX126x;
  111. #endif // __SX126x_ARCH_H__