/* * Class: edu_wpi_first_wpilibj_hal_AnalogJNI * Method: getAnalogAverageBits * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)I */ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageBits (JNIEnv * env, jclass, jobject id, jobject status) { void ** javaId = (void**)env->GetDirectBufferAddress(id); ANALOGJNI_LOG(logDEBUG) << "Analog Ptr = " << *javaId; jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); jint returnValue = getAnalogAverageBits( *javaId, statusPtr ); ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; ANALOGJNI_LOG(logDEBUG) << "AverageBits = " << returnValue; return returnValue; }
/** * Get the number of averaging bits previously configured. * This gets the number of averaging bits from the FPGA. The actual number of * averaged samples is 2^bits. * The averaging is done automatically in the FPGA. * * @return Number of bits of averaging previously configured. */ uint32_t AnalogInput::GetAverageBits() const { int32_t status = 0; int32_t averageBits = getAnalogAverageBits(m_port, &status); wpi_setErrorWithContext(status, getHALErrorMessage(status)); return averageBits; }