mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
Switches HAL to fixed length signed integers, and adds our own HAL_Bool Type (#155)
* Switches HAL to fixed length signed integers, and adds our own HAL_Bool type * Replaces HAL Floats with Doubles Doubles are just as fast as floats with optimizations turned on, so switches to all doubles. All made doubles for consistency. * Prepends HAL/ to HAL include files. Also fixes some range errors
This commit is contained in:
committed by
Peter Johnson
parent
4a98e68815
commit
b51e85ae26
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "GyroBase.h"
|
||||
|
||||
#include "HAL/Handles.h"
|
||||
#include "HAL/Types.h"
|
||||
|
||||
class AnalogInput;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "HAL/Handles.h"
|
||||
#include "HAL/Types.h"
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "PIDSource.h"
|
||||
#include "SensorBase.h"
|
||||
@@ -40,7 +40,7 @@ class AnalogInput : public SensorBase,
|
||||
explicit AnalogInput(uint32_t channel);
|
||||
virtual ~AnalogInput();
|
||||
|
||||
int16_t GetValue() const;
|
||||
int32_t GetValue() const;
|
||||
int32_t GetAverageValue() const;
|
||||
|
||||
float GetVoltage() const;
|
||||
@@ -48,12 +48,12 @@ class AnalogInput : public SensorBase,
|
||||
|
||||
uint32_t GetChannel() const;
|
||||
|
||||
void SetAverageBits(uint32_t bits);
|
||||
uint32_t GetAverageBits() const;
|
||||
void SetOversampleBits(uint32_t bits);
|
||||
uint32_t GetOversampleBits() const;
|
||||
void SetAverageBits(int32_t bits);
|
||||
int32_t GetAverageBits() const;
|
||||
void SetOversampleBits(int32_t bits);
|
||||
int32_t GetOversampleBits() const;
|
||||
|
||||
uint32_t GetLSBWeight() const;
|
||||
int32_t GetLSBWeight() const;
|
||||
int32_t GetOffset() const;
|
||||
|
||||
bool IsAccumulatorChannel() const;
|
||||
@@ -63,8 +63,8 @@ class AnalogInput : public SensorBase,
|
||||
void SetAccumulatorCenter(int32_t center);
|
||||
void SetAccumulatorDeadband(int32_t deadband);
|
||||
int64_t GetAccumulatorValue() const;
|
||||
uint32_t GetAccumulatorCount() const;
|
||||
void GetAccumulatorOutput(int64_t& value, uint32_t& count) const;
|
||||
int64_t GetAccumulatorCount() const;
|
||||
void GetAccumulatorOutput(int64_t& value, int64_t& count) const;
|
||||
|
||||
static void SetSampleRate(float samplesPerSecond);
|
||||
static float GetSampleRate();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "AnalogTriggerOutput.h"
|
||||
#include "HAL/Handles.h"
|
||||
#include "HAL/Types.h"
|
||||
#include "SensorBase.h"
|
||||
|
||||
class AnalogInput;
|
||||
@@ -25,7 +25,7 @@ class AnalogTrigger : public SensorBase {
|
||||
void SetLimitsRaw(int32_t lower, int32_t upper);
|
||||
void SetAveraged(bool useAveragedValue);
|
||||
void SetFiltered(bool useFilteredValue);
|
||||
uint32_t GetIndex() const;
|
||||
int32_t GetIndex() const;
|
||||
bool GetInWindow();
|
||||
bool GetTriggerState();
|
||||
std::shared_ptr<AnalogTriggerOutput> CreateOutput(
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "HAL/Handles.h"
|
||||
#include "HAL/Types.h"
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "SensorBase.h"
|
||||
#include "tables/ITableListener.h"
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
|
||||
class ControllerPower {
|
||||
public:
|
||||
static double GetInputVoltage();
|
||||
static double GetInputCurrent();
|
||||
static double GetVoltage3V3();
|
||||
static double GetCurrent3V3();
|
||||
static float GetInputVoltage();
|
||||
static float GetInputCurrent();
|
||||
static float GetVoltage3V3();
|
||||
static float GetCurrent3V3();
|
||||
static bool GetEnabled3V3();
|
||||
static int GetFaultCount3V3();
|
||||
static double GetVoltage5V();
|
||||
static double GetCurrent5V();
|
||||
static float GetVoltage5V();
|
||||
static float GetCurrent5V();
|
||||
static bool GetEnabled5V();
|
||||
static int GetFaultCount5V();
|
||||
static double GetVoltage6V();
|
||||
static double GetCurrent6V();
|
||||
static float GetVoltage6V();
|
||||
static float GetCurrent6V();
|
||||
static bool GetEnabled6V();
|
||||
static int GetFaultCount6V();
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "AnalogTrigger.h"
|
||||
#include "CounterBase.h"
|
||||
#include "HAL/Counter.h"
|
||||
#include "HAL/Handles.h"
|
||||
#include "HAL/Types.h"
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "SensorBase.h"
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "DigitalSource.h"
|
||||
#include "HAL/Handles.h"
|
||||
#include "HAL/Types.h"
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "tables/ITableListener.h"
|
||||
|
||||
@@ -26,7 +26,7 @@ class DigitalOutput : public DigitalSource,
|
||||
public:
|
||||
explicit DigitalOutput(uint32_t channel);
|
||||
virtual ~DigitalOutput();
|
||||
void Set(uint32_t value);
|
||||
void Set(bool value);
|
||||
uint32_t GetChannel() const override;
|
||||
void Pulse(float length);
|
||||
bool IsPulsing() const;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "HAL/Handles.h"
|
||||
#include "HAL/Types.h"
|
||||
#include "InterruptableSensorBase.h"
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "HAL/Handles.h"
|
||||
#include "HAL/Types.h"
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "SolenoidBase.h"
|
||||
#include "tables/ITableListener.h"
|
||||
|
||||
@@ -66,10 +66,10 @@ class Encoder : public SensorBase,
|
||||
bool GetStopped() const override;
|
||||
bool GetDirection() const override;
|
||||
|
||||
double GetDistance() const;
|
||||
double GetRate() const;
|
||||
void SetMinRate(double minRate);
|
||||
void SetDistancePerPulse(double distancePerPulse);
|
||||
float GetDistance() const;
|
||||
float GetRate() const;
|
||||
void SetMinRate(float minRate);
|
||||
void SetDistancePerPulse(float distancePerPulse);
|
||||
void SetReverseDirection(bool reverseDirection);
|
||||
void SetSamplesToAverage(int samplesToAverage);
|
||||
int GetSamplesToAverage() const;
|
||||
@@ -94,7 +94,7 @@ class Encoder : public SensorBase,
|
||||
private:
|
||||
void InitEncoder(bool reverseDirection, EncodingType encodingType);
|
||||
|
||||
double DecodingScaleFactor() const;
|
||||
float DecodingScaleFactor() const;
|
||||
|
||||
std::shared_ptr<DigitalSource> m_aSource; // the A phase of the quad encoder
|
||||
std::shared_ptr<DigitalSource> m_bSource; // the B phase of the quad encoder
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "HAL/Handles.h"
|
||||
#include "HAL/Types.h"
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "SensorBase.h"
|
||||
#include "tables/ITableListener.h"
|
||||
@@ -53,8 +53,8 @@ class PWM : public SensorBase,
|
||||
void SetPeriodMultiplier(PeriodMultiplier mult);
|
||||
void SetZeroLatch();
|
||||
void EnableDeadbandElimination(bool eliminateDeadband);
|
||||
void SetBounds(double max, double deadbandMax, double center,
|
||||
double deadbandMin, double min);
|
||||
void SetBounds(float max, float deadbandMax, float center, float deadbandMin,
|
||||
float min);
|
||||
void SetRawBounds(int32_t max, int32_t deadbandMax, int32_t center,
|
||||
int32_t deadbandMin, int32_t min);
|
||||
void GetRawBounds(int32_t* max, int32_t* deadbandMax, int32_t* center,
|
||||
|
||||
@@ -21,12 +21,12 @@ class PowerDistributionPanel : public SensorBase, public LiveWindowSendable {
|
||||
PowerDistributionPanel();
|
||||
explicit PowerDistributionPanel(uint8_t module);
|
||||
|
||||
double GetVoltage() const;
|
||||
double GetTemperature() const;
|
||||
double GetCurrent(uint8_t channel) const;
|
||||
double GetTotalCurrent() const;
|
||||
double GetTotalPower() const;
|
||||
double GetTotalEnergy() const;
|
||||
float GetVoltage() const;
|
||||
float GetTemperature() const;
|
||||
float GetCurrent(uint8_t channel) const;
|
||||
float GetTotalCurrent() const;
|
||||
float GetTotalPower() const;
|
||||
float GetTotalEnergy() const;
|
||||
void ResetTotalEnergy();
|
||||
void ClearStickyFaults();
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "HAL/Handles.h"
|
||||
#include "HAL/Types.h"
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "MotorSafety.h"
|
||||
#include "SensorBase.h"
|
||||
|
||||
@@ -57,9 +57,9 @@ class SPI : public SensorBase {
|
||||
void SetAccumulatorDeadband(int32_t deadband);
|
||||
int32_t GetAccumulatorLastValue() const;
|
||||
int64_t GetAccumulatorValue() const;
|
||||
uint32_t GetAccumulatorCount() const;
|
||||
int64_t GetAccumulatorCount() const;
|
||||
double GetAccumulatorAverage() const;
|
||||
void GetAccumulatorOutput(int64_t& value, uint32_t& count) const;
|
||||
void GetAccumulatorOutput(int64_t& value, int64_t& count) const;
|
||||
|
||||
protected:
|
||||
uint8_t m_port;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "HAL/Handles.h"
|
||||
#include "HAL/Types.h"
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "SolenoidBase.h"
|
||||
#include "tables/ITableListener.h"
|
||||
|
||||
Reference in New Issue
Block a user