first draft

Dependents:   LoRaWAN-demo-72_tjm frdm_LoRa_Connect_Woodstream_Demo_tjm frdm_LoRa_Connect_Woodstream_Demo_jlc

Fork of SX1272Lib by Semtech

Committer:
tmulrooney
Date:
Tue Aug 09 18:19:47 2016 +0000
Revision:
6:af0463c03b8b
Parent:
0:45c4f0364ca4
update

Who changed what in which revision?

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