use with LoRa Access Point

Fork of SX1276Lib by Semtech

Committer:
GregCr
Date:
Mon Oct 13 07:33:11 2014 +0000
Revision:
12:aa5b3bf7fdf4
Parent:
7:2b555111463f
Child:
13:618826a997e2
Added LICENSE.txt; Minor corrections

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 (______/|_____)_|_|_| \__)_____)\____)_| |_|
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 /*!
GregCr 0:e6ceb13d2d05 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
GregCr 0:e6ceb13d2d05 29 //-------------------------------------------------------------------------
GregCr 0:e6ceb13d2d05 30 // Callback functions pointers
GregCr 0:e6ceb13d2d05 31 //-------------------------------------------------------------------------
GregCr 0:e6ceb13d2d05 32
GregCr 0:e6ceb13d2d05 33 /*!
GregCr 0:e6ceb13d2d05 34 * @brief Tx Done callback prototype.
GregCr 0:e6ceb13d2d05 35 */
GregCr 0:e6ceb13d2d05 36 void ( *txDone )( );
GregCr 0:e6ceb13d2d05 37
GregCr 0:e6ceb13d2d05 38 /*!
GregCr 0:e6ceb13d2d05 39 * @brief Tx Timeout callback prototype.
GregCr 0:e6ceb13d2d05 40 */
GregCr 0:e6ceb13d2d05 41 void ( *txTimeout ) ( );
GregCr 0:e6ceb13d2d05 42
GregCr 0:e6ceb13d2d05 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 */
GregCr 7:2b555111463f 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 */
GregCr 0:e6ceb13d2d05 58 void ( *rxTimeout ) ( );
GregCr 0:e6ceb13d2d05 59
GregCr 0:e6ceb13d2d05 60 /*!
GregCr 0:e6ceb13d2d05 61 * @brief Rx Error callback prototype.
GregCr 0:e6ceb13d2d05 62 */
GregCr 0:e6ceb13d2d05 63 void ( *rxError ) ( );
GregCr 0:e6ceb13d2d05 64
GregCr 6:e7f02929cd3d 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 */
GregCr 12:aa5b3bf7fdf4 77 void ( *cadDone ) ( bool ChannelActivityDetected );
GregCr 6:e7f02929cd3d 78
GregCr 0:e6ceb13d2d05 79 public:
GregCr 0:e6ceb13d2d05 80 //-------------------------------------------------------------------------
GregCr 0:e6ceb13d2d05 81 // Constructor
GregCr 0:e6ceb13d2d05 82 //-------------------------------------------------------------------------
GregCr 0:e6ceb13d2d05 83 /*!
GregCr 0:e6ceb13d2d05 84 * @brief Constructor of the radio object, the parameters are the callback functions described in the header.
GregCr 0:e6ceb13d2d05 85 * @param [IN] txDone
GregCr 0:e6ceb13d2d05 86 * @param [IN] txTimeout
GregCr 0:e6ceb13d2d05 87 * @param [IN] rxDone
GregCr 0:e6ceb13d2d05 88 * @param [IN] rxTimeout
GregCr 0:e6ceb13d2d05 89 * @param [IN] rxError
GregCr 0:e6ceb13d2d05 90 */
GregCr 7:2b555111463f 91 Radio( void ( *txDone )( ), void ( *txTimeout ) ( ), void ( *rxDone ) ( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ),
GregCr 12:aa5b3bf7fdf4 92 void ( *rxTimeout ) ( ), void ( *rxError ) ( ), void ( *fhssChangeChannel ) ( uint8_t channelIndex ), void ( *cadDone ) ( bool ChannelActivityDetected ) );
GregCr 0:e6ceb13d2d05 93 virtual ~Radio( ) {};
GregCr 0:e6ceb13d2d05 94
GregCr 0:e6ceb13d2d05 95 //-------------------------------------------------------------------------
GregCr 0:e6ceb13d2d05 96 // Pure virtual functions
GregCr 0:e6ceb13d2d05 97 //-------------------------------------------------------------------------
GregCr 0:e6ceb13d2d05 98
GregCr 0:e6ceb13d2d05 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;
GregCr 0:e6ceb13d2d05 105
GregCr 0:e6ceb13d2d05 106 /*!
GregCr 0:e6ceb13d2d05 107 * @brief Sets the channel frequency
GregCr 0:e6ceb13d2d05 108 *
GregCr 0:e6ceb13d2d05 109 * @param [IN] freq Channel RF frequency
GregCr 0:e6ceb13d2d05 110 */
GregCr 0:e6ceb13d2d05 111 virtual void SetChannel( uint32_t freq ) = 0;
GregCr 0:e6ceb13d2d05 112
GregCr 0:e6ceb13d2d05 113 /*!
GregCr 0:e6ceb13d2d05 114 * @brief Sets the channels configuration
GregCr 0:e6ceb13d2d05 115 *
GregCr 0:e6ceb13d2d05 116 * @param [IN] modem Radio modem to be used [0: FSK, 1: LoRa]
GregCr 0:e6ceb13d2d05 117 * @param [IN] freq Channel RF frequency
GregCr 0:e6ceb13d2d05 118 * @param [IN] rssiThresh RSSI threshold
GregCr 0:e6ceb13d2d05 119 *
GregCr 0:e6ceb13d2d05 120 * @retval isFree [true: Channel is free, false: Channel is not free]
GregCr 0:e6ceb13d2d05 121 */
GregCr 0:e6ceb13d2d05 122 virtual bool IsChannelFree( ModemType modem, uint32_t freq, int8_t rssiThresh ) = 0;
GregCr 0:e6ceb13d2d05 123
GregCr 0:e6ceb13d2d05 124 /*!
GregCr 0:e6ceb13d2d05 125 * @brief Generates a 32 bits random value based on the RSSI readings
GregCr 0:e6ceb13d2d05 126 *
GregCr 0:e6ceb13d2d05 127 * \remark This function sets the radio in LoRa modem mode and disables
GregCr 0:e6ceb13d2d05 128 * all interrupts.
GregCr 0:e6ceb13d2d05 129 * After calling this function either Radio.SetRxConfig or
GregCr 0:e6ceb13d2d05 130 * Radio.SetTxConfig functions must be called.
GregCr 0:e6ceb13d2d05 131 *
GregCr 0:e6ceb13d2d05 132 * @retval randomValue 32 bits random value
GregCr 0:e6ceb13d2d05 133 */
GregCr 0:e6ceb13d2d05 134 virtual uint32_t Random( void )= 0;
GregCr 0:e6ceb13d2d05 135
GregCr 0:e6ceb13d2d05 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 )
GregCr 0:e6ceb13d2d05 157 * @param [IN] symbTimeout Sets the RxSingle timeout value ( LoRa only )
GregCr 0:e6ceb13d2d05 158 * FSK : N/A ( set to 0 )
GregCr 0:e6ceb13d2d05 159 * LoRa: timeout in symbols
GregCr 0:e6ceb13d2d05 160 * @param [IN] fixLen Fixed length packets [0: variable, 1: fixed]
GregCr 0:e6ceb13d2d05 161 * @param [IN] crcOn Enables/Disables the CRC [0: OFF, 1: ON]
GregCr 6:e7f02929cd3d 162 * @param [IN] FreqHopOn Enables disables the intra-packet frequency hopping [0: OFF, 1: ON] (LoRa only)
GregCr 6:e7f02929cd3d 163 * @param [IN] HopPeriod Number of symbols bewteen each hop (LoRa only)
GregCr 0:e6ceb13d2d05 164 * @param [IN] iqInverted Inverts IQ signals ( LoRa only )
GregCr 0:e6ceb13d2d05 165 * FSK : N/A ( set to 0 )
GregCr 0:e6ceb13d2d05 166 * LoRa: [0: not inverted, 1: inverted]
GregCr 0:e6ceb13d2d05 167 * @param [IN] rxContinuous Sets the reception in continuous mode
GregCr 0:e6ceb13d2d05 168 * [false: single mode, true: continuous mode]
GregCr 0:e6ceb13d2d05 169 */
GregCr 0:e6ceb13d2d05 170 virtual void SetRxConfig ( ModemType modem, uint32_t bandwidth,
GregCr 0:e6ceb13d2d05 171 uint32_t datarate, uint8_t coderate,
GregCr 0:e6ceb13d2d05 172 uint32_t bandwidthAfc, uint16_t preambleLen,
GregCr 0:e6ceb13d2d05 173 uint16_t symbTimeout, bool fixLen,
GregCr 6:e7f02929cd3d 174 bool crcOn, bool FreqHopOn, uint8_t HopPeriod,
GregCr 6:e7f02929cd3d 175 bool iqInverted, bool rxContinuous ) = 0;
GregCr 0:e6ceb13d2d05 176
GregCr 0:e6ceb13d2d05 177 /*!
GregCr 0:e6ceb13d2d05 178 * @brief Sets the transmission parameters
GregCr 0:e6ceb13d2d05 179 *
GregCr 0:e6ceb13d2d05 180 * @param [IN] modem Radio modem to be used [0: FSK, 1: LoRa]
GregCr 0:e6ceb13d2d05 181 * @param [IN] power Sets the output power [dBm]
GregCr 0:e6ceb13d2d05 182 * @param [IN] fdev Sets the frequency deviation ( FSK only )
GregCr 0:e6ceb13d2d05 183 * FSK : [Hz]
GregCr 0:e6ceb13d2d05 184 * LoRa: 0
GregCr 0:e6ceb13d2d05 185 * @param [IN] bandwidth Sets the bandwidth ( LoRa only )
GregCr 0:e6ceb13d2d05 186 * FSK : 0
GregCr 0:e6ceb13d2d05 187 * LoRa: [0: 125 kHz, 1: 250 kHz,
GregCr 0:e6ceb13d2d05 188 * 2: 500 kHz, 3: Reserved]
GregCr 0:e6ceb13d2d05 189 * @param [IN] datarate Sets the Datarate
GregCr 0:e6ceb13d2d05 190 * FSK : 600..300000 bits/s
GregCr 0:e6ceb13d2d05 191 * LoRa: [6: 64, 7: 128, 8: 256, 9: 512,
GregCr 0:e6ceb13d2d05 192 * 10: 1024, 11: 2048, 12: 4096 chips]
GregCr 0:e6ceb13d2d05 193 * @param [IN] coderate Sets the coding rate ( LoRa only )
GregCr 0:e6ceb13d2d05 194 * FSK : N/A ( set to 0 )
GregCr 0:e6ceb13d2d05 195 * LoRa: [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8]
GregCr 0:e6ceb13d2d05 196 * @param [IN] preambleLen Sets the preamble length
GregCr 0:e6ceb13d2d05 197 * @param [IN] fixLen Fixed length packets [0: variable, 1: fixed]
GregCr 0:e6ceb13d2d05 198 * @param [IN] crcOn Enables disables the CRC [0: OFF, 1: ON]
GregCr 6:e7f02929cd3d 199 * @param [IN] FreqHopOn Enables disables the intra-packet frequency hopping [0: OFF, 1: ON] (LoRa only)
GregCr 6:e7f02929cd3d 200 * @param [IN] HopPeriod Number of symbols bewteen each hop (LoRa only)
GregCr 0:e6ceb13d2d05 201 * @param [IN] iqInverted Inverts IQ signals ( LoRa only )
GregCr 0:e6ceb13d2d05 202 * FSK : N/A ( set to 0 )
GregCr 0:e6ceb13d2d05 203 * LoRa: [0: not inverted, 1: inverted]
GregCr 0:e6ceb13d2d05 204 * @param [IN] timeout Transmission timeout [us]
GregCr 0:e6ceb13d2d05 205 */
GregCr 0:e6ceb13d2d05 206 virtual void SetTxConfig( ModemType modem, int8_t power, uint32_t fdev,
GregCr 6:e7f02929cd3d 207 uint32_t bandwidth, uint32_t datarate,
GregCr 6:e7f02929cd3d 208 uint8_t coderate, uint16_t preambleLen,
GregCr 6:e7f02929cd3d 209 bool fixLen, bool crcOn, bool FreqHopOn,
GregCr 6:e7f02929cd3d 210 uint8_t HopPeriod, bool iqInverted, uint32_t timeout ) = 0;
GregCr 0:e6ceb13d2d05 211
GregCr 0:e6ceb13d2d05 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;
GregCr 0:e6ceb13d2d05 219
GregCr 0:e6ceb13d2d05 220 /*!
GregCr 0:e6ceb13d2d05 221 * @brief Computes the packet time on air for the given payload
GregCr 0:e6ceb13d2d05 222 *
GregCr 0:e6ceb13d2d05 223 * \Remark Can only be called once SetRxConfig or SetTxConfig have been called
GregCr 0:e6ceb13d2d05 224 *
GregCr 0:e6ceb13d2d05 225 * @param [IN] modem Radio modem to be used [0: FSK, 1: LoRa]
GregCr 0:e6ceb13d2d05 226 * @param [IN] pktLen Packet payload length
GregCr 0:e6ceb13d2d05 227 *
GregCr 0:e6ceb13d2d05 228 * @retval airTime Computed airTime for the given packet payload length
GregCr 0:e6ceb13d2d05 229 */
GregCr 0:e6ceb13d2d05 230 virtual double TimeOnAir ( ModemType modem, uint8_t pktLen ) = 0;
GregCr 0:e6ceb13d2d05 231
GregCr 0:e6ceb13d2d05 232 /*!
GregCr 0:e6ceb13d2d05 233 * @brief Sends the buffer of size. Prepares the packet to be sent and sets
GregCr 0:e6ceb13d2d05 234 * the radio in transmission
GregCr 0:e6ceb13d2d05 235 *
GregCr 0:e6ceb13d2d05 236 * @param [IN]: buffer Buffer pointer
GregCr 0:e6ceb13d2d05 237 * @param [IN]: size Buffer size
GregCr 0:e6ceb13d2d05 238 */
GregCr 0:e6ceb13d2d05 239 virtual void Send( uint8_t *buffer, uint8_t size ) = 0;
GregCr 0:e6ceb13d2d05 240
GregCr 0:e6ceb13d2d05 241 /*!
GregCr 0:e6ceb13d2d05 242 * @brief Sets the radio in sleep mode
GregCr 0:e6ceb13d2d05 243 */
GregCr 0:e6ceb13d2d05 244 virtual void Sleep( void ) = 0;
GregCr 0:e6ceb13d2d05 245
GregCr 0:e6ceb13d2d05 246 /*!
GregCr 0:e6ceb13d2d05 247 * @brief Sets the radio in standby mode
GregCr 0:e6ceb13d2d05 248 */
GregCr 7:2b555111463f 249 virtual void Standby( void ) = 0;
GregCr 7:2b555111463f 250
GregCr 7:2b555111463f 251 /*!
GregCr 7:2b555111463f 252 * @brief Sets the radio in CAD mode
GregCr 7:2b555111463f 253 */
GregCr 7:2b555111463f 254 virtual void StartCad( void ) = 0;
GregCr 0:e6ceb13d2d05 255
GregCr 0:e6ceb13d2d05 256 /*!
GregCr 0:e6ceb13d2d05 257 * @brief Sets the radio in reception mode for the given time
GregCr 0:e6ceb13d2d05 258 * @param [IN] timeout Reception timeout [us]
GregCr 0:e6ceb13d2d05 259 * [0: continuous, others timeout]
GregCr 0:e6ceb13d2d05 260 */
GregCr 0:e6ceb13d2d05 261 virtual void Rx( uint32_t timeout ) = 0;
GregCr 0:e6ceb13d2d05 262
GregCr 0:e6ceb13d2d05 263 /*!
GregCr 0:e6ceb13d2d05 264 * @brief Sets the radio in transmission mode for the given time
GregCr 0:e6ceb13d2d05 265 * @param [IN] timeout Transmission timeout [us]
GregCr 0:e6ceb13d2d05 266 * [0: continuous, others timeout]
GregCr 0:e6ceb13d2d05 267 */
GregCr 0:e6ceb13d2d05 268 virtual void Tx( uint32_t timeout ) = 0;
GregCr 0:e6ceb13d2d05 269
GregCr 0:e6ceb13d2d05 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 */
GregCr 7:2b555111463f 275 virtual int16_t GetRssi ( ModemType modem ) = 0;
GregCr 0:e6ceb13d2d05 276
GregCr 0:e6ceb13d2d05 277 /*!
GregCr 0:e6ceb13d2d05 278 * @brief Writes the radio register at the specified address
GregCr 0:e6ceb13d2d05 279 *
GregCr 0:e6ceb13d2d05 280 * @param [IN]: addr Register address
GregCr 0:e6ceb13d2d05 281 * @param [IN]: data New register value
GregCr 0:e6ceb13d2d05 282 */
GregCr 0:e6ceb13d2d05 283 virtual void Write ( uint8_t addr, uint8_t data ) = 0;
GregCr 0:e6ceb13d2d05 284
GregCr 0:e6ceb13d2d05 285 /*!
GregCr 0:e6ceb13d2d05 286 * @brief Reads the radio register at the specified address
GregCr 0:e6ceb13d2d05 287 *
GregCr 0:e6ceb13d2d05 288 * @param [IN]: addr Register address
GregCr 0:e6ceb13d2d05 289 * @retval data Register value
GregCr 0:e6ceb13d2d05 290 */
GregCr 0:e6ceb13d2d05 291 virtual uint8_t Read ( uint8_t addr ) = 0;
GregCr 0:e6ceb13d2d05 292
GregCr 0:e6ceb13d2d05 293 /*!
GregCr 0:e6ceb13d2d05 294 * @brief Writes multiple radio registers starting at address
GregCr 0:e6ceb13d2d05 295 *
GregCr 0:e6ceb13d2d05 296 * @param [IN] addr First Radio register address
GregCr 0:e6ceb13d2d05 297 * @param [IN] buffer Buffer containing the new register's values
GregCr 0:e6ceb13d2d05 298 * @param [IN] size Number of registers to be written
GregCr 0:e6ceb13d2d05 299 */
GregCr 0:e6ceb13d2d05 300 virtual void Write( uint8_t addr, uint8_t *buffer, uint8_t size ) = 0;
GregCr 0:e6ceb13d2d05 301
GregCr 0:e6ceb13d2d05 302 /*!
GregCr 0:e6ceb13d2d05 303 * @brief Reads 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 [OUT] buffer Buffer where to copy the registers data
GregCr 0:e6ceb13d2d05 307 * @param [IN] size Number of registers to be read
GregCr 0:e6ceb13d2d05 308 */
GregCr 0:e6ceb13d2d05 309 virtual void Read ( uint8_t addr, uint8_t *buffer, uint8_t size ) = 0;
GregCr 0:e6ceb13d2d05 310
GregCr 0:e6ceb13d2d05 311 /*!
GregCr 0:e6ceb13d2d05 312 * @brief Writes the buffer contents to the SX1276 FIFO
GregCr 0:e6ceb13d2d05 313 *
GregCr 0:e6ceb13d2d05 314 * @param [IN] buffer Buffer containing data to be put on the FIFO.
GregCr 0:e6ceb13d2d05 315 * @param [IN] size Number of bytes to be written to the FIFO
GregCr 0:e6ceb13d2d05 316 */
GregCr 0:e6ceb13d2d05 317 virtual void WriteFifo( uint8_t *buffer, uint8_t size ) = 0;
GregCr 0:e6ceb13d2d05 318
GregCr 0:e6ceb13d2d05 319 /*!
GregCr 0:e6ceb13d2d05 320 * @brief Reads the contents of the SX1276 FIFO
GregCr 0:e6ceb13d2d05 321 *
GregCr 0:e6ceb13d2d05 322 * @param [OUT] buffer Buffer where to copy the FIFO read data.
GregCr 0:e6ceb13d2d05 323 * @param [IN] size Number of bytes to be read from the FIFO
GregCr 0:e6ceb13d2d05 324 */
GregCr 0:e6ceb13d2d05 325 virtual void ReadFifo( uint8_t *buffer, uint8_t size ) = 0;
GregCr 0:e6ceb13d2d05 326 };
GregCr 0:e6ceb13d2d05 327
GregCr 0:e6ceb13d2d05 328 #endif // __RADIO_H__
GregCr 0:e6ceb13d2d05 329