Hexmodal SX1276lib
Dependents: LoRaWAN-hello-world_Class_C_Anish
radio/radio.h@13:618826a997e2, 2014-12-16 (annotated)
- Committer:
- mluis
- Date:
- Tue Dec 16 10:02:45 2014 +0000
- Revision:
- 13:618826a997e2
- Parent:
- 12:aa5b3bf7fdf4
- Child:
- 19:71a47bb03fbb
Cosmetics; Added LICENSE text.; Added the possibility to specify the payload length for receiving fixed length frames.; Added SetModem function to radio interface.; Added LoRa syncword register definition
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 | /*! |
mluis | 13:618826a997e2 | 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 | |
mluis | 13:618826a997e2 | 29 | //------------------------------------------------------------------------- |
mluis | 13:618826a997e2 | 30 | // Callback functions pointers |
mluis | 13:618826a997e2 | 31 | //------------------------------------------------------------------------- |
mluis | 13:618826a997e2 | 32 | |
mluis | 13:618826a997e2 | 33 | /*! |
GregCr | 0:e6ceb13d2d05 | 34 | * @brief Tx Done callback prototype. |
GregCr | 0:e6ceb13d2d05 | 35 | */ |
mluis | 13:618826a997e2 | 36 | void ( *txDone )( ); |
GregCr | 0:e6ceb13d2d05 | 37 | |
mluis | 13:618826a997e2 | 38 | /*! |
GregCr | 0:e6ceb13d2d05 | 39 | * @brief Tx Timeout callback prototype. |
GregCr | 0:e6ceb13d2d05 | 40 | */ |
mluis | 13:618826a997e2 | 41 | void ( *txTimeout ) ( ); |
GregCr | 0:e6ceb13d2d05 | 42 | |
mluis | 13:618826a997e2 | 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 | */ |
mluis | 13:618826a997e2 | 53 | void ( *rxDone ) ( uint8_t *payload, uint16_t size, int16_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 | */ |
mluis | 13:618826a997e2 | 58 | void ( *rxTimeout ) ( ); |
mluis | 13:618826a997e2 | 59 | |
GregCr | 0:e6ceb13d2d05 | 60 | /*! |
GregCr | 0:e6ceb13d2d05 | 61 | * @brief Rx Error callback prototype. |
GregCr | 0:e6ceb13d2d05 | 62 | */ |
mluis | 13:618826a997e2 | 63 | void ( *rxError ) ( ); |
mluis | 13:618826a997e2 | 64 | |
mluis | 13:618826a997e2 | 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 | 7:2b555111463f | 71 | |
GregCr | 7:2b555111463f | 72 | /*! |
GregCr | 7:2b555111463f | 73 | * @brief CAD Done callback prototype. |
GregCr | 12:aa5b3bf7fdf4 | 74 | * |
GregCr | 12:aa5b3bf7fdf4 | 75 | * @param [IN] ChannelDetected Channel Activity detected during the CAD |
GregCr | 7:2b555111463f | 76 | */ |
mluis | 13:618826a997e2 | 77 | void ( *cadDone ) ( bool channelActivityDetected ); |
mluis | 13:618826a997e2 | 78 | |
GregCr | 0:e6ceb13d2d05 | 79 | public: |
mluis | 13:618826a997e2 | 80 | //------------------------------------------------------------------------- |
mluis | 13:618826a997e2 | 81 | // Constructor |
mluis | 13:618826a997e2 | 82 | //------------------------------------------------------------------------- |
mluis | 13:618826a997e2 | 83 | /*! |
mluis | 13:618826a997e2 | 84 | * @brief Constructor of the radio object, the parameters are the callback functions described in the header. |
mluis | 13:618826a997e2 | 85 | * @param [IN] txDone |
mluis | 13:618826a997e2 | 86 | * @param [IN] txTimeout |
mluis | 13:618826a997e2 | 87 | * @param [IN] rxDone |
mluis | 13:618826a997e2 | 88 | * @param [IN] rxTimeout |
mluis | 13:618826a997e2 | 89 | * @param [IN] rxError |
mluis | 13:618826a997e2 | 90 | */ |
mluis | 13:618826a997e2 | 91 | Radio( void ( *txDone )( ), void ( *txTimeout ) ( ), void ( *rxDone ) ( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ), |
mluis | 13:618826a997e2 | 92 | void ( *rxTimeout ) ( ), void ( *rxError ) ( ), void ( *fhssChangeChannel ) ( uint8_t channelIndex ), void ( *cadDone ) ( bool channelActivityDetected ) ); |
mluis | 13:618826a997e2 | 93 | virtual ~Radio( ) {}; |
GregCr | 0:e6ceb13d2d05 | 94 | |
mluis | 13:618826a997e2 | 95 | //------------------------------------------------------------------------- |
mluis | 13:618826a997e2 | 96 | // Pure virtual functions |
mluis | 13:618826a997e2 | 97 | //------------------------------------------------------------------------- |
GregCr | 0:e6ceb13d2d05 | 98 | |
mluis | 13:618826a997e2 | 99 | /*! |
GregCr | 0:e6ceb13d2d05 | 100 | * Return current radio status |
GregCr | 0:e6ceb13d2d05 | 101 | * |
GregCr | 0:e6ceb13d2d05 | 102 | * @param status Radio status.[RF_IDLE, RF_RX_RUNNING, RF_TX_RUNNING] |
GregCr | 0:e6ceb13d2d05 | 103 | */ |
GregCr | 0:e6ceb13d2d05 | 104 | virtual RadioState GetState( void ) = 0; |
mluis | 13:618826a997e2 | 105 | |
mluis | 13:618826a997e2 | 106 | /*! |
mluis | 13:618826a997e2 | 107 | * \brief Configures the radio with the given modem |
mluis | 13:618826a997e2 | 108 | * |
mluis | 13:618826a997e2 | 109 | * \param [IN] modem Modem to be used [0: FSK, 1: LoRa] |
mluis | 13:618826a997e2 | 110 | */ |
mluis | 13:618826a997e2 | 111 | virtual void SetModem( ModemType modem ) = 0; |
mluis | 13:618826a997e2 | 112 | |
mluis | 13:618826a997e2 | 113 | /*! |
GregCr | 0:e6ceb13d2d05 | 114 | * @brief Sets the channel frequency |
GregCr | 0:e6ceb13d2d05 | 115 | * |
GregCr | 0:e6ceb13d2d05 | 116 | * @param [IN] freq Channel RF frequency |
GregCr | 0:e6ceb13d2d05 | 117 | */ |
GregCr | 0:e6ceb13d2d05 | 118 | virtual void SetChannel( uint32_t freq ) = 0; |
GregCr | 0:e6ceb13d2d05 | 119 | |
mluis | 13:618826a997e2 | 120 | /*! |
GregCr | 0:e6ceb13d2d05 | 121 | * @brief Sets the channels configuration |
GregCr | 0:e6ceb13d2d05 | 122 | * |
GregCr | 0:e6ceb13d2d05 | 123 | * @param [IN] modem Radio modem to be used [0: FSK, 1: LoRa] |
GregCr | 0:e6ceb13d2d05 | 124 | * @param [IN] freq Channel RF frequency |
GregCr | 0:e6ceb13d2d05 | 125 | * @param [IN] rssiThresh RSSI threshold |
GregCr | 0:e6ceb13d2d05 | 126 | * |
GregCr | 0:e6ceb13d2d05 | 127 | * @retval isFree [true: Channel is free, false: Channel is not free] |
GregCr | 0:e6ceb13d2d05 | 128 | */ |
GregCr | 0:e6ceb13d2d05 | 129 | virtual bool IsChannelFree( ModemType modem, uint32_t freq, int8_t rssiThresh ) = 0; |
GregCr | 0:e6ceb13d2d05 | 130 | |
mluis | 13:618826a997e2 | 131 | /*! |
GregCr | 0:e6ceb13d2d05 | 132 | * @brief Generates a 32 bits random value based on the RSSI readings |
GregCr | 0:e6ceb13d2d05 | 133 | * |
GregCr | 0:e6ceb13d2d05 | 134 | * \remark This function sets the radio in LoRa modem mode and disables |
GregCr | 0:e6ceb13d2d05 | 135 | * all interrupts. |
GregCr | 0:e6ceb13d2d05 | 136 | * After calling this function either Radio.SetRxConfig or |
GregCr | 0:e6ceb13d2d05 | 137 | * Radio.SetTxConfig functions must be called. |
GregCr | 0:e6ceb13d2d05 | 138 | * |
GregCr | 0:e6ceb13d2d05 | 139 | * @retval randomValue 32 bits random value |
GregCr | 0:e6ceb13d2d05 | 140 | */ |
GregCr | 0:e6ceb13d2d05 | 141 | virtual uint32_t Random( void )= 0; |
GregCr | 0:e6ceb13d2d05 | 142 | |
mluis | 13:618826a997e2 | 143 | /*! |
GregCr | 0:e6ceb13d2d05 | 144 | * @brief Sets the reception parameters |
GregCr | 0:e6ceb13d2d05 | 145 | * |
GregCr | 0:e6ceb13d2d05 | 146 | * @param [IN] modem Radio modem to be used [0: FSK, 1: LoRa] |
GregCr | 0:e6ceb13d2d05 | 147 | * @param [IN] bandwidth Sets the bandwidth |
GregCr | 0:e6ceb13d2d05 | 148 | * FSK : >= 2600 and <= 250000 Hz |
GregCr | 0:e6ceb13d2d05 | 149 | * LoRa: [0: 125 kHz, 1: 250 kHz, |
GregCr | 0:e6ceb13d2d05 | 150 | * 2: 500 kHz, 3: Reserved] |
GregCr | 0:e6ceb13d2d05 | 151 | * @param [IN] datarate Sets the Datarate |
GregCr | 0:e6ceb13d2d05 | 152 | * FSK : 600..300000 bits/s |
GregCr | 0:e6ceb13d2d05 | 153 | * LoRa: [6: 64, 7: 128, 8: 256, 9: 512, |
GregCr | 0:e6ceb13d2d05 | 154 | * 10: 1024, 11: 2048, 12: 4096 chips] |
GregCr | 0:e6ceb13d2d05 | 155 | * @param [IN] coderate Sets the coding rate ( LoRa only ) |
GregCr | 0:e6ceb13d2d05 | 156 | * FSK : N/A ( set to 0 ) |
GregCr | 0:e6ceb13d2d05 | 157 | * LoRa: [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8] |
GregCr | 0:e6ceb13d2d05 | 158 | * @param [IN] bandwidthAfc Sets the AFC Bandwidth ( FSK only ) |
GregCr | 0:e6ceb13d2d05 | 159 | * FSK : >= 2600 and <= 250000 Hz |
GregCr | 0:e6ceb13d2d05 | 160 | * LoRa: N/A ( set to 0 ) |
GregCr | 0:e6ceb13d2d05 | 161 | * @param [IN] preambleLen Sets the Preamble length ( LoRa only ) |
GregCr | 0:e6ceb13d2d05 | 162 | * FSK : N/A ( set to 0 ) |
GregCr | 0:e6ceb13d2d05 | 163 | * LoRa: Length in symbols ( the hardware adds 4 more symbols ) |
GregCr | 0:e6ceb13d2d05 | 164 | * @param [IN] symbTimeout Sets the RxSingle timeout value ( LoRa only ) |
GregCr | 0:e6ceb13d2d05 | 165 | * FSK : N/A ( set to 0 ) |
GregCr | 0:e6ceb13d2d05 | 166 | * LoRa: timeout in symbols |
GregCr | 0:e6ceb13d2d05 | 167 | * @param [IN] fixLen Fixed length packets [0: variable, 1: fixed] |
mluis | 13:618826a997e2 | 168 | * @param [IN] payloadLen Sets payload length when fixed lenght is used |
GregCr | 0:e6ceb13d2d05 | 169 | * @param [IN] crcOn Enables/Disables the CRC [0: OFF, 1: ON] |
mluis | 13:618826a997e2 | 170 | * @param [IN] freqHopOn Enables disables the intra-packet frequency hopping [0: OFF, 1: ON] (LoRa only) |
mluis | 13:618826a997e2 | 171 | * @param [IN] hopPeriod Number of symbols bewteen each hop (LoRa only) |
GregCr | 0:e6ceb13d2d05 | 172 | * @param [IN] iqInverted Inverts IQ signals ( LoRa only ) |
GregCr | 0:e6ceb13d2d05 | 173 | * FSK : N/A ( set to 0 ) |
GregCr | 0:e6ceb13d2d05 | 174 | * LoRa: [0: not inverted, 1: inverted] |
GregCr | 0:e6ceb13d2d05 | 175 | * @param [IN] rxContinuous Sets the reception in continuous mode |
GregCr | 0:e6ceb13d2d05 | 176 | * [false: single mode, true: continuous mode] |
GregCr | 0:e6ceb13d2d05 | 177 | */ |
GregCr | 0:e6ceb13d2d05 | 178 | virtual void SetRxConfig ( ModemType modem, uint32_t bandwidth, |
GregCr | 0:e6ceb13d2d05 | 179 | uint32_t datarate, uint8_t coderate, |
GregCr | 0:e6ceb13d2d05 | 180 | uint32_t bandwidthAfc, uint16_t preambleLen, |
GregCr | 0:e6ceb13d2d05 | 181 | uint16_t symbTimeout, bool fixLen, |
mluis | 13:618826a997e2 | 182 | uint8_t payloadLen, |
mluis | 13:618826a997e2 | 183 | bool crcOn, bool freqHopOn, uint8_t hopPeriod, |
GregCr | 6:e7f02929cd3d | 184 | bool iqInverted, bool rxContinuous ) = 0; |
GregCr | 0:e6ceb13d2d05 | 185 | |
mluis | 13:618826a997e2 | 186 | /*! |
GregCr | 0:e6ceb13d2d05 | 187 | * @brief Sets the transmission parameters |
GregCr | 0:e6ceb13d2d05 | 188 | * |
GregCr | 0:e6ceb13d2d05 | 189 | * @param [IN] modem Radio modem to be used [0: FSK, 1: LoRa] |
GregCr | 0:e6ceb13d2d05 | 190 | * @param [IN] power Sets the output power [dBm] |
GregCr | 0:e6ceb13d2d05 | 191 | * @param [IN] fdev Sets the frequency deviation ( FSK only ) |
GregCr | 0:e6ceb13d2d05 | 192 | * FSK : [Hz] |
GregCr | 0:e6ceb13d2d05 | 193 | * LoRa: 0 |
GregCr | 0:e6ceb13d2d05 | 194 | * @param [IN] bandwidth Sets the bandwidth ( LoRa only ) |
GregCr | 0:e6ceb13d2d05 | 195 | * FSK : 0 |
GregCr | 0:e6ceb13d2d05 | 196 | * LoRa: [0: 125 kHz, 1: 250 kHz, |
GregCr | 0:e6ceb13d2d05 | 197 | * 2: 500 kHz, 3: Reserved] |
GregCr | 0:e6ceb13d2d05 | 198 | * @param [IN] datarate Sets the Datarate |
GregCr | 0:e6ceb13d2d05 | 199 | * FSK : 600..300000 bits/s |
GregCr | 0:e6ceb13d2d05 | 200 | * LoRa: [6: 64, 7: 128, 8: 256, 9: 512, |
GregCr | 0:e6ceb13d2d05 | 201 | * 10: 1024, 11: 2048, 12: 4096 chips] |
GregCr | 0:e6ceb13d2d05 | 202 | * @param [IN] coderate Sets the coding rate ( LoRa only ) |
GregCr | 0:e6ceb13d2d05 | 203 | * FSK : N/A ( set to 0 ) |
GregCr | 0:e6ceb13d2d05 | 204 | * LoRa: [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8] |
GregCr | 0:e6ceb13d2d05 | 205 | * @param [IN] preambleLen Sets the preamble length |
GregCr | 0:e6ceb13d2d05 | 206 | * @param [IN] fixLen Fixed length packets [0: variable, 1: fixed] |
GregCr | 0:e6ceb13d2d05 | 207 | * @param [IN] crcOn Enables disables the CRC [0: OFF, 1: ON] |
mluis | 13:618826a997e2 | 208 | * @param [IN] freqHopOn Enables disables the intra-packet frequency hopping [0: OFF, 1: ON] (LoRa only) |
mluis | 13:618826a997e2 | 209 | * @param [IN] hopPeriod Number of symbols bewteen each hop (LoRa only) |
GregCr | 0:e6ceb13d2d05 | 210 | * @param [IN] iqInverted Inverts IQ signals ( LoRa only ) |
GregCr | 0:e6ceb13d2d05 | 211 | * FSK : N/A ( set to 0 ) |
GregCr | 0:e6ceb13d2d05 | 212 | * LoRa: [0: not inverted, 1: inverted] |
GregCr | 0:e6ceb13d2d05 | 213 | * @param [IN] timeout Transmission timeout [us] |
GregCr | 0:e6ceb13d2d05 | 214 | */ |
GregCr | 0:e6ceb13d2d05 | 215 | virtual void SetTxConfig( ModemType modem, int8_t power, uint32_t fdev, |
GregCr | 6:e7f02929cd3d | 216 | uint32_t bandwidth, uint32_t datarate, |
GregCr | 6:e7f02929cd3d | 217 | uint8_t coderate, uint16_t preambleLen, |
mluis | 13:618826a997e2 | 218 | bool fixLen, bool crcOn, bool freqHopOn, |
mluis | 13:618826a997e2 | 219 | uint8_t hopPeriod, bool iqInverted, uint32_t timeout ) = 0; |
GregCr | 0:e6ceb13d2d05 | 220 | |
mluis | 13:618826a997e2 | 221 | /*! |
GregCr | 0:e6ceb13d2d05 | 222 | * @brief Checks if the given RF frequency is supported by the hardware |
GregCr | 0:e6ceb13d2d05 | 223 | * |
GregCr | 0:e6ceb13d2d05 | 224 | * @param [IN] frequency RF frequency to be checked |
GregCr | 0:e6ceb13d2d05 | 225 | * @retval isSupported [true: supported, false: unsupported] |
GregCr | 0:e6ceb13d2d05 | 226 | */ |
GregCr | 0:e6ceb13d2d05 | 227 | virtual bool CheckRfFrequency( uint32_t frequency ) = 0; |
GregCr | 0:e6ceb13d2d05 | 228 | |
mluis | 13:618826a997e2 | 229 | /*! |
GregCr | 0:e6ceb13d2d05 | 230 | * @brief Computes the packet time on air for the given payload |
GregCr | 0:e6ceb13d2d05 | 231 | * |
GregCr | 0:e6ceb13d2d05 | 232 | * \Remark Can only be called once SetRxConfig or SetTxConfig have been called |
GregCr | 0:e6ceb13d2d05 | 233 | * |
GregCr | 0:e6ceb13d2d05 | 234 | * @param [IN] modem Radio modem to be used [0: FSK, 1: LoRa] |
GregCr | 0:e6ceb13d2d05 | 235 | * @param [IN] pktLen Packet payload length |
GregCr | 0:e6ceb13d2d05 | 236 | * |
GregCr | 0:e6ceb13d2d05 | 237 | * @retval airTime Computed airTime for the given packet payload length |
GregCr | 0:e6ceb13d2d05 | 238 | */ |
GregCr | 0:e6ceb13d2d05 | 239 | virtual double TimeOnAir ( ModemType modem, uint8_t pktLen ) = 0; |
GregCr | 0:e6ceb13d2d05 | 240 | |
mluis | 13:618826a997e2 | 241 | /*! |
GregCr | 0:e6ceb13d2d05 | 242 | * @brief Sends the buffer of size. Prepares the packet to be sent and sets |
GregCr | 0:e6ceb13d2d05 | 243 | * the radio in transmission |
GregCr | 0:e6ceb13d2d05 | 244 | * |
GregCr | 0:e6ceb13d2d05 | 245 | * @param [IN]: buffer Buffer pointer |
GregCr | 0:e6ceb13d2d05 | 246 | * @param [IN]: size Buffer size |
GregCr | 0:e6ceb13d2d05 | 247 | */ |
GregCr | 0:e6ceb13d2d05 | 248 | virtual void Send( uint8_t *buffer, uint8_t size ) = 0; |
GregCr | 0:e6ceb13d2d05 | 249 | |
mluis | 13:618826a997e2 | 250 | /*! |
GregCr | 0:e6ceb13d2d05 | 251 | * @brief Sets the radio in sleep mode |
GregCr | 0:e6ceb13d2d05 | 252 | */ |
GregCr | 0:e6ceb13d2d05 | 253 | virtual void Sleep( void ) = 0; |
GregCr | 0:e6ceb13d2d05 | 254 | |
mluis | 13:618826a997e2 | 255 | /*! |
GregCr | 0:e6ceb13d2d05 | 256 | * @brief Sets the radio in standby mode |
GregCr | 0:e6ceb13d2d05 | 257 | */ |
GregCr | 7:2b555111463f | 258 | virtual void Standby( void ) = 0; |
GregCr | 7:2b555111463f | 259 | |
mluis | 13:618826a997e2 | 260 | /*! |
GregCr | 7:2b555111463f | 261 | * @brief Sets the radio in CAD mode |
GregCr | 7:2b555111463f | 262 | */ |
GregCr | 7:2b555111463f | 263 | virtual void StartCad( void ) = 0; |
GregCr | 0:e6ceb13d2d05 | 264 | |
mluis | 13:618826a997e2 | 265 | /*! |
GregCr | 0:e6ceb13d2d05 | 266 | * @brief Sets the radio in reception mode for the given time |
GregCr | 0:e6ceb13d2d05 | 267 | * @param [IN] timeout Reception timeout [us] |
GregCr | 0:e6ceb13d2d05 | 268 | * [0: continuous, others timeout] |
GregCr | 0:e6ceb13d2d05 | 269 | */ |
GregCr | 0:e6ceb13d2d05 | 270 | virtual void Rx( uint32_t timeout ) = 0; |
GregCr | 0:e6ceb13d2d05 | 271 | |
mluis | 13:618826a997e2 | 272 | /*! |
GregCr | 0:e6ceb13d2d05 | 273 | * @brief Sets the radio in transmission mode for the given time |
GregCr | 0:e6ceb13d2d05 | 274 | * @param [IN] timeout Transmission timeout [us] |
GregCr | 0:e6ceb13d2d05 | 275 | * [0: continuous, others timeout] |
GregCr | 0:e6ceb13d2d05 | 276 | */ |
GregCr | 0:e6ceb13d2d05 | 277 | virtual void Tx( uint32_t timeout ) = 0; |
GregCr | 0:e6ceb13d2d05 | 278 | |
mluis | 13:618826a997e2 | 279 | /*! |
GregCr | 0:e6ceb13d2d05 | 280 | * @brief Reads the current RSSI value |
GregCr | 0:e6ceb13d2d05 | 281 | * |
GregCr | 0:e6ceb13d2d05 | 282 | * @retval rssiValue Current RSSI value in [dBm] |
GregCr | 0:e6ceb13d2d05 | 283 | */ |
GregCr | 7:2b555111463f | 284 | virtual int16_t GetRssi ( ModemType modem ) = 0; |
GregCr | 0:e6ceb13d2d05 | 285 | |
mluis | 13:618826a997e2 | 286 | /*! |
GregCr | 0:e6ceb13d2d05 | 287 | * @brief Writes the radio register at the specified address |
GregCr | 0:e6ceb13d2d05 | 288 | * |
GregCr | 0:e6ceb13d2d05 | 289 | * @param [IN]: addr Register address |
GregCr | 0:e6ceb13d2d05 | 290 | * @param [IN]: data New register value |
GregCr | 0:e6ceb13d2d05 | 291 | */ |
GregCr | 0:e6ceb13d2d05 | 292 | virtual void Write ( uint8_t addr, uint8_t data ) = 0; |
GregCr | 0:e6ceb13d2d05 | 293 | |
mluis | 13:618826a997e2 | 294 | /*! |
GregCr | 0:e6ceb13d2d05 | 295 | * @brief Reads the radio register at the specified address |
GregCr | 0:e6ceb13d2d05 | 296 | * |
GregCr | 0:e6ceb13d2d05 | 297 | * @param [IN]: addr Register address |
GregCr | 0:e6ceb13d2d05 | 298 | * @retval data Register value |
GregCr | 0:e6ceb13d2d05 | 299 | */ |
GregCr | 0:e6ceb13d2d05 | 300 | virtual uint8_t Read ( uint8_t addr ) = 0; |
GregCr | 0:e6ceb13d2d05 | 301 | |
mluis | 13:618826a997e2 | 302 | /*! |
GregCr | 0:e6ceb13d2d05 | 303 | * @brief Writes multiple radio registers starting at address |
GregCr | 0:e6ceb13d2d05 | 304 | * |
GregCr | 0:e6ceb13d2d05 | 305 | * @param [IN] addr First Radio register address |
GregCr | 0:e6ceb13d2d05 | 306 | * @param [IN] buffer Buffer containing the new register's values |
GregCr | 0:e6ceb13d2d05 | 307 | * @param [IN] size Number of registers to be written |
GregCr | 0:e6ceb13d2d05 | 308 | */ |
GregCr | 0:e6ceb13d2d05 | 309 | virtual void Write( uint8_t addr, uint8_t *buffer, uint8_t size ) = 0; |
GregCr | 0:e6ceb13d2d05 | 310 | |
mluis | 13:618826a997e2 | 311 | /*! |
GregCr | 0:e6ceb13d2d05 | 312 | * @brief Reads multiple radio registers starting at address |
GregCr | 0:e6ceb13d2d05 | 313 | * |
GregCr | 0:e6ceb13d2d05 | 314 | * @param [IN] addr First Radio register address |
GregCr | 0:e6ceb13d2d05 | 315 | * @param [OUT] buffer Buffer where to copy the registers data |
GregCr | 0:e6ceb13d2d05 | 316 | * @param [IN] size Number of registers to be read |
GregCr | 0:e6ceb13d2d05 | 317 | */ |
GregCr | 0:e6ceb13d2d05 | 318 | virtual void Read ( uint8_t addr, uint8_t *buffer, uint8_t size ) = 0; |
mluis | 13:618826a997e2 | 319 | |
mluis | 13:618826a997e2 | 320 | /*! |
mluis | 13:618826a997e2 | 321 | * @brief Writes the buffer contents to the SX1276 FIFO |
mluis | 13:618826a997e2 | 322 | * |
mluis | 13:618826a997e2 | 323 | * @param [IN] buffer Buffer containing data to be put on the FIFO. |
mluis | 13:618826a997e2 | 324 | * @param [IN] size Number of bytes to be written to the FIFO |
mluis | 13:618826a997e2 | 325 | */ |
mluis | 13:618826a997e2 | 326 | virtual void WriteFifo( uint8_t *buffer, uint8_t size ) = 0; |
GregCr | 0:e6ceb13d2d05 | 327 | |
mluis | 13:618826a997e2 | 328 | /*! |
mluis | 13:618826a997e2 | 329 | * @brief Reads the contents of the SX1276 FIFO |
mluis | 13:618826a997e2 | 330 | * |
mluis | 13:618826a997e2 | 331 | * @param [OUT] buffer Buffer where to copy the FIFO read data. |
mluis | 13:618826a997e2 | 332 | * @param [IN] size Number of bytes to be read from the FIFO |
mluis | 13:618826a997e2 | 333 | */ |
mluis | 13:618826a997e2 | 334 | virtual void ReadFifo( uint8_t *buffer, uint8_t size ) = 0; |
GregCr | 0:e6ceb13d2d05 | 335 | }; |
GregCr | 0:e6ceb13d2d05 | 336 | |
GregCr | 0:e6ceb13d2d05 | 337 | #endif // __RADIO_H__ |
GregCr | 0:e6ceb13d2d05 | 338 |