18#include <SI_EFM8BB1_Register_Enums.h>
22#include "PetitModbus.h"
103#define HB_DUTYCYCLE (32u)
105#define FAST_BLINK (9u)
106#define SLOW_BLINK (FAST_BLINK + 2u)
126 bool hb_internal = hb_fast && hb_slow;
131 else if (hbs_re ==
true)
136 hb_internal = hb_internal && (
hbsCount == 0);
139 if (hb_internal ==
true && hbf_re ==
true)
195#define SCOUNTER_ONE_SECOND (125)
207 static uint8_t sCounter = 0;
220 if (
cprif ==
true || VinCmp ==
true)
236 if (
cprif ==
true || VinCmp ==
true)
294#define C_DEFAULT_MB_WD_TIMEOUT (15)
296#define C_MB_WD_COUNT2MIN (7500)
311 static uint16_t mbWDTc = 0;
312 static uint16_t mbWDTcM = 0;
382#define C_FLASH_CONF (0x1E00)
384#define pFLASH_CONF ((uint8_t code*)C_FLASH_CONF)
389#define C_PW_DEFAULT (0xDEFA)
391#if defined(DEBUG) && DEBUG
396#define C_FOUND_PROG_END (0x101F)
398#define C_FOUND_PROG_END (0x12A9)
417#define C_CFG_HEADER_LEN (sizeof(ex_cfg_header))
436#define C_CFG_DATA_LEN (sizeof(cfg_t))
438#define C_CFG_C_CRC_LEN (2)
440#define C_CFG_P_CRC_LEN (2)
444#define C_CFG_DATA_END (C_CFG_HEADER_LEN + C_CFG_DATA_LEN)
448#define C_CFG_C_CRC_END (C_CFG_DATA_END + C_CFG_C_CRC_LEN)
453#define C_CFG_P_CRC_END (C_CFG_C_CRC_END + C_CFG_P_CRC_LEN)
529 cfg.
pw |= (uint16_t)i << 8;
694 RSTSRC |= RSTSRC_SWRSF__SET;
731 if (
pw_flag && Petit_RxTx_State == PETIT_RXTX_RX &&
dir_tx ==
false)
752 if (
pw_flag && Petit_RxTx_State == PETIT_RXTX_RX &&
dir_tx ==
false)
836 if ((RSTSRC & RSTSRC_SWRSF__BMASK) == RSTSRC_SWRSF__SET)
842#if defined(DEBUG) && DEBUG
844 enter_DebugMode_from_DefaultMode();
849 if (
t1Count - t1CountLast >= 1u)
857 ProcessPetitModbus();
void FLASH_ByteWrite(FLADDR addr, uint8_t byte)
void FLASH_PageErase(FLADDR addr)
void enter_DefaultMode_from_RESET(void)
void KirisakiCRC16Calc(uint8_t Data, uint16_t *CRC)
code const cfg_t default_cfg
code const uint8_t ex_cfg_header[]
@ 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_Setup
Initial Setup.
void SiLabs_Startup(void)
SiLabs_Startup() Routine.
volatile t1Count_t t1Count
volatile sv_dev_sta_t sv_dev_sta
@ eLR_WDT
The modbus watchdog timer caused the last reset.
@ eLR_VSM
A low voltage condition caused the last reset.
void mmw_init(uint8_t sid, uint8_t baud)
#define C_DEFAULT_MB_WD_TIMEOUT
#define C_MB_WD_COUNT2MIN
@ eMW_Timeout
Timeout State. This watchdog bites!
#define SCOUNTER_ONE_SECOND
@ eVIN_VLow
Voltage Low State.
@ eVIN_OK
Voltage in and Reset State Machine OK.
#define PETIT_PROCESS_OFF()
#define RESET_LED_SET(nSTATE)
#define PETIT_PROCESS_ON()
#define WDT_LED_SET(nSTATE)
This struct is a storage type for flash memory.
struct sv_dev_sta_t::@0 v