mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[hal] Remove HAL_GetPort (#7754)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user