IoT Supervisor 0.0
Loading...
Searching...
No Matches
IoT Supervisor_main.c File Reference
#include <hardware.h>
#include <SI_EFM8BB1_Register_Enums.h>
#include "InitDevice.h"
#include "IoT_Supervisor.h"
#include "ModbusMiddleWare.h"
#include "PetitModbus.h"
#include "EFM8BB1_FlashPrimitives.h"

Go to the source code of this file.

Macros

#define HB_DIV   (9u)
 
#define HB_DUTYCYCLE   (32u)
 
#define HB_SKIP   (3u)
 
#define FAST_BLINK   (9u)
 
#define SLOW_BLINK   (FAST_BLINK + 2u)
 
#define SCOUNTER_ONE_SECOND   (125)
 
#define C_DEFAULT_MB_WD_TIMEOUT   (15)
 
#define C_MB_WD_COUNT2MIN   (7500)
 
#define C_FLASH_CONF   (0x1E00)
 
#define pFLASH_CONF   ((uint8_t code*)C_FLASH_CONF)
 
#define C_PW_DEFAULT   (0xDEFA)
 
#define C_FOUND_PROG_END   (0x12A9)
 
#define C_CFG_HEADER_LEN   (sizeof(ex_cfg_header))
 
#define C_CFG_DATA_LEN   (sizeof(cfg_t))
 
#define C_CFG_C_CRC_LEN   (2)
 
#define C_CFG_P_CRC_LEN   (2)
 
#define C_CFG_DATA_END   (C_CFG_HEADER_LEN + C_CFG_DATA_LEN)
 
#define C_CFG_C_CRC_END   (C_CFG_DATA_END + C_CFG_C_CRC_LEN)
 
#define C_CFG_P_CRC_END   (C_CFG_C_CRC_END + C_CFG_P_CRC_LEN)
 

Functions

void SiLabs_Startup (void)
 SiLabs_Startup() Routine.
 
void blinker (void)
 
void VinSm (void)
 
void mbWDTsm (void)
 
bool ccfg_check (void)
 
bool dcfg_check ()
 
void cfg_load ()
 
void cfg_write (void)
 
void CFGsm ()
 
int main (void)
 

Variables

volatile sv_dev_sta_t sv_dev_sta = {0}
 
volatile t1Count_t t1Count = 0
 
volatile uint8_t t0Count = 0
 
uint8_t T0C_TOP = 0
 
bool sys_ok = true
 
bool configuring = false
 
uint8_t hbdCount = 0
 
uint8_t hbsCount = 0
 
bool nReset = false
 
bool modbusWdtSmEn = false
 
bool cprif = false
 
bool modbusWdtExp = false
 
uint8_t MB_WD_TIMEOUT = C_DEFAULT_MB_WD_TIMEOUT
 
bool mbWDTen = false
 
bool mbWDTpet = false
 
code const uint8_t ex_cfg_header []
 
code const cfg_t default_cfg
 
CfgSM_t cfgSmS = eCFG_Load
 
bool pw_flag = false
 
bool dir_tx = false
 
bool run_petitmodbus = false
 
uint16_t pw
 
cfg_t cfg
 
uint8_t cfg_write_idx = 0
 
uint16_t calc_cfg_crc = 0xFFFF
 
uint16_t calc_prog_crc = 0xFFFF
 

Detailed Description

generated by Hardware Configurator

This file will be updated when saving a document. leave the sections inside the "$[...]" comment tags alone or they will be overwritten!!

This is the internet of trash supervisor implementation it has two components: voltage monitoring (because the opi doesn't have it) and a watchdog (because stuff crashes all the time and nobody notices)

Definition in file IoT Supervisor_main.c.