diff --git a/hal/src/main/java/edu/wpi/first/hal/AnalogJNI.java b/hal/src/main/java/edu/wpi/first/hal/AnalogJNI.java
index dc816cda76..4042863997 100644
--- a/hal/src/main/java/edu/wpi/first/hal/AnalogJNI.java
+++ b/hal/src/main/java/edu/wpi/first/hal/AnalogJNI.java
@@ -13,19 +13,19 @@ public class AnalogJNI extends JNIWrapper {
/**
* Initializes the analog input port using the given port object.
*
- * @param halPortHandle Handle to the port to initialize.
+ * @param channel The smartio channel.
* @return the created analog input handle
* @see "HAL_InitializeAnalogInputPort"
*/
- public static native int initializeAnalogInputPort(int halPortHandle);
+ public static native int initializeAnalogInputPort(int channel);
/**
* Frees an analog input port.
*
- * @param portHandle Handle to the analog port.
+ * @param analogPortHandle Handle to the analog port.
* @see "HAL_FreeAnalogInputPort"
*/
- public static native void freeAnalogInputPort(int portHandle);
+ public static native void freeAnalogInputPort(int analogPortHandle);
/**
* Checks that the analog module number is valid.
diff --git a/hal/src/main/java/edu/wpi/first/hal/DIOJNI.java b/hal/src/main/java/edu/wpi/first/hal/DIOJNI.java
index ad75e3956f..4e4529c0f8 100644
--- a/hal/src/main/java/edu/wpi/first/hal/DIOJNI.java
+++ b/hal/src/main/java/edu/wpi/first/hal/DIOJNI.java
@@ -13,12 +13,12 @@ public class DIOJNI extends JNIWrapper {
/**
* Creates a new instance of a digital port.
*
- * @param halPortHandle the port handle to create from
+ * @param channel the smartio channel
* @param input true for input, false for output
* @return the created digital handle
* @see "HAL_InitializeDIOPort"
*/
- public static native int initializeDIOPort(int halPortHandle, boolean input);
+ public static native int initializeDIOPort(int channel, boolean input);
/**
* Checks if a DIO channel is valid.
diff --git a/hal/src/main/java/edu/wpi/first/hal/DutyCycleJNI.java b/hal/src/main/java/edu/wpi/first/hal/DutyCycleJNI.java
index 6113710b23..37822697ab 100644
--- a/hal/src/main/java/edu/wpi/first/hal/DutyCycleJNI.java
+++ b/hal/src/main/java/edu/wpi/first/hal/DutyCycleJNI.java
@@ -13,11 +13,11 @@ public class DutyCycleJNI extends JNIWrapper {
/**
* Initialize a DutyCycle input.
*
- * @param halPortHandle the port handle to create from
+ * @param channel the smartio channel
* @return the created duty cycle handle
* @see "HAL_InitializeDutyCycle"
*/
- public static native int initialize(int halPortHandle);
+ public static native int initialize(int channel);
/**
* Free a DutyCycle.
diff --git a/hal/src/main/java/edu/wpi/first/hal/HAL.java b/hal/src/main/java/edu/wpi/first/hal/HAL.java
index a14e5f910f..e551ffff16 100644
--- a/hal/src/main/java/edu/wpi/first/hal/HAL.java
+++ b/hal/src/main/java/edu/wpi/first/hal/HAL.java
@@ -211,31 +211,6 @@ public final class HAL extends JNIWrapper {
*/
public static native boolean getSystemTimeValid();
- /**
- * Gets a port handle for a specific channel and module.
- *
- *
This is expected to be used for PCMs, as the roboRIO does not work with modules anymore.
- *
- *
The created handle does not need to be freed.
- *
- * @param module the module number
- * @param channel the channel number
- * @return the created port
- * @see "HAL_GetPortWithModule"
- */
- public static native int getPortWithModule(byte module, byte channel);
-
- /**
- * Gets a port handle for a specific channel.
- *
- *
The created handle does not need to be freed.
- *
- * @param channel the channel number
- * @return the created port
- * @see "HAL_GetPort"
- */
- public static native int getPort(byte channel);
-
/**
* Report the usage of a resource of interest.
*
diff --git a/hal/src/main/java/edu/wpi/first/hal/PWMJNI.java b/hal/src/main/java/edu/wpi/first/hal/PWMJNI.java
index 700b27a2a1..3bb04e8597 100644
--- a/hal/src/main/java/edu/wpi/first/hal/PWMJNI.java
+++ b/hal/src/main/java/edu/wpi/first/hal/PWMJNI.java
@@ -13,10 +13,10 @@ public class PWMJNI extends DIOJNI {
/**
* Initializes a PWM port.
*
- * @param halPortHandle the port to initialize
+ * @param channel the smartio channel
* @return the created pwm handle
*/
- public static native int initializePWMPort(int halPortHandle);
+ public static native int initializePWMPort(int channel);
/**
* Checks if a pwm channel is valid.
diff --git a/hal/src/main/native/cpp/handles/HandlesInternal.cpp b/hal/src/main/native/cpp/handles/HandlesInternal.cpp
index 6436667fb3..ebf2a36250 100644
--- a/hal/src/main/native/cpp/handles/HandlesInternal.cpp
+++ b/hal/src/main/native/cpp/handles/HandlesInternal.cpp
@@ -49,18 +49,6 @@ void HandleBase::ResetGlobalHandles() {
}
}
}
-HAL_PortHandle createPortHandle(uint8_t channel, uint8_t module) {
- // set last 8 bits, then shift to first 8 bits
- HAL_PortHandle handle = static_cast(HAL_HandleEnum::Port);
- handle = handle << 24;
- // shift module and add to 3rd set of 8 bits
- int32_t temp = module;
- temp = (temp << 8) & 0xff00;
- handle += temp;
- // add channel to last 8 bits
- handle += channel;
- return handle;
-}
HAL_Handle createHandle(int16_t index, HAL_HandleEnum handleType,
int16_t version) {
if (index < 0) {
diff --git a/hal/src/main/native/cpp/jni/AnalogJNI.cpp b/hal/src/main/native/cpp/jni/AnalogJNI.cpp
index f3081b877a..e09c6fb746 100644
--- a/hal/src/main/native/cpp/jni/AnalogJNI.cpp
+++ b/hal/src/main/native/cpp/jni/AnalogJNI.cpp
@@ -25,12 +25,11 @@ extern "C" {
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_AnalogJNI_initializeAnalogInputPort
- (JNIEnv* env, jclass, jint id)
+ (JNIEnv* env, jclass, jint channel)
{
int32_t status = 0;
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
- auto analog =
- HAL_InitializeAnalogInputPort((HAL_PortHandle)id, stack.c_str(), &status);
+ auto analog = HAL_InitializeAnalogInputPort(channel, stack.c_str(), &status);
CheckStatusForceThrow(env, status);
return (jint)analog;
}
diff --git a/hal/src/main/native/cpp/jni/DIOJNI.cpp b/hal/src/main/native/cpp/jni/DIOJNI.cpp
index 788fe3414e..6bc36fe4e5 100644
--- a/hal/src/main/native/cpp/jni/DIOJNI.cpp
+++ b/hal/src/main/native/cpp/jni/DIOJNI.cpp
@@ -26,12 +26,12 @@ extern "C" {
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_DIOJNI_initializeDIOPort
- (JNIEnv* env, jclass, jint id, jboolean input)
+ (JNIEnv* env, jclass, jint channel, jboolean input)
{
int32_t status = 0;
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
- auto dio = HAL_InitializeDIOPort(
- (HAL_PortHandle)id, static_cast(input), stack.c_str(), &status);
+ auto dio = HAL_InitializeDIOPort(channel, static_cast(input),
+ stack.c_str(), &status);
CheckStatusForceThrow(env, status);
return (jint)dio;
}
diff --git a/hal/src/main/native/cpp/jni/DutyCycleJNI.cpp b/hal/src/main/native/cpp/jni/DutyCycleJNI.cpp
index 3908d4aaa8..be67458b5a 100644
--- a/hal/src/main/native/cpp/jni/DutyCycleJNI.cpp
+++ b/hal/src/main/native/cpp/jni/DutyCycleJNI.cpp
@@ -20,12 +20,11 @@ extern "C" {
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_DutyCycleJNI_initialize
- (JNIEnv* env, jclass, jint portHandle)
+ (JNIEnv* env, jclass, jint channel)
{
int32_t status = 0;
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
- auto handle = HAL_InitializeDutyCycle(static_cast(portHandle),
- stack.c_str(), &status);
+ auto handle = HAL_InitializeDutyCycle(channel, stack.c_str(), &status);
CheckStatus(env, status);
return handle;
}
diff --git a/hal/src/main/native/cpp/jni/HAL.cpp b/hal/src/main/native/cpp/jni/HAL.cpp
index bfde2c2824..837daa67be 100644
--- a/hal/src/main/native/cpp/jni/HAL.cpp
+++ b/hal/src/main/native/cpp/jni/HAL.cpp
@@ -199,30 +199,4 @@ Java_edu_wpi_first_hal_HAL_getSystemTimeValid
return val;
}
-/*
- * Class: edu_wpi_first_hal_HAL
- * Method: getPortWithModule
- * Signature: (BB)I
- */
-JNIEXPORT jint JNICALL
-Java_edu_wpi_first_hal_HAL_getPortWithModule
- (JNIEnv* env, jclass, jbyte module, jbyte channel)
-{
- HAL_PortHandle port = HAL_GetPortWithModule(module, channel);
- return (jint)port;
-}
-
-/*
- * Class: edu_wpi_first_hal_HAL
- * Method: getPort
- * Signature: (B)I
- */
-JNIEXPORT jint JNICALL
-Java_edu_wpi_first_hal_HAL_getPort
- (JNIEnv* env, jclass, jbyte channel)
-{
- HAL_PortHandle port = HAL_GetPort(channel);
- return (jint)port;
-}
-
} // extern "C"
diff --git a/hal/src/main/native/cpp/jni/PWMJNI.cpp b/hal/src/main/native/cpp/jni/PWMJNI.cpp
index b7a8b1e102..c7d02377ff 100644
--- a/hal/src/main/native/cpp/jni/PWMJNI.cpp
+++ b/hal/src/main/native/cpp/jni/PWMJNI.cpp
@@ -26,11 +26,11 @@ extern "C" {
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_PWMJNI_initializePWMPort
- (JNIEnv* env, jclass, jint id)
+ (JNIEnv* env, jclass, jint channel)
{
int32_t status = 0;
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
- auto pwm = HAL_InitializePWMPort((HAL_PortHandle)id, stack.c_str(), &status);
+ auto pwm = HAL_InitializePWMPort(channel, stack.c_str(), &status);
CheckStatusForceThrow(env, status);
return (jint)pwm;
}
diff --git a/hal/src/main/native/include/hal/AnalogInput.h b/hal/src/main/native/include/hal/AnalogInput.h
index 7075544ff1..47dc979e89 100644
--- a/hal/src/main/native/include/hal/AnalogInput.h
+++ b/hal/src/main/native/include/hal/AnalogInput.h
@@ -21,14 +21,14 @@ extern "C" {
/**
* Initializes the analog input port using the given port object.
*
- * @param[in] portHandle Handle to the port to initialize.
+ * @param[in] channel the smartio channel.
* @param[in] allocationLocation the location where the allocation is occurring
* (can be null)
* @param[out] status the error code, or 0 for success
* @return the created analog input handle
*/
HAL_AnalogInputHandle HAL_InitializeAnalogInputPort(
- HAL_PortHandle portHandle, const char* allocationLocation, int32_t* status);
+ int32_t channel, const char* allocationLocation, int32_t* status);
/**
* Frees an analog input port.
diff --git a/hal/src/main/native/include/hal/DIO.h b/hal/src/main/native/include/hal/DIO.h
index f62e7451ad..e9e9119781 100644
--- a/hal/src/main/native/include/hal/DIO.h
+++ b/hal/src/main/native/include/hal/DIO.h
@@ -21,15 +21,14 @@ extern "C" {
/**
* Creates a new instance of a digital port.
*
- * @param[in] portHandle the port handle to create from
+ * @param[in] channel the smartio channel
* @param[in] input true for input, false for output
* @param[in] allocationLocation the location where the allocation is occurring
* (can be null)
* @param[out] status Error status variable. 0 on success.
* @return the created digital handle
*/
-HAL_DigitalHandle HAL_InitializeDIOPort(HAL_PortHandle portHandle,
- HAL_Bool input,
+HAL_DigitalHandle HAL_InitializeDIOPort(int32_t channel, HAL_Bool input,
const char* allocationLocation,
int32_t* status);
diff --git a/hal/src/main/native/include/hal/DutyCycle.h b/hal/src/main/native/include/hal/DutyCycle.h
index 522f2fad02..4eaa26d142 100644
--- a/hal/src/main/native/include/hal/DutyCycle.h
+++ b/hal/src/main/native/include/hal/DutyCycle.h
@@ -19,13 +19,13 @@ extern "C" {
/**
* Initialize a DutyCycle input.
*
- * @param[in] portHandle the port handle to create from
+ * @param[in] channel the smartio channel
* @param[in] allocationLocation the location where the allocation is occurring
* (can be null)
* @param[out] status Error status variable. 0 on success.
* @return the created duty cycle handle
*/
-HAL_DutyCycleHandle HAL_InitializeDutyCycle(HAL_PortHandle portHandle,
+HAL_DutyCycleHandle HAL_InitializeDutyCycle(int32_t channel,
const char* allocationLocation,
int32_t* status);
diff --git a/hal/src/main/native/include/hal/HALBase.h b/hal/src/main/native/include/hal/HALBase.h
index 9ce3408966..95e3a5f28e 100644
--- a/hal/src/main/native/include/hal/HALBase.h
+++ b/hal/src/main/native/include/hal/HALBase.h
@@ -148,30 +148,6 @@ HAL_Bool HAL_GetBrownedOut(int32_t* status);
*/
int32_t HAL_GetCommsDisableCount(int32_t* status);
-/**
- * Gets a port handle for a specific channel.
- *
- * The created handle does not need to be freed.
- *
- * @param channel the channel number
- * @return the created port
- */
-HAL_PortHandle HAL_GetPort(int32_t channel);
-
-/**
- * Gets a port handle for a specific channel and module.
- *
- * This is expected to be used for PCMs, as the roboRIO does not work with
- * modules anymore.
- *
- * The created handle does not need to be freed.
- *
- * @param module the module number
- * @param channel the channel number
- * @return the created port
- */
-HAL_PortHandle HAL_GetPortWithModule(int32_t module, int32_t channel);
-
/**
* Reads the microsecond-resolution timer on the FPGA.
*
diff --git a/hal/src/main/native/include/hal/PWM.h b/hal/src/main/native/include/hal/PWM.h
index ad67535e75..04884b08ac 100644
--- a/hal/src/main/native/include/hal/PWM.h
+++ b/hal/src/main/native/include/hal/PWM.h
@@ -21,13 +21,13 @@ extern "C" {
/**
* Initializes a PWM port.
*
- * @param[in] portHandle the port to initialize
+ * @param[in] channel the smartio channel
* @param[in] allocationLocation the location where the allocation is occurring
* (can be null)
* @param[out] status Error status variable. 0 on success.
* @return the created pwm handle
*/
-HAL_DigitalHandle HAL_InitializePWMPort(HAL_PortHandle portHandle,
+HAL_DigitalHandle HAL_InitializePWMPort(int32_t channel,
const char* allocationLocation,
int32_t* status);
diff --git a/hal/src/main/native/include/hal/Types.h b/hal/src/main/native/include/hal/Types.h
index 1abb16e477..265bf88fad 100644
--- a/hal/src/main/native/include/hal/Types.h
+++ b/hal/src/main/native/include/hal/Types.h
@@ -16,8 +16,6 @@
typedef int32_t HAL_Handle;
-typedef HAL_Handle HAL_PortHandle;
-
typedef HAL_Handle HAL_AnalogInputHandle;
typedef HAL_Handle HAL_AnalogOutputHandle;
diff --git a/hal/src/main/native/include/hal/handles/HandlesInternal.h b/hal/src/main/native/include/hal/handles/HandlesInternal.h
index 6b31f6e30b..71f62f81df 100644
--- a/hal/src/main/native/include/hal/handles/HandlesInternal.h
+++ b/hal/src/main/native/include/hal/handles/HandlesInternal.h
@@ -153,43 +153,6 @@ inline int16_t getHandleTypedIndex(HAL_Handle handle, HAL_HandleEnum enumType,
* Bit 31: 1 if handle error, 0 if no error
*/
-// using a 16 bit value so we can store 0-255 and still report error
-/**
- * Gets the port channel of a port handle.
- *
- * @param handle the port handle
- * @return the port channel
- */
-inline int16_t getPortHandleChannel(HAL_PortHandle handle) {
- if (!isHandleType(handle, HAL_HandleEnum::Port)) {
- return InvalidHandleIndex;
- }
- return static_cast(handle & 0xff);
-}
-
-// using a 16 bit value so we can store 0-255 and still report error
-/**
- * Gets the port module of a port handle.
- *
- * @param handle the port handle
- * @return the port module
- */
-inline int16_t getPortHandleModule(HAL_PortHandle handle) {
- if (!isHandleType(handle, HAL_HandleEnum::Port)) {
- return InvalidHandleIndex;
- }
- return static_cast((handle >> 8) & 0xff);
-}
-
-/**
- * Create a port handle.
- *
- * @param channel the channel
- * @param module the module
- * @return port handle for the module and channel
- */
-HAL_PortHandle createPortHandle(uint8_t channel, uint8_t module);
-
/**
* Create a handle for a specific index, type and version.
*
diff --git a/hal/src/main/native/sim/AnalogInput.cpp b/hal/src/main/native/sim/AnalogInput.cpp
index 40cbe07306..95e5102a40 100644
--- a/hal/src/main/native/sim/AnalogInput.cpp
+++ b/hal/src/main/native/sim/AnalogInput.cpp
@@ -19,11 +19,9 @@ void InitializeAnalogInput() {}
extern "C" {
HAL_AnalogInputHandle HAL_InitializeAnalogInputPort(
- HAL_PortHandle portHandle, const char* allocationLocation,
- int32_t* status) {
+ int32_t channel, const char* allocationLocation, int32_t* status) {
hal::init::CheckInit();
- int16_t channel = getPortHandleChannel(portHandle);
- if (channel == InvalidHandleIndex || channel >= kNumAnalogInputs) {
+ if (channel < 0 || channel >= kNumAnalogInputs) {
*status = RESOURCE_OUT_OF_RANGE;
hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for Analog Input",
0, kNumAnalogInputs, channel);
diff --git a/hal/src/main/native/sim/DIO.cpp b/hal/src/main/native/sim/DIO.cpp
index 7f87f80fad..ecf2cea8c4 100644
--- a/hal/src/main/native/sim/DIO.cpp
+++ b/hal/src/main/native/sim/DIO.cpp
@@ -31,14 +31,12 @@ void InitializeDIO() {
extern "C" {
-HAL_DigitalHandle HAL_InitializeDIOPort(HAL_PortHandle portHandle,
- HAL_Bool input,
+HAL_DigitalHandle HAL_InitializeDIOPort(int32_t channel, HAL_Bool input,
const char* allocationLocation,
int32_t* status) {
hal::init::CheckInit();
- int16_t channel = getPortHandleChannel(portHandle);
- if (channel == InvalidHandleIndex) {
+ if (channel < 0 || channel >= kNumDigitalChannels) {
*status = RESOURCE_OUT_OF_RANGE;
hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for DIO", 0,
kNumDigitalChannels, channel);
diff --git a/hal/src/main/native/sim/DutyCycle.cpp b/hal/src/main/native/sim/DutyCycle.cpp
index e290cbfc9e..c044a1cf7a 100644
--- a/hal/src/main/native/sim/DutyCycle.cpp
+++ b/hal/src/main/native/sim/DutyCycle.cpp
@@ -33,7 +33,7 @@ void InitializeDutyCycle() {
} // namespace hal::init
extern "C" {
-HAL_DutyCycleHandle HAL_InitializeDutyCycle(HAL_PortHandle portHandle,
+HAL_DutyCycleHandle HAL_InitializeDutyCycle(int32_t channel,
const char* allocationLocation,
int32_t* status) {
hal::init::CheckInit();
@@ -51,7 +51,7 @@ HAL_DutyCycleHandle HAL_InitializeDutyCycle(HAL_PortHandle portHandle,
}
int16_t index = getHandleIndex(handle);
- SimDutyCycleData[index].digitalChannel = getPortHandleChannel(portHandle);
+ SimDutyCycleData[index].digitalChannel = channel;
SimDutyCycleData[index].initialized = true;
SimDutyCycleData[index].simDevice = 0;
dutyCycle->index = index;
diff --git a/hal/src/main/native/sim/HAL.cpp b/hal/src/main/native/sim/HAL.cpp
index 3e000997f4..16ef13c7c7 100644
--- a/hal/src/main/native/sim/HAL.cpp
+++ b/hal/src/main/native/sim/HAL.cpp
@@ -112,25 +112,6 @@ void InitializeHAL() {
extern "C" {
-HAL_PortHandle HAL_GetPort(int32_t channel) {
- // Dont allow a number that wouldn't fit in a uint8_t
- if (channel < 0 || channel >= 255) {
- return HAL_kInvalidHandle;
- }
- return createPortHandle(channel, 1);
-}
-
-HAL_PortHandle HAL_GetPortWithModule(int32_t module, int32_t channel) {
- // Dont allow a number that wouldn't fit in a uint8_t
- if (channel < 0 || channel >= 255) {
- return HAL_kInvalidHandle;
- }
- if (module < 0 || module >= 255) {
- return HAL_kInvalidHandle;
- }
- return createPortHandle(channel, module);
-}
-
const char* HAL_GetErrorMessage(int32_t code) {
switch (code) {
case 0:
diff --git a/hal/src/main/native/sim/PWM.cpp b/hal/src/main/native/sim/PWM.cpp
index 333cf0fc68..19d4a6b6c0 100644
--- a/hal/src/main/native/sim/PWM.cpp
+++ b/hal/src/main/native/sim/PWM.cpp
@@ -63,13 +63,12 @@ static inline int32_t GetFullRangeScaleFactor(DigitalPort* port) {
extern "C" {
-HAL_DigitalHandle HAL_InitializePWMPort(HAL_PortHandle portHandle,
+HAL_DigitalHandle HAL_InitializePWMPort(int32_t channel,
const char* allocationLocation,
int32_t* status) {
hal::init::CheckInit();
- int16_t channel = getPortHandleChannel(portHandle);
- if (channel == InvalidHandleIndex) {
+ if (channel < 0 || channel >= kNumPWMChannels) {
*status = RESOURCE_OUT_OF_RANGE;
hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for PWM", 0,
kNumPWMChannels, channel);
diff --git a/hal/src/main/native/systemcore/AnalogInput.cpp b/hal/src/main/native/systemcore/AnalogInput.cpp
index 4cc8ca0ab9..3dbf033ce8 100644
--- a/hal/src/main/native/systemcore/AnalogInput.cpp
+++ b/hal/src/main/native/systemcore/AnalogInput.cpp
@@ -26,12 +26,10 @@ using namespace hal;
extern "C" {
HAL_AnalogInputHandle HAL_InitializeAnalogInputPort(
- HAL_PortHandle portHandle, const char* allocationLocation,
- int32_t* status) {
+ int32_t channel, const char* allocationLocation, int32_t* status) {
hal::init::CheckInit();
- int16_t channel = getPortHandleChannel(portHandle);
- if (channel == InvalidHandleIndex || channel >= kNumSmartIo) {
+ if (channel < 0 || channel >= kNumSmartIo) {
*status = RESOURCE_OUT_OF_RANGE;
hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for Analog", 0,
kNumSmartIo, channel);
diff --git a/hal/src/main/native/systemcore/DIO.cpp b/hal/src/main/native/systemcore/DIO.cpp
index 64ba27bd37..8b51aeed8b 100644
--- a/hal/src/main/native/systemcore/DIO.cpp
+++ b/hal/src/main/native/systemcore/DIO.cpp
@@ -25,14 +25,12 @@ void InitializeDIO() {}
extern "C" {
-HAL_DigitalHandle HAL_InitializeDIOPort(HAL_PortHandle portHandle,
- HAL_Bool input,
+HAL_DigitalHandle HAL_InitializeDIOPort(int32_t channel, HAL_Bool input,
const char* allocationLocation,
int32_t* status) {
hal::init::CheckInit();
- int16_t channel = getPortHandleChannel(portHandle);
- if (channel == InvalidHandleIndex || channel >= kNumSmartIo) {
+ if (channel < 0 || channel >= kNumSmartIo) {
*status = RESOURCE_OUT_OF_RANGE;
hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for DIO", 0,
kNumSmartIo, channel);
diff --git a/hal/src/main/native/systemcore/DutyCycle.cpp b/hal/src/main/native/systemcore/DutyCycle.cpp
index 85d115d92b..71f0abbbe7 100644
--- a/hal/src/main/native/systemcore/DutyCycle.cpp
+++ b/hal/src/main/native/systemcore/DutyCycle.cpp
@@ -24,13 +24,12 @@ void InitializeDutyCycle() {}
} // namespace hal::init
extern "C" {
-HAL_DutyCycleHandle HAL_InitializeDutyCycle(HAL_PortHandle portHandle,
+HAL_DutyCycleHandle HAL_InitializeDutyCycle(int32_t channel,
const char* allocationLocation,
int32_t* status) {
hal::init::CheckInit();
- int16_t channel = getPortHandleChannel(portHandle);
- if (channel == InvalidHandleIndex || channel >= kNumSmartIo) {
+ if (channel < 0 || channel >= kNumSmartIo) {
*status = RESOURCE_OUT_OF_RANGE;
hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for DutyCycle", 0,
kNumSmartIo, channel);
diff --git a/hal/src/main/native/systemcore/HAL.cpp b/hal/src/main/native/systemcore/HAL.cpp
index 9739a9e921..171e4635ee 100644
--- a/hal/src/main/native/systemcore/HAL.cpp
+++ b/hal/src/main/native/systemcore/HAL.cpp
@@ -81,25 +81,6 @@ uint64_t GetDSInitializeTime() {
extern "C" {
-HAL_PortHandle HAL_GetPort(int32_t channel) {
- // Dont allow a number that wouldn't fit in a uint8_t
- if (channel < 0 || channel >= 255) {
- return HAL_kInvalidHandle;
- }
- return createPortHandle(channel, 1);
-}
-
-HAL_PortHandle HAL_GetPortWithModule(int32_t module, int32_t channel) {
- // Dont allow a number that wouldn't fit in a uint8_t
- if (channel < 0 || channel >= 255) {
- return HAL_kInvalidHandle;
- }
- if (module < 0 || module >= 255) {
- return HAL_kInvalidHandle;
- }
- return createPortHandle(channel, module);
-}
-
const char* HAL_GetErrorMessage(int32_t code) {
switch (code) {
case 0:
diff --git a/hal/src/main/native/systemcore/PWM.cpp b/hal/src/main/native/systemcore/PWM.cpp
index f5bb48430b..83b3fe5818 100644
--- a/hal/src/main/native/systemcore/PWM.cpp
+++ b/hal/src/main/native/systemcore/PWM.cpp
@@ -68,13 +68,12 @@ void InitializePWM() {}
extern "C" {
-HAL_DigitalHandle HAL_InitializePWMPort(HAL_PortHandle portHandle,
+HAL_DigitalHandle HAL_InitializePWMPort(int32_t channel,
const char* allocationLocation,
int32_t* status) {
hal::init::CheckInit();
- int16_t channel = getPortHandleChannel(portHandle);
- if (channel == InvalidHandleIndex || channel >= kNumSmartIo) {
+ if (channel < 0 || channel >= kNumSmartIo) {
*status = RESOURCE_OUT_OF_RANGE;
hal::SetLastErrorIndexOutOfRange(status, "Invalid Index for PWM", 0,
kNumSmartIo, channel);
diff --git a/hal/src/test/native/cpp/mockdata/AnalogInDataTest.cpp b/hal/src/test/native/cpp/mockdata/AnalogInDataTest.cpp
index 965565cbb4..15dba390ac 100644
--- a/hal/src/test/native/cpp/mockdata/AnalogInDataTest.cpp
+++ b/hal/src/test/native/cpp/mockdata/AnalogInDataTest.cpp
@@ -32,13 +32,13 @@ TEST(AnalogInSimTest, AnalogInInitialization) {
ASSERT_TRUE(0 != callbackId);
int32_t status = 0;
- HAL_PortHandle portHandle;
+ int32_t channel = 0;
HAL_DigitalHandle analogInHandle;
// Use out of range index
- portHandle = 8000;
+ channel = 8000;
gTestAnalogInCallbackName = "Unset";
- analogInHandle = HAL_InitializeAnalogInputPort(portHandle, nullptr, &status);
+ analogInHandle = HAL_InitializeAnalogInputPort(channel, nullptr, &status);
EXPECT_EQ(HAL_kInvalidHandle, analogInHandle);
EXPECT_EQ(HAL_USE_LAST_ERROR, status);
HAL_GetLastError(&status);
@@ -47,18 +47,18 @@ TEST(AnalogInSimTest, AnalogInInitialization) {
// Successful setup
status = 0;
- portHandle = HAL_GetPort(INDEX_TO_TEST);
+ channel = INDEX_TO_TEST;
gTestAnalogInCallbackName = "Unset";
- analogInHandle = HAL_InitializeAnalogInputPort(portHandle, nullptr, &status);
+ analogInHandle = HAL_InitializeAnalogInputPort(channel, nullptr, &status);
EXPECT_TRUE(HAL_kInvalidHandle != analogInHandle);
EXPECT_EQ(0, status);
EXPECT_STREQ("Initialized", gTestAnalogInCallbackName.c_str());
// Double initialize... should fail
status = 0;
- portHandle = HAL_GetPort(INDEX_TO_TEST);
+ channel = INDEX_TO_TEST;
gTestAnalogInCallbackName = "Unset";
- analogInHandle = HAL_InitializeAnalogInputPort(portHandle, nullptr, &status);
+ analogInHandle = HAL_InitializeAnalogInputPort(channel, nullptr, &status);
EXPECT_EQ(HAL_kInvalidHandle, analogInHandle);
EXPECT_EQ(HAL_USE_LAST_ERROR, status);
HAL_GetLastError(&status);
@@ -73,9 +73,9 @@ TEST(AnalogInSimTest, AnalogInInitialization) {
false);
status = 0;
- portHandle = HAL_GetPort(INDEX_TO_TEST);
+ channel = INDEX_TO_TEST;
gTestAnalogInCallbackName = "Unset";
- analogInHandle = HAL_InitializeAnalogInputPort(portHandle, nullptr, &status);
+ analogInHandle = HAL_InitializeAnalogInputPort(channel, nullptr, &status);
EXPECT_TRUE(HAL_kInvalidHandle != analogInHandle);
EXPECT_EQ(0, status);
EXPECT_STREQ("Initialized", gTestAnalogInCallbackName.c_str());
diff --git a/hal/src/test/native/cpp/mockdata/DIODataTest.cpp b/hal/src/test/native/cpp/mockdata/DIODataTest.cpp
index fba657df08..f1d670c5a5 100644
--- a/hal/src/test/native/cpp/mockdata/DIODataTest.cpp
+++ b/hal/src/test/native/cpp/mockdata/DIODataTest.cpp
@@ -32,13 +32,13 @@ TEST(DigitalIoSimTest, DigitalIoInitialization) {
ASSERT_TRUE(0 != callbackId);
int32_t status = 0;
- HAL_PortHandle portHandle;
+ int32_t channel = 0;
HAL_DigitalHandle digitalIoHandle;
// Use out of range index
- portHandle = 8000;
+ channel = 8000;
gTestDigitalIoCallbackName = "Unset";
- digitalIoHandle = HAL_InitializeDIOPort(portHandle, true, nullptr, &status);
+ digitalIoHandle = HAL_InitializeDIOPort(channel, true, nullptr, &status);
EXPECT_EQ(HAL_kInvalidHandle, digitalIoHandle);
EXPECT_EQ(HAL_USE_LAST_ERROR, status);
HAL_GetLastError(&status);
@@ -47,18 +47,18 @@ TEST(DigitalIoSimTest, DigitalIoInitialization) {
// Successful setup
status = 0;
- portHandle = HAL_GetPort(INDEX_TO_TEST);
+ channel = INDEX_TO_TEST;
gTestDigitalIoCallbackName = "Unset";
- digitalIoHandle = HAL_InitializeDIOPort(portHandle, true, nullptr, &status);
+ digitalIoHandle = HAL_InitializeDIOPort(channel, true, nullptr, &status);
EXPECT_TRUE(HAL_kInvalidHandle != digitalIoHandle);
EXPECT_EQ(0, status);
EXPECT_STREQ("Initialized", gTestDigitalIoCallbackName.c_str());
// Double initialize... should fail
status = 0;
- portHandle = HAL_GetPort(INDEX_TO_TEST);
+ channel = INDEX_TO_TEST;
gTestDigitalIoCallbackName = "Unset";
- digitalIoHandle = HAL_InitializeDIOPort(portHandle, true, nullptr, &status);
+ digitalIoHandle = HAL_InitializeDIOPort(channel, true, nullptr, &status);
EXPECT_EQ(HAL_kInvalidHandle, digitalIoHandle);
EXPECT_EQ(HAL_USE_LAST_ERROR, status);
HAL_GetLastError(&status);
@@ -73,9 +73,9 @@ TEST(DigitalIoSimTest, DigitalIoInitialization) {
false);
status = 0;
- portHandle = HAL_GetPort(INDEX_TO_TEST);
+ channel = INDEX_TO_TEST;
gTestDigitalIoCallbackName = "Unset";
- digitalIoHandle = HAL_InitializeDIOPort(portHandle, true, nullptr, &status);
+ digitalIoHandle = HAL_InitializeDIOPort(channel, true, nullptr, &status);
EXPECT_TRUE(HAL_kInvalidHandle != digitalIoHandle);
EXPECT_EQ(0, status);
EXPECT_STREQ("Initialized", gTestDigitalIoCallbackName.c_str());
diff --git a/hal/src/test/native/cpp/mockdata/PWMDataTest.cpp b/hal/src/test/native/cpp/mockdata/PWMDataTest.cpp
index 1054589af3..286208c28e 100644
--- a/hal/src/test/native/cpp/mockdata/PWMDataTest.cpp
+++ b/hal/src/test/native/cpp/mockdata/PWMDataTest.cpp
@@ -31,13 +31,13 @@ TEST(PWMSimTest, PwmInitialization) {
ASSERT_TRUE(0 != callbackId);
int32_t status = 0;
- HAL_PortHandle portHandle;
+ int32_t channel = 0;
HAL_DigitalHandle pwmHandle;
// Use out of range index
- portHandle = 8000;
+ channel = 8000;
gTestPwmCallbackName = "Unset";
- pwmHandle = HAL_InitializePWMPort(portHandle, nullptr, &status);
+ pwmHandle = HAL_InitializePWMPort(channel, nullptr, &status);
EXPECT_EQ(HAL_kInvalidHandle, pwmHandle);
EXPECT_EQ(HAL_USE_LAST_ERROR, status);
HAL_GetLastError(&status);
@@ -46,18 +46,18 @@ TEST(PWMSimTest, PwmInitialization) {
// Successful setup
status = 0;
- portHandle = HAL_GetPort(INDEX_TO_TEST);
+ channel = INDEX_TO_TEST;
gTestPwmCallbackName = "Unset";
- pwmHandle = HAL_InitializePWMPort(portHandle, nullptr, &status);
+ pwmHandle = HAL_InitializePWMPort(channel, nullptr, &status);
EXPECT_TRUE(HAL_kInvalidHandle != pwmHandle);
EXPECT_EQ(0, status);
EXPECT_STREQ("Initialized", gTestPwmCallbackName.c_str());
// Double initialize... should fail
status = 0;
- portHandle = HAL_GetPort(INDEX_TO_TEST);
+ channel = INDEX_TO_TEST;
gTestPwmCallbackName = "Unset";
- pwmHandle = HAL_InitializePWMPort(portHandle, nullptr, &status);
+ pwmHandle = HAL_InitializePWMPort(channel, nullptr, &status);
EXPECT_EQ(HAL_kInvalidHandle, pwmHandle);
EXPECT_EQ(HAL_USE_LAST_ERROR, status);
HAL_GetLastError(&status);
@@ -71,9 +71,9 @@ TEST(PWMSimTest, PwmInitialization) {
INDEX_TO_TEST, &TestPwmInitializationCallback, &callbackParam, false);
status = 0;
- portHandle = HAL_GetPort(INDEX_TO_TEST);
+ channel = INDEX_TO_TEST;
gTestPwmCallbackName = "Unset";
- pwmHandle = HAL_InitializePWMPort(portHandle, nullptr, &status);
+ pwmHandle = HAL_InitializePWMPort(channel, nullptr, &status);
EXPECT_TRUE(HAL_kInvalidHandle != pwmHandle);
EXPECT_EQ(0, status);
EXPECT_STREQ("Initialized", gTestPwmCallbackName.c_str());
diff --git a/wpilibc/src/main/native/cpp/AddressableLED.cpp b/wpilibc/src/main/native/cpp/AddressableLED.cpp
index 7c70033fe3..daa5aae47a 100644
--- a/wpilibc/src/main/native/cpp/AddressableLED.cpp
+++ b/wpilibc/src/main/native/cpp/AddressableLED.cpp
@@ -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;
diff --git a/wpilibc/src/main/native/cpp/AnalogInput.cpp b/wpilibc/src/main/native/cpp/AnalogInput.cpp
index 84f168e18e..9aa27e7a47 100644
--- a/wpilibc/src/main/native/cpp/AnalogInput.cpp
+++ b/wpilibc/src/main/native/cpp/AnalogInput.cpp
@@ -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);
diff --git a/wpilibc/src/main/native/cpp/DigitalInput.cpp b/wpilibc/src/main/native/cpp/DigitalInput.cpp
index 5840686cb0..19c35eb6ee 100644
--- a/wpilibc/src/main/native/cpp/DigitalInput.cpp
+++ b/wpilibc/src/main/native/cpp/DigitalInput.cpp
@@ -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);
diff --git a/wpilibc/src/main/native/cpp/DigitalOutput.cpp b/wpilibc/src/main/native/cpp/DigitalOutput.cpp
index b124e06ecb..270c2c1472 100644
--- a/wpilibc/src/main/native/cpp/DigitalOutput.cpp
+++ b/wpilibc/src/main/native/cpp/DigitalOutput.cpp
@@ -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);
diff --git a/wpilibc/src/main/native/cpp/DutyCycle.cpp b/wpilibc/src/main/native/cpp/DutyCycle.cpp
index b0ad03adf0..e00320a942 100644
--- a/wpilibc/src/main/native/cpp/DutyCycle.cpp
+++ b/wpilibc/src/main/native/cpp/DutyCycle.cpp
@@ -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);
diff --git a/wpilibc/src/main/native/cpp/PWM.cpp b/wpilibc/src/main/native/cpp/PWM.cpp
index bf8d1b87cf..5c3f8052a8 100644
--- a/wpilibc/src/main/native/cpp/PWM.cpp
+++ b/wpilibc/src/main/native/cpp/PWM.cpp
@@ -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;
diff --git a/wpilibcExamples/src/main/cpp/examples/HAL/c/Robot.c b/wpilibcExamples/src/main/cpp/examples/HAL/c/Robot.c
index 3cebc20e05..b56b859245 100644
--- a/wpilibcExamples/src/main/cpp/examples/HAL/c/Robot.c
+++ b/wpilibcExamples/src/main/cpp/examples/HAL/c/Robot.c
@@ -62,8 +62,7 @@ int main(void) {
// Create a Motor Controller
status = 0;
- HAL_DigitalHandle pwmPort =
- HAL_InitializePWMPort(HAL_GetPort(2), NULL, &status);
+ HAL_DigitalHandle pwmPort = HAL_InitializePWMPort(1, NULL, &status);
if (status != 0) {
const char* message = HAL_GetLastError(&status);
@@ -76,8 +75,7 @@ int main(void) {
// Create an Input
status = 0;
- HAL_DigitalHandle dio =
- HAL_InitializeDIOPort(HAL_GetPort(2), 1, NULL, &status);
+ HAL_DigitalHandle dio = HAL_InitializeDIOPort(2, 1, NULL, &status);
if (status != 0) {
const char* message = HAL_GetLastError(&status);
diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AddressableLED.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AddressableLED.java
index a8c160fa4b..036d422530 100644
--- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AddressableLED.java
+++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AddressableLED.java
@@ -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);
}
diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogInput.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogInput.java
index e17721f917..fca6d7f388 100644
--- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogInput.java
+++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogInput.java
@@ -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);
diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalInput.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalInput.java
index f7d9be4f70..862864308d 100644
--- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalInput.java
+++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalInput.java
@@ -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);
diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java
index 75951b63af..b6aab35ba5 100644
--- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java
+++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java
@@ -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);
diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DutyCycle.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DutyCycle.java
index cf8451db76..a7b8299884 100644
--- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DutyCycle.java
+++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DutyCycle.java
@@ -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);
diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWM.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWM.java
index 460424abfb..9d1d1bcc6f 100644
--- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWM.java
+++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWM.java
@@ -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();