mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
Moves the HAL priority_ custom types to the hal namespace (#532)
There is a shim for backwards compatibility, just like the frc namespace. As with the frc namespace, the library compiles without the shim.
This commit is contained in:
committed by
Peter Johnson
parent
16e71eac43
commit
efec0c5cc3
@@ -80,7 +80,7 @@ double Timer::Get() const {
|
||||
double result;
|
||||
double currentTime = GetFPGATimestamp();
|
||||
|
||||
std::lock_guard<priority_mutex> sync(m_mutex);
|
||||
std::lock_guard<hal::priority_mutex> sync(m_mutex);
|
||||
if (m_running) {
|
||||
// If the current time is before the start time, then the FPGA clock
|
||||
// rolled over. Compensate by adding the ~71 minutes that it takes
|
||||
@@ -104,7 +104,7 @@ double Timer::Get() const {
|
||||
* now.
|
||||
*/
|
||||
void Timer::Reset() {
|
||||
std::lock_guard<priority_mutex> sync(m_mutex);
|
||||
std::lock_guard<hal::priority_mutex> sync(m_mutex);
|
||||
m_accumulatedTime = 0;
|
||||
m_startTime = GetFPGATimestamp();
|
||||
}
|
||||
@@ -116,7 +116,7 @@ void Timer::Reset() {
|
||||
* relative to the system clock.
|
||||
*/
|
||||
void Timer::Start() {
|
||||
std::lock_guard<priority_mutex> sync(m_mutex);
|
||||
std::lock_guard<hal::priority_mutex> sync(m_mutex);
|
||||
if (!m_running) {
|
||||
m_startTime = GetFPGATimestamp();
|
||||
m_running = true;
|
||||
@@ -133,7 +133,7 @@ void Timer::Start() {
|
||||
void Timer::Stop() {
|
||||
double temp = Get();
|
||||
|
||||
std::lock_guard<priority_mutex> sync(m_mutex);
|
||||
std::lock_guard<hal::priority_mutex> sync(m_mutex);
|
||||
if (m_running) {
|
||||
m_accumulatedTime = temp;
|
||||
m_running = false;
|
||||
@@ -150,7 +150,7 @@ void Timer::Stop() {
|
||||
*/
|
||||
bool Timer::HasPeriodPassed(double period) {
|
||||
if (Get() > period) {
|
||||
std::lock_guard<priority_mutex> sync(m_mutex);
|
||||
std::lock_guard<hal::priority_mutex> sync(m_mutex);
|
||||
// Advance the start time by the period.
|
||||
m_startTime += period;
|
||||
// Don't set it to the current time... we want to avoid drift.
|
||||
|
||||
Reference in New Issue
Block a user