This library update contains changes according to the HW-modification.

Dependents:   LoRaWAN_Serial_port_driven_and_configurable_ELMO_based_on_TxRx_Template

Fork of SX1272lib by Espotel

Changes compared to original SX1272lib:

HW modification was made to remove RFO-output and replaced with PABOOST-output. PASELECT changed accordingly.

Committer:
KosTee
Date:
Fri Oct 07 11:35:50 2016 +0000
Revision:
13:1af18cdef696
Parent:
0:669f3b0e91c8
RFO & PABOOST transmit modification has been done to some devices.; Selection can be made on sx1272-hal.cpp.; The new transmit route is currently commented on sx1272-hal.cpp, cause majority of devices still use the old route.;

Who changed what in which revision?

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