-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathFreeRTOS-LoRaMac-node-v4_4_4.patch
More file actions
143 lines (135 loc) · 3.89 KB
/
Copy pathFreeRTOS-LoRaMac-node-v4_4_4.patch
File metadata and controls
143 lines (135 loc) · 3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
diff --git a/LoRaMac-node/src/mac/LoRaMac.h b/LoRaMac-node/src/mac/LoRaMac.h
index d8b908dc..ab0347ba 100644
--- a/LoRaMac-node/src/mac/LoRaMac.h
+++ b/LoRaMac-node/src/mac/LoRaMac.h
@@ -458,7 +458,7 @@ typedef union uPingSlotInfo
/*!
* RFU
*/
- uint8_t RFU : 5;
+ uint8_t reserved : 5;
}Fields;
}PingSlotInfo_t;
diff --git a/LoRaMac-node/src/mac/LoRaMacHeaderTypes.h b/LoRaMac-node/src/mac/LoRaMacHeaderTypes.h
index 6a865c03..57d9aac8 100644
--- a/LoRaMac-node/src/mac/LoRaMacHeaderTypes.h
+++ b/LoRaMac-node/src/mac/LoRaMacHeaderTypes.h
@@ -246,7 +246,7 @@ typedef union uLoRaMacHeader
/*!
* RFU
*/
- uint8_t RFU : 3;
+ uint8_t reserved : 3;
/*!
* Message type
*/
diff --git a/LoRaMac-node/src/radio/radio.h b/LoRaMac-node/src/radio/radio.h
index 6dd2a254..b1f0dce1 100644
--- a/LoRaMac-node/src/radio/radio.h
+++ b/LoRaMac-node/src/radio/radio.h
@@ -106,6 +106,12 @@ typedef struct
* \brief Gnss Done Done callback prototype.
*/
void ( *WifiDone )( void );
+
+ /*!
+ * \brief Notify of a radio event from ISR.
+ */
+
+ void ( *notify )( void );
}RadioEvents_t;
/*!
@@ -377,6 +383,12 @@ struct Radio_s
* \brief Process radio irq
*/
void ( *IrqProcess )( void );
+
+ /*!
+ * \brief Set radio notification.
+ */
+ void ( *SetEventNotify )( void ( * notify ) ( void ) );
+
/*
* The next functions are available only on SX126x radios.
*/
diff --git a/LoRaMac-node/src/radio/sx126x/radio.c b/LoRaMac-node/src/radio/sx126x/radio.c
index 88b9714e..12b81a55 100644
--- a/LoRaMac-node/src/radio/sx126x/radio.c
+++ b/LoRaMac-node/src/radio/sx126x/radio.c
@@ -319,6 +319,8 @@ uint32_t RadioGetWakeupTime( void );
*/
void RadioIrqProcess( void );
+void RadioSetEventNotify( void ( * notify ) ( void ) );
+
/*!
* \brief Sets the radio in reception mode with Max LNA gain for the given time
* \param [IN] timeout Reception timeout [ms]
@@ -364,6 +366,7 @@ const struct Radio_s Radio =
RadioSetPublicNetwork,
RadioGetWakeupTime,
RadioIrqProcess,
+ RadioSetEventNotify,
// Available on SX126x only
RadioRxBoosted,
RadioSetRxDutyCycle
@@ -1198,13 +1201,27 @@ void RadioOnRxTimeoutIrq( void* context )
{
if( ( RadioEvents != NULL ) && ( RadioEvents->RxTimeout != NULL ) )
{
- RadioEvents->RxTimeout( );
+ RadioEvents->RxTimeout();
+ }
+}
+
+void RadioSetEventNotify( void ( * notify ) ( void ) )
+{
+ if( RadioEvents != NULL )
+ {
+ RadioEvents->notify = notify;
}
+
}
void RadioOnDioIrq( void* context )
{
IrqFired = true;
+
+ if( ( RadioEvents != NULL ) && ( RadioEvents->notify != NULL ) )
+ {
+ RadioEvents->notify();
+ }
}
void RadioIrqProcess( void )
diff --git a/LoRaMac-node/src/system/timer.h b/LoRaMac-node/src/system/timer.h
index e18fc10f..a450cf4c 100644
--- a/LoRaMac-node/src/system/timer.h
+++ b/LoRaMac-node/src/system/timer.h
@@ -32,6 +32,12 @@ extern "C"
#include <stdbool.h>
#include <stdint.h>
+#ifdef LORAWAN_USE_EXTERNAL_TIMERS
+ /* Forward declaration of the Timer event structure. */
+ struct TimerEvent_s;
+ typedef struct TimerEvent_s * TimerEvent_t;
+#else
+
/*!
* \brief Timer object description
*/
@@ -44,7 +50,10 @@ typedef struct TimerEvent_s
void ( *Callback )( void* context ); //! Timer IRQ callback function
void *Context; //! User defined data object pointer to pass back
struct TimerEvent_s *Next; //! Pointer to the next Timer object.
-}TimerEvent_t;
+} TimerEvent_t;
+
+#endif
+
/*!
* \brief Timer time variable definition
@@ -54,6 +63,7 @@ typedef uint32_t TimerTime_t;
#define TIMERTIME_T_MAX ( ( uint32_t )~0 )
#endif
+
/*!
* \brief Initializes the timer object
*