IoT Supervisor 0.0
Loading...
Searching...
No Matches
IoT_Supervisor.h
Go to the documentation of this file.
1
11#ifndef INC_IOT_SUPERVISOR_H_
12#define INC_IOT_SUPERVISOR_H_
13#include <stdint.h>
14#include <stdbool.h>
15
16//-----------------------------------------------------------------------------
17// Defines
18//-----------------------------------------------------------------------------
22#define C_WDT_PET 0x5A
23#define C_WDT_DIS 0xA5
// group Modbus WDT State Machine
28#define C_CMD_COMMIT 0x5FAF
29#define C_CMD_CANCEL 0x0000
30#define C_SID_MIN 1
31#define C_SID_MAX 247
// group Configuration_State_Machine
33//-----------------------------------------------------------------------------
34// Type Definitions
35//-----------------------------------------------------------------------------
36#define t1Count_t uint16_t
37
48typedef enum
49{
58 eVIN_OK
// group Voltage_State_Machine
71typedef enum
72{
73 eMW_Ini = 0,
// Modbus_WDT_State_Machine
87typedef enum
88{
91 eLR_WDT
// Main_Application
115
131
133typedef struct
134{
135 uint8_t sid;
136 uint8_t baud;
137 uint8_t wdto;
138 uint16_t pw;
139} cfg_t;
// group Configuration_State_Machine
141
151typedef union
152{
153 /* bitfield access
154 *
155 * @note these fields are represented in LSB first which is normal in C
156 */
157 struct
158 {
163 } v;
165 uint8_t b;
// Main_Application
168
169//-----------------------------------------------------------------------------
170// Globals
171//-----------------------------------------------------------------------------
172extern bool sys_ok;
173
174extern volatile t1Count_t t1Count;
175extern volatile bool cprif;
176
177extern volatile uint8_t t0Count;
178extern uint8_t T0C_TOP;
179
181
182extern bool mbWDTen;
183extern bool mbWDTpet;
184extern uint8_t MB_WD_TIMEOUT;
185
186extern bool pw_flag;
187extern bool dir_tx;
188extern uint16_t pw;
189extern cfg_t cfg;
190
191extern CfgSM_t cfgSmS;
192//-----------------------------------------------------------------------------
193// Functions
194//-----------------------------------------------------------------------------
195void VinSm(void);
196void mbWDTsm(void);
197
198#endif /* INC_IOT_SUPERVISOR_H_ */
#define t1Count_t
bool sys_ok
bool pw_flag
cfg_t cfg
uint16_t pw
CfgSM_t
bool dir_tx
CfgSM_t cfgSmS
VerifSt_t
@ eCFG_Cache
New Configuration is Caching from Modbus.
@ eCFG_Load
Configuration Loading from memory.
@ eCFG_Commit
New Configuration is Committed (Active)
@ eCFG_Idle
Idle State. No configuration state machine activity.
@ eCFG_Write
Write the new Configuration (into Flash)
@ eCFG_Erase
Erase the old Configuration (from Flash)
@ eVS_Cfg
Configuration Error or CRC Mismatch Detected.
@ eVS_Prog
Program Memory Mismatch Detected.
@ eVS_Norm
@ eVS_Setup
Initial Setup.
uint8_t T0C_TOP
volatile t1Count_t t1Count
sv_dev_sta_t sv_dev_sta
LastRst_t
volatile uint8_t t0Count
@ eLR_Init
Initial State. No recorded reset.
@ eLR_WDT
The modbus watchdog timer caused the last reset.
@ eLR_VSM
A low voltage condition caused the last reset.
void mbWDTsm(void)
bool mbWDTpet
mbWDTsmS_t
uint8_t MB_WD_TIMEOUT
bool mbWDTen
@ eMW_Ini
Initial State.
@ eMW_Timeout
Timeout State. This watchdog bites!
@ eMW_En
Enable State.
volatile bool cprif
VinSm_t
void VinSm(void)
@ eVIN_Init
@ eVIN_VLow
Voltage Low State.
@ eVIN_OK
Voltage in and Reset State Machine OK.
This struct is a storage type for flash memory.
uint16_t pw
uint8_t sid
uint8_t wdto
uint8_t baud
uint8_t b
byte access
VerifSt_t verifSt
mbWDTsmS_t wdtSmS
LastRst_t lastRstS