mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
[wpilibc] Use std::atomic in ADIS classes (#6217)
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
#include <hal/SimDevice.h>
|
||||
@@ -114,8 +115,8 @@ class ADIS16448_IMU : public wpi::Sendable,
|
||||
|
||||
~ADIS16448_IMU() override;
|
||||
|
||||
ADIS16448_IMU(ADIS16448_IMU&&) = default;
|
||||
ADIS16448_IMU& operator=(ADIS16448_IMU&&) = default;
|
||||
ADIS16448_IMU(ADIS16448_IMU&&);
|
||||
ADIS16448_IMU& operator=(ADIS16448_IMU&&);
|
||||
|
||||
/**
|
||||
* Initialize the IMU.
|
||||
@@ -414,10 +415,10 @@ class ADIS16448_IMU : public wpi::Sendable,
|
||||
double CompFilterProcess(double compAngle, double accelAngle, double omega);
|
||||
|
||||
// State and resource variables
|
||||
volatile bool m_thread_active = false;
|
||||
volatile bool m_first_run = true;
|
||||
volatile bool m_thread_idle = false;
|
||||
volatile bool m_start_up_mode = true;
|
||||
std::atomic<bool> m_thread_active = false;
|
||||
std::atomic<bool> m_first_run = true;
|
||||
std::atomic<bool> m_thread_idle = false;
|
||||
std::atomic<bool> m_start_up_mode = true;
|
||||
|
||||
bool m_auto_configured = false;
|
||||
SPI::Port m_spi_port;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
#include <hal/SimDevice.h>
|
||||
@@ -143,8 +144,8 @@ class ADIS16470_IMU : public wpi::Sendable,
|
||||
|
||||
~ADIS16470_IMU() override;
|
||||
|
||||
ADIS16470_IMU(ADIS16470_IMU&&) = default;
|
||||
ADIS16470_IMU& operator=(ADIS16470_IMU&&) = default;
|
||||
ADIS16470_IMU(ADIS16470_IMU&& other);
|
||||
ADIS16470_IMU& operator=(ADIS16470_IMU&& other);
|
||||
|
||||
/**
|
||||
* Configures the decimation rate of the IMU.
|
||||
@@ -500,9 +501,9 @@ class ADIS16470_IMU : public wpi::Sendable,
|
||||
double CompFilterProcess(double compAngle, double accelAngle, double omega);
|
||||
|
||||
// State and resource variables
|
||||
volatile bool m_thread_active = false;
|
||||
volatile bool m_first_run = true;
|
||||
volatile bool m_thread_idle = false;
|
||||
std::atomic<bool> m_thread_active = false;
|
||||
std::atomic<bool> m_first_run = true;
|
||||
std::atomic<bool> m_thread_idle = false;
|
||||
bool m_auto_configured = false;
|
||||
SPI::Port m_spi_port;
|
||||
uint16_t m_calibration_time = 0;
|
||||
|
||||
Reference in New Issue
Block a user