[hal] Add autodetect for power modules (#3706)

Default autodetect to REV if no devices are found, as only the REV devices have control functionality (the switchable output).
This commit is contained in:
Thad House
2021-11-07 13:53:38 -08:00
committed by GitHub
parent 3dd41c0d37
commit 68ce62e2e9
3 changed files with 51 additions and 2 deletions

View File

@@ -34,6 +34,7 @@ using namespace hal;
static std::unique_ptr<tGlobal> global;
static std::unique_ptr<tSysWatchdog> watchdog;
static uint64_t dsStartTime;
using namespace hal;
@@ -86,6 +87,11 @@ void ReleaseFPGAInterrupt(int32_t interruptNumber) {
&status);
global->strobeInterruptForceOnce(&status);
}
uint64_t GetDSInitializeTime() {
return dsStartTime;
}
} // namespace hal
extern "C" {
@@ -420,6 +426,11 @@ HAL_Bool HAL_Initialize(int32_t timeout, int32_t mode) {
HAL_InitializeDriverStation();
dsStartTime = HAL_GetFPGATime(&status);
if (status != 0) {
return false;
}
// Set WPI_Now to use FPGA timestamp
wpi::SetNowImpl([]() -> uint64_t {
int32_t status = 0;