/* * Class: edu_wpi_first_wpilibj_hal_PDPJNI * Method: getPDPChannelCurrent * Signature: (BLjava/nio/IntBuffer;)D */ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPChannelCurrent (JNIEnv *env, jclass, jbyte channel, jobject status, jint module) { jint *status_ptr = (jint *)env->GetDirectBufferAddress(status); return getPDPChannelCurrent(channel, status_ptr, module); }
/* * Class: edu_wpi_first_wpilibj_hal_PDPJNI * Method: getPDPChannelCurrent * Signature: (BI)D */ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPChannelCurrent (JNIEnv *env, jclass, jbyte channel, jint module) { int32_t status = 0; double current = getPDPChannelCurrent(module, channel, &status); CheckStatus(env, status, false); return current; }
/** * Query the current of a single channel of the PDP * @return The current of one of the PDP channels (channels 0-15) in Amperes */ double PowerDistributionPanel::GetCurrent(uint8_t channel) { int32_t status = 0; if(!CheckPDPChannel(channel)) { char buf[64]; snprintf(buf, 64, "PDP Channel %d", channel); wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf); } double current = getPDPChannelCurrent(channel, &status); if(status) { wpi_setWPIErrorWithContext(Timeout, ""); } return current; }