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