mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-30 02:31:44 +00:00
[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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user