use with LoRa Access Point
Fork of SX1276Lib by
radio/radio.h@6:e7f02929cd3d, 2014-09-04 (annotated)
- Committer:
- GregCr
- Date:
- Thu Sep 04 14:03:20 2014 +0000
- Revision:
- 6:e7f02929cd3d
- Parent:
- 0:e6ceb13d2d05
- Child:
- 7:2b555111463f
Added support for FHSS
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GregCr | 0:e6ceb13d2d05 | 1 | /* |
GregCr | 0:e6ceb13d2d05 | 2 | / _____) _ | | |
GregCr | 0:e6ceb13d2d05 | 3 | ( (____ _____ ____ _| |_ _____ ____| |__ |
GregCr | 0:e6ceb13d2d05 | 4 | \____ \| ___ | (_ _) ___ |/ ___) _ \ |
GregCr | 0:e6ceb13d2d05 | 5 | _____) ) ____| | | || |_| ____( (___| | | | |
GregCr | 0:e6ceb13d2d05 | 6 | (______/|_____)_|_|_| \__)_____)\____)_| |_| |
GregCr | 0:e6ceb13d2d05 | 7 | ( C )2014 Semtech |
GregCr | 0:e6ceb13d2d05 | 8 | |
GregCr | 0:e6ceb13d2d05 | 9 | Description: Interface for the radios, contains the main functions that a radio needs, and 5 callback functions |
GregCr | 0:e6ceb13d2d05 | 10 | |
GregCr | 0:e6ceb13d2d05 | 11 | License: Revised BSD License, see LICENSE.TXT file include in the project |
GregCr | 0:e6ceb13d2d05 | 12 | |
GregCr | 0:e6ceb13d2d05 | 13 | Maintainers: Miguel Luis, Gregory Cristian and Nicolas Huguenin |
GregCr | 0:e6ceb13d2d05 | 14 | */ |
GregCr | 0:e6ceb13d2d05 | 15 | #ifndef __RADIO_H__ |
GregCr | 0:e6ceb13d2d05 | 16 | #define __RADIO_H__ |
GregCr | 0:e6ceb13d2d05 | 17 | |
GregCr | 0:e6ceb13d2d05 | 18 | #include "mbed.h" |
GregCr | 0:e6ceb13d2d05 | 19 | |
GregCr | 0:e6ceb13d2d05 | 20 | #include "./enums/enums.h" |
GregCr | 0:e6ceb13d2d05 | 21 | |
GregCr | 0:e6ceb13d2d05 | 22 | /*! |
GregCr | 0:e6ceb13d2d05 | 23 | * Interface for the radios, contains the main functions that a radio needs, and 5 callback functions |
GregCr | 0:e6ceb13d2d05 | 24 | */ |
GregCr | 0:e6ceb13d2d05 | 25 | class Radio |
GregCr | 0:e6ceb13d2d05 | 26 | { |
GregCr | 0:e6ceb13d2d05 | 27 | protected: |
GregCr | 0:e6ceb13d2d05 | 28 | |
GregCr | 0:e6ceb13d2d05 | 29 | //------------------------------------------------------------------------- |
GregCr | 0:e6ceb13d2d05 | 30 | // Callback functions pointers |
GregCr | 0:e6ceb13d2d05 | 31 | //------------------------------------------------------------------------- |
GregCr | 0:e6ceb13d2d05 | 32 | |
GregCr | 0:e6ceb13d2d05 | 33 | /*! |
GregCr | 0:e6ceb13d2d05 | 34 | * @brief Tx Done callback prototype. |
GregCr | 0:e6ceb13d2d05 | 35 | */ |
GregCr | 0:e6ceb13d2d05 | 36 | void ( *txDone )( ); |
GregCr | 0:e6ceb13d2d05 | 37 | |
GregCr | 0:e6ceb13d2d05 | 38 | /*! |
GregCr | 0:e6ceb13d2d05 | 39 | * @brief Tx Timeout callback prototype. |
GregCr | 0:e6ceb13d2d05 | 40 | */ |
GregCr | 0:e6ceb13d2d05 | 41 | void ( *txTimeout ) ( ); |
GregCr | 0:e6ceb13d2d05 | 42 | |
GregCr | 0:e6ceb13d2d05 | 43 | /*! |
GregCr | 0:e6ceb13d2d05 | 44 | * @brief Rx Done callback prototype. |
GregCr | 0:e6ceb13d2d05 | 45 | * |
GregCr | 0:e6ceb13d2d05 | 46 | * @param [IN] payload Received buffer pointer |
GregCr | 0:e6ceb13d2d05 | 47 | * @param [IN] size Received buffer size |
GregCr | 0:e6ceb13d2d05 | 48 | * @param [IN] rssi RSSI value computed while receiving the frame [dBm] |
GregCr | 0:e6ceb13d2d05 | 49 | * @param [IN] snr Raw SNR value given by the radio hardware |
GregCr | 0:e6ceb13d2d05 | 50 | * FSK : N/A ( set to 0 ) |
GregCr | 0:e6ceb13d2d05 | 51 | * LoRa: SNR value in dB |
GregCr | 0:e6ceb13d2d05 | 52 | */ |
GregCr | 0:e6ceb13d2d05 | 53 | void ( *rxDone ) ( uint8_t *payload, uint16_t size, int8_t rssi, int8_t snr ); |
GregCr | 0:e6ceb13d2d05 | 54 | |
GregCr | 0:e6ceb13d2d05 | 55 | /*! |
GregCr | 0:e6ceb13d2d05 | 56 | * @brief Rx Timeout callback prototype. |
GregCr | 0:e6ceb13d2d05 | 57 | */ |
GregCr | 0:e6ceb13d2d05 | 58 | void ( *rxTimeout ) ( ); |
GregCr | 0:e6ceb13d2d05 | 59 | |
GregCr | 0:e6ceb13d2d05 | 60 | /*! |
GregCr | 0:e6ceb13d2d05 | 61 | * @brief Rx Error callback prototype. |
GregCr | 0:e6ceb13d2d05 | 62 | */ |
GregCr | 0:e6ceb13d2d05 | 63 | void ( *rxError ) ( ); |
GregCr | 0:e6ceb13d2d05 | 64 | |
GregCr | 6:e7f02929cd3d | 65 | /*! |
GregCr | 6:e7f02929cd3d | 66 | * \brief FHSS Change Channel callback prototype. |
GregCr | 6:e7f02929cd3d | 67 | * |
GregCr | 6:e7f02929cd3d | 68 | * \param [IN] CurrentChannel Index number of the current channel |
GregCr | 6:e7f02929cd3d | 69 | */ |
GregCr | 6:e7f02929cd3d | 70 | void ( *fhssChangeChannel )( uint8_t CurrentChannel ); |
GregCr | 6:e7f02929cd3d | 71 | |
GregCr | 0:e6ceb13d2d05 | 72 | public: |
GregCr | 0:e6ceb13d2d05 | 73 | //------------------------------------------------------------------------- |
GregCr | 0:e6ceb13d2d05 | 74 | // Constructor |
GregCr | 0:e6ceb13d2d05 | 75 | //------------------------------------------------------------------------- |
GregCr | 0:e6ceb13d2d05 | 76 | /*! |
GregCr | 0:e6ceb13d2d05 | 77 | * @brief Constructor of the radio object, the parameters are the callback functions described in the header. |
GregCr | 0:e6ceb13d2d05 | 78 | * @param [IN] txDone |
GregCr | 0:e6ceb13d2d05 | 79 | * @param [IN] txTimeout |
GregCr | 0:e6ceb13d2d05 | 80 | * @param [IN] rxDone |
GregCr | 0:e6ceb13d2d05 | 81 | * @param [IN] rxTimeout |
GregCr | 0:e6ceb13d2d05 | 82 | * @param [IN] rxError |
GregCr | 0:e6ceb13d2d05 | 83 | */ |
GregCr | 6:e7f02929cd3d | 84 | Radio( void ( *txDone )( ), void ( *txTimeout ) ( ), void ( *rxDone ) ( uint8_t *payload, uint16_t size, int8_t rssi, int8_t snr ), |
GregCr | 6:e7f02929cd3d | 85 | void ( *rxTimeout ) ( ), void ( *rxError ) ( ), void ( *fhssChangeChannel ) ( uint8_t channelIndex ) ); |
GregCr | 0:e6ceb13d2d05 | 86 | virtual ~Radio( ) {}; |
GregCr | 0:e6ceb13d2d05 | 87 | |
GregCr | 0:e6ceb13d2d05 | 88 | //------------------------------------------------------------------------- |
GregCr | 0:e6ceb13d2d05 | 89 | // Pure virtual functions |
GregCr | 0:e6ceb13d2d05 | 90 | //------------------------------------------------------------------------- |
GregCr | 0:e6ceb13d2d05 | 91 | |
GregCr | 0:e6ceb13d2d05 | 92 | /*! |
GregCr | 0:e6ceb13d2d05 | 93 | * Return current radio status |
GregCr | 0:e6ceb13d2d05 | 94 | * |
GregCr | 0:e6ceb13d2d05 | 95 | * @param status Radio status.[RF_IDLE, RF_RX_RUNNING, RF_TX_RUNNING] |
GregCr | 0:e6ceb13d2d05 | 96 | */ |
GregCr | 0:e6ceb13d2d05 | 97 | virtual RadioState GetState( void ) = 0; |
GregCr | 0:e6ceb13d2d05 | 98 | |
GregCr | 0:e6ceb13d2d05 | 99 | /*! |
GregCr | 0:e6ceb13d2d05 | 100 | * @brief Sets the channel frequency |
GregCr | 0:e6ceb13d2d05 | 101 | * |
GregCr | 0:e6ceb13d2d05 | 102 | * @param [IN] freq Channel RF frequency |
GregCr | 0:e6ceb13d2d05 | 103 | */ |
GregCr | 0:e6ceb13d2d05 | 104 | virtual void SetChannel( uint32_t freq ) = 0; |
GregCr | 0:e6ceb13d2d05 | 105 | |
GregCr | 0:e6ceb13d2d05 | 106 | /*! |
GregCr | 0:e6ceb13d2d05 | 107 | * @brief Sets the channels configuration |
GregCr | 0:e6ceb13d2d05 | 108 | * |
GregCr | 0:e6ceb13d2d05 | 109 | * @param [IN] modem Radio modem to be used [0: FSK, 1: LoRa] |
GregCr | 0:e6ceb13d2d05 | 110 | * @param [IN] freq Channel RF frequency |
GregCr | 0:e6ceb13d2d05 | 111 | * @param [IN] rssiThresh RSSI threshold |
GregCr | 0:e6ceb13d2d05 | 112 | * |
GregCr | 0:e6ceb13d2d05 | 113 | * @retval isFree [true: Channel is free, false: Channel is not free] |
GregCr | 0:e6ceb13d2d05 | 114 | */ |
GregCr | 0:e6ceb13d2d05 | 115 | virtual bool IsChannelFree( ModemType modem, uint32_t freq, int8_t rssiThresh ) = 0; |
GregCr | 0:e6ceb13d2d05 | 116 | |
GregCr | 0:e6ceb13d2d05 | 117 | /*! |
GregCr | 0:e6ceb13d2d05 | 118 | * @brief Generates a 32 bits random value based on the RSSI readings |
GregCr | 0:e6ceb13d2d05 | 119 | * |
GregCr | 0:e6ceb13d2d05 | 120 | * \remark This function sets the radio in LoRa modem mode and disables |
GregCr | 0:e6ceb13d2d05 | 121 | * all interrupts. |
GregCr | 0:e6ceb13d2d05 | 122 | * After calling this function either Radio.SetRxConfig or |
GregCr | 0:e6ceb13d2d05 | 123 | * Radio.SetTxConfig functions must be called. |
GregCr | 0:e6ceb13d2d05 | 124 | * |
GregCr | 0:e6ceb13d2d05 | 125 | * @retval randomValue 32 bits random value |
GregCr | 0:e6ceb13d2d05 | 126 | */ |
GregCr | 0:e6ceb13d2d05 | 127 | virtual uint32_t Random( void )= 0; |
GregCr | 0:e6ceb13d2d05 | 128 | |
GregCr | 0:e6ceb13d2d05 | 129 | /*! |
GregCr | 0:e6ceb13d2d05 | 130 | * @brief Sets the reception parameters |
GregCr | 0:e6ceb13d2d05 | 131 | * |
GregCr | 0:e6ceb13d2d05 | 132 | * @param [IN] modem Radio modem to be used [0: FSK, 1: LoRa] |
GregCr | 0:e6ceb13d2d05 | 133 | * @param [IN] bandwidth Sets the bandwidth |
GregCr | 0:e6ceb13d2d05 | 134 | * FSK : >= 2600 and <= 250000 Hz |
GregCr | 0:e6ceb13d2d05 | 135 | * LoRa: [0: 125 kHz, 1: 250 kHz, |
GregCr | 0:e6ceb13d2d05 | 136 | * 2: 500 kHz, 3: Reserved] |
GregCr | 0:e6ceb13d2d05 | 137 | * @param [IN] datarate Sets the Datarate |
GregCr | 0:e6ceb13d2d05 | 138 | * FSK : 600..300000 bits/s |
GregCr | 0:e6ceb13d2d05 | 139 | * LoRa: [6: 64, 7: 128, 8: 256, 9: 512, |
GregCr | 0:e6ceb13d2d05 | 140 | * 10: 1024, 11: 2048, 12: 4096 chips] |
GregCr | 0:e6ceb13d2d05 | 141 | * @param [IN] coderate Sets the coding rate ( LoRa only ) |
GregCr | 0:e6ceb13d2d05 | 142 | * FSK : N/A ( set to 0 ) |
GregCr | 0:e6ceb13d2d05 | 143 | * LoRa: [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8] |
GregCr | 0:e6ceb13d2d05 | 144 | * @param [IN] bandwidthAfc Sets the AFC Bandwidth ( FSK only ) |
GregCr | 0:e6ceb13d2d05 | 145 | * FSK : >= 2600 and <= 250000 Hz |
GregCr | 0:e6ceb13d2d05 | 146 | * LoRa: N/A ( set to 0 ) |
GregCr | 0:e6ceb13d2d05 | 147 | * @param [IN] preambleLen Sets the Preamble length ( LoRa only ) |
GregCr | 0:e6ceb13d2d05 | 148 | * FSK : N/A ( set to 0 ) |
GregCr | 0:e6ceb13d2d05 | 149 | * LoRa: Length in symbols ( the hardware adds 4 more symbols ) |
GregCr | 0:e6ceb13d2d05 | 150 | * @param [IN] symbTimeout Sets the RxSingle timeout value ( LoRa only ) |
GregCr | 0:e6ceb13d2d05 | 151 | * FSK : N/A ( set to 0 ) |
GregCr | 0:e6ceb13d2d05 | 152 | * LoRa: timeout in symbols |
GregCr | 0:e6ceb13d2d05 | 153 | * @param [IN] fixLen Fixed length packets [0: variable, 1: fixed] |
GregCr | 0:e6ceb13d2d05 | 154 | * @param [IN] crcOn Enables/Disables the CRC [0: OFF, 1: ON] |
GregCr | 6:e7f02929cd3d | 155 | * @param [IN] FreqHopOn Enables disables the intra-packet frequency hopping [0: OFF, 1: ON] (LoRa only) |
GregCr | 6:e7f02929cd3d | 156 | * @param [IN] HopPeriod Number of symbols bewteen each hop (LoRa only) |
GregCr | 0:e6ceb13d2d05 | 157 | * @param [IN] iqInverted Inverts IQ signals ( LoRa only ) |
GregCr | 0:e6ceb13d2d05 | 158 | * FSK : N/A ( set to 0 ) |
GregCr | 0:e6ceb13d2d05 | 159 | * LoRa: [0: not inverted, 1: inverted] |
GregCr | 0:e6ceb13d2d05 | 160 | * @param [IN] rxContinuous Sets the reception in continuous mode |
GregCr | 0:e6ceb13d2d05 | 161 | * [false: single mode, true: continuous mode] |
GregCr | 0:e6ceb13d2d05 | 162 | */ |
GregCr | 0:e6ceb13d2d05 | 163 | virtual void SetRxConfig ( ModemType modem, uint32_t bandwidth, |
GregCr | 0:e6ceb13d2d05 | 164 | uint32_t datarate, uint8_t coderate, |
GregCr | 0:e6ceb13d2d05 | 165 | uint32_t bandwidthAfc, uint16_t preambleLen, |
GregCr | 0:e6ceb13d2d05 | 166 | uint16_t symbTimeout, bool fixLen, |
GregCr | 6:e7f02929cd3d | 167 | bool crcOn, bool FreqHopOn, uint8_t HopPeriod, |
GregCr | 6:e7f02929cd3d | 168 | bool iqInverted, bool rxContinuous ) = 0; |
GregCr | 0:e6ceb13d2d05 | 169 | |
GregCr | 0:e6ceb13d2d05 | 170 | /*! |
GregCr | 0:e6ceb13d2d05 | 171 | * @brief Sets the transmission parameters |
GregCr | 0:e6ceb13d2d05 | 172 | * |
GregCr | 0:e6ceb13d2d05 | 173 | * @param [IN] modem Radio modem to be used [0: FSK, 1: LoRa] |
GregCr | 0:e6ceb13d2d05 | 174 | * @param [IN] power Sets the output power [dBm] |
GregCr | 0:e6ceb13d2d05 | 175 | * @param [IN] fdev Sets the frequency deviation ( FSK only ) |
GregCr | 0:e6ceb13d2d05 | 176 | * FSK : [Hz] |
GregCr | 0:e6ceb13d2d05 | 177 | * LoRa: 0 |
GregCr | 0:e6ceb13d2d05 | 178 | * @param [IN] bandwidth Sets the bandwidth ( LoRa only ) |
GregCr | 0:e6ceb13d2d05 | 179 | * FSK : 0 |
GregCr | 0:e6ceb13d2d05 | 180 | * LoRa: [0: 125 kHz, 1: 250 kHz, |
GregCr | 0:e6ceb13d2d05 | 181 | * 2: 500 kHz, 3: Reserved] |
GregCr | 0:e6ceb13d2d05 | 182 | * @param [IN] datarate Sets the Datarate |
GregCr | 0:e6ceb13d2d05 | 183 | * FSK : 600..300000 bits/s |
GregCr | 0:e6ceb13d2d05 | 184 | * LoRa: [6: 64, 7: 128, 8: 256, 9: 512, |
GregCr | 0:e6ceb13d2d05 | 185 | * 10: 1024, 11: 2048, 12: 4096 chips] |
GregCr | 0:e6ceb13d2d05 | 186 | * @param [IN] coderate Sets the coding rate ( LoRa only ) |
GregCr | 0:e6ceb13d2d05 | 187 | * FSK : N/A ( set to 0 ) |
GregCr | 0:e6ceb13d2d05 | 188 | * LoRa: [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8] |
GregCr | 0:e6ceb13d2d05 | 189 | * @param [IN] preambleLen Sets the preamble length |
GregCr | 0:e6ceb13d2d05 | 190 | * @param [IN] fixLen Fixed length packets [0: variable, 1: fixed] |
GregCr | 0:e6ceb13d2d05 | 191 | * @param [IN] crcOn Enables disables the CRC [0: OFF, 1: ON] |
GregCr | 6:e7f02929cd3d | 192 | * @param [IN] FreqHopOn Enables disables the intra-packet frequency hopping [0: OFF, 1: ON] (LoRa only) |
GregCr | 6:e7f02929cd3d | 193 | * @param [IN] HopPeriod Number of symbols bewteen each hop (LoRa only) |
GregCr | 0:e6ceb13d2d05 | 194 | * @param [IN] iqInverted Inverts IQ signals ( LoRa only ) |
GregCr | 0:e6ceb13d2d05 | 195 | * FSK : N/A ( set to 0 ) |
GregCr | 0:e6ceb13d2d05 | 196 | * LoRa: [0: not inverted, 1: inverted] |
GregCr | 0:e6ceb13d2d05 | 197 | * @param [IN] timeout Transmission timeout [us] |
GregCr | 0:e6ceb13d2d05 | 198 | */ |
GregCr | 0:e6ceb13d2d05 | 199 | virtual void SetTxConfig( ModemType modem, int8_t power, uint32_t fdev, |
GregCr | 6:e7f02929cd3d | 200 | uint32_t bandwidth, uint32_t datarate, |
GregCr | 6:e7f02929cd3d | 201 | uint8_t coderate, uint16_t preambleLen, |
GregCr | 6:e7f02929cd3d | 202 | bool fixLen, bool crcOn, bool FreqHopOn, |
GregCr | 6:e7f02929cd3d | 203 | uint8_t HopPeriod, bool iqInverted, uint32_t timeout ) = 0; |
GregCr | 0:e6ceb13d2d05 | 204 | |
GregCr | 0:e6ceb13d2d05 | 205 | /*! |
GregCr | 0:e6ceb13d2d05 | 206 | * @brief Checks if the given RF frequency is supported by the hardware |
GregCr | 0:e6ceb13d2d05 | 207 | * |
GregCr | 0:e6ceb13d2d05 | 208 | * @param [IN] frequency RF frequency to be checked |
GregCr | 0:e6ceb13d2d05 | 209 | * @retval isSupported [true: supported, false: unsupported] |
GregCr | 0:e6ceb13d2d05 | 210 | */ |
GregCr | 0:e6ceb13d2d05 | 211 | virtual bool CheckRfFrequency( uint32_t frequency ) = 0; |
GregCr | 0:e6ceb13d2d05 | 212 | |
GregCr | 0:e6ceb13d2d05 | 213 | /*! |
GregCr | 0:e6ceb13d2d05 | 214 | * @brief Computes the packet time on air for the given payload |
GregCr | 0:e6ceb13d2d05 | 215 | * |
GregCr | 0:e6ceb13d2d05 | 216 | * \Remark Can only be called once SetRxConfig or SetTxConfig have been called |
GregCr | 0:e6ceb13d2d05 | 217 | * |
GregCr | 0:e6ceb13d2d05 | 218 | * @param [IN] modem Radio modem to be used [0: FSK, 1: LoRa] |
GregCr | 0:e6ceb13d2d05 | 219 | * @param [IN] pktLen Packet payload length |
GregCr | 0:e6ceb13d2d05 | 220 | * |
GregCr | 0:e6ceb13d2d05 | 221 | * @retval airTime Computed airTime for the given packet payload length |
GregCr | 0:e6ceb13d2d05 | 222 | */ |
GregCr | 0:e6ceb13d2d05 | 223 | virtual double TimeOnAir ( ModemType modem, uint8_t pktLen ) = 0; |
GregCr | 0:e6ceb13d2d05 | 224 | |
GregCr | 0:e6ceb13d2d05 | 225 | /*! |
GregCr | 0:e6ceb13d2d05 | 226 | * @brief Sends the buffer of size. Prepares the packet to be sent and sets |
GregCr | 0:e6ceb13d2d05 | 227 | * the radio in transmission |
GregCr | 0:e6ceb13d2d05 | 228 | * |
GregCr | 0:e6ceb13d2d05 | 229 | * @param [IN]: buffer Buffer pointer |
GregCr | 0:e6ceb13d2d05 | 230 | * @param [IN]: size Buffer size |
GregCr | 0:e6ceb13d2d05 | 231 | */ |
GregCr | 0:e6ceb13d2d05 | 232 | virtual void Send( uint8_t *buffer, uint8_t size ) = 0; |
GregCr | 0:e6ceb13d2d05 | 233 | |
GregCr | 0:e6ceb13d2d05 | 234 | /*! |
GregCr | 0:e6ceb13d2d05 | 235 | * @brief Sets the radio in sleep mode |
GregCr | 0:e6ceb13d2d05 | 236 | */ |
GregCr | 0:e6ceb13d2d05 | 237 | virtual void Sleep( void ) = 0; |
GregCr | 0:e6ceb13d2d05 | 238 | |
GregCr | 0:e6ceb13d2d05 | 239 | /*! |
GregCr | 0:e6ceb13d2d05 | 240 | * @brief Sets the radio in standby mode |
GregCr | 0:e6ceb13d2d05 | 241 | */ |
GregCr | 0:e6ceb13d2d05 | 242 | virtual void Standby( void )= 0; |
GregCr | 0:e6ceb13d2d05 | 243 | |
GregCr | 0:e6ceb13d2d05 | 244 | /*! |
GregCr | 0:e6ceb13d2d05 | 245 | * @brief Sets the radio in reception mode for the given time |
GregCr | 0:e6ceb13d2d05 | 246 | * @param [IN] timeout Reception timeout [us] |
GregCr | 0:e6ceb13d2d05 | 247 | * [0: continuous, others timeout] |
GregCr | 0:e6ceb13d2d05 | 248 | */ |
GregCr | 0:e6ceb13d2d05 | 249 | virtual void Rx( uint32_t timeout ) = 0; |
GregCr | 0:e6ceb13d2d05 | 250 | |
GregCr | 0:e6ceb13d2d05 | 251 | /*! |
GregCr | 0:e6ceb13d2d05 | 252 | * @brief Sets the radio in transmission mode for the given time |
GregCr | 0:e6ceb13d2d05 | 253 | * @param [IN] timeout Transmission timeout [us] |
GregCr | 0:e6ceb13d2d05 | 254 | * [0: continuous, others timeout] |
GregCr | 0:e6ceb13d2d05 | 255 | */ |
GregCr | 0:e6ceb13d2d05 | 256 | virtual void Tx( uint32_t timeout ) = 0; |
GregCr | 0:e6ceb13d2d05 | 257 | |
GregCr | 0:e6ceb13d2d05 | 258 | /*! |
GregCr | 0:e6ceb13d2d05 | 259 | * @brief Reads the current RSSI value |
GregCr | 0:e6ceb13d2d05 | 260 | * |
GregCr | 0:e6ceb13d2d05 | 261 | * @retval rssiValue Current RSSI value in [dBm] |
GregCr | 0:e6ceb13d2d05 | 262 | */ |
GregCr | 0:e6ceb13d2d05 | 263 | virtual int8_t GetRssi ( ModemType modem ) = 0; |
GregCr | 0:e6ceb13d2d05 | 264 | |
GregCr | 0:e6ceb13d2d05 | 265 | /*! |
GregCr | 0:e6ceb13d2d05 | 266 | * @brief Writes the radio register at the specified address |
GregCr | 0:e6ceb13d2d05 | 267 | * |
GregCr | 0:e6ceb13d2d05 | 268 | * @param [IN]: addr Register address |
GregCr | 0:e6ceb13d2d05 | 269 | * @param [IN]: data New register value |
GregCr | 0:e6ceb13d2d05 | 270 | */ |
GregCr | 0:e6ceb13d2d05 | 271 | virtual void Write ( uint8_t addr, uint8_t data ) = 0; |
GregCr | 0:e6ceb13d2d05 | 272 | |
GregCr | 0:e6ceb13d2d05 | 273 | /*! |
GregCr | 0:e6ceb13d2d05 | 274 | * @brief Reads the radio register at the specified address |
GregCr | 0:e6ceb13d2d05 | 275 | * |
GregCr | 0:e6ceb13d2d05 | 276 | * @param [IN]: addr Register address |
GregCr | 0:e6ceb13d2d05 | 277 | * @retval data Register value |
GregCr | 0:e6ceb13d2d05 | 278 | */ |
GregCr | 0:e6ceb13d2d05 | 279 | virtual uint8_t Read ( uint8_t addr ) = 0; |
GregCr | 0:e6ceb13d2d05 | 280 | |
GregCr | 0:e6ceb13d2d05 | 281 | /*! |
GregCr | 0:e6ceb13d2d05 | 282 | * @brief Writes multiple radio registers starting at address |
GregCr | 0:e6ceb13d2d05 | 283 | * |
GregCr | 0:e6ceb13d2d05 | 284 | * @param [IN] addr First Radio register address |
GregCr | 0:e6ceb13d2d05 | 285 | * @param [IN] buffer Buffer containing the new register's values |
GregCr | 0:e6ceb13d2d05 | 286 | * @param [IN] size Number of registers to be written |
GregCr | 0:e6ceb13d2d05 | 287 | */ |
GregCr | 0:e6ceb13d2d05 | 288 | virtual void Write( uint8_t addr, uint8_t *buffer, uint8_t size ) = 0; |
GregCr | 0:e6ceb13d2d05 | 289 | |
GregCr | 0:e6ceb13d2d05 | 290 | /*! |
GregCr | 0:e6ceb13d2d05 | 291 | * @brief Reads multiple radio registers starting at address |
GregCr | 0:e6ceb13d2d05 | 292 | * |
GregCr | 0:e6ceb13d2d05 | 293 | * @param [IN] addr First Radio register address |
GregCr | 0:e6ceb13d2d05 | 294 | * @param [OUT] buffer Buffer where to copy the registers data |
GregCr | 0:e6ceb13d2d05 | 295 | * @param [IN] size Number of registers to be read |
GregCr | 0:e6ceb13d2d05 | 296 | */ |
GregCr | 0:e6ceb13d2d05 | 297 | virtual void Read ( uint8_t addr, uint8_t *buffer, uint8_t size ) = 0; |
GregCr | 0:e6ceb13d2d05 | 298 | |
GregCr | 0:e6ceb13d2d05 | 299 | /*! |
GregCr | 0:e6ceb13d2d05 | 300 | * @brief Writes the buffer contents to the SX1276 FIFO |
GregCr | 0:e6ceb13d2d05 | 301 | * |
GregCr | 0:e6ceb13d2d05 | 302 | * @param [IN] buffer Buffer containing data to be put on the FIFO. |
GregCr | 0:e6ceb13d2d05 | 303 | * @param [IN] size Number of bytes to be written to the FIFO |
GregCr | 0:e6ceb13d2d05 | 304 | */ |
GregCr | 0:e6ceb13d2d05 | 305 | virtual void WriteFifo( uint8_t *buffer, uint8_t size ) = 0; |
GregCr | 0:e6ceb13d2d05 | 306 | |
GregCr | 0:e6ceb13d2d05 | 307 | /*! |
GregCr | 0:e6ceb13d2d05 | 308 | * @brief Reads the contents of the SX1276 FIFO |
GregCr | 0:e6ceb13d2d05 | 309 | * |
GregCr | 0:e6ceb13d2d05 | 310 | * @param [OUT] buffer Buffer where to copy the FIFO read data. |
GregCr | 0:e6ceb13d2d05 | 311 | * @param [IN] size Number of bytes to be read from the FIFO |
GregCr | 0:e6ceb13d2d05 | 312 | */ |
GregCr | 0:e6ceb13d2d05 | 313 | virtual void ReadFifo( uint8_t *buffer, uint8_t size ) = 0; |
GregCr | 0:e6ceb13d2d05 | 314 | }; |
GregCr | 0:e6ceb13d2d05 | 315 | |
GregCr | 0:e6ceb13d2d05 | 316 | #endif // __RADIO_H__ |
GregCr | 0:e6ceb13d2d05 | 317 |