/* * Class: edu_wpi_first_wpilibj_hal_AnalogJNI * Method: setAnalogOutput * Signature: (Ljava/nio/ByteBuffer;DLjava/nio/IntBuffer;)V */ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogOutput (JNIEnv * env, jclass, jobject id, jdouble voltage, jobject status) { void ** javaId = (void**)env->GetDirectBufferAddress(id); jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); setAnalogOutput(*javaId, voltage, statusPtr); }
///////////////////////////////////////////////////////////////////// // This is called when a new UDP message is received in the RC port // Caution: RSSI support requires mods to WiShield g2100.c as per // http://asynclabs.com/forums/viewtopic.php?f=10&t=385&start=0 void RCRx::handleRequest(uint8_t *msg, uint16_t len, uint16_t rssi) { _rssi = rssi; RCOIPCmdSetAnalogChannels* setAnalogChannels = (RCOIPCmdSetAnalogChannels*)msg; if (len >= 1 && setAnalogChannels->version == RC_VERSION1) { int i; for (i = 0; i < len-1; i++) setAnalogOutput(i, setAnalogChannels->channels[i]); // Only reply at most once per _replyInterval millis // Transmitter will typically interpret gap in replies // of 2 sec or more as bad connection _lastRequestTime = millis(); if (_lastRequestTime > _lastReplyTime + _replyInterval) sendReply(); } }