浏览代码

修复了一些bug

dropLin 6 月之前
父节点
当前提交
9aacf9997a
共有 5 个文件被更改,包括 27 次插入18 次删除
  1. 6 0
      README.md
  2. 11 8
      radio/myRadio.c
  3. 1 1
      radio/myRadio.h
  4. 6 6
      radio/myRadio_gpio.c
  5. 3 3
      radio/myRadio_gpio.h

+ 6 - 0
README.md

@@ -433,6 +433,12 @@ RadioEvents.RxError = OnRxError;
 2024年6月24日
     - 优化固件默认参数
 
+- V12
+2024年11月15日
+    - 增加无线发送数据长度设置
+    - 优化射频底层适配无线单包最大长度,最大可达255字节
+    - 修复直接通过usb串口收发数据,收发长度不受设置的影响,最大可达255字节
+
 ## 免责说明
 1、本工程驱动软件只提供做演示项目使用,未经过大批量项目验证,客户需谨慎使用,如果使用在正式项目中引发的所有问题,本司概不负责。使用过程若发现任何问题,可及时与本司相关人员联系。
 2、本工程所有文件可以用于商业性项目移植,无需向本司申请。

+ 11 - 8
radio/myRadio.c

@@ -16,7 +16,7 @@ static uint8_t rfRxBuffer[255];
 static uint32_t rf_handle;
 static uint8_t rf_workProcess;
 static uint8_t chipType;
-static uint8_t rfModuleMode = RF_MM_MODE_LORA;
+static uint8_t rfModuleMode = RF_MM_MODE_FLRC;
 /**-------------------------radio params----------------------------------**/
 ModulationParams_t modulationParams;
 rfRxPacket_ts rfRxPacket;
@@ -110,7 +110,7 @@ const fastloraBaudrateFrame_ts fastLoraConfigList[] =
 /*!
  * \brief Number of tick size steps for tx timeout
  */
-#define TX_TIMEOUT_VALUE                            1000 // ms
+#define TX_TIMEOUT_VALUE                            3000 // ms
 
 /*!
  * \brief Number of tick size steps for rx timeout
@@ -238,7 +238,7 @@ void myRadio_delay(uint32_t time_ms)
     i = time_ms;
     while (i --)
     {
-        for ( j = 0; j < 2000; j++)
+        for ( j = 0; j < 1000; j++)
         {
             ;
         }
@@ -276,7 +276,8 @@ void myRadio_init(int agr0, void *agr1_ptr)
     Radio.Init( &Callbacks );
     Radio.SetRegulatorMode( USE_DCDC ); // Can also be set in LDO mode but consume more power
     {
-        ver = Radio.GetFirmwareVersion();//获取芯片信息 0xA9B5 可用于测试SPI的读写情况
+        
+       ver = Radio.GetFirmwareVersion();//获取芯片信息 0xA9B5 可用于测试SPI的读写情况
     }
     if (rfModuleMode == RF_MM_MODE_BLE)
     {
@@ -365,7 +366,10 @@ void myRadio_init(int agr0, void *agr1_ptr)
         packetParams.Params.Flrc.Whitening = RADIO_WHITENING_OFF;
         
     }
-
+    
+    
+    
+    
 //     #elif defined( MODE_GFSK )
     
 // #elif defined( MODE_LORA )
@@ -382,9 +386,9 @@ void myRadio_init(int agr0, void *agr1_ptr)
     Radio.SetPacketType( modulationParams.PacketType );
     Radio.SetModulationParams( &modulationParams );
     Radio.SetPacketParams( &packetParams );
-    Radio.SetRfFrequency( RF_FREQUENCY );                       //频点设置
+    Radio.SetRfFrequency( RF_FREQUENCY );//频点设置
     Radio.SetBufferBaseAddresses( 0x00, 0x00 );
-    Radio.SetTxParams( TX_OUTPUT_POWER, RADIO_RAMP_02_US );     //功率设置
+    Radio.SetTxParams( TX_OUTPUT_POWER, RADIO_RAMP_02_US );//功率设置
     
 //    Radio.SetInterruptMode();
     Radio.SetPollingMode();
@@ -593,7 +597,6 @@ void myRadio_transmit(rfTxPacket_ts *packet)
     }
 	TickTime_t TickTime ={ RX_TIMEOUT_TICK_SIZE, TX_TIMEOUT_VALUE };
     Radio.SetDioIrqParams( TxIrqMask, TxIrqMask, IRQ_RADIO_NONE, IRQ_RADIO_NONE );
-    packet->len = 64;
     if(rfModuleMode == RF_MM_MODE_GFSK)
     {
         packetParams.Params.Gfsk.PayloadLength = packet->len;

+ 1 - 1
radio/myRadio.h

@@ -6,7 +6,7 @@
 #include <stdint.h>
 #include <string.h>
 
-#define MAX_RF_PACKET_LEN 128
+#define MAX_RF_PACKET_LEN 255
 /*!
  * Select mode of operation for the Ping Ping application
  */

+ 6 - 6
radio/myRadio_gpio.c

@@ -321,9 +321,9 @@ uint8_t myRadioSpi_rwByte(uint8_t byteToWrite)
 	return temp;
 }
 
-void myRadioSpi_wBuffer(uint8_t* pData, uint8_t len)
+void myRadioSpi_wBuffer(uint8_t* pData, uint16_t len)
 {
-  uint8_t i;
+  uint16_t i;
   
   for(i = 0; i < len; i++)
   {
@@ -332,9 +332,9 @@ void myRadioSpi_wBuffer(uint8_t* pData, uint8_t len)
   }
 }
 
-void myRadioSpi_rBuffer(uint8_t* pData, uint8_t len)
+void myRadioSpi_rBuffer(uint8_t* pData, uint16_t len)
 {
-  uint8_t i;
+  uint16_t i;
   
   for(i = 0; i < len; i++)
   {
@@ -342,9 +342,9 @@ void myRadioSpi_rBuffer(uint8_t* pData, uint8_t len)
     pData ++;
   }
 }
-void myRadioSpi_rwBuffer(uint8_t* pDataR, uint8_t* pDataW, uint8_t len)
+void myRadioSpi_rwBuffer(uint8_t* pDataR, uint8_t* pDataW, uint16_t len)
 {
-  uint8_t i;
+  uint16_t i;
   
   for(i = 0; i < len; i++)
   {

+ 3 - 3
radio/myRadio_gpio.h

@@ -108,9 +108,9 @@ void BOARD_SPI_NSS_L(void);
 void myRadio_gpio_init(RADIO_GPIO_CALLBACK cb);
 void myRadio_gpio_intoLwPwr(bool sta);
 uint8_t myRadioSpi_rwByte(uint8_t byteToWrite);
-void myRadioSpi_wBuffer(uint8_t* pData, uint8_t len);
-void myRadioSpi_rBuffer(uint8_t* pData, uint8_t len);
-void myRadioSpi_rwBuffer(uint8_t* pDataR, uint8_t* pDataW, uint8_t len);
+void myRadioSpi_wBuffer(uint8_t* pData, uint16_t len);
+void myRadioSpi_rBuffer(uint8_t* pData, uint16_t len);
+void myRadioSpi_rwBuffer(uint8_t* pDataR, uint8_t* pDataW, uint16_t len);
 
 #define SpiReadWrite(p)                 myRadioSpi_rwByte(p)
 #define SpiWriteData(p1, p2)            myRadioSpi_wBuffer(p1, p2)