mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[hal] Remove HAL_GetPort (#7754)
This commit is contained in:
@@ -19,8 +19,7 @@ AddressableLED::AddressableLED(int port) : m_port{port} {
|
||||
int32_t status = 0;
|
||||
|
||||
auto stack = wpi::GetStackTrace(1);
|
||||
m_pwmHandle =
|
||||
HAL_InitializePWMPort(HAL_GetPort(port), stack.c_str(), &status);
|
||||
m_pwmHandle = HAL_InitializePWMPort(port, stack.c_str(), &status);
|
||||
FRC_CheckErrorStatus(status, "Port {}", port);
|
||||
if (m_pwmHandle == HAL_kInvalidHandle) {
|
||||
return;
|
||||
|
||||
@@ -26,11 +26,9 @@ AnalogInput::AnalogInput(int channel) {
|
||||
}
|
||||
|
||||
m_channel = channel;
|
||||
|
||||
HAL_PortHandle port = HAL_GetPort(channel);
|
||||
int32_t status = 0;
|
||||
std::string stackTrace = wpi::GetStackTrace(1);
|
||||
m_port = HAL_InitializeAnalogInputPort(port, stackTrace.c_str(), &status);
|
||||
m_port = HAL_InitializeAnalogInputPort(channel, stackTrace.c_str(), &status);
|
||||
FRC_CheckErrorStatus(status, "Channel {}", channel);
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_AnalogChannel, channel + 1);
|
||||
|
||||
@@ -27,8 +27,7 @@ DigitalInput::DigitalInput(int channel) {
|
||||
|
||||
int32_t status = 0;
|
||||
std::string stackTrace = wpi::GetStackTrace(1);
|
||||
m_handle = HAL_InitializeDIOPort(HAL_GetPort(channel), true,
|
||||
stackTrace.c_str(), &status);
|
||||
m_handle = HAL_InitializeDIOPort(channel, true, stackTrace.c_str(), &status);
|
||||
FRC_CheckErrorStatus(status, "Channel {}", channel);
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_DigitalInput, channel + 1);
|
||||
|
||||
@@ -28,8 +28,7 @@ DigitalOutput::DigitalOutput(int channel) {
|
||||
|
||||
int32_t status = 0;
|
||||
std::string stackTrace = wpi::GetStackTrace(1);
|
||||
m_handle = HAL_InitializeDIOPort(HAL_GetPort(channel), false,
|
||||
stackTrace.c_str(), &status);
|
||||
m_handle = HAL_InitializeDIOPort(channel, false, stackTrace.c_str(), &status);
|
||||
FRC_CheckErrorStatus(status, "Channel {}", channel);
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_DigitalOutput, channel + 1);
|
||||
|
||||
@@ -29,8 +29,7 @@ DutyCycle::DutyCycle(int channel) : m_channel{channel} {
|
||||
void DutyCycle::InitDutyCycle() {
|
||||
int32_t status = 0;
|
||||
std::string stackTrace = wpi::GetStackTrace(1);
|
||||
m_handle = HAL_InitializeDutyCycle(HAL_GetPort(m_channel), stackTrace.c_str(),
|
||||
&status);
|
||||
m_handle = HAL_InitializeDutyCycle(m_channel, stackTrace.c_str(), &status);
|
||||
FRC_CheckErrorStatus(status, "Channel {}", GetSourceChannel());
|
||||
HAL_Report(HALUsageReporting::kResourceType_DutyCycle, m_channel + 1);
|
||||
wpi::SendableRegistry::Add(this, "Duty Cycle", m_channel);
|
||||
|
||||
@@ -26,8 +26,7 @@ PWM::PWM(int channel, bool registerSendable) {
|
||||
|
||||
auto stack = wpi::GetStackTrace(1);
|
||||
int32_t status = 0;
|
||||
m_handle =
|
||||
HAL_InitializePWMPort(HAL_GetPort(channel), stack.c_str(), &status);
|
||||
m_handle = HAL_InitializePWMPort(channel, stack.c_str(), &status);
|
||||
FRC_CheckErrorStatus(status, "Channel {}", channel);
|
||||
|
||||
m_channel = channel;
|
||||
|
||||
Reference in New Issue
Block a user