mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpiutil,hal] Move C++ Handle wrapper to wpiutil (#8935)
Also move WPI_Handle typedef to its own header (util/Handle.h).
This commit is contained in:
@@ -6,10 +6,10 @@
|
||||
|
||||
#include "EdgeConfiguration.hpp"
|
||||
#include "wpi/hal/Counter.h"
|
||||
#include "wpi/hal/Types.hpp"
|
||||
#include "wpi/units/angular_velocity.hpp"
|
||||
#include "wpi/units/frequency.hpp"
|
||||
#include "wpi/units/time.hpp"
|
||||
#include "wpi/util/Handle.hpp"
|
||||
#include "wpi/util/sendable/Sendable.hpp"
|
||||
#include "wpi/util/sendable/SendableHelper.hpp"
|
||||
|
||||
@@ -110,7 +110,7 @@ class Tachometer : public wpi::util::Sendable,
|
||||
void InitSendable(wpi::util::SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
wpi::hal::Handle<HAL_CounterHandle, HAL_FreeCounter> m_handle;
|
||||
wpi::util::Handle<HAL_CounterHandle, HAL_FreeCounter> m_handle;
|
||||
int m_edgesPerRevolution;
|
||||
int32_t m_channel;
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "EdgeConfiguration.hpp"
|
||||
#include "wpi/hal/Counter.h"
|
||||
#include "wpi/hal/Types.hpp"
|
||||
#include "wpi/util/Handle.hpp"
|
||||
#include "wpi/util/sendable/Sendable.hpp"
|
||||
#include "wpi/util/sendable/SendableHelper.hpp"
|
||||
|
||||
@@ -54,7 +54,7 @@ class UpDownCounter : public wpi::util::Sendable,
|
||||
void InitSendable(wpi::util::SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
wpi::hal::Handle<HAL_CounterHandle, HAL_FreeCounter> m_handle;
|
||||
wpi::util::Handle<HAL_CounterHandle, HAL_FreeCounter> m_handle;
|
||||
int32_t m_channel;
|
||||
};
|
||||
} // namespace wpi
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <string_view>
|
||||
|
||||
#include "wpi/hal/Alert.h"
|
||||
#include "wpi/hal/Types.hpp"
|
||||
#include "wpi/util/Handle.hpp"
|
||||
|
||||
namespace wpi {
|
||||
|
||||
@@ -116,7 +116,7 @@ class Alert {
|
||||
|
||||
private:
|
||||
Level m_type;
|
||||
wpi::hal::Handle<HAL_AlertHandle, HAL_DestroyAlert> m_handle;
|
||||
wpi::util::Handle<HAL_AlertHandle, HAL_DestroyAlert> m_handle;
|
||||
};
|
||||
|
||||
} // namespace wpi
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
#include "wpi/framework/IterativeRobotBase.hpp"
|
||||
#include "wpi/hal/Notifier.hpp"
|
||||
#include "wpi/hal/Types.hpp"
|
||||
#include "wpi/internal/PeriodicPriorityQueue.hpp"
|
||||
#include "wpi/units/frequency.hpp"
|
||||
#include "wpi/units/time.hpp"
|
||||
#include "wpi/util/Handle.hpp"
|
||||
|
||||
namespace wpi {
|
||||
|
||||
@@ -88,7 +88,7 @@ class TimedRobot : public IterativeRobotBase {
|
||||
wpi::units::second_t offset = 0_s);
|
||||
|
||||
protected:
|
||||
wpi::hal::Handle<HAL_NotifierHandle, HAL_DestroyNotifier> m_notifier;
|
||||
wpi::util::Handle<HAL_NotifierHandle, HAL_DestroyNotifier> m_notifier;
|
||||
std::chrono::microseconds m_startTime;
|
||||
|
||||
private:
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "wpi/hal/CANAPI.h"
|
||||
#include "wpi/hal/Types.hpp"
|
||||
#include "wpi/util/Handle.hpp"
|
||||
|
||||
namespace wpi {
|
||||
|
||||
@@ -155,6 +155,6 @@ class CAN {
|
||||
HAL_CAN_DEV_MISCELLANEOUS;
|
||||
|
||||
private:
|
||||
wpi::hal::Handle<HAL_CANHandle, HAL_CleanCAN> m_handle;
|
||||
wpi::util::Handle<HAL_CANHandle, HAL_CleanCAN> m_handle;
|
||||
};
|
||||
} // namespace wpi
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "wpi/hal/I2C.h"
|
||||
#include "wpi/hal/I2CTypes.h"
|
||||
#include "wpi/hal/Types.hpp"
|
||||
#include "wpi/util/Handle.hpp"
|
||||
|
||||
namespace wpi {
|
||||
|
||||
@@ -154,7 +154,7 @@ class I2C {
|
||||
bool VerifySensor(int registerAddress, int count, const uint8_t* expected);
|
||||
|
||||
private:
|
||||
wpi::hal::Handle<HAL_I2CPort, HAL_CloseI2C, HAL_I2C_PORT_INVALID> m_port;
|
||||
wpi::util::Handle<HAL_I2CPort, HAL_CloseI2C, HAL_I2C_PORT_INVALID> m_port;
|
||||
int m_deviceAddress;
|
||||
};
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
#include <string_view>
|
||||
|
||||
#include "wpi/hal/SerialPort.h"
|
||||
#include "wpi/hal/Types.hpp"
|
||||
#include "wpi/units/time.hpp"
|
||||
#include "wpi/util/Handle.hpp"
|
||||
|
||||
namespace wpi {
|
||||
|
||||
@@ -253,7 +253,7 @@ class SerialPort {
|
||||
void Reset();
|
||||
|
||||
private:
|
||||
wpi::hal::Handle<HAL_SerialPortHandle, HAL_CloseSerial> m_portHandle;
|
||||
wpi::util::Handle<HAL_SerialPortHandle, HAL_CloseSerial> m_portHandle;
|
||||
};
|
||||
|
||||
} // namespace wpi
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "wpi/hal/AnalogInput.h"
|
||||
#include "wpi/hal/Types.hpp"
|
||||
#include "wpi/util/Handle.hpp"
|
||||
#include "wpi/util/sendable/Sendable.hpp"
|
||||
#include "wpi/util/sendable/SendableHelper.hpp"
|
||||
|
||||
@@ -78,7 +78,7 @@ class AnalogInput : public wpi::util::Sendable,
|
||||
|
||||
private:
|
||||
int m_channel;
|
||||
wpi::hal::Handle<HAL_AnalogInputHandle, HAL_FreeAnalogInputPort> m_port;
|
||||
wpi::util::Handle<HAL_AnalogInputHandle, HAL_FreeAnalogInputPort> m_port;
|
||||
};
|
||||
|
||||
} // namespace wpi
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "wpi/hal/DIO.h"
|
||||
#include "wpi/hal/Types.hpp"
|
||||
#include "wpi/util/Handle.hpp"
|
||||
#include "wpi/util/sendable/Sendable.hpp"
|
||||
#include "wpi/util/sendable/SendableHelper.hpp"
|
||||
|
||||
@@ -60,7 +60,7 @@ class DigitalInput : public wpi::util::Sendable,
|
||||
|
||||
private:
|
||||
int m_channel;
|
||||
wpi::hal::Handle<HAL_DigitalHandle, HAL_FreeDIOPort> m_handle;
|
||||
wpi::util::Handle<HAL_DigitalHandle, HAL_FreeDIOPort> m_handle;
|
||||
};
|
||||
|
||||
} // namespace wpi
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "wpi/hal/DIO.h"
|
||||
#include "wpi/hal/Types.hpp"
|
||||
#include "wpi/units/time.hpp"
|
||||
#include "wpi/util/Handle.hpp"
|
||||
#include "wpi/util/sendable/Sendable.hpp"
|
||||
#include "wpi/util/sendable/SendableHelper.hpp"
|
||||
|
||||
@@ -142,8 +142,8 @@ class DigitalOutput : public wpi::util::Sendable,
|
||||
|
||||
private:
|
||||
int m_channel;
|
||||
wpi::hal::Handle<HAL_DigitalHandle, HAL_FreeDIOPort> m_handle;
|
||||
wpi::hal::Handle<HAL_DigitalPWMHandle> m_pwmGenerator;
|
||||
wpi::util::Handle<HAL_DigitalHandle, HAL_FreeDIOPort> m_handle;
|
||||
wpi::util::Handle<HAL_DigitalPWMHandle> m_pwmGenerator;
|
||||
};
|
||||
|
||||
} // namespace wpi
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "wpi/hal/PWM.h"
|
||||
#include "wpi/hal/Types.hpp"
|
||||
#include "wpi/units/time.hpp"
|
||||
#include "wpi/util/Handle.hpp"
|
||||
#include "wpi/util/sendable/Sendable.hpp"
|
||||
#include "wpi/util/sendable/SendableHelper.hpp"
|
||||
|
||||
@@ -90,7 +90,7 @@ class PWM : public wpi::util::Sendable, public wpi::util::SendableHelper<PWM> {
|
||||
|
||||
private:
|
||||
int m_channel;
|
||||
wpi::hal::Handle<HAL_DigitalHandle, HAL_FreePWMPort> m_handle;
|
||||
wpi::util::Handle<HAL_DigitalHandle, HAL_FreePWMPort> m_handle;
|
||||
};
|
||||
|
||||
} // namespace wpi
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
#include "wpi/hal/AddressableLED.h"
|
||||
#include "wpi/hal/AddressableLEDTypes.h"
|
||||
#include "wpi/hal/Types.hpp"
|
||||
#include "wpi/util/Color.hpp"
|
||||
#include "wpi/util/Color8Bit.hpp"
|
||||
#include "wpi/util/Handle.hpp"
|
||||
|
||||
namespace wpi {
|
||||
|
||||
@@ -170,7 +170,7 @@ class AddressableLED {
|
||||
std::span<const LEDData> ledData);
|
||||
|
||||
private:
|
||||
wpi::hal::Handle<HAL_AddressableLEDHandle, HAL_FreeAddressableLED> m_handle;
|
||||
wpi::util::Handle<HAL_AddressableLEDHandle, HAL_FreeAddressableLED> m_handle;
|
||||
int m_channel;
|
||||
int m_start{0};
|
||||
int m_length{0};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "wpi/hal/PowerDistribution.h"
|
||||
#include "wpi/hal/Types.hpp"
|
||||
#include "wpi/util/Handle.hpp"
|
||||
#include "wpi/util/sendable/Sendable.hpp"
|
||||
#include "wpi/util/sendable/SendableHelper.hpp"
|
||||
|
||||
@@ -346,7 +346,7 @@ class PowerDistribution : public wpi::util::Sendable,
|
||||
void InitSendable(wpi::util::SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
wpi::hal::Handle<HAL_PowerDistributionHandle, HAL_CleanPowerDistribution>
|
||||
wpi::util::Handle<HAL_PowerDistributionHandle, HAL_CleanPowerDistribution>
|
||||
m_handle;
|
||||
int m_module;
|
||||
};
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "wpi/hal/DutyCycle.h"
|
||||
#include "wpi/hal/Types.hpp"
|
||||
#include "wpi/units/frequency.hpp"
|
||||
#include "wpi/units/time.hpp"
|
||||
#include "wpi/util/Handle.hpp"
|
||||
#include "wpi/util/sendable/Sendable.hpp"
|
||||
#include "wpi/util/sendable/SendableHelper.hpp"
|
||||
|
||||
@@ -72,6 +72,6 @@ class DutyCycle : public wpi::util::Sendable,
|
||||
private:
|
||||
void InitDutyCycle();
|
||||
int m_channel;
|
||||
wpi::hal::Handle<HAL_DutyCycleHandle, HAL_FreeDutyCycle> m_handle;
|
||||
wpi::util::Handle<HAL_DutyCycleHandle, HAL_FreeDutyCycle> m_handle;
|
||||
};
|
||||
} // namespace wpi
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "wpi/hal/Encoder.h"
|
||||
#include "wpi/hal/Types.hpp"
|
||||
#include "wpi/hardware/discrete/CounterBase.hpp"
|
||||
#include "wpi/util/Handle.hpp"
|
||||
#include "wpi/util/sendable/Sendable.hpp"
|
||||
#include "wpi/util/sendable/SendableHelper.hpp"
|
||||
|
||||
@@ -272,7 +272,7 @@ class Encoder : public CounterBase,
|
||||
*/
|
||||
double DecodingScaleFactor() const;
|
||||
|
||||
wpi::hal::Handle<HAL_EncoderHandle, HAL_FreeEncoder> m_encoder;
|
||||
wpi::util::Handle<HAL_EncoderHandle, HAL_FreeEncoder> m_encoder;
|
||||
};
|
||||
|
||||
} // namespace wpi
|
||||
|
||||
Reference in New Issue
Block a user