mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[sim] Add WPILib-class-taking constructors (#2538)
When not direct mapped, make index constructors private and add factory functions for channel and index. Co-authored-by: GabrielDeml <gabrielddeml@gmail.com>
This commit is contained in:
@@ -13,12 +13,31 @@
|
||||
#include <hal/simulation/AnalogGyroData.h>
|
||||
|
||||
#include "CallbackStore.h"
|
||||
#include "frc/AnalogGyro.h"
|
||||
#include "frc/AnalogInput.h"
|
||||
|
||||
namespace frc {
|
||||
namespace sim {
|
||||
|
||||
/**
|
||||
* Class to control a simulated analog gyro.
|
||||
*/
|
||||
class AnalogGyroSim {
|
||||
public:
|
||||
explicit AnalogGyroSim(int index) { m_index = index; }
|
||||
/**
|
||||
* Constructs from an AnalogGyro object.
|
||||
*
|
||||
* @param gyro AnalogGyro to simulate
|
||||
*/
|
||||
explicit AnalogGyroSim(const AnalogGyro& gyro)
|
||||
: m_index{gyro.GetAnalogInput()->GetChannel()} {}
|
||||
|
||||
/**
|
||||
* Constructs from an analog input channel number.
|
||||
*
|
||||
* @param channel Channel number
|
||||
*/
|
||||
explicit AnalogGyroSim(int channel) : m_index{channel} {}
|
||||
|
||||
std::unique_ptr<CallbackStore> RegisterAngleCallback(NotifyCallback callback,
|
||||
bool initialNotify) {
|
||||
|
||||
Reference in New Issue
Block a user