use with LoRa Access Point

Fork of SX1276Lib by Semtech

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