MCPcopy Create free account
hub / github.com/dmadison/ArduinoXInput / setJoystickDirect

Method setJoystickDirect

src/XInput.cpp:345–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343}
344
345void XInputController::setJoystickDirect(XInputControl joy, int16_t x, int16_t y) {
346 const XInputMap_Joystick * joyData = getJoyFromEnum(joy);
347 if (joyData == nullptr) return; // Not a joystick
348
349 if (getJoystickX(joy) != x) {
350 tx[joyData->x_low] = lowByte(x);
351 tx[joyData->x_high] = highByte(x);
352 newData = true;
353 }
354
355 if (getJoystickY(joy) != y) {
356 tx[joyData->y_low] = lowByte(y);
357 tx[joyData->y_high] = highByte(y);
358 newData = true;
359 }
360
361 autosend();
362}
363
364void XInputController::releaseAll() {
365 const uint8_t offset = 2; // Skip message type and packet size

Callers

nothing calls this directly

Calls 1

getJoyFromEnumFunction · 0.85

Tested by

no test coverage detected