mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[hal, wpilib] Remove DigitalSource and AnalogTrigger (#7753)
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#include "DigitalInternal.h"
|
||||
|
||||
#include "PortsInternal.h"
|
||||
#include "hal/AnalogTrigger.h"
|
||||
#include "hal/Errors.h"
|
||||
#include "hal/handles/DigitalHandleResource.h"
|
||||
#include "hal/handles/HandlesInternal.h"
|
||||
@@ -25,33 +24,6 @@ void InitializeDigitalInternal() {
|
||||
}
|
||||
} // namespace init
|
||||
|
||||
bool remapDigitalSource(HAL_Handle digitalSourceHandle,
|
||||
HAL_AnalogTriggerType analogTriggerType,
|
||||
uint8_t& channel, uint8_t& module,
|
||||
bool& analogTrigger) {
|
||||
if (isHandleType(digitalSourceHandle, HAL_HandleEnum::AnalogTrigger)) {
|
||||
// If handle passed, index is not negative
|
||||
int32_t index = getHandleIndex(digitalSourceHandle);
|
||||
channel = (index << 2) + analogTriggerType;
|
||||
module = channel >> 4;
|
||||
analogTrigger = true;
|
||||
return true;
|
||||
} else if (isHandleType(digitalSourceHandle, HAL_HandleEnum::DIO)) {
|
||||
int32_t index = getHandleIndex(digitalSourceHandle);
|
||||
if (index >= kNumDigitalHeaders) {
|
||||
channel = remapMXPChannel(index);
|
||||
module = 1;
|
||||
} else {
|
||||
channel = index;
|
||||
module = 0;
|
||||
}
|
||||
analogTrigger = false;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t remapMXPChannel(int32_t channel) {
|
||||
return channel - 10;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user