1

Committer:
floatlei
Date:
Sat Oct 08 02:35:14 2016 +0000
Revision:
0:7e14d7c443f1
11

Who changed what in which revision?

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