Added software timers
Accessory state machine framework functional
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "utils.h"
|
||||
#include "usbComms.h"
|
||||
#include "System/system.h"
|
||||
#include "soft_timer.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* Definitions
|
||||
@@ -58,7 +59,7 @@ ctimer_config_t config;
|
||||
uint32_t Sys_Timer,Tx_timer;
|
||||
|
||||
extern uint8_t Task, Tx_Time_Out_Flag, frq_chg_tmr;
|
||||
extern uint16_t Port_timer, Taps_adjust_timer,Sys_Chk_tmr,Display_warning_tmr;
|
||||
extern uint16_t Port_timer, Taps_adjust_timer,Display_warning_tmr;
|
||||
uint16_t Low_Bat_timer,Estop_timer,Shut_down_tmr,Vchktmr, Over_Voltage_tmr,PSU_Check_tmr;
|
||||
uint16_t Key_Lock_Out_tmr,ByPass_tmr;
|
||||
uint32_t TX_TIME[4] = {TIME_1HR,TIME_2HR,TIME_0HR,TIME_0HR};
|
||||
@@ -72,26 +73,26 @@ uint32_t systemTime = 0; // 10mS ticks
|
||||
|
||||
|
||||
#define TIMER_SCALE 10
|
||||
void ctimer_match0_callback(uint32_t flags) // ISR every 10mS
|
||||
void ctimer_match0_callback(uint32_t flags) // ISR every 1mS
|
||||
{
|
||||
int timerScaler = 0;
|
||||
static bool Test_Flg = false;
|
||||
if(Test_Flg)
|
||||
GPIO_PinWrite(GPIO, 0, 4, 1); //TODO remove
|
||||
else
|
||||
GPIO_PinWrite(GPIO, 0, 4, 0); //TODO remove
|
||||
|
||||
Test_Flg ^=1;
|
||||
|
||||
systemTime++; // increment system time by 10mS
|
||||
sys.systemTime++; // increment system time by 1mS
|
||||
|
||||
Check_Live_Voltage();
|
||||
stimer_update();
|
||||
|
||||
if ((systemTime % TIMER_SCALE != 0))
|
||||
|
||||
|
||||
//Check_Live_Voltage();
|
||||
|
||||
if ((systemTime % TIMER_SCALE != 0)) // 10ms timer
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
system_monitor();
|
||||
|
||||
if (Sys_Timer > 0)
|
||||
Sys_Timer--;
|
||||
|
||||
@@ -122,8 +123,6 @@ void ctimer_match0_callback(uint32_t flags) // ISR every 10mS
|
||||
Taps_adjust_timer--; // Port checking timer
|
||||
if(Estop_timer > 0)
|
||||
Estop_timer--;
|
||||
if(Sys_Chk_tmr > 0)
|
||||
Sys_Chk_tmr--;
|
||||
|
||||
if(ByPass_tmr > 0)
|
||||
ByPass_tmr--;
|
||||
@@ -136,7 +135,7 @@ void ctimer_match0_callback(uint32_t flags) // ISR every 10mS
|
||||
{
|
||||
ADC_Update();
|
||||
}
|
||||
// GPIO_PinWrite(GPIO, 0, 4, 0); // TODO Whats' this for ?? Probably left over debug of timer
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user