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

Method setJoystickY

src/XInput.cpp:299–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297}
298
299void XInputController::setJoystickY(XInputControl joy, int32_t y, boolean invert) {
300 const XInputMap_Joystick * joyData = getJoyFromEnum(joy);
301 if (joyData == nullptr) return; // Not a joystick
302
303 y = rescaleInput(y, *getRangeFromEnum(joy), XInputMap_Joystick::range);
304 if (invert) y = invertInput(y, XInputMap_Joystick::range);
305
306 if (getJoystickY(joy) == y) return; // Axis hasn't changed
307
308 tx[joyData->y_low] = lowByte(y);
309 tx[joyData->y_high] = highByte(y);
310
311 newData = true;
312 autosend();
313}
314
315void XInputController::setJoystick(XInputControl joy, boolean up, boolean down, boolean left, boolean right, boolean useSOCD) {
316 const XInputMap_Joystick * joyData = getJoyFromEnum(joy);

Callers

nothing calls this directly

Calls 1

getJoyFromEnumFunction · 0.85

Tested by

no test coverage detected