Fix bugs in simulation libraries (#853)

Some thing got broken in the past couple of weeks with updates to the
HAL.
This commit is contained in:
PJ Reiniger
2017-12-31 15:37:14 -05:00
committed by Peter Johnson
parent 2c4faee667
commit 55b6764d50
14 changed files with 201 additions and 121 deletions

View File

@@ -19,6 +19,10 @@ class ADXL345_I2CData : public ThreeAxisAccelerometerData {
void HandleRead(uint8_t* buffer, uint32_t count);
private:
int m_port;
int m_writeCallbackId;
int m_readCallbackId;
int m_lastWriteAddress;
static const double LSB;

View File

@@ -19,6 +19,10 @@ class ADXL345_SpiAccelerometer : public ThreeAxisAccelerometerData {
void HandleRead(uint8_t* buffer, uint32_t count);
private:
int m_port;
int m_writeCallbackId;
int m_readCallbackId;
int m_lastWriteAddress;
static const double LSB;

View File

@@ -19,6 +19,10 @@ class ADXL362_SpiAccelerometer : public ThreeAxisAccelerometerData {
void HandleRead(uint8_t* buffer, uint32_t count);
private:
int m_port;
int m_writeCallbackId;
int m_readCallbackId;
int m_lastWriteAddress;
static const double LSB;

View File

@@ -21,6 +21,8 @@ class ADXRS450_SpiGyroWrapper {
virtual ~ADXRS450_SpiGyroWrapper();
void HandleRead(uint8_t* buffer, uint32_t count);
void HandleAutoReceiveData(uint8_t* buffer, int32_t numToRead,
int32_t& outputCount);
virtual void ResetData();
@@ -32,12 +34,20 @@ class ADXRS450_SpiGyroWrapper {
void SetAngle(double angle);
private:
const int m_port;
int m_port;
int m_readCallbackId;
int m_autoReceiveReadCallbackId;
wpi::mutex m_registerMutex;
std::atomic<double> m_angle{0.0};
wpi::mutex m_dataMutex;
double m_angle = 0.0;
double m_angleDiff = 0.0;
std::shared_ptr<NotifyListenerVector> m_angleCallbacks = nullptr;
static const double ANGLE_LSB;
static const double kAngleLsb;
// The maximum difference that can fit inside of the shifted and masked data
// field, per transaction
static const double kMaxAngleDeltaPerMessage;
static const int kPacketSize;
};
} // namespace hal