mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[hal, wpilib] PWM Rewrite (#7845)
The HAL will only contain the output period and the raw microseconds. Higher level things such as SimDevice can handle everything else.
This commit is contained in:
@@ -63,69 +63,14 @@ Java_edu_wpi_first_hal_PWMJNI_freePWMPort
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_PWMJNI
|
||||
* Method: setPWMConfigMicroseconds
|
||||
* Signature: (IIIIII)V
|
||||
* Method: setPWMSimDevice
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_PWMJNI_setPWMConfigMicroseconds
|
||||
(JNIEnv* env, jclass, jint id, jint maxPwm, jint deadbandMaxPwm,
|
||||
jint centerPwm, jint deadbandMinPwm, jint minPwm)
|
||||
Java_edu_wpi_first_hal_PWMJNI_setPWMSimDevice
|
||||
(JNIEnv* env, jclass, jint handle, jint device)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetPWMConfigMicroseconds((HAL_DigitalHandle)id, maxPwm, deadbandMaxPwm,
|
||||
centerPwm, deadbandMinPwm, minPwm, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_PWMJNI
|
||||
* Method: getPWMConfigMicroseconds
|
||||
* Signature: (I)Ljava/lang/Object;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_edu_wpi_first_hal_PWMJNI_getPWMConfigMicroseconds
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
int32_t maxPwm = 0;
|
||||
int32_t deadbandMaxPwm = 0;
|
||||
int32_t centerPwm = 0;
|
||||
int32_t deadbandMinPwm = 0;
|
||||
int32_t minPwm = 0;
|
||||
HAL_GetPWMConfigMicroseconds((HAL_DigitalHandle)id, &maxPwm, &deadbandMaxPwm,
|
||||
¢erPwm, &deadbandMinPwm, &minPwm, &status);
|
||||
CheckStatus(env, status);
|
||||
return CreatePWMConfigDataResult(env, maxPwm, deadbandMaxPwm, centerPwm,
|
||||
deadbandMinPwm, minPwm);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_PWMJNI
|
||||
* Method: setPWMEliminateDeadband
|
||||
* Signature: (IZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_PWMJNI_setPWMEliminateDeadband
|
||||
(JNIEnv* env, jclass, jint id, jboolean value)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetPWMEliminateDeadband((HAL_DigitalHandle)id, value, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_PWMJNI
|
||||
* Method: getPWMEliminateDeadband
|
||||
* Signature: (I)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_edu_wpi_first_hal_PWMJNI_getPWMEliminateDeadband
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
auto val = HAL_GetPWMEliminateDeadband((HAL_DigitalHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
return (jboolean)val;
|
||||
HAL_SetPWMSimDevice((HAL_DigitalHandle)handle, (HAL_SimDeviceHandle)device);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -142,34 +87,6 @@ Java_edu_wpi_first_hal_PWMJNI_setPulseTimeMicroseconds
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_PWMJNI
|
||||
* Method: setPWMSpeed
|
||||
* Signature: (ID)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_PWMJNI_setPWMSpeed
|
||||
(JNIEnv* env, jclass, jint id, jdouble value)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetPWMSpeed((HAL_DigitalHandle)id, value, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_PWMJNI
|
||||
* Method: setPWMPosition
|
||||
* Signature: (ID)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_PWMJNI_setPWMPosition
|
||||
(JNIEnv* env, jclass, jint id, jdouble value)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetPWMPosition((HAL_DigitalHandle)id, value, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_PWMJNI
|
||||
* Method: getPulseTimeMicroseconds
|
||||
@@ -188,87 +105,15 @@ Java_edu_wpi_first_hal_PWMJNI_getPulseTimeMicroseconds
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_PWMJNI
|
||||
* Method: getPWMSpeed
|
||||
* Signature: (I)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_edu_wpi_first_hal_PWMJNI_getPWMSpeed
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
jdouble returnValue = HAL_GetPWMSpeed((HAL_DigitalHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_PWMJNI
|
||||
* Method: getPWMPosition
|
||||
* Signature: (I)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_edu_wpi_first_hal_PWMJNI_getPWMPosition
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
jdouble returnValue = HAL_GetPWMPosition((HAL_DigitalHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_PWMJNI
|
||||
* Method: setPWMDisabled
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_PWMJNI_setPWMDisabled
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetPWMDisabled((HAL_DigitalHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_PWMJNI
|
||||
* Method: latchPWMZero
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_PWMJNI_latchPWMZero
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_LatchPWMZero((HAL_DigitalHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_PWMJNI
|
||||
* Method: setAlwaysHighMode
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_PWMJNI_setAlwaysHighMode
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetPWMAlwaysHighMode((HAL_DigitalHandle)id, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_PWMJNI
|
||||
* Method: setPWMPeriodScale
|
||||
* Method: setPWMOutputPeriod
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_PWMJNI_setPWMPeriodScale
|
||||
Java_edu_wpi_first_hal_PWMJNI_setPWMOutputPeriod
|
||||
(JNIEnv* env, jclass, jint id, jint value)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetPWMPeriodScale((HAL_DigitalHandle)id, value, &status);
|
||||
HAL_SetPWMOutputPeriod((HAL_DigitalHandle)id, value, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user