Răsfoiți Sursa

add:RadioEventsInit函数

Dozingfiretruck 3 ani în urmă
părinte
comite
2621908193
2 a modificat fișierele cu 7 adăugiri și 1 ștergeri
  1. 2 0
      components/lora/luat_lib_lora.c
  2. 5 1
      components/lora/sx126x/radio.c

+ 2 - 0
components/lora/luat_lib_lora.c

@@ -166,6 +166,7 @@ void OnRxError( void ){
     luat_msgbus_put(&msg, 1);
 }
 
+extern void RadioEventsInit(RadioEvents_t *events);
 /*
 lora初始化
 @api lora.init(ic, loraconfig,spiconfig)
@@ -245,6 +246,7 @@ static int luat_lora_init(lua_State *L){
         RadioEvents.RxTimeout = OnRxTimeout;
         RadioEvents.RxError = OnRxError;
 
+        RadioEventsInit(&RadioEvents);
         if (lora_init) Radio.Init( &RadioEvents );
 
         luat_start_rtos_timer(luat_create_rtos_timer(Radio.IrqProcess, NULL, NULL), 10, 1);

+ 5 - 1
components/lora/sx126x/radio.c

@@ -446,7 +446,7 @@ static RadioPublicNetwork_t RadioPublicNetwork = { false };
 /*!
  * Radio callbacks variable
  */
-static RadioEvents_t* RadioEvents;
+RadioEvents_t* RadioEvents;
 
 /*
  * Public global variables
@@ -489,6 +489,10 @@ static uint8_t RadioGetFskBandwidthRegValue( uint32_t bandwidth )
     while( 1 );
 }
 
+void RadioEventsInit(RadioEvents_t *events){
+    RadioEvents = events;
+}
+
 void RadioInit( RadioEvents_t *events )
 {
     RadioEvents = events;