[hal] Remove HAL_GetPort (#7754)

This commit is contained in:
Thad House
2025-01-30 18:59:34 -08:00
committed by GitHub
parent 6e704370b3
commit ad29d45dfb
44 changed files with 84 additions and 272 deletions

View File

@@ -28,7 +28,7 @@ public class AddressableLED implements AutoCloseable {
* @param port the output port to use (Must be a PWM header, not on MXP)
*/
public AddressableLED(int port) {
m_pwmHandle = PWMJNI.initializePWMPort(HAL.getPort((byte) port));
m_pwmHandle = PWMJNI.initializePWMPort(port);
m_handle = AddressableLEDJNI.initialize(m_pwmHandle);
HAL.report(tResourceType.kResourceType_AddressableLEDs, port + 1);
}

View File

@@ -38,8 +38,7 @@ public class AnalogInput implements Sendable, AutoCloseable {
AnalogJNI.checkAnalogInputChannel(channel);
m_channel = channel;
final int portHandle = HAL.getPort((byte) channel);
m_port = AnalogJNI.initializeAnalogInputPort(portHandle);
m_port = AnalogJNI.initializeAnalogInputPort(channel);
HAL.report(tResourceType.kResourceType_AnalogChannel, channel + 1);
SendableRegistry.add(this, "AnalogInput", channel);

View File

@@ -32,7 +32,7 @@ public class DigitalInput implements AutoCloseable, Sendable {
SensorUtil.checkDigitalChannel(channel);
m_channel = channel;
m_handle = DIOJNI.initializeDIOPort(HAL.getPort((byte) channel), true);
m_handle = DIOJNI.initializeDIOPort(channel, true);
HAL.report(tResourceType.kResourceType_DigitalInput, channel + 1);
SendableRegistry.add(this, "DigitalInput", channel);

View File

@@ -34,7 +34,7 @@ public class DigitalOutput implements AutoCloseable, Sendable {
SensorUtil.checkDigitalChannel(channel);
m_channel = channel;
m_handle = DIOJNI.initializeDIOPort(HAL.getPort((byte) channel), false);
m_handle = DIOJNI.initializeDIOPort(channel, false);
HAL.report(tResourceType.kResourceType_DigitalOutput, channel + 1);
SendableRegistry.add(this, "DigitalOutput", channel);

View File

@@ -32,7 +32,7 @@ public class DutyCycle implements Sendable, AutoCloseable {
*/
@SuppressWarnings("this-escape")
public DutyCycle(int channel) {
m_handle = DutyCycleJNI.initialize(HAL.getPort((byte) channel));
m_handle = DutyCycleJNI.initialize(channel);
m_channel = channel;
HAL.report(tResourceType.kResourceType_DutyCycle, channel + 1);

View File

@@ -59,7 +59,7 @@ public class PWM implements Sendable, AutoCloseable {
SensorUtil.checkPWMChannel(channel);
m_channel = channel;
m_handle = PWMJNI.initializePWMPort(HAL.getPort((byte) channel));
m_handle = PWMJNI.initializePWMPort(channel);
setDisabled();