MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / write_matching_button

Method write_matching_button

OpenHD/ohd_telemetry/src/rc/JoystickReader.cpp:293–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291}
292
293void JoystickReader::write_matching_button(std::array<uint16_t, 18>& rc_data,
294 const Uint8 button, bool up) {
295 // The mavlink rc channels override message has more than enough "channels"
296 // anyways.
297 // However, we could optimize here putting multiple buttons (aka bool) into
298 // one channel
299 const int channel_index =
300 JoystickReader::N_CHANNELS_RESERVED_FOR_AXES + button;
301 if (channel_index < rc_data.size()) {
302 rc_data[channel_index] = up ? JoystickReader::VALUE_BUTTON_UP
303 : JoystickReader::VALUE_BUTTON_DOWN;
304 }
305}
306
307#endif // OPENHD_TELEMETRY_SDL_FOR_JOYSTICK_FOUND

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected