Ejemplo n.º 1
0
/**
 * Read the number of accumulated values.
 *
 * Read the count of the accumulated values since the accumulator was last
 * Reset().
 *
 * @return The number of times samples from the channel were accumulated.
 */
uint32_t AnalogInput::GetAccumulatorCount() const {
    if (StatusIsFatal()) return 0;
    int32_t status = 0;
    uint32_t count = getAccumulatorCount(m_port, &status);
    wpi_setErrorWithContext(status, getHALErrorMessage(status));
    return count;
}
Ejemplo n.º 2
0
/*
 * Class:     edu_wpi_first_wpilibj_hal_AnalogJNI
 * Method:    getAccumulatorCount
 * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)I
 */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorCount
  (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 = getAccumulatorCount(*javaId, statusPtr);
	ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr;
	ANALOGJNI_LOG(logDEBUG) << "AccumulatorCount = " << returnValue;
	return returnValue;
}