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

Method setJoystickX

src/XInput.cpp:283–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281}
282
283void XInputController::setJoystickX(XInputControl joy, int32_t x, boolean invert) {
284 const XInputMap_Joystick * joyData = getJoyFromEnum(joy);
285 if (joyData == nullptr) return; // Not a joystick
286
287 x = rescaleInput(x, *getRangeFromEnum(joy), XInputMap_Joystick::range);
288 if (invert) x = invertInput(x, XInputMap_Joystick::range);
289
290 if (getJoystickX(joy) == x) return; // Axis hasn't changed
291
292 tx[joyData->x_low] = lowByte(x);
293 tx[joyData->x_high] = highByte(x);
294
295 newData = true;
296 autosend();
297}
298
299void XInputController::setJoystickY(XInputControl joy, int32_t y, boolean invert) {
300 const XInputMap_Joystick * joyData = getJoyFromEnum(joy);

Callers

nothing calls this directly

Calls 1

getJoyFromEnumFunction · 0.85

Tested by

no test coverage detected