Просмотр исходного кода

update:避免与老lora库冲突

Dozingfiretruck 2 лет назад
Родитель
Сommit
ba3ddacb7f

+ 5 - 5
components/lora/luat_lib_lora.c

@@ -117,7 +117,7 @@ end)
     return 0;
 }
 
-void OnTxDone( void ){
+static void OnTxDone( void ){
     rtos_msg_t msg = {0};
     msg.handler = l_lora_handler;
     msg.ptr = NULL;
@@ -126,7 +126,7 @@ void OnTxDone( void ){
     luat_msgbus_put(&msg, 1);
 }
 
-void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ){
+static void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ){
     // printf("RxDone size:%d rssi:%d snr:%d\n",size,rssi,snr);
     // printf("RxDone payload: %.*s",size,payload);
     char* rx_buff = luat_heap_malloc(size);
@@ -140,7 +140,7 @@ void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ){
     luat_msgbus_put(&msg, 1);
 }
 
-void OnTxTimeout( void ){
+static void OnTxTimeout( void ){
     rtos_msg_t msg = {0};
     msg.handler = l_lora_handler;
     msg.ptr = NULL;
@@ -149,7 +149,7 @@ void OnTxTimeout( void ){
     luat_msgbus_put(&msg, 1);
 }
 
-void OnRxTimeout( void ){
+static void OnRxTimeout( void ){
     rtos_msg_t msg = {0};
     msg.handler = l_lora_handler;
     msg.ptr = NULL;
@@ -158,7 +158,7 @@ void OnRxTimeout( void ){
     luat_msgbus_put(&msg, 1);
 }
 
-void OnRxError( void ){
+static void OnRxError( void ){
     rtos_msg_t msg = {0};
     msg.handler = l_lora_handler;
     msg.ptr = NULL;

+ 2 - 2
components/lora/sx126x/radio.c

@@ -364,7 +364,7 @@ typedef struct
 /*!
  * Precomputed FSK bandwidth registers values
  */
-const FskBandwidth_t FskBandwidths[] =
+static const FskBandwidth_t FskBandwidths[] =
 {
     { 4800  , 0x1F },
     { 5800  , 0x17 },
@@ -390,7 +390,7 @@ const FskBandwidth_t FskBandwidths[] =
     { 500000, 0x00 }, // Invalid Bandwidth
 };
 
-const RadioLoRaBandwidths_t Bandwidths[] = { LORA_BW_125, LORA_BW_250, LORA_BW_500 };
+static const RadioLoRaBandwidths_t Bandwidths[] = { LORA_BW_125, LORA_BW_250, LORA_BW_500 };
 
 //                                          SF12    SF11    SF10    SF9    SF8    SF7
 static double RadioLoRaSymbTime[3][6] = {{ 32.768, 16.384, 8.192, 4.096, 2.048, 1.024 },  // 125 KHz

+ 45 - 16
components/lora2/luat_lib_lora.c

@@ -211,11 +211,11 @@ static int luat_lora_init(lua_State *L){
         RadioEvents.TxTimeout = OnTxTimeout;
         RadioEvents.RxTimeout = OnRxTimeout;
         RadioEvents.RxError = OnRxError;
-        RadioEventsInit(lora_device,&RadioEvents);
-        if (lora_device->lora_init) Radio.Init( lora_device,&RadioEvents );
+        RadioEventsInit2(lora_device,&RadioEvents);
+        if (lora_device->lora_init) Radio2.Init( lora_device,&RadioEvents );
 
         luat_rtos_timer_create(&lora_device->timer);
-        luat_rtos_timer_start(lora_device->timer, 10, 1, Radio.IrqProcess, lora_device);
+        luat_rtos_timer_start(lora_device->timer, 10, 1, Radio2.IrqProcess, lora_device);
 
         luaL_setmetatable(L, LUAT_LORA_TYPE);
         lua_pushvalue(L, -1);
@@ -238,16 +238,16 @@ lora_device:set_channel(433000000)
 static int luat_lora_set_channel(lua_State *L){
     lora_device_t  * lora_device = get_lora_device(L);
     uint32_t freq = luaL_optinteger(L, 2,433000000);
-    Radio.SetChannel(lora_device,freq);
+    Radio2.SetChannel(lora_device,freq);
     return 0;
 }
 
 /*
 lora配置发送参数
-@api lora.set_txconfig(txconfig)
+@api lora_device:set_txconfig(txconfig)
 @table lora发送配置参数,与具体设备有关
 @usage
-lora.set_txconfig(
+lora_device:set_txconfig(
     {
         mode=1,
         power=22,
@@ -340,7 +340,7 @@ static int luat_lora_set_txconfig(lua_State *L){
         lua_pop(L, 1);
     }
     
-    Radio.SetTxConfig( lora_device,mode, power, fdev, bandwidth,
+    Radio2.SetTxConfig( lora_device,mode, power, fdev, bandwidth,
                         datarate, coderate,
                         preambleLen, fixLen,
                         crcOn, freqHopOn, hopPeriod, iqInverted, timeout );
@@ -350,10 +350,10 @@ static int luat_lora_set_txconfig(lua_State *L){
 
 /*
 lora配置接收参数
-@api lora.set_rxconfig(set_rxconfig)
+@api lora_device:set_rxconfig(set_rxconfig)
 @table lora接收配置参数,与具体设备有关
 @usage
-lora.set_rxconfig(
+lora_device:set_rxconfig(
     {
         mode=1,
         bandwidth=0,
@@ -450,7 +450,7 @@ static int luat_lora_set_rxconfig(lua_State *L){
         lua_pop(L, 1);
     }
 
-    Radio.SetRxConfig( lora_device,mode, bandwidth, datarate,
+    Radio2.SetRxConfig( lora_device,mode, bandwidth, datarate,
                         coderate, bandwidthAfc, preambleLen,
                         symbTimeout, fixLen,
                         payloadLen, crcOn, freqHopOn, hopPeriod, iqInverted, rxContinuous );
@@ -469,8 +469,8 @@ static int luat_lora_send(lua_State *L){
     lora_device_t  * lora_device = get_lora_device(L);
     size_t len;
     const char* send_buff = luaL_checklstring(L, 2, &len);
-    Radio.Standby(lora_device);
-    Radio.Send( lora_device,send_buff, len);
+    Radio2.Standby(lora_device);
+    Radio2.Send( lora_device,send_buff, len);
     return 0;
 }
 
@@ -488,8 +488,8 @@ lora_device:recv(1000)
 static int luat_lora_recv(lua_State *L){
     lora_device_t  * lora_device = get_lora_device(L);
     int rx_timeout = luaL_optinteger(L, 2, 1000);
-    Radio.Standby(lora_device);
-    Radio.Rx(lora_device,rx_timeout);
+    Radio2.Standby(lora_device);
+    Radio2.Rx(lora_device,rx_timeout);
     return 0;
 }
 
@@ -504,13 +504,42 @@ static int luat_lora_mode(lua_State *L){
     lora_device_t  * lora_device = get_lora_device(L);
     int mode = luaL_optinteger(L, 2, 1);
     if (mode == 1){
-        Radio.Standby(lora_device);
+        Radio2.Standby(lora_device);
     }else if (mode == 0){
-        Radio.Sleep(lora_device);
+        Radio2.Sleep(lora_device);
     }
     return 0;
 }
 
+/*
+注册lora回调
+@api lora_device:on(cb)
+@function cb lora回调,参数包括lora_device, event, data, size
+@return nil 无返回值
+@usage 
+lora_device:on(function(lora_device, event, data, size)
+    log.info("lora", "event", event, lora_device, data, size)
+    if event == "tx_done" then
+        lora_device:recv(1000)
+    elseif event == "rx_done" then
+        lora_device:send("PING")
+    elseif event == "tx_timeout" then
+
+    elseif event == "rx_timeout" then
+        lora_device:recv(1000)
+    elseif event == "rx_error" then
+
+    end
+end)
+--[[
+event可能出现的值有
+    tx_done         -- 发送完成
+    rx_done         -- 接收完成
+    tx_timeout      -- 发送超时
+    rx_timeout      -- 接收超时
+    rx_error        -- 接收错误
+]]
+*/
 static int luat_lora_on(lua_State *L){
     lora_device_t *lora_device = get_lora_device(L);
 	if (lora_device->lora_cb != 0) {

+ 134 - 134
components/lora2/sx126x/radio.c

@@ -32,28 +32,28 @@
  *
  * \param [IN] events Structure containing the driver callback functions
  */
-void RadioInit( lora_device_t* lora_device,RadioEvents_t *events );
+static void RadioInit( lora_device_t* lora_device,RadioEvents_t *events );
 
 /*!
  * Return current radio status
  *
  * \param status Radio status.[RF_IDLE, RF_RX_RUNNING, RF_TX_RUNNING]
  */
-RadioState_t RadioGetStatus( lora_device_t* lora_device );
+static RadioState_t RadioGetStatus( lora_device_t* lora_device );
 
 /*!
  * \brief Configures the radio with the given modem
  *
  * \param [IN] modem Modem to be used [0: FSK, 1: LoRa]
  */
-void RadioSetModem( lora_device_t* lora_device,RadioModems_t modem );
+static void RadioSetModem( lora_device_t* lora_device,RadioModems_t modem );
 
 /*!
  * \brief Sets the channel frequency
  *
  * \param [IN] freq         Channel RF frequency
  */
-void RadioSetChannel( lora_device_t* lora_device,uint32_t freq );
+static void RadioSetChannel( lora_device_t* lora_device,uint32_t freq );
 
 /*!
  * \brief Checks if the channel is free for the given time
@@ -65,7 +65,7 @@ void RadioSetChannel( lora_device_t* lora_device,uint32_t freq );
  *
  * \retval isFree         [true: Channel is free, false: Channel is not free]
  */
-bool RadioIsChannelFree( lora_device_t* lora_device,RadioModems_t modem, uint32_t freq, int16_t rssiThresh, uint32_t maxCarrierSenseTime );
+static bool RadioIsChannelFree( lora_device_t* lora_device,RadioModems_t modem, uint32_t freq, int16_t rssiThresh, uint32_t maxCarrierSenseTime );
 
 /*!
  * \brief Generates a 32 bits random value based on the RSSI readings
@@ -77,7 +77,7 @@ bool RadioIsChannelFree( lora_device_t* lora_device,RadioModems_t modem, uint32_
  *
  * \retval randomValue    32 bits random value
  */
-uint32_t RadioRandom( lora_device_t* lora_device );
+static uint32_t RadioRandom( lora_device_t* lora_device );
 
 /*!
  * \brief Sets the reception parameters
@@ -118,7 +118,7 @@ uint32_t RadioRandom( lora_device_t* lora_device );
  * \param [IN] rxContinuous Sets the reception in continuous mode
  *                          [false: single mode, true: continuous mode]
  */
-void RadioSetRxConfig( lora_device_t* lora_device,RadioModems_t modem, uint32_t bandwidth,
+static void RadioSetRxConfig( lora_device_t* lora_device,RadioModems_t modem, uint32_t bandwidth,
                           uint32_t datarate, uint8_t coderate,
                           uint32_t bandwidthAfc, uint16_t preambleLen,
                           uint16_t symbTimeout, bool fixLen,
@@ -161,7 +161,7 @@ void RadioSetRxConfig( lora_device_t* lora_device,RadioModems_t modem, uint32_t
  *                          LoRa: [0: not inverted, 1: inverted]
  * \param [IN] timeout      Transmission timeout [ms]
  */
-void RadioSetTxConfig( lora_device_t* lora_device,RadioModems_t modem, int8_t power, uint32_t fdev,
+static void RadioSetTxConfig( lora_device_t* lora_device,RadioModems_t modem, int8_t power, uint32_t fdev,
                           uint32_t bandwidth, uint32_t datarate,
                           uint8_t coderate, uint16_t preambleLen,
                           bool fixLen, bool crcOn, bool FreqHopOn,
@@ -173,7 +173,7 @@ void RadioSetTxConfig( lora_device_t* lora_device,RadioModems_t modem, int8_t po
  * \param [IN] frequency RF frequency to be checked
  * \retval isSupported [true: supported, false: unsupported]
  */
-bool RadioCheckRfFrequency( lora_device_t* lora_device,uint32_t frequency );
+static bool RadioCheckRfFrequency( lora_device_t* lora_device,uint32_t frequency );
 
 /*!
  * \brief Computes the packet time on air in ms for the given payload
@@ -185,7 +185,7 @@ bool RadioCheckRfFrequency( lora_device_t* lora_device,uint32_t frequency );
  *
  * \retval airTime        Computed airTime (ms) for the given packet payload length
  */
-uint32_t RadioTimeOnAir( lora_device_t* lora_device,RadioModems_t modem, uint8_t pktLen );
+static uint32_t RadioTimeOnAir( lora_device_t* lora_device,RadioModems_t modem, uint8_t pktLen );
 
 /*!
  * \brief Sends the buffer of size. Prepares the packet to be sent and sets
@@ -194,29 +194,29 @@ uint32_t RadioTimeOnAir( lora_device_t* lora_device,RadioModems_t modem, uint8_t
  * \param [IN]: buffer     Buffer pointer
  * \param [IN]: size       Buffer size
  */
-void RadioSend( lora_device_t* lora_device,uint8_t *buffer, uint8_t size );
+static void RadioSend( lora_device_t* lora_device,uint8_t *buffer, uint8_t size );
 
 /*!
  * \brief Sets the radio in sleep mode
  */
-void RadioSleep( lora_device_t* lora_device );
+static void RadioSleep( lora_device_t* lora_device );
 
 /*!
  * \brief Sets the radio in standby mode
  */
-void RadioStandby( lora_device_t* lora_device );
+static void RadioStandby( lora_device_t* lora_device );
 
 /*!
  * \brief Sets the radio in reception mode for the given time
  * \param [IN] timeout Reception timeout [ms]
  *                     [0: continuous, others timeout]
  */
-void RadioRx( lora_device_t* lora_device,uint32_t timeout );
+static void RadioRx( lora_device_t* lora_device,uint32_t timeout );
 
 /*!
  * \brief Start a Channel Activity Detection
  */
-void RadioStartCad( lora_device_t* lora_device );
+static void RadioStartCad( lora_device_t* lora_device );
 
 /*!
  * \brief Sets the radio in continuous wave transmission mode
@@ -225,14 +225,14 @@ void RadioStartCad( lora_device_t* lora_device );
  * \param [IN]: power      Sets the output power [dBm]
  * \param [IN]: time       Transmission mode timeout [s]
  */
-void RadioSetTxContinuousWave( lora_device_t* lora_device,uint32_t freq, int8_t power, uint16_t time );
+static void RadioSetTxContinuousWave( lora_device_t* lora_device,uint32_t freq, int8_t power, uint16_t time );
 
 /*!
  * \brief Reads the current RSSI value
  *
  * \retval rssiValue Current RSSI value in [dBm]
  */
-int16_t RadioRssi( lora_device_t* lora_device,RadioModems_t modem );
+static int16_t RadioRssi( lora_device_t* lora_device,RadioModems_t modem );
 
 /*!
  * \brief Writes the radio register at the specified address
@@ -240,7 +240,7 @@ int16_t RadioRssi( lora_device_t* lora_device,RadioModems_t modem );
  * \param [IN]: addr Register address
  * \param [IN]: data New register value
  */
-void RadioWrite( lora_device_t* lora_device,uint16_t addr, uint8_t data );
+static void RadioWrite( lora_device_t* lora_device,uint16_t addr, uint8_t data );
 
 /*!
  * \brief Reads the radio register at the specified address
@@ -248,7 +248,7 @@ void RadioWrite( lora_device_t* lora_device,uint16_t addr, uint8_t data );
  * \param [IN]: addr Register address
  * \retval data Register value
  */
-uint8_t RadioRead( lora_device_t* lora_device,uint16_t addr );
+static uint8_t RadioRead( lora_device_t* lora_device,uint16_t addr );
 
 /*!
  * \brief Writes multiple radio registers starting at address
@@ -257,7 +257,7 @@ uint8_t RadioRead( lora_device_t* lora_device,uint16_t addr );
  * \param [IN] buffer Buffer containing the new register's values
  * \param [IN] size   Number of registers to be written
  */
-void RadioWriteBuffer( lora_device_t* lora_device,uint16_t addr, uint8_t *buffer, uint8_t size );
+static void RadioWriteBuffer( lora_device_t* lora_device,uint16_t addr, uint8_t *buffer, uint8_t size );
 
 /*!
  * \brief Reads multiple radio registers starting at address
@@ -266,7 +266,7 @@ void RadioWriteBuffer( lora_device_t* lora_device,uint16_t addr, uint8_t *buffer
  * \param [OUT] buffer Buffer where to copy the registers data
  * \param [IN] size Number of registers to be read
  */
-void RadioReadBuffer( lora_device_t* lora_device,uint16_t addr, uint8_t *buffer, uint8_t size );
+static void RadioReadBuffer( lora_device_t* lora_device,uint16_t addr, uint8_t *buffer, uint8_t size );
 
 /*!
  * \brief Sets the maximum payload length.
@@ -274,7 +274,7 @@ void RadioReadBuffer( lora_device_t* lora_device,uint16_t addr, uint8_t *buffer,
  * \param [IN] modem      Radio modem to be used [0: FSK, 1: LoRa]
  * \param [IN] max        Maximum payload length in bytes
  */
-void RadioSetMaxPayloadLength( lora_device_t* lora_device,RadioModems_t modem, uint8_t max );
+static void RadioSetMaxPayloadLength( lora_device_t* lora_device,RadioModems_t modem, uint8_t max );
 
 /*!
  * \brief Sets the network to public or private. Updates the sync byte.
@@ -283,26 +283,26 @@ void RadioSetMaxPayloadLength( lora_device_t* lora_device,RadioModems_t modem, u
  *
  * \param [IN] enable if true, it enables a public network
  */
-void RadioSetPublicNetwork( lora_device_t* lora_device,bool enable );
+static void RadioSetPublicNetwork( lora_device_t* lora_device,bool enable );
 
 /*!
  * \brief Gets the time required for the board plus radio to get out of sleep.[ms]
  *
  * \retval time Radio plus board wakeup time in ms.
  */
-uint32_t RadioGetWakeupTime( lora_device_t* lora_device );
+static uint32_t RadioGetWakeupTime( lora_device_t* lora_device );
 
 /*!
  * \brief Process radio irq
  */
-void RadioIrqProcess( lora_device_t* lora_device );
+static void RadioIrqProcess( lora_device_t* lora_device );
 
 /*!
  * \brief Sets the radio in reception mode with Max LNA gain for the given time
  * \param [IN] timeout Reception timeout [ms]
  *                     [0: continuous, others timeout]
  */
-void RadioRxBoosted( lora_device_t* lora_device,uint32_t timeout );
+static void RadioRxBoosted( lora_device_t* lora_device,uint32_t timeout );
 
 /*!
  * \brief Sets the Rx duty cycle management parameters
@@ -310,12 +310,12 @@ void RadioRxBoosted( lora_device_t* lora_device,uint32_t timeout );
  * \param [in]  rxTime        Structure describing reception timeout value
  * \param [in]  sleepTime     Structure describing sleep timeout value
  */
-void RadioSetRxDutyCycle( lora_device_t* lora_device,uint32_t rxTime, uint32_t sleepTime );
+static void RadioSetRxDutyCycle( lora_device_t* lora_device,uint32_t rxTime, uint32_t sleepTime );
 
 /*!
  * Radio driver structure initialization
  */
-const struct Radio_s Radio =
+const struct Radio_s Radio2 =
 {
     RadioInit,
     RadioGetStatus,
@@ -404,17 +404,17 @@ static double RadioLoRaSymbTime[3][6] = {{ 32.768, 16.384, 8.192, 4.096, 2.048,
 /*!
  * \brief DIO 0 IRQ callback
  */
-void RadioOnDioIrq( lora_device_t* lora_device );
+static void RadioOnDioIrq( lora_device_t* lora_device );
 
 /*!
  * \brief Tx timeout timer callback
  */
-void RadioOnTxTimeoutIrq( lora_device_t* lora_device );
+static void RadioOnTxTimeoutIrq( lora_device_t* lora_device );
 
 /*!
  * \brief Rx timeout timer callback
  */
-void RadioOnRxTimeoutIrq( lora_device_t* lora_device );
+static void RadioOnRxTimeoutIrq( lora_device_t* lora_device );
 
 /*
  * Private global variables
@@ -477,25 +477,25 @@ static uint8_t RadioGetFskBandwidthRegValue( lora_device_t* lora_device,uint32_t
     while( 1 );
 }
 
-void RadioEventsInit(lora_device_t* lora_device,RadioEvents_t *events){
+void RadioEventsInit2(lora_device_t* lora_device,RadioEvents_t *events){
     memcpy(&lora_device->RadioEvents,events,sizeof(RadioEvents_t));
 }
 
-void RadioInit( lora_device_t* lora_device,RadioEvents_t *events )
+static void RadioInit( lora_device_t* lora_device,RadioEvents_t *events )
 {
     memcpy(&lora_device->RadioEvents,events,sizeof(RadioEvents_t));
     lora_device->MaxPayloadLength = 0xFF;
-    SX126xInit(  lora_device,RadioOnDioIrq );
-    SX126xSetStandby(  lora_device,STDBY_RC );
-    SX126xSetRegulatorMode(  lora_device,USE_DCDC );
-    SX126xSetBufferBaseAddress(  lora_device,0x00, 0x00 );
-    SX126xSetTxParams(  lora_device,0, RADIO_RAMP_200_US );
-    SX126xSetDioIrqParams(  lora_device,IRQ_RADIO_ALL, IRQ_RADIO_ALL, IRQ_RADIO_NONE, IRQ_RADIO_NONE );
+    SX126xInit2(  lora_device,RadioOnDioIrq );
+    SX126xSetStandby2(  lora_device,STDBY_RC );
+    SX126xSetRegulatorMode2(  lora_device,USE_DCDC );
+    SX126xSetBufferBaseAddress2(  lora_device,0x00, 0x00 );
+    SX126xSetTx2Params2(  lora_device,0, RADIO_RAMP_200_US );
+    SX126xSetDioIrqParams2(  lora_device,IRQ_RADIO_ALL, IRQ_RADIO_ALL, IRQ_RADIO_NONE, IRQ_RADIO_NONE );
 }
 
-RadioState_t RadioGetStatus( lora_device_t* lora_device )
+static RadioState_t RadioGetStatus( lora_device_t* lora_device )
 {
-    switch( SX126xGetOperatingMode( lora_device ) )
+    switch( SX126xGetOperatingMode2( lora_device ) )
     {
         case MODE_TX:
             return RF_TX_RUNNING;
@@ -508,19 +508,19 @@ RadioState_t RadioGetStatus( lora_device_t* lora_device )
     }
 }
 
-void RadioSetModem(lora_device_t* lora_device, RadioModems_t modem )
+static void RadioSetModem(lora_device_t* lora_device, RadioModems_t modem )
 {
     switch( modem )
     {
     default:
     case MODEM_FSK:
-        SX126xSetPacketType(  lora_device,PACKET_TYPE_GFSK );
+        SX126xSetPacketType2(  lora_device,PACKET_TYPE_GFSK );
         // When switching to GFSK mode the LoRa SyncWord register value is reset
         // Thus, we also reset the RadioPublicNetwork variable
         RadioPublicNetwork.Current = false;
         break;
     case MODEM_LORA:
-        SX126xSetPacketType(  lora_device,PACKET_TYPE_LORA );
+        SX126xSetPacketType2(  lora_device,PACKET_TYPE_LORA );
         // Public/Private network register is reset when switching modems
         if( RadioPublicNetwork.Current != RadioPublicNetwork.Previous )
         {
@@ -531,12 +531,12 @@ void RadioSetModem(lora_device_t* lora_device, RadioModems_t modem )
     }
 }
 
-void RadioSetChannel( lora_device_t* lora_device,uint32_t freq )
+static void RadioSetChannel( lora_device_t* lora_device,uint32_t freq )
 {
-    SX126xSetRfFrequency( lora_device,freq );
+    SX126xSetRfFrequency2( lora_device,freq );
 }
 
-bool RadioIsChannelFree( lora_device_t* lora_device,RadioModems_t modem, uint32_t freq, int16_t rssiThresh, uint32_t maxCarrierSenseTime )
+static bool RadioIsChannelFree( lora_device_t* lora_device,RadioModems_t modem, uint32_t freq, int16_t rssiThresh, uint32_t maxCarrierSenseTime )
 {
     bool status = true;
    // int16_t rssi = 0;
@@ -548,7 +548,7 @@ bool RadioIsChannelFree( lora_device_t* lora_device,RadioModems_t modem, uint32_
 
     RadioRx(lora_device,0 );
 
-    SX126xDelayMs( 1 );
+    SX126xDelayMs2( 1 );
 
     //carrierSenseTime = TimerGetCurrentTime( );
 
@@ -568,7 +568,7 @@ bool RadioIsChannelFree( lora_device_t* lora_device,RadioModems_t modem, uint32_
     return status;
 }
 
-uint32_t RadioRandom( lora_device_t* lora_device )
+static uint32_t RadioRandom( lora_device_t* lora_device )
 {
     uint8_t i;
     uint32_t rnd = 0;
@@ -580,13 +580,13 @@ uint32_t RadioRandom( lora_device_t* lora_device )
     RadioSetModem(lora_device,MODEM_LORA );
 
     // Set radio in continuous reception
-    SX126xSetRx(  lora_device,0 );
+    SX126xSetRx2(  lora_device,0 );
 
     for( i = 0; i < 32; i++ )
     {
-        SX126xDelayMs( 1 );
+        SX126xDelayMs2( 1 );
         // Unfiltered RSSI value reading. Only takes the LSB value
-        rnd |= ( ( uint32_t )SX126xGetRssiInst( lora_device ) & 0x01 ) << i;
+        rnd |= ( ( uint32_t )SX126xGetRssiInst2( lora_device ) & 0x01 ) << i;
     }
 
     RadioSleep(lora_device );
@@ -594,7 +594,7 @@ uint32_t RadioRandom( lora_device_t* lora_device )
     return rnd;
 }
 
-void RadioSetRxConfig( lora_device_t* lora_device,RadioModems_t modem, uint32_t bandwidth,
+static void RadioSetRxConfig( lora_device_t* lora_device,RadioModems_t modem, uint32_t bandwidth,
                          uint32_t datarate, uint8_t coderate,
                          uint32_t bandwidthAfc, uint16_t preambleLen,
                          uint16_t symbTimeout, bool fixLen,
@@ -617,7 +617,7 @@ void RadioSetRxConfig( lora_device_t* lora_device,RadioModems_t modem, uint32_t
     switch( modem )
     {
         case MODEM_FSK:
-            SX126xSetStopRxTimerOnPreambleDetect( lora_device,false );
+            SX126xSetStopRxTimerOnPreambleDetect2( lora_device,false );
             lora_device->SX126x.ModulationParams.PacketType = PACKET_TYPE_GFSK;
 
             lora_device->SX126x.ModulationParams.Params.Gfsk.BitRate = datarate;
@@ -643,17 +643,17 @@ void RadioSetRxConfig( lora_device_t* lora_device,RadioModems_t modem, uint32_t
 
             RadioStandby( lora_device);
             RadioSetModem(  lora_device,( lora_device->SX126x.ModulationParams.PacketType == PACKET_TYPE_GFSK ) ? MODEM_FSK : MODEM_LORA );
-            SX126xSetModulationParams(  lora_device,&lora_device->SX126x.ModulationParams );
-            SX126xSetPacketParams(  lora_device,&lora_device->SX126x.PacketParams );
-            SX126xSetSyncWord(  lora_device,( uint8_t[] ){ 0xC1, 0x94, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00 } );
-            SX126xSetWhiteningSeed( lora_device,0x01FF );
+            SX126xSetModulationParams2(  lora_device,&lora_device->SX126x.ModulationParams );
+            SX126xSetPacketParams2(  lora_device,&lora_device->SX126x.PacketParams );
+            SX126xSetSyncWord2(  lora_device,( uint8_t[] ){ 0xC1, 0x94, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00 } );
+            SX126xSetWhiteningSeed2( lora_device,0x01FF );
 
             // RxTimeout = ( uint32_t )( symbTimeout * ( ( 1.0 / ( double )datarate ) * 8.0 ) * 1000 );
             break;
 
         case MODEM_LORA:
-            SX126xSetStopRxTimerOnPreambleDetect(lora_device, false );
-            SX126xSetLoRaSymbNumTimeout( lora_device,symbTimeout );
+            SX126xSetStopRxTimerOnPreambleDetect2(lora_device, false );
+            SX126xSetLoRaSymbNumTimeout2( lora_device,symbTimeout );
             lora_device->SX126x.ModulationParams.PacketType = PACKET_TYPE_LORA;
             lora_device->SX126x.ModulationParams.Params.LoRa.SpreadingFactor = ( RadioLoRaSpreadingFactors_t )datarate;
             lora_device->SX126x.ModulationParams.Params.LoRa.Bandwidth = Bandwidths[bandwidth];
@@ -695,8 +695,8 @@ void RadioSetRxConfig( lora_device_t* lora_device,RadioModems_t modem, uint32_t
             lora_device->SX126x.PacketParams.Params.LoRa.InvertIQ = ( RadioLoRaIQModes_t )iqInverted;
 
             RadioSetModem( lora_device,( lora_device->SX126x.ModulationParams.PacketType == PACKET_TYPE_GFSK ) ? MODEM_FSK : MODEM_LORA );
-            SX126xSetModulationParams( lora_device,&lora_device->SX126x.ModulationParams );
-            SX126xSetPacketParams( lora_device,&lora_device->SX126x.PacketParams );
+            SX126xSetModulationParams2( lora_device,&lora_device->SX126x.ModulationParams );
+            SX126xSetPacketParams2( lora_device,&lora_device->SX126x.PacketParams );
 
             // Timeout Max, Timeout handled directly in SetRx function
             //  RxTimeout = 0xFFFF;
@@ -705,7 +705,7 @@ void RadioSetRxConfig( lora_device_t* lora_device,RadioModems_t modem, uint32_t
     }
 }
 
-void RadioSetTxConfig( lora_device_t* lora_device,RadioModems_t modem, int8_t power, uint32_t fdev,
+static void RadioSetTxConfig( lora_device_t* lora_device,RadioModems_t modem, int8_t power, uint32_t fdev,
                         uint32_t bandwidth, uint32_t datarate,
                         uint8_t coderate, uint16_t preambleLen,
                         bool fixLen, bool crcOn, bool freqHopOn,
@@ -741,10 +741,10 @@ void RadioSetTxConfig( lora_device_t* lora_device,RadioModems_t modem, int8_t po
 
             RadioStandby( lora_device );
             RadioSetModem( lora_device,( lora_device->SX126x.ModulationParams.PacketType == PACKET_TYPE_GFSK ) ? MODEM_FSK : MODEM_LORA );
-            SX126xSetModulationParams( lora_device, &lora_device->SX126x.ModulationParams );
-            SX126xSetPacketParams(  lora_device,&lora_device->SX126x.PacketParams );
-            SX126xSetSyncWord( lora_device,( uint8_t[] ){ 0xC1, 0x94, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00 } );
-            SX126xSetWhiteningSeed( lora_device,0x01FF );
+            SX126xSetModulationParams2( lora_device, &lora_device->SX126x.ModulationParams );
+            SX126xSetPacketParams2(  lora_device,&lora_device->SX126x.PacketParams );
+            SX126xSetSyncWord2( lora_device,( uint8_t[] ){ 0xC1, 0x94, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00 } );
+            SX126xSetWhiteningSeed2( lora_device,0x01FF );
             break;
 
         case MODEM_LORA:
@@ -789,20 +789,20 @@ void RadioSetTxConfig( lora_device_t* lora_device,RadioModems_t modem, int8_t po
 
             RadioStandby( lora_device);
             RadioSetModem( lora_device,( lora_device->SX126x.ModulationParams.PacketType == PACKET_TYPE_GFSK ) ? MODEM_FSK : MODEM_LORA );
-            SX126xSetModulationParams( lora_device,&lora_device->SX126x.ModulationParams );
-            SX126xSetPacketParams( lora_device,&lora_device->SX126x.PacketParams );
+            SX126xSetModulationParams2( lora_device,&lora_device->SX126x.ModulationParams );
+            SX126xSetPacketParams2( lora_device,&lora_device->SX126x.PacketParams );
             break;
     }
-    SX126xSetRfTxPower( lora_device,power );
+    SX126xSetRfTxPower2( lora_device,power );
     // TxTimeout = timeout;
 }
 
-bool RadioCheckRfFrequency( lora_device_t* lora_device,uint32_t frequency )
+static bool RadioCheckRfFrequency( lora_device_t* lora_device,uint32_t frequency )
 {
     return true;
 }
 
-uint32_t RadioTimeOnAir( lora_device_t* lora_device,RadioModems_t modem, uint8_t pktLen )
+static uint32_t RadioTimeOnAir( lora_device_t* lora_device,RadioModems_t modem, uint8_t pktLen )
 {
     uint32_t airTime = 0;
 
@@ -842,14 +842,14 @@ uint32_t RadioTimeOnAir( lora_device_t* lora_device,RadioModems_t modem, uint8_t
     return airTime;
 }
 
-void RadioSend( lora_device_t* lora_device,uint8_t *buffer, uint8_t size )
+static void RadioSend( lora_device_t* lora_device,uint8_t *buffer, uint8_t size )
 {
-    SX126xSetDioIrqParams( lora_device,IRQ_TX_DONE | IRQ_RX_TX_TIMEOUT,
+    SX126xSetDioIrqParams2( lora_device,IRQ_TX_DONE | IRQ_RX_TX_TIMEOUT,
                            IRQ_TX_DONE | IRQ_RX_TX_TIMEOUT,
                            IRQ_RADIO_NONE,
                            IRQ_RADIO_NONE );
 
-    if( SX126xGetPacketType( lora_device ) == PACKET_TYPE_LORA )
+    if( SX126xGetPacketType2( lora_device ) == PACKET_TYPE_LORA )
     {
         lora_device->SX126x.PacketParams.Params.LoRa.PayloadLength = size;
     }
@@ -857,31 +857,31 @@ void RadioSend( lora_device_t* lora_device,uint8_t *buffer, uint8_t size )
     {
         lora_device->SX126x.PacketParams.Params.Gfsk.PayloadLength = size;
     }
-    SX126xSetPacketParams( lora_device,&lora_device->SX126x.PacketParams );
+    SX126xSetPacketParams2( lora_device,&lora_device->SX126x.PacketParams );
 
-    SX126xSendPayload( lora_device, buffer, size, 0 );
+    SX126xSendPayload2( lora_device, buffer, size, 0 );
 //    TimerSetValue( &TxTimeoutTimer, TxTimeout );
 //    TimerStart( &TxTimeoutTimer );
 }
 
-void RadioSleep( lora_device_t* lora_device )
+static void RadioSleep( lora_device_t* lora_device )
 {
     SleepParams_t params = { 0 };
 
     params.Fields.WarmStart = 1;
-    SX126xSetSleep( lora_device,params );
+    SX126xSetSleep2( lora_device,params );
 
-    SX126xDelayMs( 2 );
+    SX126xDelayMs2( 2 );
 }
 
-void RadioStandby( lora_device_t* lora_device )
+static void RadioStandby( lora_device_t* lora_device )
 {
-    SX126xSetStandby( lora_device,STDBY_RC );
+    SX126xSetStandby2( lora_device,STDBY_RC );
 }
 
-void RadioRx( lora_device_t* lora_device,uint32_t timeout )
+static void RadioRx( lora_device_t* lora_device,uint32_t timeout )
 {
-    SX126xSetDioIrqParams( lora_device,IRQ_RADIO_ALL, //IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT,
+    SX126xSetDioIrqParams2( lora_device,IRQ_RADIO_ALL, //IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT,
                            IRQ_RADIO_ALL, //IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT,
                            IRQ_RADIO_NONE,
                            IRQ_RADIO_NONE );
@@ -889,17 +889,17 @@ void RadioRx( lora_device_t* lora_device,uint32_t timeout )
 
     if( lora_device->RxContinuous == true )
     {
-        SX126xSetRx(lora_device,0xFFFFFF ); // Rx Continuous
+        SX126xSetRx2(lora_device,0xFFFFFF ); // Rx Continuous
     }
     else
     {
-        SX126xSetRx( lora_device,timeout << 6 );
+        SX126xSetRx2( lora_device,timeout << 6 );
     }
 }
 
-void RadioRxBoosted( lora_device_t* lora_device,uint32_t timeout )
+static void RadioRxBoosted( lora_device_t* lora_device,uint32_t timeout )
 {
-    SX126xSetDioIrqParams( lora_device,IRQ_RADIO_ALL, //IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT,
+    SX126xSetDioIrqParams2( lora_device,IRQ_RADIO_ALL, //IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT,
                            IRQ_RADIO_ALL, //IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT,
                            IRQ_RADIO_NONE,
                            IRQ_RADIO_NONE );
@@ -907,92 +907,92 @@ void RadioRxBoosted( lora_device_t* lora_device,uint32_t timeout )
 
     if( lora_device->RxContinuous == true )
     {
-        SX126xSetRxBoosted( lora_device,0xFFFFFF ); // Rx Continuous
+        SX126xSetRxBoosted2( lora_device,0xFFFFFF ); // Rx Continuous
     }
     else
     {
-        SX126xSetRxBoosted( lora_device,timeout << 6 );
+        SX126xSetRxBoosted2( lora_device,timeout << 6 );
     }
 }
 
-void RadioSetRxDutyCycle( lora_device_t* lora_device,uint32_t rxTime, uint32_t sleepTime )
+static void RadioSetRxDutyCycle( lora_device_t* lora_device,uint32_t rxTime, uint32_t sleepTime )
 {
-    SX126xSetRxDutyCycle( lora_device,rxTime, sleepTime );
+    SX126xSetRxDutyCycle2( lora_device,rxTime, sleepTime );
 }
 
-void RadioStartCad( lora_device_t* lora_device )
+static void RadioStartCad( lora_device_t* lora_device )
 {
-    SX126xSetCad( lora_device );
+    SX126xSetCad2( lora_device );
 }
 
-void RadioTx( lora_device_t* lora_device,uint32_t timeout )
+static void RadioTx( lora_device_t* lora_device,uint32_t timeout )
 {
-    SX126xSetTx( lora_device,timeout << 6 );
+    SX126xSetTx2( lora_device,timeout << 6 );
 }
 
-void RadioSetTxContinuousWave( lora_device_t* lora_device,uint32_t freq, int8_t power, uint16_t time )
+static void RadioSetTxContinuousWave( lora_device_t* lora_device,uint32_t freq, int8_t power, uint16_t time )
 {
-    SX126xSetRfFrequency( lora_device,freq );
-    SX126xSetRfTxPower( lora_device,power );
-    SX126xSetTxContinuousWave(lora_device );
+    SX126xSetRfFrequency2( lora_device,freq );
+    SX126xSetRfTxPower2( lora_device,power );
+    SX126xSetTx2ContinuousWave2(lora_device );
 
 //    TimerSetValue( &RxTimeoutTimer, time  * 1e3 );
 //    TimerStart( &RxTimeoutTimer );
 }
 
-int16_t RadioRssi( lora_device_t* lora_device,RadioModems_t modem )
+static int16_t RadioRssi( lora_device_t* lora_device,RadioModems_t modem )
 {
-    return SX126xGetRssiInst(lora_device );
+    return SX126xGetRssiInst2(lora_device );
 }
 
-void RadioWrite( lora_device_t* lora_device,uint16_t addr, uint8_t data )
+static void RadioWrite( lora_device_t* lora_device,uint16_t addr, uint8_t data )
 {
-    SX126xWriteRegister( lora_device,addr, data );
+    SX126xWriteRegister2( lora_device,addr, data );
 }
 
-uint8_t RadioRead( lora_device_t* lora_device,uint16_t addr )
+static uint8_t RadioRead( lora_device_t* lora_device,uint16_t addr )
 {
-    return SX126xReadRegister( lora_device,addr );
+    return SX126xReadRegister2( lora_device,addr );
 }
 
-void RadioWriteBuffer( lora_device_t* lora_device,uint16_t addr, uint8_t *buffer, uint8_t size )
+static void RadioWriteBuffer( lora_device_t* lora_device,uint16_t addr, uint8_t *buffer, uint8_t size )
 {
-    SX126xWriteRegisters( lora_device,addr, buffer, size );
+    SX126xWriteRegister2s2( lora_device,addr, buffer, size );
 }
 
-void RadioReadBuffer( lora_device_t* lora_device,uint16_t addr, uint8_t *buffer, uint8_t size )
+static void RadioReadBuffer( lora_device_t* lora_device,uint16_t addr, uint8_t *buffer, uint8_t size )
 {
-    SX126xReadRegisters( lora_device,addr, buffer, size );
+    SX126xReadRegister2s2( lora_device,addr, buffer, size );
 }
 
-void RadioWriteFifo( lora_device_t* lora_device,uint8_t *buffer, uint8_t size )
+static void RadioWriteFifo( lora_device_t* lora_device,uint8_t *buffer, uint8_t size )
 {
-    SX126xWriteBuffer( lora_device,0, buffer, size );
+    SX126xWriteBuffer2( lora_device,0, buffer, size );
 }
 
-void RadioReadFifo( lora_device_t* lora_device,uint8_t *buffer, uint8_t size )
+static void RadioReadFifo( lora_device_t* lora_device,uint8_t *buffer, uint8_t size )
 {
-    SX126xReadBuffer( lora_device,0, buffer, size );
+    SX126xReadBuffer2( lora_device,0, buffer, size );
 }
 
-void RadioSetMaxPayloadLength( lora_device_t* lora_device,RadioModems_t modem, uint8_t max )
+static void RadioSetMaxPayloadLength( lora_device_t* lora_device,RadioModems_t modem, uint8_t max )
 {
     if( modem == MODEM_LORA )
     {
         lora_device->SX126x.PacketParams.Params.LoRa.PayloadLength = lora_device->MaxPayloadLength = max;
-        SX126xSetPacketParams( lora_device,&lora_device->SX126x.PacketParams );
+        SX126xSetPacketParams2( lora_device,&lora_device->SX126x.PacketParams );
     }
     else
     {
         if( lora_device->SX126x.PacketParams.Params.Gfsk.HeaderType == RADIO_PACKET_VARIABLE_LENGTH )
         {
             lora_device->SX126x.PacketParams.Params.Gfsk.PayloadLength = lora_device->MaxPayloadLength = max;
-            SX126xSetPacketParams( lora_device,&lora_device->SX126x.PacketParams );
+            SX126xSetPacketParams2( lora_device,&lora_device->SX126x.PacketParams );
         }
     }
 }
 
-void RadioSetPublicNetwork( lora_device_t* lora_device,bool enable )
+static void RadioSetPublicNetwork( lora_device_t* lora_device,bool enable )
 {
     RadioPublicNetwork.Current = RadioPublicNetwork.Previous = enable;
 
@@ -1000,23 +1000,23 @@ void RadioSetPublicNetwork( lora_device_t* lora_device,bool enable )
     if( enable == true )
     {
         // Change LoRa modem SyncWord
-        SX126xWriteRegister( lora_device,REG_LR_SYNCWORD, ( LORA_MAC_PUBLIC_SYNCWORD >> 8 ) & 0xFF );
-        SX126xWriteRegister( lora_device,REG_LR_SYNCWORD + 1, LORA_MAC_PUBLIC_SYNCWORD & 0xFF );
+        SX126xWriteRegister2( lora_device,REG_LR_SYNCWORD, ( LORA_MAC_PUBLIC_SYNCWORD >> 8 ) & 0xFF );
+        SX126xWriteRegister2( lora_device,REG_LR_SYNCWORD + 1, LORA_MAC_PUBLIC_SYNCWORD & 0xFF );
     }
     else
     {
         // Change LoRa modem SyncWord
-        SX126xWriteRegister(lora_device,REG_LR_SYNCWORD, ( LORA_MAC_PRIVATE_SYNCWORD >> 8 ) & 0xFF );
-        SX126xWriteRegister(lora_device,REG_LR_SYNCWORD + 1, LORA_MAC_PRIVATE_SYNCWORD & 0xFF );
+        SX126xWriteRegister2(lora_device,REG_LR_SYNCWORD, ( LORA_MAC_PRIVATE_SYNCWORD >> 8 ) & 0xFF );
+        SX126xWriteRegister2(lora_device,REG_LR_SYNCWORD + 1, LORA_MAC_PRIVATE_SYNCWORD & 0xFF );
     }
 }
 
-uint32_t RadioGetWakeupTime( lora_device_t* lora_device )
+static uint32_t RadioGetWakeupTime( lora_device_t* lora_device )
 {
     return( RADIO_TCXO_SETUP_TIME + RADIO_WAKEUP_TIME );
 }
 
-void RadioOnTxTimeoutIrq( lora_device_t* lora_device )
+static void RadioOnTxTimeoutIrq( lora_device_t* lora_device )
 {
     if( lora_device->RadioEvents.TxTimeout != NULL )
     {
@@ -1024,7 +1024,7 @@ void RadioOnTxTimeoutIrq( lora_device_t* lora_device )
     }
 }
 
-void RadioOnRxTimeoutIrq( lora_device_t* lora_device )
+static void RadioOnRxTimeoutIrq( lora_device_t* lora_device )
 {
     if( lora_device->RadioEvents.RxTimeout != NULL )
     {
@@ -1032,18 +1032,18 @@ void RadioOnRxTimeoutIrq( lora_device_t* lora_device )
     }
 }
 
-void RadioOnDioIrq( lora_device_t* lora_device )
+static void RadioOnDioIrq( lora_device_t* lora_device )
 {
 
 }
 
-void RadioIrqProcess( lora_device_t* lora_device )
+static void RadioIrqProcess( lora_device_t* lora_device )
 {
-    if(SX126xGetIrqFired(lora_device)==1)
+    if(SX126xGetIrqFired2(lora_device)==1)
     {
 
-        uint16_t irqRegs = SX126xGetIrqStatus( lora_device);
-        SX126xClearIrqStatus( lora_device,IRQ_RADIO_ALL );
+        uint16_t irqRegs = SX126xGetIrqStatus2( lora_device);
+        SX126xClearIrqStatus2( lora_device,IRQ_RADIO_ALL );
         
         if( ( irqRegs & IRQ_TX_DONE ) == IRQ_TX_DONE )
         {
@@ -1057,8 +1057,8 @@ void RadioIrqProcess( lora_device_t* lora_device )
         {
             uint8_t size;
 
-            SX126xGetPayload( lora_device,lora_device->RadioRxPayload, &size , 255 );
-            SX126xGetPacketStatus( lora_device,&lora_device->RadioPktStatus );
+            SX126xGetPayload2( lora_device,lora_device->RadioRxPayload, &size , 255 );
+            SX126xGetPacketStatus2( lora_device,&lora_device->RadioPktStatus );
             if( lora_device->RadioEvents.RxDone != NULL )
             {
                 lora_device->RadioEvents.RxDone( lora_device,lora_device->RadioRxPayload, size, lora_device->RadioPktStatus.Params.LoRa.RssiPkt, lora_device->RadioPktStatus.Params.LoRa.SnrPkt );
@@ -1083,14 +1083,14 @@ void RadioIrqProcess( lora_device_t* lora_device )
 
         if( ( irqRegs & IRQ_RX_TX_TIMEOUT ) == IRQ_RX_TX_TIMEOUT )
         {
-            if( SX126xGetOperatingMode( lora_device) == MODE_TX )
+            if( SX126xGetOperatingMode2( lora_device) == MODE_TX )
             {
                 if(lora_device->RadioEvents.TxTimeout != NULL )
                 {
                     lora_device->RadioEvents.TxTimeout( lora_device );
                 }
             }
-            else if( SX126xGetOperatingMode( lora_device) == MODE_RX )
+            else if( SX126xGetOperatingMode2( lora_device) == MODE_RX )
             {
  
                 if( lora_device->RadioEvents.RxTimeout != NULL )

+ 2 - 2
components/lora2/sx126x/radio.h

@@ -370,13 +370,13 @@ struct Radio_s
      */
     void ( *SetRxDutyCycle ) (lora_device_t* lora_device, uint32_t rxTime, uint32_t sleepTime );
 };
-void RadioEventsInit(lora_device_t* lora_device,RadioEvents_t *events);
+void RadioEventsInit2(lora_device_t* lora_device,RadioEvents_t *events);
 /*!
  * \brief Radio driver
  *
  * \remark This variable is defined and initialized in the specific radio
  *         board implementation
  */
-extern const struct Radio_s Radio;
+extern const struct Radio_s Radio2;
 
 #endif // __RADIO_H__

+ 41 - 41
components/lora2/sx126x/sx126x-board.c

@@ -18,29 +18,29 @@ Maintainer: Miguel Luis and Gregory Cristian
 #include "sx126x.h"
 #include "sx126x-board.h"
 
-uint8_t SX126xGetIrqFired( lora_device_t* lora_device ){
+uint8_t SX126xGetIrqFired2( lora_device_t* lora_device ){
     return luat_gpio_get(lora_device->lora_pin_dio1);
 }
 
-void SX126xDelayMs(uint32_t ms){
+void SX126xDelayMs2(uint32_t ms){
 	luat_timer_mdelay(ms);
 }
 
-void SX126xReset( lora_device_t* lora_device ){
-    SX126xDelayMs(10);
+void SX126xReset2( lora_device_t* lora_device ){
+    SX126xDelayMs2(10);
     luat_gpio_set( lora_device->lora_pin_rst, 0 );
-    SX126xDelayMs(20);
+    SX126xDelayMs2(20);
     luat_gpio_set( lora_device->lora_pin_rst, 1 );
-    SX126xDelayMs(10);
+    SX126xDelayMs2(10);
 }
 
-void SX126xWaitOnBusy( lora_device_t* lora_device ){
+void SX126xWaitOnBusy2( lora_device_t* lora_device ){
     while(luat_gpio_get(lora_device->lora_pin_busy)==1){
-        SX126xDelayMs(1);
+        SX126xDelayMs2(1);
     }
 }
 
-void SX126xSetNss(lora_device_t* lora_device,uint8_t lev ){
+void SX126xSetNss2(lora_device_t* lora_device,uint8_t lev ){
     luat_gpio_set( lora_device->lora_pin_cs, lev);
 }
 
@@ -48,7 +48,7 @@ void lora_spi_transfer(lora_device_t* lora_device, const char* send_buf, size_t
     if (lora_device->lora_spi_id == 255){
         luat_spi_device_transfer(lora_device->lora_spi_device, send_buf, send_length, recv_buf, recv_length);
     }else{
-        SX126xSetNss(lora_device,0);
+        SX126xSetNss2(lora_device,0);
         // luat_spi_transfer(lora_device->lora_spi_id, send_buf, send_length, recv_buf, recv_length);
         if (send_length){
             luat_spi_send(lora_device->lora_spi_id, send_buf, send_length);
@@ -56,104 +56,104 @@ void lora_spi_transfer(lora_device_t* lora_device, const char* send_buf, size_t
         if (recv_length){
             luat_spi_recv(lora_device->lora_spi_id, recv_buf, recv_length);
         }
-        SX126xSetNss(lora_device,1);
+        SX126xSetNss2(lora_device,1);
     }
 }
 
-void SX126xWakeup( lora_device_t* lora_device){
+void SX126xWakeup2( lora_device_t* lora_device){
     uint8_t cmd[2] = {RADIO_GET_STATUS,0x00};
     lora_spi_transfer(lora_device, cmd, 2,NULL,0);
     // Wait for chip to be ready.
-    SX126xWaitOnBusy(lora_device );
+    SX126xWaitOnBusy2(lora_device );
 }
 
-void SX126xWriteCommand( lora_device_t* lora_device,RadioCommands_t command, uint8_t *buffer, uint16_t size ){
+void SX126xWriteCommand2( lora_device_t* lora_device,RadioCommands_t command, uint8_t *buffer, uint16_t size ){
     uint16_t i = 0;
-    SX126xCheckDeviceReady( lora_device );
+    SX126xCheckDeviceReady2( lora_device );
     uint8_t cmd[1+size];
     cmd[0] = (uint8_t)command;
     memcpy(cmd+1,buffer,size);
     lora_spi_transfer(lora_device, cmd, 1+size,NULL,0);
     if( command != RADIO_SET_SLEEP ){
-        SX126xWaitOnBusy(lora_device );
+        SX126xWaitOnBusy2(lora_device );
     }
 }
 
-void SX126xReadCommand( lora_device_t* lora_device,RadioCommands_t command, uint8_t *buffer, uint16_t size ){
+void SX126xReadCommand2( lora_device_t* lora_device,RadioCommands_t command, uint8_t *buffer, uint16_t size ){
     uint16_t i = 0;
-    SX126xCheckDeviceReady( lora_device);
+    SX126xCheckDeviceReady2( lora_device);
     uint8_t cmd[2] = {(uint8_t)command,0x00};
     lora_spi_transfer(lora_device, cmd, 2,buffer,size);
-    SX126xWaitOnBusy(lora_device );
+    SX126xWaitOnBusy2(lora_device );
 }
 
-void SX126xWriteRegisters(lora_device_t* lora_device, uint16_t address, uint8_t *buffer, uint16_t size ){
+void SX126xWriteRegister2s2(lora_device_t* lora_device, uint16_t address, uint8_t *buffer, uint16_t size ){
     uint16_t i = 0;
-    SX126xCheckDeviceReady( lora_device );
+    SX126xCheckDeviceReady2( lora_device );
     uint8_t cmd[3+size];
     cmd[0] = RADIO_WRITE_REGISTER;
     cmd[1] = (address & 0xFF00 ) >> 8;
     cmd[2] = address & 0x00FF;
     memcpy(cmd+3,buffer,size);
     lora_spi_transfer(lora_device, cmd, 3+size,NULL,0);
-    SX126xWaitOnBusy( lora_device);
+    SX126xWaitOnBusy2( lora_device);
 }
 
-void SX126xWriteRegister( lora_device_t* lora_device,uint16_t address, uint8_t value ){
-    SX126xWriteRegisters( lora_device,address, &value, 1 );
+void SX126xWriteRegister2( lora_device_t* lora_device,uint16_t address, uint8_t value ){
+    SX126xWriteRegister2s2( lora_device,address, &value, 1 );
 }
 
-void SX126xReadRegisters( lora_device_t* lora_device,uint16_t address, uint8_t *buffer, uint16_t size ){
+void SX126xReadRegister2s2( lora_device_t* lora_device,uint16_t address, uint8_t *buffer, uint16_t size ){
     uint16_t i = 0;
-    SX126xCheckDeviceReady(lora_device );
+    SX126xCheckDeviceReady2(lora_device );
     uint8_t cmd[4] = {RADIO_READ_REGISTER,( address & 0xFF00 ) >> 8,address & 0x00FF,0x00};
     lora_spi_transfer(lora_device, cmd, 4,buffer,size);
-    SX126xWaitOnBusy( lora_device);
+    SX126xWaitOnBusy2( lora_device);
 }
 
-uint8_t SX126xReadRegister( lora_device_t* lora_device,uint16_t address ){
+uint8_t SX126xReadRegister2( lora_device_t* lora_device,uint16_t address ){
     uint8_t data;
-    SX126xReadRegisters( lora_device,address, &data, 1 );
+    SX126xReadRegister2s2( lora_device,address, &data, 1 );
     return data;
 }
 
-void SX126xWriteBuffer( lora_device_t* lora_device,uint8_t offset, uint8_t *buffer, uint8_t size ){
+void SX126xWriteBuffer2( lora_device_t* lora_device,uint8_t offset, uint8_t *buffer, uint8_t size ){
     uint16_t i = 0;
-    SX126xCheckDeviceReady( lora_device);
+    SX126xCheckDeviceReady2( lora_device);
     uint8_t cmd[2+size];
     cmd[0] = RADIO_WRITE_BUFFER;
     cmd[1] = offset;
     memcpy(cmd+2,buffer,size);
     luat_spi_send(lora_device->lora_spi_id, cmd, 2+size);
     lora_spi_transfer(lora_device, cmd, 2+size,NULL,0);
-    SX126xWaitOnBusy(lora_device );
+    SX126xWaitOnBusy2(lora_device );
 }
 
-void SX126xReadBuffer(lora_device_t* lora_device, uint8_t offset, uint8_t *buffer, uint8_t size ){
+void SX126xReadBuffer2(lora_device_t* lora_device, uint8_t offset, uint8_t *buffer, uint8_t size ){
     uint16_t i = 0;
-    SX126xCheckDeviceReady(lora_device);
+    SX126xCheckDeviceReady2(lora_device);
     uint8_t cmd[3] = {RADIO_READ_BUFFER,offset,0x00};
     lora_spi_transfer(lora_device, cmd, 3,buffer,size);
-    SX126xWaitOnBusy(lora_device );
+    SX126xWaitOnBusy2(lora_device );
 }
 
-void SX126xSetRfTxPower(lora_device_t* lora_device, int8_t power ){
-    SX126xSetTxParams( lora_device,power, RADIO_RAMP_40_US );
+void SX126xSetRfTxPower2(lora_device_t* lora_device, int8_t power ){
+    SX126xSetTx2Params2( lora_device,power, RADIO_RAMP_40_US );
 }
 
-uint8_t SX126xGetPaSelect(lora_device_t* lora_device, uint32_t channel ){
+uint8_t SX126xGetPaSelect2(lora_device_t* lora_device, uint32_t channel ){
     return SX1262;
 }
 
-void SX126xAntSwOn( lora_device_t* lora_device ){
+void SX126xAntSwOn2( lora_device_t* lora_device ){
 
 }
 
-void SX126xAntSwOff( lora_device_t* lora_device ){
+void SX126xAntSwOff2( lora_device_t* lora_device ){
 
 }
 
-bool SX126xCheckRfFrequency( lora_device_t* lora_device,uint32_t frequency ){
+bool SX126xCheckRfFrequency2( lora_device_t* lora_device,uint32_t frequency ){
     // Implement check. Currently all frequencies are supported
     return true;
 }

+ 15 - 15
components/lora2/sx126x/sx126x-board.h

@@ -72,17 +72,17 @@ typedef struct lora_device
 /*!
  * \brief HW Reset of the radio
  */
-void SX126xReset( lora_device_t* lora_device );
+void SX126xReset2( lora_device_t* lora_device );
 
 /*!
  * \brief Blocking loop to wait while the Busy pin in high
  */
-void SX126xWaitOnBusy( lora_device_t* lora_device );
+void SX126xWaitOnBusy2( lora_device_t* lora_device );
 
 /*!
  * \brief Wakes up the radio
  */
-void SX126xWakeup( lora_device_t* lora_device );
+void SX126xWakeup2( lora_device_t* lora_device );
 
 /*!
  * \brief Send a command that write data to the radio
@@ -91,7 +91,7 @@ void SX126xWakeup( lora_device_t* lora_device );
  * \param [in]  buffer        Buffer to be send to the radio
  * \param [in]  size          Size of the buffer to send
  */
-void SX126xWriteCommand( lora_device_t* lora_device,RadioCommands_t opcode, uint8_t *buffer, uint16_t size );
+void SX126xWriteCommand2( lora_device_t* lora_device,RadioCommands_t opcode, uint8_t *buffer, uint16_t size );
 
 /*!
  * \brief Send a command that read data from the radio
@@ -100,7 +100,7 @@ void SX126xWriteCommand( lora_device_t* lora_device,RadioCommands_t opcode, uint
  * \param [out] buffer        Buffer holding data from the radio
  * \param [in]  size          Size of the buffer
  */
-void SX126xReadCommand( lora_device_t* lora_device,RadioCommands_t opcode, uint8_t *buffer, uint16_t size );
+void SX126xReadCommand2( lora_device_t* lora_device,RadioCommands_t opcode, uint8_t *buffer, uint16_t size );
 
 /*!
  * \brief Write a single byte of data to the radio memory
@@ -108,7 +108,7 @@ void SX126xReadCommand( lora_device_t* lora_device,RadioCommands_t opcode, uint8
  * \param [in]  address       The address of the first byte to write in the radio
  * \param [in]  value         The data to be written in radio's memory
  */
-void SX126xWriteRegister( lora_device_t* lora_device,uint16_t address, uint8_t value );
+void SX126xWriteRegister2( lora_device_t* lora_device,uint16_t address, uint8_t value );
 
 /*!
  * \brief Read a single byte of data from the radio memory
@@ -117,14 +117,14 @@ void SX126xWriteRegister( lora_device_t* lora_device,uint16_t address, uint8_t v
  *
  * \retval      value         The value of the byte at the given address in radio's memory
  */
-uint8_t SX126xReadRegister( lora_device_t* lora_device,uint16_t address );
+uint8_t SX126xReadRegister2( lora_device_t* lora_device,uint16_t address );
 
 /*!
  * \brief Sets the radio output power.
  *
  * \param [IN] power Sets the RF output power
  */
-void SX126xSetRfTxPower( lora_device_t* lora_device,int8_t power );
+void SX126xSetRfTxPower2( lora_device_t* lora_device,int8_t power );
 
 /*!
  * \brief Gets the board PA selection configuration
@@ -132,19 +132,19 @@ void SX126xSetRfTxPower( lora_device_t* lora_device,int8_t power );
  * \param [IN] channel Channel frequency in Hz
  * \retval PaSelect RegPaConfig PaSelect value
  */
-uint8_t SX126xGetPaSelect( lora_device_t* lora_device,uint32_t channel );
+uint8_t SX126xGetPaSelect2( lora_device_t* lora_device,uint32_t channel );
 
 /*!
  * \brief Initializes the RF Switch I/Os pins interface
  */
-void SX126xAntSwOn( lora_device_t* lora_device );
+void SX126xAntSwOn2( lora_device_t* lora_device );
 
 /*!
  * \brief De-initializes the RF Switch I/Os pins interface
  *
  * \remark Needed to decrease the power consumption in MCU low power modes
  */
-void SX126xAntSwOff( lora_device_t* lora_device );
+void SX126xAntSwOff2( lora_device_t* lora_device );
 
 /*!
  * \brief Checks if the given RF frequency is supported by the hardware
@@ -152,13 +152,13 @@ void SX126xAntSwOff( lora_device_t* lora_device );
  * \param [IN] frequency RF frequency to be checked
  * \retval isSupported [true: supported, false: unsupported]
  */
-bool SX126xCheckRfFrequency( lora_device_t* lora_device,uint32_t frequency );
+bool SX126xCheckRfFrequency2( lora_device_t* lora_device,uint32_t frequency );
 
-void SX126xDelayMs(uint32_t ms);
-uint8_t SX126xGetIrqFired( lora_device_t* lora_device );
+void SX126xDelayMs2(uint32_t ms);
+uint8_t SX126xGetIrqFired2( lora_device_t* lora_device );
 /*!
  * Radio hardware and global parameters
  */
-extern SX126x_t SX126x;
+// extern SX126x_t SX126x;
 
 #endif // __SX126x_ARCH_H__

+ 129 - 129
components/lora2/sx126x/sx126x.c

@@ -81,80 +81,80 @@ void SX126xSetInterruptMode( lora_device_t* lora_device );
 void SX126xProcessIrqs( lora_device_t* lora_device );
 
 
-void SX126xInit( lora_device_t* lora_device,DioIrqHandler dioIrq )
+void SX126xInit2( lora_device_t* lora_device,DioIrqHandler dioIrq )
 {
-    SX126xReset( lora_device);
-    SX126xWakeup( lora_device );
-    SX126xSetStandby( lora_device,STDBY_RC );
+    SX126xReset2( lora_device);
+    SX126xWakeup2( lora_device );
+    SX126xSetStandby2( lora_device,STDBY_RC );
 #ifdef USE_TCXO
     CalibrationParams_t calibParam;
 
-    SX126xSetDio3AsTcxoCtrl( lora_device,TCXO_CTRL_1_7V, RADIO_TCXO_SETUP_TIME << 6 ); // convert from ms to SX126x time base
+    SX126xSetDio3AsTcxoCtrl2( lora_device,TCXO_CTRL_1_7V, RADIO_TCXO_SETUP_TIME << 6 ); // convert from ms to SX126x time base
     calibParam.Value = 0x7F;    
-    SX126xCalibrate( lora_device,calibParam );
+    SX126xCalibrate2( lora_device,calibParam );
 
 #endif
-    SX126xSetDio2AsRfSwitchCtrl( lora_device,true );
+    SX126xSetDio2AsRfSwitchCtrl2( lora_device,true );
     lora_device->OperatingMode = MODE_STDBY_RC;
 }
 
-RadioOperatingModes_t SX126xGetOperatingMode( lora_device_t* lora_device )
+RadioOperatingModes_t SX126xGetOperatingMode2( lora_device_t* lora_device )
 {
     return lora_device->OperatingMode;
 }
 
-void SX126xCheckDeviceReady( lora_device_t* lora_device )
+void SX126xCheckDeviceReady2( lora_device_t* lora_device )
 {
-    if( ( SX126xGetOperatingMode( lora_device) == MODE_SLEEP ) || ( SX126xGetOperatingMode( lora_device) == MODE_RX_DC ) )
+    if( ( SX126xGetOperatingMode2( lora_device) == MODE_SLEEP ) || ( SX126xGetOperatingMode2( lora_device) == MODE_RX_DC ) )
     {
-        SX126xWakeup( lora_device);
+        SX126xWakeup2( lora_device);
         // Switch is turned off when device is in sleep mode and turned on is all other modes
-        SX126xAntSwOn( lora_device );
+        SX126xAntSwOn2( lora_device );
     }
-    SX126xWaitOnBusy( lora_device );
+    SX126xWaitOnBusy2( lora_device );
 }
 
-void SX126xSetPayload( lora_device_t* lora_device,uint8_t *payload, uint8_t size )
+void SX126xSetPayload2( lora_device_t* lora_device,uint8_t *payload, uint8_t size )
 {
-    SX126xWriteBuffer( lora_device,0x00, payload, size );
+    SX126xWriteBuffer2( lora_device,0x00, payload, size );
 }
 
-uint8_t SX126xGetPayload( lora_device_t* lora_device,uint8_t *buffer, uint8_t *size,  uint8_t maxSize )
+uint8_t SX126xGetPayload2( lora_device_t* lora_device,uint8_t *buffer, uint8_t *size,  uint8_t maxSize )
 {
     uint8_t offset = 0;
 
-    SX126xGetRxBufferStatus( lora_device,size, &offset );
+    SX126xGetRxBufferStatus2( lora_device,size, &offset );
     if( *size > maxSize )
     {
         return 1;
     }
-    SX126xReadBuffer( lora_device, offset, buffer, *size );
+    SX126xReadBuffer2( lora_device, offset, buffer, *size );
     return 0;
 }
 
-void SX126xSendPayload(lora_device_t* lora_device, uint8_t *payload, uint8_t size, uint32_t timeout )
+void SX126xSendPayload2(lora_device_t* lora_device, uint8_t *payload, uint8_t size, uint32_t timeout )
 {
-    SX126xSetPayload(lora_device,payload, size );
-    SX126xSetTx( lora_device,timeout );
+    SX126xSetPayload2(lora_device,payload, size );
+    SX126xSetTx2( lora_device,timeout );
 }
 
-uint8_t SX126xSetSyncWord( lora_device_t* lora_device,uint8_t *syncWord )
+uint8_t SX126xSetSyncWord2( lora_device_t* lora_device,uint8_t *syncWord )
 {
-    SX126xWriteRegisters(lora_device,REG_LR_SYNCWORDBASEADDRESS, syncWord, 8 );
+    SX126xWriteRegister2s2(lora_device,REG_LR_SYNCWORDBASEADDRESS, syncWord, 8 );
     return 0;
 }
 
-void SX126xSetCrcSeed( lora_device_t* lora_device,uint16_t seed )
+void SX126xSetCrcSeed2( lora_device_t* lora_device,uint16_t seed )
 {
     uint8_t buf[2];
 
     buf[0] = ( uint8_t )( ( seed >> 8 ) & 0xFF );
     buf[1] = ( uint8_t )( seed & 0xFF );
 
-    switch( SX126xGetPacketType( lora_device) )
+    switch( SX126xGetPacketType2( lora_device) )
     {
         case PACKET_TYPE_GFSK:
-            SX126xWriteRegisters(lora_device, REG_LR_CRCSEEDBASEADDR, buf, 2 );
+            SX126xWriteRegister2s2(lora_device, REG_LR_CRCSEEDBASEADDR, buf, 2 );
             break;
 
         default:
@@ -162,17 +162,17 @@ void SX126xSetCrcSeed( lora_device_t* lora_device,uint16_t seed )
     }
 }
 
-void SX126xSetCrcPolynomial( lora_device_t* lora_device,uint16_t polynomial )
+void SX126xSetCrcPolynomial2( lora_device_t* lora_device,uint16_t polynomial )
 {
     uint8_t buf[2];
 
     buf[0] = ( uint8_t )( ( polynomial >> 8 ) & 0xFF );
     buf[1] = ( uint8_t )( polynomial & 0xFF );
 
-    switch( SX126xGetPacketType( lora_device) )
+    switch( SX126xGetPacketType2( lora_device) )
     {
         case PACKET_TYPE_GFSK:
-            SX126xWriteRegisters( lora_device,REG_LR_CRCPOLYBASEADDR, buf, 2 );
+            SX126xWriteRegister2s2( lora_device,REG_LR_CRCPOLYBASEADDR, buf, 2 );
             break;
 
         default:
@@ -180,17 +180,17 @@ void SX126xSetCrcPolynomial( lora_device_t* lora_device,uint16_t polynomial )
     }
 }
 
-void SX126xSetWhiteningSeed( lora_device_t* lora_device,uint16_t seed )
+void SX126xSetWhiteningSeed2( lora_device_t* lora_device,uint16_t seed )
 {
     uint8_t regValue = 0;
     
-    switch( SX126xGetPacketType( lora_device ) )
+    switch( SX126xGetPacketType2( lora_device ) )
     {
         case PACKET_TYPE_GFSK:
-            regValue = SX126xReadRegister( lora_device,REG_LR_WHITSEEDBASEADDR_MSB ) & 0xFE;
+            regValue = SX126xReadRegister2( lora_device,REG_LR_WHITSEEDBASEADDR_MSB ) & 0xFE;
             regValue = ( ( seed >> 8 ) & 0x01 ) | regValue;
-            SX126xWriteRegister( lora_device,REG_LR_WHITSEEDBASEADDR_MSB, regValue ); // only 1 bit.
-            SX126xWriteRegister( lora_device,REG_LR_WHITSEEDBASEADDR_LSB, ( uint8_t )seed );
+            SX126xWriteRegister2( lora_device,REG_LR_WHITSEEDBASEADDR_MSB, regValue ); // only 1 bit.
+            SX126xWriteRegister2( lora_device,REG_LR_WHITSEEDBASEADDR_LSB, ( uint8_t )seed );
             break;
 
         default:
@@ -198,33 +198,33 @@ void SX126xSetWhiteningSeed( lora_device_t* lora_device,uint16_t seed )
     }
 }
 
-uint32_t SX126xGetRandom( lora_device_t* lora_device )
+uint32_t SX126xGetRandom2( lora_device_t* lora_device )
 {
     uint8_t buf[] = { 0, 0, 0, 0 };
 
     // Set radio in continuous reception
-    SX126xSetRx( lora_device,0 );
+    SX126xSetRx2( lora_device,0 );
 
-    SX126xDelayMs( 1 );
+    SX126xDelayMs2( 1 );
 
-    SX126xReadRegisters(  lora_device,RANDOM_NUMBER_GENERATORBASEADDR, buf, 4 );
+    SX126xReadRegister2s2(  lora_device,RANDOM_NUMBER_GENERATORBASEADDR, buf, 4 );
 
-    SX126xSetStandby(lora_device, STDBY_RC );
+    SX126xSetStandby2(lora_device, STDBY_RC );
 
     return ( buf[0] << 24 ) | ( buf[1] << 16 ) | ( buf[2] << 8 ) | buf[3];
 }
 
-void SX126xSetSleep( lora_device_t* lora_device,SleepParams_t sleepConfig )
+void SX126xSetSleep2( lora_device_t* lora_device,SleepParams_t sleepConfig )
 {
-    SX126xAntSwOff(lora_device );
+    SX126xAntSwOff2(lora_device );
 
-    SX126xWriteCommand(  lora_device,RADIO_SET_SLEEP, &sleepConfig.Value, 1 );
+    SX126xWriteCommand2(  lora_device,RADIO_SET_SLEEP, &sleepConfig.Value, 1 );
     lora_device->OperatingMode = MODE_SLEEP;
 }
 
-void SX126xSetStandby( lora_device_t* lora_device,RadioStandbyModes_t standbyConfig )
+void SX126xSetStandby2( lora_device_t* lora_device,RadioStandbyModes_t standbyConfig )
 {
-    SX126xWriteCommand( lora_device,RADIO_SET_STANDBY, ( uint8_t* )&standbyConfig, 1 );
+    SX126xWriteCommand2( lora_device,RADIO_SET_STANDBY, ( uint8_t* )&standbyConfig, 1 );
     if( standbyConfig == STDBY_RC )
     {
         lora_device->OperatingMode = MODE_STDBY_RC;
@@ -235,13 +235,13 @@ void SX126xSetStandby( lora_device_t* lora_device,RadioStandbyModes_t standbyCon
     }
 }
 
-void SX126xSetFs(lora_device_t* lora_device )
+void SX126xSetFs2(lora_device_t* lora_device )
 {
-    SX126xWriteCommand(lora_device,RADIO_SET_FS, 0, 0 );
+    SX126xWriteCommand2(lora_device,RADIO_SET_FS, 0, 0 );
     lora_device->OperatingMode = MODE_FS;
 }
 
-void SX126xSetTx( lora_device_t* lora_device,uint32_t timeout )
+void SX126xSetTx2( lora_device_t* lora_device,uint32_t timeout )
 {
     uint8_t buf[3];
 
@@ -250,10 +250,10 @@ void SX126xSetTx( lora_device_t* lora_device,uint32_t timeout )
     buf[0] = ( uint8_t )( ( timeout >> 16 ) & 0xFF );
     buf[1] = ( uint8_t )( ( timeout >> 8 ) & 0xFF );
     buf[2] = ( uint8_t )( timeout & 0xFF );
-    SX126xWriteCommand( lora_device,RADIO_SET_TX, buf, 3 );
+    SX126xWriteCommand2( lora_device,RADIO_SET_TX, buf, 3 );
 }
 
-void SX126xSetRx( lora_device_t* lora_device,uint32_t timeout )
+void SX126xSetRx2( lora_device_t* lora_device,uint32_t timeout )
 {
     uint8_t buf[3];
 
@@ -262,24 +262,24 @@ void SX126xSetRx( lora_device_t* lora_device,uint32_t timeout )
     buf[0] = ( uint8_t )( ( timeout >> 16 ) & 0xFF );
     buf[1] = ( uint8_t )( ( timeout >> 8 ) & 0xFF );
     buf[2] = ( uint8_t )( timeout & 0xFF );
-    SX126xWriteCommand( lora_device,RADIO_SET_RX, buf, 3 );
+    SX126xWriteCommand2( lora_device,RADIO_SET_RX, buf, 3 );
 }
 
-void SX126xSetRxBoosted( lora_device_t* lora_device,uint32_t timeout )
+void SX126xSetRxBoosted2( lora_device_t* lora_device,uint32_t timeout )
 {
     uint8_t buf[3];
 
     lora_device->OperatingMode = MODE_RX;
 
-    SX126xWriteRegister(lora_device,REG_RX_GAIN, 0x96 ); // max LNA gain, increase current by ~2mA for around ~3dB in sensivity
+    SX126xWriteRegister2(lora_device,REG_RX_GAIN, 0x96 ); // max LNA gain, increase current by ~2mA for around ~3dB in sensivity
 
     buf[0] = ( uint8_t )( ( timeout >> 16 ) & 0xFF );
     buf[1] = ( uint8_t )( ( timeout >> 8 ) & 0xFF );
     buf[2] = ( uint8_t )( timeout & 0xFF );
-    SX126xWriteCommand(  lora_device,RADIO_SET_RX, buf, 3 );
+    SX126xWriteCommand2(  lora_device,RADIO_SET_RX, buf, 3 );
 }
 
-void SX126xSetRxDutyCycle( lora_device_t* lora_device,uint32_t rxTime, uint32_t sleepTime )
+void SX126xSetRxDutyCycle2( lora_device_t* lora_device,uint32_t rxTime, uint32_t sleepTime )
 {
     uint8_t buf[6];
 
@@ -289,47 +289,47 @@ void SX126xSetRxDutyCycle( lora_device_t* lora_device,uint32_t rxTime, uint32_t
     buf[3] = ( uint8_t )( ( sleepTime >> 16 ) & 0xFF );
     buf[4] = ( uint8_t )( ( sleepTime >> 8 ) & 0xFF );
     buf[5] = ( uint8_t )( sleepTime & 0xFF );
-    SX126xWriteCommand( lora_device,RADIO_SET_RXDUTYCYCLE, buf, 6 );
+    SX126xWriteCommand2( lora_device,RADIO_SET_RXDUTYCYCLE, buf, 6 );
     lora_device->OperatingMode = MODE_RX_DC;
 }
 
-void SX126xSetCad( lora_device_t* lora_device )
+void SX126xSetCad2( lora_device_t* lora_device )
 {
-    SX126xWriteCommand( lora_device,RADIO_SET_CAD, 0, 0 );
+    SX126xWriteCommand2( lora_device,RADIO_SET_CAD, 0, 0 );
     lora_device->OperatingMode = MODE_CAD;
 }
 
-void SX126xSetTxContinuousWave( lora_device_t* lora_device )
+void SX126xSetTx2ContinuousWave2( lora_device_t* lora_device )
 {
-    SX126xWriteCommand( lora_device,RADIO_SET_TXCONTINUOUSWAVE, 0, 0 );
+    SX126xWriteCommand2( lora_device,RADIO_SET_TXCONTINUOUSWAVE, 0, 0 );
 }
 
-void SX126xSetTxInfinitePreamble( lora_device_t* lora_device )
+void SX126xSetTx2InfinitePreamble2( lora_device_t* lora_device )
 {
-    SX126xWriteCommand( lora_device,RADIO_SET_TXCONTINUOUSPREAMBLE, 0, 0 );
+    SX126xWriteCommand2( lora_device,RADIO_SET_TXCONTINUOUSPREAMBLE, 0, 0 );
 }
 
-void SX126xSetStopRxTimerOnPreambleDetect( lora_device_t* lora_device,bool enable )
+void SX126xSetStopRxTimerOnPreambleDetect2( lora_device_t* lora_device,bool enable )
 {
-    SX126xWriteCommand( lora_device,RADIO_SET_STOPRXTIMERONPREAMBLE, ( uint8_t* )&enable, 1 );
+    SX126xWriteCommand2( lora_device,RADIO_SET_STOPRXTIMERONPREAMBLE, ( uint8_t* )&enable, 1 );
 }
 
-void SX126xSetLoRaSymbNumTimeout( lora_device_t* lora_device,uint8_t SymbNum )
+void SX126xSetLoRaSymbNumTimeout2( lora_device_t* lora_device,uint8_t SymbNum )
 {
-    SX126xWriteCommand( lora_device, RADIO_SET_LORASYMBTIMEOUT, &SymbNum, 1 );
+    SX126xWriteCommand2( lora_device, RADIO_SET_LORASYMBTIMEOUT, &SymbNum, 1 );
 }
 
-void SX126xSetRegulatorMode( lora_device_t* lora_device,RadioRegulatorMode_t mode )
+void SX126xSetRegulatorMode2( lora_device_t* lora_device,RadioRegulatorMode_t mode )
 {
-    SX126xWriteCommand(  lora_device,RADIO_SET_REGULATORMODE, ( uint8_t* )&mode, 1 );
+    SX126xWriteCommand2(  lora_device,RADIO_SET_REGULATORMODE, ( uint8_t* )&mode, 1 );
 }
 
-void SX126xCalibrate( lora_device_t* lora_device,CalibrationParams_t calibParam )
+void SX126xCalibrate2( lora_device_t* lora_device,CalibrationParams_t calibParam )
 {
-    SX126xWriteCommand( lora_device, RADIO_CALIBRATE, ( uint8_t* )&calibParam, 1 );
+    SX126xWriteCommand2( lora_device, RADIO_CALIBRATE, ( uint8_t* )&calibParam, 1 );
 }
 
-void SX126xCalibrateImage( lora_device_t* lora_device,uint32_t freq )
+void SX126xCalibrateImage2( lora_device_t* lora_device,uint32_t freq )
 {
     uint8_t calFreq[2];
 
@@ -358,10 +358,10 @@ void SX126xCalibrateImage( lora_device_t* lora_device,uint32_t freq )
         calFreq[0] = 0x6B;
         calFreq[1] = 0x6F;
     }
-    SX126xWriteCommand(lora_device,RADIO_CALIBRATEIMAGE, calFreq, 2 );
+    SX126xWriteCommand2(lora_device,RADIO_CALIBRATEIMAGE, calFreq, 2 );
 }
 
-void SX126xSetPaConfig( lora_device_t* lora_device,uint8_t paDutyCycle, uint8_t hpMax, uint8_t deviceSel, uint8_t paLut )
+void SX126xSetPaConfig2( lora_device_t* lora_device,uint8_t paDutyCycle, uint8_t hpMax, uint8_t deviceSel, uint8_t paLut )
 {
     uint8_t buf[4];
 
@@ -369,15 +369,15 @@ void SX126xSetPaConfig( lora_device_t* lora_device,uint8_t paDutyCycle, uint8_t
     buf[1] = hpMax;
     buf[2] = deviceSel;
     buf[3] = paLut;
-    SX126xWriteCommand( lora_device,RADIO_SET_PACONFIG, buf, 4 );
+    SX126xWriteCommand2( lora_device,RADIO_SET_PACONFIG, buf, 4 );
 }
 
-void SX126xSetRxTxFallbackMode( lora_device_t* lora_device,uint8_t fallbackMode )
+void SX126xSetRx2TxFallbackMode2( lora_device_t* lora_device,uint8_t fallbackMode )
 {
-    SX126xWriteCommand( lora_device,RADIO_SET_TXFALLBACKMODE, &fallbackMode, 1 );
+    SX126xWriteCommand2( lora_device,RADIO_SET_TXFALLBACKMODE, &fallbackMode, 1 );
 }
 
-void SX126xSetDioIrqParams( lora_device_t* lora_device,uint16_t irqMask, uint16_t dio1Mask, uint16_t dio2Mask, uint16_t dio3Mask )
+void SX126xSetDioIrqParams2( lora_device_t* lora_device,uint16_t irqMask, uint16_t dio1Mask, uint16_t dio2Mask, uint16_t dio3Mask )
 {
     uint8_t buf[8];
 
@@ -389,23 +389,23 @@ void SX126xSetDioIrqParams( lora_device_t* lora_device,uint16_t irqMask, uint16_
     buf[5] = ( uint8_t )( dio2Mask & 0x00FF );
     buf[6] = ( uint8_t )( ( dio3Mask >> 8 ) & 0x00FF );
     buf[7] = ( uint8_t )( dio3Mask & 0x00FF );
-    SX126xWriteCommand( lora_device,RADIO_CFG_DIOIRQ, buf, 8 );
+    SX126xWriteCommand2( lora_device,RADIO_CFG_DIOIRQ, buf, 8 );
 }
 
-uint16_t SX126xGetIrqStatus( lora_device_t* lora_device )
+uint16_t SX126xGetIrqStatus2( lora_device_t* lora_device )
 {
     uint8_t irqStatus[2];
 
-    SX126xReadCommand( lora_device,RADIO_GET_IRQSTATUS, irqStatus, 2 );
+    SX126xReadCommand2( lora_device,RADIO_GET_IRQSTATUS, irqStatus, 2 );
     return ( irqStatus[0] << 8 ) | irqStatus[1];
 }
 
-void SX126xSetDio2AsRfSwitchCtrl( lora_device_t* lora_device,uint8_t enable )
+void SX126xSetDio2AsRfSwitchCtrl2( lora_device_t* lora_device,uint8_t enable )
 {
-    SX126xWriteCommand(lora_device,RADIO_SET_RFSWITCHMODE, &enable, 1 );
+    SX126xWriteCommand2(lora_device,RADIO_SET_RFSWITCHMODE, &enable, 1 );
 }
 
-void SX126xSetDio3AsTcxoCtrl( lora_device_t* lora_device,RadioTcxoCtrlVoltage_t tcxoVoltage, uint32_t timeout )
+void SX126xSetDio3AsTcxoCtrl2( lora_device_t* lora_device,RadioTcxoCtrlVoltage_t tcxoVoltage, uint32_t timeout )
 {
     uint8_t buf[4];
 
@@ -414,17 +414,17 @@ void SX126xSetDio3AsTcxoCtrl( lora_device_t* lora_device,RadioTcxoCtrlVoltage_t
     buf[2] = ( uint8_t )( ( timeout >> 8 ) & 0xFF );
     buf[3] = ( uint8_t )( timeout & 0xFF );
 
-    SX126xWriteCommand( lora_device,RADIO_SET_TCXOMODE, buf, 4 );
+    SX126xWriteCommand2( lora_device,RADIO_SET_TCXOMODE, buf, 4 );
 }
 
-void SX126xSetRfFrequency( lora_device_t* lora_device,uint32_t frequency )
+void SX126xSetRfFrequency2( lora_device_t* lora_device,uint32_t frequency )
 {
     uint8_t buf[4];
     uint32_t freq = 0;
 
     if( lora_device->ImageCalibrated == false )
     {
-        SX126xCalibrateImage( lora_device,frequency );
+        SX126xCalibrateImage2( lora_device,frequency );
         lora_device->ImageCalibrated = true;
     }
 
@@ -433,34 +433,34 @@ void SX126xSetRfFrequency( lora_device_t* lora_device,uint32_t frequency )
     buf[1] = ( uint8_t )( ( freq >> 16 ) & 0xFF );
     buf[2] = ( uint8_t )( ( freq >> 8 ) & 0xFF );
     buf[3] = ( uint8_t )( freq & 0xFF );
-    SX126xWriteCommand( lora_device,RADIO_SET_RFFREQUENCY, buf, 4 );
+    SX126xWriteCommand2( lora_device,RADIO_SET_RFFREQUENCY, buf, 4 );
 }
 
-void SX126xSetPacketType( lora_device_t* lora_device,RadioPacketTypes_t packetType )
+void SX126xSetPacketType2( lora_device_t* lora_device,RadioPacketTypes_t packetType )
 {
     // Save packet type internally to avoid questioning the radio
     lora_device->PacketType = packetType;
-    SX126xWriteCommand( lora_device,RADIO_SET_PACKETTYPE, ( uint8_t* )&packetType, 1 );
+    SX126xWriteCommand2( lora_device,RADIO_SET_PACKETTYPE, ( uint8_t* )&packetType, 1 );
 }
 
-RadioPacketTypes_t SX126xGetPacketType( lora_device_t* lora_device )
+RadioPacketTypes_t SX126xGetPacketType2( lora_device_t* lora_device )
 {
     return lora_device->PacketType;
 }
 
-void SX126xSetTxParams( lora_device_t* lora_device,int8_t power, RadioRampTimes_t rampTime )
+void SX126xSetTx2Params2( lora_device_t* lora_device,int8_t power, RadioRampTimes_t rampTime )
 {
     uint8_t buf[2];
 
-    if( SX126xGetPaSelect( lora_device,0 ) == SX1261 )
+    if( SX126xGetPaSelect2( lora_device,0 ) == SX1261 )
     {
         if( power == 15 )
         {
-            SX126xSetPaConfig( lora_device,0x06, 0x00, 0x01, 0x01 );
+            SX126xSetPaConfig2( lora_device,0x06, 0x00, 0x01, 0x01 );
         }
         else
         {
-            SX126xSetPaConfig( lora_device,0x04, 0x00, 0x01, 0x01 );
+            SX126xSetPaConfig2( lora_device,0x04, 0x00, 0x01, 0x01 );
         }
         if( power >= 14 )
         {
@@ -470,11 +470,11 @@ void SX126xSetTxParams( lora_device_t* lora_device,int8_t power, RadioRampTimes_
         {
             power = -3;
         }
-        SX126xWriteRegister( lora_device,REG_OCP, 0x18 ); // current max is 80 mA for the whole device
+        SX126xWriteRegister2( lora_device,REG_OCP, 0x18 ); // current max is 80 mA for the whole device
     }
     else // sx1262
     {
-        SX126xSetPaConfig( lora_device,0x04, 0x07, 0x00, 0x01 );
+        SX126xSetPaConfig2( lora_device,0x04, 0x07, 0x00, 0x01 );
         if( power > 22 )
         {
             power = 22;
@@ -483,14 +483,14 @@ void SX126xSetTxParams( lora_device_t* lora_device,int8_t power, RadioRampTimes_
         {
             power = -3;
         }
-        SX126xWriteRegister(lora_device,REG_OCP, 0x38 ); // current max 160mA for the whole device
+        SX126xWriteRegister2(lora_device,REG_OCP, 0x38 ); // current max 160mA for the whole device
     }
     buf[0] = power;
     buf[1] = ( uint8_t )rampTime;
-    SX126xWriteCommand( lora_device,RADIO_SET_TXPARAMS, buf, 2 );
+    SX126xWriteCommand2( lora_device,RADIO_SET_TXPARAMS, buf, 2 );
 }
 
-void SX126xSetModulationParams( lora_device_t* lora_device,ModulationParams_t *modulationParams )
+void SX126xSetModulationParams2( lora_device_t* lora_device,ModulationParams_t *modulationParams )
 {
     uint8_t n;
     uint32_t tempVal = 0;
@@ -500,7 +500,7 @@ void SX126xSetModulationParams( lora_device_t* lora_device,ModulationParams_t *m
     // If not, silently update radio packet type
     if( lora_device->PacketType != modulationParams->PacketType )
     {
-        SX126xSetPacketType( lora_device,modulationParams->PacketType );
+        SX126xSetPacketType2( lora_device,modulationParams->PacketType );
     }
 
     switch( modulationParams->PacketType )
@@ -517,7 +517,7 @@ void SX126xSetModulationParams( lora_device_t* lora_device,ModulationParams_t *m
         buf[5] = ( tempVal >> 16 ) & 0xFF;
         buf[6] = ( tempVal >> 8 ) & 0xFF;
         buf[7] = ( tempVal& 0xFF );
-        SX126xWriteCommand( lora_device,RADIO_SET_MODULATIONPARAMS, buf, n );
+        SX126xWriteCommand2( lora_device,RADIO_SET_MODULATIONPARAMS, buf, n );
         break;
     case PACKET_TYPE_LORA:
         n = 4;
@@ -526,7 +526,7 @@ void SX126xSetModulationParams( lora_device_t* lora_device,ModulationParams_t *m
         buf[2] = modulationParams->Params.LoRa.CodingRate;
         buf[3] = modulationParams->Params.LoRa.LowDatarateOptimize;
 
-        SX126xWriteCommand(lora_device,RADIO_SET_MODULATIONPARAMS, buf, n );
+        SX126xWriteCommand2(lora_device,RADIO_SET_MODULATIONPARAMS, buf, n );
 
         break;
     default:
@@ -535,7 +535,7 @@ void SX126xSetModulationParams( lora_device_t* lora_device,ModulationParams_t *m
     }
 }
 
-void SX126xSetPacketParams( lora_device_t* lora_device,PacketParams_t *packetParams )
+void SX126xSetPacketParams2( lora_device_t* lora_device,PacketParams_t *packetParams )
 {
     uint8_t n;
     uint8_t crcVal = 0;
@@ -545,7 +545,7 @@ void SX126xSetPacketParams( lora_device_t* lora_device,PacketParams_t *packetPar
     // If not, silently update radio packet type
     if( lora_device->PacketType != packetParams->PacketType )
     {
-        SX126xSetPacketType( lora_device,packetParams->PacketType );
+        SX126xSetPacketType2( lora_device,packetParams->PacketType );
     }
 
     switch( packetParams->PacketType )
@@ -553,14 +553,14 @@ void SX126xSetPacketParams( lora_device_t* lora_device,PacketParams_t *packetPar
     case PACKET_TYPE_GFSK:
         if( packetParams->Params.Gfsk.CrcLength == RADIO_CRC_2_BYTES_IBM )
         {
-            SX126xSetCrcSeed(lora_device,CRC_IBM_SEED );
-            SX126xSetCrcPolynomial(lora_device, CRC_POLYNOMIAL_IBM );
+            SX126xSetCrcSeed2(lora_device,CRC_IBM_SEED );
+            SX126xSetCrcPolynomial2(lora_device, CRC_POLYNOMIAL_IBM );
             crcVal = RADIO_CRC_2_BYTES;
         }
         else if( packetParams->Params.Gfsk.CrcLength == RADIO_CRC_2_BYTES_CCIT )
         {
-            SX126xSetCrcSeed(lora_device, CRC_CCITT_SEED );
-            SX126xSetCrcPolynomial(lora_device,CRC_POLYNOMIAL_CCITT );
+            SX126xSetCrcSeed2(lora_device, CRC_CCITT_SEED );
+            SX126xSetCrcPolynomial2(lora_device,CRC_POLYNOMIAL_CCITT );
             crcVal = RADIO_CRC_2_BYTES_INV;
         }
         else
@@ -591,10 +591,10 @@ void SX126xSetPacketParams( lora_device_t* lora_device,PacketParams_t *packetPar
     case PACKET_TYPE_NONE:
         return;
     }
-    SX126xWriteCommand(lora_device,RADIO_SET_PACKETPARAMS, buf, n );
+    SX126xWriteCommand2(lora_device,RADIO_SET_PACKETPARAMS, buf, n );
 }
 
-void SX126xSetCadParams( lora_device_t* lora_device,RadioLoRaCadSymbols_t cadSymbolNum, uint8_t cadDetPeak, uint8_t cadDetMin, RadioCadExitModes_t cadExitMode, uint32_t cadTimeout )
+void SX126xSetCad2Params2( lora_device_t* lora_device,RadioLoRaCadSymbols_t cadSymbolNum, uint8_t cadDetPeak, uint8_t cadDetMin, RadioCadExitModes_t cadExitMode, uint32_t cadTimeout )
 {
     uint8_t buf[7];
 
@@ -605,50 +605,50 @@ void SX126xSetCadParams( lora_device_t* lora_device,RadioLoRaCadSymbols_t cadSym
     buf[4] = ( uint8_t )( ( cadTimeout >> 16 ) & 0xFF );
     buf[5] = ( uint8_t )( ( cadTimeout >> 8 ) & 0xFF );
     buf[6] = ( uint8_t )( cadTimeout & 0xFF );
-    SX126xWriteCommand( lora_device,RADIO_SET_CADPARAMS, buf, 5 );
+    SX126xWriteCommand2( lora_device,RADIO_SET_CADPARAMS, buf, 5 );
     lora_device->OperatingMode = MODE_CAD;
 }
 
-void SX126xSetBufferBaseAddress(lora_device_t* lora_device,uint8_t txBaseAddress, uint8_t rxBaseAddress )
+void SX126xSetBufferBaseAddress2(lora_device_t* lora_device,uint8_t txBaseAddress, uint8_t rxBaseAddress )
 {
     uint8_t buf[2];
 
     buf[0] = txBaseAddress;
     buf[1] = rxBaseAddress;
-    SX126xWriteCommand(lora_device,RADIO_SET_BUFFERBASEADDRESS, buf, 2 );
+    SX126xWriteCommand2(lora_device,RADIO_SET_BUFFERBASEADDRESS, buf, 2 );
 }
 
-RadioStatus_t SX126xGetStatus( lora_device_t* lora_device )
+RadioStatus_t SX126xGetStatus2( lora_device_t* lora_device )
 {
     uint8_t stat = 0;
     RadioStatus_t status;
 
-    SX126xReadCommand(lora_device,RADIO_GET_STATUS, ( uint8_t * )&stat, 1 );
+    SX126xReadCommand2(lora_device,RADIO_GET_STATUS, ( uint8_t * )&stat, 1 );
     status.Value = stat;
     return status;
 }
 
-int8_t SX126xGetRssiInst( lora_device_t* lora_device )
+int8_t SX126xGetRssiInst2( lora_device_t* lora_device )
 {
     uint8_t buf[1];
     int8_t rssi = 0;
 
-    SX126xReadCommand(lora_device,RADIO_GET_RSSIINST, buf, 1 );
+    SX126xReadCommand2(lora_device,RADIO_GET_RSSIINST, buf, 1 );
     rssi = -buf[0] >> 1;
     return rssi;
 }
 
-void SX126xGetRxBufferStatus( lora_device_t* lora_device,uint8_t *payloadLength, uint8_t *rxStartBufferPointer )
+void SX126xGetRxBufferStatus2( lora_device_t* lora_device,uint8_t *payloadLength, uint8_t *rxStartBufferPointer )
 {
     uint8_t status[2];
 
-    SX126xReadCommand( lora_device,RADIO_GET_RXBUFFERSTATUS, status, 2 );
+    SX126xReadCommand2( lora_device,RADIO_GET_RXBUFFERSTATUS, status, 2 );
 
     // In case of LORA fixed header, the payloadLength is obtained by reading
     // the register REG_LR_PAYLOADLENGTH
-    if( ( SX126xGetPacketType(lora_device ) == PACKET_TYPE_LORA ) && ( SX126xReadRegister( lora_device,REG_LR_PACKETPARAMS ) >> 7 == 1 ) )
+    if( ( SX126xGetPacketType2(lora_device ) == PACKET_TYPE_LORA ) && ( SX126xReadRegister2( lora_device,REG_LR_PACKETPARAMS ) >> 7 == 1 ) )
     {
-        *payloadLength = SX126xReadRegister( lora_device,REG_LR_PAYLOADLENGTH );
+        *payloadLength = SX126xReadRegister2( lora_device,REG_LR_PAYLOADLENGTH );
     }
     else
     {
@@ -657,13 +657,13 @@ void SX126xGetRxBufferStatus( lora_device_t* lora_device,uint8_t *payloadLength,
     *rxStartBufferPointer = status[1];
 }
 
-void SX126xGetPacketStatus( lora_device_t* lora_device,PacketStatus_t *pktStatus )
+void SX126xGetPacketStatus2( lora_device_t* lora_device,PacketStatus_t *pktStatus )
 {
     uint8_t status[3];
 
-    SX126xReadCommand(lora_device,RADIO_GET_PACKETSTATUS, status, 3 );
+    SX126xReadCommand2(lora_device,RADIO_GET_PACKETSTATUS, status, 3 );
 
-    pktStatus->packetType = SX126xGetPacketType(lora_device );
+    pktStatus->packetType = SX126xGetPacketType2(lora_device );
     switch( pktStatus->packetType )
     {
         case PACKET_TYPE_GFSK:
@@ -690,25 +690,25 @@ void SX126xGetPacketStatus( lora_device_t* lora_device,PacketStatus_t *pktStatus
     }
 }
 
-RadioError_t SX126xGetDeviceErrors( lora_device_t* lora_device )
+RadioError_t SX126xGetDeviceErrors2( lora_device_t* lora_device )
 {
     RadioError_t error;
 
-    SX126xReadCommand( lora_device,RADIO_GET_ERROR, ( uint8_t * )&error, 2 );
+    SX126xReadCommand2( lora_device,RADIO_GET_ERROR, ( uint8_t * )&error, 2 );
     return error;
 }
 
-void SX126xClearDeviceErrors( lora_device_t* lora_device )
+void SX126xClearDeviceErrors2( lora_device_t* lora_device )
 {
     uint8_t buf[2] = { 0x00, 0x00 };
-    SX126xWriteCommand(lora_device,RADIO_CLR_ERROR, buf, 2 );
+    SX126xWriteCommand2(lora_device,RADIO_CLR_ERROR, buf, 2 );
 }
 
-void SX126xClearIrqStatus(lora_device_t* lora_device, uint16_t irq )
+void SX126xClearIrqStatus2(lora_device_t* lora_device, uint16_t irq )
 {
     uint8_t buf[2];
 
     buf[0] = ( uint8_t )( ( ( uint16_t )irq >> 8 ) & 0x00FF );
     buf[1] = ( uint8_t )( ( uint16_t )irq & 0x00FF );
-    SX126xWriteCommand(lora_device,RADIO_CLR_IRQSTATUS, buf, 2 );
+    SX126xWriteCommand2(lora_device,RADIO_CLR_IRQSTATUS, buf, 2 );
 }

+ 52 - 71
components/lora2/sx126x/sx126x.h

@@ -695,25 +695,6 @@ typedef void ( DioIrqHandler )( void );
 #define FREQ_DIV                                    ( double )pow( 2.0, 25.0 )
 #define FREQ_STEP                                   ( double )( XTAL_FREQ / FREQ_DIV )
 
-#define RX_BUFFER_SIZE                              256
-
-/*!
- * \brief The radio callbacks structure
- * Holds function pointers to be called on radio interrupts
- */
-typedef struct
-{
-    void ( *txDone )( void );                       //!< Pointer to a function run on successful transmission
-    void ( *rxDone )( void );                       //!< Pointer to a function run on successful reception
-    void ( *rxPreambleDetect )( void );             //!< Pointer to a function run on successful Preamble detection
-    void ( *rxSyncWordDone )( void );               //!< Pointer to a function run on successful SyncWord reception
-    void ( *rxHeaderDone )( bool isOk );            //!< Pointer to a function run on successful Header reception
-    void ( *txTimeout )( void );                    //!< Pointer to a function run on transmission timeout
-    void ( *rxTimeout )( void );                    //!< Pointer to a function run on reception timeout
-    void ( *rxError )( IrqErrorCode_t errCode );    //!< Pointer to a function run on reception error
-    void ( *cadDone )( bool cadFlag );              //!< Pointer to a function run on channel activity detected
-}SX126xCallbacks_t;
-
 /*!
  * ============================================================================
  * Public functions prototypes
@@ -723,19 +704,19 @@ typedef struct
 /*!
  * \brief Initializes the radio driver
  */
-void SX126xInit( lora_device_t* lora_device,DioIrqHandler dioIrq );
+void SX126xInit2( lora_device_t* lora_device,DioIrqHandler dioIrq );
 
 /*!
  * \brief Gets the current Operation Mode of the Radio
  *
  * \retval      RadioOperatingModes_t last operating mode
  */
-RadioOperatingModes_t SX126xGetOperatingMode( lora_device_t* lora_device );
+RadioOperatingModes_t SX126xGetOperatingMode2( lora_device_t* lora_device );
 
 /*!
  * \brief Wakeup the radio if it is in Sleep mode and check that Busy is low
  */
-void SX126xCheckDeviceReady( lora_device_t* lora_device );
+void SX126xCheckDeviceReady2( lora_device_t* lora_device );
 
 /*!
  * \brief Saves the payload to be send in the radio buffer
@@ -743,7 +724,7 @@ void SX126xCheckDeviceReady( lora_device_t* lora_device );
  * \param [in]  payload       A pointer to the payload
  * \param [in]  size          The size of the payload
  */
-void SX126xSetPayload( lora_device_t* lora_device,uint8_t *payload, uint8_t size );
+void SX126xSetPayload2( lora_device_t* lora_device,uint8_t *payload, uint8_t size );
 
 /*!
  * \brief Reads the payload received. If the received payload is longer
@@ -753,7 +734,7 @@ void SX126xSetPayload( lora_device_t* lora_device,uint8_t *payload, uint8_t size
  * \param [out] size          A pointer to the size of the payload received
  * \param [in]  maxSize       The maximal size allowed to copy into the buffer
  */
-uint8_t SX126xGetPayload( lora_device_t* lora_device,uint8_t *payload, uint8_t *size, uint8_t maxSize );
+uint8_t SX126xGetPayload2( lora_device_t* lora_device,uint8_t *payload, uint8_t *size, uint8_t maxSize );
 
 /*!
  * \brief Sends a payload
@@ -762,7 +743,7 @@ uint8_t SX126xGetPayload( lora_device_t* lora_device,uint8_t *payload, uint8_t *
  * \param [in]  size          The size of the payload to send
  * \param [in]  timeout       The timeout for Tx operation
  */
-void SX126xSendPayload( lora_device_t* lora_device,uint8_t *payload, uint8_t size, uint32_t timeout );
+void SX126xSendPayload2( lora_device_t* lora_device,uint8_t *payload, uint8_t size, uint32_t timeout );
 
 /*!
  * \brief Sets the Sync Word given by index used in GFSK
@@ -771,7 +752,7 @@ void SX126xSendPayload( lora_device_t* lora_device,uint8_t *payload, uint8_t siz
  *
  * \retval      status        [0: OK, 1: NOK]
  */
-uint8_t SX126xSetSyncWord( lora_device_t* lora_device,uint8_t *syncWord );
+uint8_t SX126xSetSyncWord2( lora_device_t* lora_device,uint8_t *syncWord );
 
 /*!
  * \brief Sets the Initial value for the LFSR used for the CRC calculation
@@ -779,7 +760,7 @@ uint8_t SX126xSetSyncWord( lora_device_t* lora_device,uint8_t *syncWord );
  * \param [in]  seed          Initial LFSR value ( 2 bytes )
  *
  */
-void SX126xSetCrcSeed( lora_device_t* lora_device,uint16_t seed );
+void SX126xSetCrcSeed2( lora_device_t* lora_device,uint16_t seed );
 
 /*!
  * \brief Sets the seed used for the CRC calculation
@@ -787,14 +768,14 @@ void SX126xSetCrcSeed( lora_device_t* lora_device,uint16_t seed );
  * \param [in]  seed          The seed value
  *
  */
-void SX126xSetCrcPolynomial( lora_device_t* lora_device,uint16_t polynomial );
+void SX126xSetCrcPolynomial2( lora_device_t* lora_device,uint16_t polynomial );
 
 /*!
  * \brief Sets the Initial value of the LFSR used for the whitening in GFSK protocols
  *
  * \param [in]  seed          Initial LFSR value
  */
-void SX126xSetWhiteningSeed( lora_device_t* lora_device,uint16_t seed );
+void SX126xSetWhiteningSeed2( lora_device_t* lora_device,uint16_t seed );
 
 /*!
  * \brief Gets a 32 bits random value generated by the radio
@@ -803,7 +784,7 @@ void SX126xSetWhiteningSeed( lora_device_t* lora_device,uint16_t seed );
  *
  * \retval randomValue    32 bits random value
  */
-uint32_t SX126xGetRandom( lora_device_t* lora_device );
+uint32_t SX126xGetRandom2( lora_device_t* lora_device );
 
 /*!
  * \brief Sets the radio in sleep mode
@@ -811,40 +792,40 @@ uint32_t SX126xGetRandom( lora_device_t* lora_device );
  * \param [in]  sleepConfig   The sleep configuration describing data
  *                            retention and RTC wake-up
  */
-void SX126xSetSleep( lora_device_t* lora_device,SleepParams_t sleepConfig );
+void SX126xSetSleep2( lora_device_t* lora_device,SleepParams_t sleepConfig );
 
 /*!
  * \brief Sets the radio in configuration mode
  *
  * \param [in]  mode          The standby mode to put the radio into
  */
-void SX126xSetStandby( lora_device_t* lora_device,RadioStandbyModes_t mode );
+void SX126xSetStandby2( lora_device_t* lora_device,RadioStandbyModes_t mode );
 
 /*!
  * \brief Sets the radio in FS mode
  */
-void SX126xSetFs( lora_device_t* lora_device );
+void SX126xSetFs2( lora_device_t* lora_device );
 
 /*!
  * \brief Sets the radio in transmission mode
  *
  * \param [in]  timeout       Structure describing the transmission timeout value
  */
-void SX126xSetTx( lora_device_t* lora_device,uint32_t timeout );
+void SX126xSetTx2( lora_device_t* lora_device,uint32_t timeout );
 
 /*!
  * \brief Sets the radio in reception mode
  *
  * \param [in]  timeout       Structure describing the reception timeout value
  */
-void SX126xSetRx( lora_device_t* lora_device,uint32_t timeout );
+void SX126xSetRx2( lora_device_t* lora_device,uint32_t timeout );
 
 /*!
  * \brief Sets the radio in reception mode with Boosted LNA gain
  *
  * \param [in]  timeout       Structure describing the reception timeout value
  */
-void SX126xSetRxBoosted( lora_device_t* lora_device,uint32_t timeout );
+void SX126xSetRxBoosted2( lora_device_t* lora_device,uint32_t timeout );
 
 /*!
  * \brief Sets the Rx duty cycle management parameters
@@ -852,22 +833,22 @@ void SX126xSetRxBoosted( lora_device_t* lora_device,uint32_t timeout );
  * \param [in]  rxTime        Structure describing reception timeout value
  * \param [in]  sleepTime     Structure describing sleep timeout value
  */
-void SX126xSetRxDutyCycle( lora_device_t* lora_device,uint32_t rxTime, uint32_t sleepTime );
+void SX126xSetRxDutyCycle2( lora_device_t* lora_device,uint32_t rxTime, uint32_t sleepTime );
 
 /*!
  * \brief Sets the radio in CAD mode
  */
-void SX126xSetCad( lora_device_t* lora_device );
+void SX126xSetCad2( lora_device_t* lora_device );
 
 /*!
  * \brief Sets the radio in continuous wave transmission mode
  */
-void SX126xSetTxContinuousWave( lora_device_t* lora_device );
+void SX126xSetTx2ContinuousWave2( lora_device_t* lora_device );
 
 /*!
  * \brief Sets the radio in continuous preamble transmission mode
  */
-void SX126xSetTxInfinitePreamble( lora_device_t* lora_device );
+void SX126xSetTx2InfinitePreamble2( lora_device_t* lora_device );
 
 /*!
  * \brief Decide which interrupt will stop the internal radio rx timer.
@@ -875,42 +856,42 @@ void SX126xSetTxInfinitePreamble( lora_device_t* lora_device );
  * \param [in]  enable          [0: Timer stop after header/syncword detection
  *                               1: Timer stop after preamble detection]
  */
-void SX126xSetStopRxTimerOnPreambleDetect(lora_device_t* lora_device, bool enable );
+void SX126xSetStopRxTimerOnPreambleDetect2(lora_device_t* lora_device, bool enable );
 
 /*!
  * \brief Set the number of symbol the radio will wait to validate a reception
  *
  * \param [in]  SymbNum          number of LoRa symbols
  */
-void SX126xSetLoRaSymbNumTimeout( lora_device_t* lora_device,uint8_t SymbNum );
+void SX126xSetLoRaSymbNumTimeout2( lora_device_t* lora_device,uint8_t SymbNum );
 
 /*!
  * \brief Sets the power regulators operating mode
  *
  * \param [in]  mode          [0: LDO, 1:DC_DC]
  */
-void SX126xSetRegulatorMode(lora_device_t* lora_device, RadioRegulatorMode_t mode );
+void SX126xSetRegulatorMode2(lora_device_t* lora_device, RadioRegulatorMode_t mode );
 
 /*!
  * \brief Calibrates the given radio block
  *
  * \param [in]  calibParam    The description of blocks to be calibrated
  */
-void SX126xCalibrate( lora_device_t* lora_device,CalibrationParams_t calibParam );
+void SX126xCalibrate2( lora_device_t* lora_device,CalibrationParams_t calibParam );
 
 /*!
  * \brief Calibrates the Image rejection depending of the frequency
  *
  * \param [in]  freq    The operating frequency
  */
-void SX126xCalibrateImage( lora_device_t* lora_device,uint32_t freq );
+void SX126xCalibrateImage2( lora_device_t* lora_device,uint32_t freq );
 
 /*!
  * \brief Activate the extention of the timeout when long preamble is used
  *
  * \param [in]  enable      The radio will extend the timeout to cope with long preamble
  */
-void SX126xSetLongPreamble( lora_device_t* lora_device,uint8_t enable );
+void SX126xSetLongPreamble2( lora_device_t* lora_device,uint8_t enable );
 
 /*!
  * \brief Sets the transmission parameters
@@ -920,14 +901,14 @@ void SX126xSetLongPreamble( lora_device_t* lora_device,uint8_t enable );
  * \param [in]  deviceSel       1 for sx1261, 0 for sx1262
  * \param [in]  paLut           0 for 14dBm LUT, 1 for 22dBm LUT
  */
-void SX126xSetPaConfig( lora_device_t* lora_device,uint8_t paDutyCycle, uint8_t hpMax, uint8_t deviceSel, uint8_t paLut );
+void SX126xSetPaConfig2( lora_device_t* lora_device,uint8_t paDutyCycle, uint8_t hpMax, uint8_t deviceSel, uint8_t paLut );
 
 /*!
  * \brief Defines into which mode the chip goes after a TX / RX done
  *
  * \param [in]  fallbackMode    The mode in which the radio goes
  */
-void SX126xSetRxTxFallbackMode( lora_device_t* lora_device,uint8_t fallbackMode );
+void SX126xSetRx2TxFallbackMode2( lora_device_t* lora_device,uint8_t fallbackMode );
 
 /*!
  * \brief Write data to the radio memory
@@ -936,7 +917,7 @@ void SX126xSetRxTxFallbackMode( lora_device_t* lora_device,uint8_t fallbackMode
  * \param [in]  buffer        The data to be written in radio's memory
  * \param [in]  size          The number of bytes to write in radio's memory
  */
-void SX126xWriteRegisters( lora_device_t* lora_device,uint16_t address, uint8_t *buffer, uint16_t size );
+void SX126xWriteRegister2s2( lora_device_t* lora_device,uint16_t address, uint8_t *buffer, uint16_t size );
 
 /*!
  * \brief Read data from the radio memory
@@ -945,7 +926,7 @@ void SX126xWriteRegisters( lora_device_t* lora_device,uint16_t address, uint8_t
  * \param [out] buffer        The buffer that holds data read from radio
  * \param [in]  size          The number of bytes to read from radio's memory
  */
-void SX126xReadRegisters( lora_device_t* lora_device,uint16_t address, uint8_t *buffer, uint16_t size );
+void SX126xReadRegister2s2( lora_device_t* lora_device,uint16_t address, uint8_t *buffer, uint16_t size );
 
 /*!
  * \brief Write data to the buffer holding the payload in the radio
@@ -954,7 +935,7 @@ void SX126xReadRegisters( lora_device_t* lora_device,uint16_t address, uint8_t *
  * \param [in]  buffer        The data to be written (the payload)
  * \param [in]  size          The number of byte to be written
  */
-void SX126xWriteBuffer( lora_device_t* lora_device,uint8_t offset, uint8_t *buffer, uint8_t size );
+void SX126xWriteBuffer2( lora_device_t* lora_device,uint8_t offset, uint8_t *buffer, uint8_t size );
 
 /*!
  * \brief Read data from the buffer holding the payload in the radio
@@ -963,7 +944,7 @@ void SX126xWriteBuffer( lora_device_t* lora_device,uint8_t offset, uint8_t *buff
  * \param [out] buffer        A pointer to a buffer holding the data from the radio
  * \param [in]  size          The number of byte to be read
  */
-void SX126xReadBuffer( lora_device_t* lora_device,uint8_t offset, uint8_t *buffer, uint8_t size );
+void SX126xReadBuffer2( lora_device_t* lora_device,uint8_t offset, uint8_t *buffer, uint8_t size );
 
 /*!
  * \brief   Sets the IRQ mask and DIO masks
@@ -973,21 +954,21 @@ void SX126xReadBuffer( lora_device_t* lora_device,uint8_t offset, uint8_t *buffe
  * \param [in]  dio2Mask      DIO2 mask
  * \param [in]  dio3Mask      DIO3 mask
  */
-void SX126xSetDioIrqParams( lora_device_t* lora_device,uint16_t irqMask, uint16_t dio1Mask, uint16_t dio2Mask, uint16_t dio3Mask );
+void SX126xSetDioIrqParams2( lora_device_t* lora_device,uint16_t irqMask, uint16_t dio1Mask, uint16_t dio2Mask, uint16_t dio3Mask );
 
 /*!
  * \brief Returns the current IRQ status
  *
  * \retval      irqStatus     IRQ status
  */
-uint16_t SX126xGetIrqStatus( lora_device_t* lora_device );
+uint16_t SX126xGetIrqStatus2( lora_device_t* lora_device );
 
 /*!
  * \brief Indicates if DIO2 is used to control an RF Switch
  *
  * \param [in] enable     true of false
  */
-void SX126xSetDio2AsRfSwitchCtrl( lora_device_t* lora_device,uint8_t enable );
+void SX126xSetDio2AsRfSwitchCtrl2( lora_device_t* lora_device,uint8_t enable );
 
 /*!
  * \brief Indicates if the Radio main clock is supplied from a tcxo
@@ -995,14 +976,14 @@ void SX126xSetDio2AsRfSwitchCtrl( lora_device_t* lora_device,uint8_t enable );
  * \param [in] tcxoVoltage     voltage used to control the TCXO
  * \param [in] timeout         time given to the TCXO to go to 32MHz
  */
-void SX126xSetDio3AsTcxoCtrl( lora_device_t* lora_device,RadioTcxoCtrlVoltage_t tcxoVoltage, uint32_t timeout );
+void SX126xSetDio3AsTcxoCtrl2( lora_device_t* lora_device,RadioTcxoCtrlVoltage_t tcxoVoltage, uint32_t timeout );
 
 /*!
  * \brief Sets the RF frequency
  *
  * \param [in]  frequency     RF frequency [Hz]
  */
-void SX126xSetRfFrequency( lora_device_t* lora_device,uint32_t frequency );
+void SX126xSetRfFrequency2( lora_device_t* lora_device,uint32_t frequency );
 
 /*!
  * \brief Sets the radio for the given protocol
@@ -1012,14 +993,14 @@ void SX126xSetRfFrequency( lora_device_t* lora_device,uint32_t frequency );
  * \remark This method has to be called before SetRfFrequency,
  *         SetModulationParams and SetPacketParams
  */
-void SX126xSetPacketType( lora_device_t* lora_device,RadioPacketTypes_t packetType );
+void SX126xSetPacketType2( lora_device_t* lora_device,RadioPacketTypes_t packetType );
 
 /*!
  * \brief Gets the current radio protocol
  *
  * \retval      packetType    [PACKET_TYPE_GFSK, PACKET_TYPE_LORA]
  */
-RadioPacketTypes_t SX126xGetPacketType( lora_device_t* lora_device );
+RadioPacketTypes_t SX126xGetPacketType2( lora_device_t* lora_device );
 
 /*!
  * \brief Sets the transmission parameters
@@ -1027,21 +1008,21 @@ RadioPacketTypes_t SX126xGetPacketType( lora_device_t* lora_device );
  * \param [in]  power         RF output power [-18..13] dBm
  * \param [in]  rampTime      Transmission ramp up time
  */
-void SX126xSetTxParams( lora_device_t* lora_device,int8_t power, RadioRampTimes_t rampTime );
+void SX126xSetTx2Params2( lora_device_t* lora_device,int8_t power, RadioRampTimes_t rampTime );
 
 /*!
  * \brief Set the modulation parameters
  *
  * \param [in]  modParams     A structure describing the modulation parameters
  */
-void SX126xSetModulationParams(lora_device_t* lora_device, ModulationParams_t *modParams );
+void SX126xSetModulationParams2(lora_device_t* lora_device, ModulationParams_t *modParams );
 
 /*!
  * \brief Sets the packet parameters
  *
  * \param [in]  packetParams  A structure describing the packet parameters
  */
-void SX126xSetPacketParams( lora_device_t* lora_device,PacketParams_t *packetParams );
+void SX126xSetPacketParams2( lora_device_t* lora_device,PacketParams_t *packetParams );
 
 /*!
  * \brief Sets the Channel Activity Detection (CAD) parameters
@@ -1056,7 +1037,7 @@ void SX126xSetPacketParams( lora_device_t* lora_device,PacketParams_t *packetPar
  *                             [LORA_CAD_ONLY, LORA_CAD_RX, LORA_CAD_LBT]
  * \param [in]  cadTimeout     Defines the timeout value to abort the CAD activity
  */
-void SX126xSetCadParams( lora_device_t* lora_device,RadioLoRaCadSymbols_t cadSymbolNum, uint8_t cadDetPeak, uint8_t cadDetMin, RadioCadExitModes_t cadExitMode, uint32_t cadTimeout );
+void SX126xSetCad2Params2( lora_device_t* lora_device,RadioLoRaCadSymbols_t cadSymbolNum, uint8_t cadDetPeak, uint8_t cadDetMin, RadioCadExitModes_t cadExitMode, uint32_t cadTimeout );
 
 /*!
  * \brief Sets the data buffer base address for transmission and reception
@@ -1064,21 +1045,21 @@ void SX126xSetCadParams( lora_device_t* lora_device,RadioLoRaCadSymbols_t cadSym
  * \param [in]  txBaseAddress Transmission base address
  * \param [in]  rxBaseAddress Reception base address
  */
-void SX126xSetBufferBaseAddress( lora_device_t* lora_device,uint8_t txBaseAddress, uint8_t rxBaseAddress );
+void SX126xSetBufferBaseAddress2( lora_device_t* lora_device,uint8_t txBaseAddress, uint8_t rxBaseAddress );
 
 /*!
  * \brief Gets the current radio status
  *
  * \retval      status        Radio status
  */
-RadioStatus_t SX126xGetStatus( lora_device_t* lora_device );
+RadioStatus_t SX126xGetStatus2( lora_device_t* lora_device );
 
 /*!
  * \brief Returns the instantaneous RSSI value for the last packet received
  *
  * \retval      rssiInst      Instantaneous RSSI
  */
-int8_t SX126xGetRssiInst( lora_device_t* lora_device );
+int8_t SX126xGetRssiInst2( lora_device_t* lora_device );
 
 /*!
  * \brief Gets the last received packet buffer status
@@ -1086,32 +1067,32 @@ int8_t SX126xGetRssiInst( lora_device_t* lora_device );
  * \param [out] payloadLength Last received packet payload length
  * \param [out] rxStartBuffer Last received packet buffer address pointer
  */
-void SX126xGetRxBufferStatus( lora_device_t* lora_device,uint8_t *payloadLength, uint8_t *rxStartBuffer );
+void SX126xGetRxBufferStatus2( lora_device_t* lora_device,uint8_t *payloadLength, uint8_t *rxStartBuffer );
 
 /*!
  * \brief Gets the last received packet payload length
  *
  * \param [out] pktStatus     A structure of packet status
  */
-void SX126xGetPacketStatus( lora_device_t* lora_device,PacketStatus_t *pktStatus );
+void SX126xGetPacketStatus2( lora_device_t* lora_device,PacketStatus_t *pktStatus );
 
 /*!
  * \brief Returns the possible system errors
  *
  * \retval sysErrors Value representing the possible sys failures
  */
-RadioError_t SX126xGetDeviceErrors( lora_device_t* lora_device );
+RadioError_t SX126xGetDeviceErrors2( lora_device_t* lora_device );
 
 /*!
  * \brief Clear all the errors in the device
  */
-void SX126xClearDeviceErrors( lora_device_t* lora_device );
+void SX126xClearDeviceErrors2( lora_device_t* lora_device );
 
 /*!
  * \brief Clears the IRQs
  *
  * \param [in]  irq           IRQ(s) to be cleared
  */
-void SX126xClearIrqStatus( lora_device_t* lora_device,uint16_t irq );
+void SX126xClearIrqStatus2( lora_device_t* lora_device,uint16_t irq );
 
 #endif // __SX126x_H__