mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Add ability to associate other devices with a SimDevice
Implemented only for AnalogInput, DIO, and Encoder.
This commit is contained in:
@@ -63,8 +63,8 @@ HAL_DigitalHandle HAL_InitializeDIOPort(HAL_PortHandle portHandle,
|
||||
port->channel = static_cast<uint8_t>(channel);
|
||||
|
||||
SimDIOData[channel].initialized = true;
|
||||
|
||||
SimDIOData[channel].isInput = input;
|
||||
SimDIOData[channel].simDevice = 0;
|
||||
|
||||
return handle;
|
||||
}
|
||||
@@ -81,6 +81,12 @@ void HAL_FreeDIOPort(HAL_DigitalHandle dioPortHandle) {
|
||||
SimDIOData[port->channel].initialized = false;
|
||||
}
|
||||
|
||||
void HAL_SetDIOSimDevice(HAL_DigitalHandle handle, HAL_SimDeviceHandle device) {
|
||||
auto port = digitalChannelHandles->Get(handle, HAL_HandleEnum::DIO);
|
||||
if (port == nullptr) return;
|
||||
SimDIOData[port->channel].simDevice = device;
|
||||
}
|
||||
|
||||
HAL_DigitalPWMHandle HAL_AllocateDigitalPWM(int32_t* status) {
|
||||
auto handle = digitalPWMHandles->Allocate();
|
||||
if (handle == HAL_kInvalidHandle) {
|
||||
|
||||
Reference in New Issue
Block a user