Library files for InAir9 module containing SX1272

Fork of SX1272Lib by Semtech

Committer:
mluis
Date:
Mon Apr 24 09:26:08 2017 +0000
Revision:
7:b988b60083a1
Parent:
0:45c4f0364ca4
WARNING: Radio API timings changed from micro-seconds to milliseconds; ; Synchronized with https://github.com/Lora-net/LoRaMac-node git revision e506c246652fa44c3f24cecb89d0707b49ece739

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