Add methods for checking Watchdog status, ds status, and brownout status

Change-Id: I723c87d0c50612cbffbb81b0e039efd0ef05fcd0
This commit is contained in:
Kevin O'Connor
2014-11-18 10:56:25 -05:00
parent c7a90b2ccc
commit e73b3ed7b5
7 changed files with 89 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ const uint32_t interrupt_kNumSystems = tInterrupt::kNumSystems;
const uint32_t kSystemClockTicksPerMicrosecond = 40;
static tGlobal *global;
static tSysWatchdog *watchdog;
void* getPort(uint8_t pin)
{
@@ -210,6 +211,16 @@ void HALSetNewDataSem(pthread_cond_t * param)
setNewDataSem(param);
}
bool HALGetSystemActive(int32_t *status)
{
return watchdog->readStatus_SystemActive(status);
}
bool HALGetBrownedOut(int32_t *status)
{
return !(watchdog->readStatus_PowerAlive(status));
}
/**
* Call this to start up HAL. This is required for robot programs.
*/
@@ -227,6 +238,7 @@ int HALInitialize(int mode)
int32_t status;
global = tGlobal::create(&status);
watchdog = tSysWatchdog::create(&status);
// Kill any previous robot programs
std::fstream fs;