OpenVex
0.5.0
|
Functions | |
unsigned char | rc_read_status (void) |
signed char | rc_read_data (unsigned char channel) |
signed char | rc_button_sequence (unsigned char channel, unsigned char len) |
unsigned char | rc_new_data_available (void) |
signed char rc_button_sequence | ( | unsigned char | channel, |
unsigned char | len | ||
) |
Return a value indicating a binary sequence on RC button 'channel'. This function allows a single button pair to be used to trigger up to 127 different actions.
This function keeps a static internal value and counter. Each time this function is called, the buttons on channel are sampled. If the lower button is pressed, a 0 is inserted into least significant bit of the value, and the counter incremented. If the upper button is pressed, a 1 is inserted and the counter is incremented. If neither button is pressed, neither the value nor counter are changed.
A button being held down will only be counted once. It must be released and pressed again to advance the sequence.
When the counter reaches 'len', the function returns the value based on the binary sequence of button presses. For example, if the sequence length is 3, and the user presses the sequence lower, upper, upper, then the value returned is 011 binary (3 in decimal).
Until then, it returns -1, indicating that the sequence is not yet complete.
channel | Channel of button pair to read. |
len | Length of button sequence. |
unsigned char rc_new_data_available | ( | void | ) |
Determine whether new data is available from the remote control unit.
signed char rc_read_data | ( | unsigned char | channel | ) |
Retrieve most recently sampled data from the specified channel on the remote control unit. All values returned range from -127 to +127. For joysticks, 0 is the center positionm, full left or full up is -127, and full down or full right is +127. For buttons, 0 indicates that neither button for the channel is pressed, -127 indicates the lower button, and 127 indicates the upper.
channel | Channel (joystick axis or button pair) to read. |
unsigned char rc_read_status | ( | void | ) |
Determine current state of remote control unit.