1 /*!
2  * \file      LoRaMacClassBNvm.h
3  *
4  * \brief     LoRa MAC Class B non-volatile data.
5  *
6  * \copyright Revised BSD License, see section \ref LICENSE.
7  *
8  * \code
9  *                ______                              _
10  *               / _____)             _              | |
11  *              ( (____  _____ ____ _| |_ _____  ____| |__
12  *               \____ \| ___ |    (_   _) ___ |/ ___)  _ \
13  *               _____) ) ____| | | || |_| ____( (___| | | |
14  *              (______/|_____)_|_|_| \__)_____)\____)_| |_|
15  *              (C)2013 Semtech
16  *
17  *               ___ _____ _   ___ _  _____ ___  ___  ___ ___
18  *              / __|_   _/_\ / __| |/ / __/ _ \| _ \/ __| __|
19  *              \__ \ | |/ _ \ (__| ' <| _| (_) |   / (__| _|
20  *              |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
21  *              embedded.connectivity.solutions===============
22  *
23  * \endcode
24  *
25  * \author     Miguel Luis ( Semtech )
26  *
27  * \author     Daniel Jaeckle ( STACKFORCE )
28  *
29  * \addtogroup LORAMACCLASSB
30  *
31  * \{
32  */
33 #ifndef __LORAMACCLASSBNVM_H__
34 #define __LORAMACCLASSBNVM_H__
35 
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40 
41 #include <stdint.h>
42 
43 /*!
44  * LoRaMac Class B Context structure for NVM parameters
45  * related to ping slots
46  */
47 typedef struct sLoRaMacClassBPingSlotNvmData
48 {
49     struct sPingSlotCtrlNvm
50     {
51         /*!
52          * Set when the server assigned a ping slot to the node
53          */
54         uint8_t Assigned         : 1;
55         /*!
56          * Set when a custom frequency is used
57          */
58         uint8_t CustomFreq       : 1;
59     }Ctrl;
60     /*!
61      * Number of ping slots
62      */
63     uint8_t PingNb;
64     /*!
65      * Period of the ping slots
66      */
67     uint16_t PingPeriod;
68     /*!
69      * Reception frequency of the ping slot windows
70      */
71     uint32_t Frequency;
72     /*!
73      * Datarate of the ping slot
74      */
75     int8_t Datarate;
76     /*!
77      * Set to 1, if the FPending bit is set
78      */
79     uint8_t FPendingSet;
80 } LoRaMacClassBPingSlotNvmData_t;
81 
82 /*!
83  * LoRaMac Class B Context structure for NVM parameters
84  * related to beaconing
85  */
86 typedef struct sLoRaMacClassBBeaconNvmData
87 {
88     struct sBeaconCtrlNvm
89     {
90         /*!
91          * Set if the node has a custom frequency for beaconing and ping slots
92          */
93         uint8_t CustomFreq          : 1;
94     }Ctrl;
95     /*!
96      * Beacon reception frequency
97      */
98     uint32_t Frequency;
99 } LoRaMacClassBBeaconNvmData_t;
100 
101 /*!
102  * LoRaMac Class B Context structure
103  */
104 typedef struct sLoRaMacClassBNvmData
105 {
106     /*!
107      * Class B ping slot context
108      */
109     LoRaMacClassBPingSlotNvmData_t PingSlotCtx;
110     /*!
111      * Class B beacon context
112      */
113     LoRaMacClassBBeaconNvmData_t BeaconCtx;
114     /*!
115      * CRC32 value of the ClassB data structure.
116      */
117     uint32_t Crc32;
118 } LoRaMacClassBNvmData_t;
119 
120 #ifdef __cplusplus
121 }
122 #endif
123 
124 #endif // __LORAMACCLASSBNVM_H__
125