qmk_firmware/internals/joystick.md

6.9 KiB

group joystick

Summary

Members Descriptions
define JOYSTICK_BUTTON_COUNT
define JOYSTICK_AXIS_COUNT
define JOYSTICK_AXIS_RESOLUTION
define JOYSTICK_MAX_VALUE
define JS_VIRTUAL_AXIS
define JOYSTICK_AXIS_VIRTUAL
define JOYSTICK_AXIS_IN
define JOYSTICK_AXIS_IN_OUT
define JOYSTICK_AXIS_IN_OUT_GROUND
public void joystick_task(void)
public void joystick_flush(void) Send the joystick report to the host, if it has been marked as dirty.
public void register_joystick_button(uint8_t button) Set the state of a button, and flush the report.
public void unregister_joystick_button(uint8_t button) Reset the state of a button, and flush the report.
public int16_t joystick_read_axis(uint8_t axis) Sample and process the analog value of the given axis.
public void joystick_read_axes(void)
public void joystick_set_axis(uint8_t axis,int16_t value) Set the value of the given axis.
public void host_joystick_send(joystick_t * joystick)
struct joystick_config_t
struct joystick_t

Members

define JOYSTICK_BUTTON_COUNT

define JOYSTICK_AXIS_COUNT

define JOYSTICK_AXIS_RESOLUTION

define JOYSTICK_MAX_VALUE

define JS_VIRTUAL_AXIS

define JOYSTICK_AXIS_VIRTUAL

define JOYSTICK_AXIS_IN

define JOYSTICK_AXIS_IN_OUT

define JOYSTICK_AXIS_IN_OUT_GROUND

public void joystick_task(void)

public void joystick_flush(void)

Send the joystick report to the host, if it has been marked as dirty.

public void register_joystick_button(uint8_t button)

Set the state of a button, and flush the report.

Parameters

  • button The index of the button to press, from 0 to 31.

public void unregister_joystick_button(uint8_t button)

Reset the state of a button, and flush the report.

Parameters

  • button The index of the button to release, from 0 to 31.

public int16_t joystick_read_axis(uint8_t axis)

Sample and process the analog value of the given axis.

Parameters

  • axis The axis to read.

Returns

A signed 16-bit integer, where 0 is the resting or mid point.

public void joystick_read_axes(void)

public void joystick_set_axis(uint8_t axis,int16_t value)

Set the value of the given axis.

Parameters

  • axis The axis to set the value of.

  • value The value to set.

public void host_joystick_send(joystick_t * joystick)

struct joystick_config_t

Summary

Members Descriptions
public pin_t output_pin
public pin_t input_pin
public pin_t ground_pin
public uint16_t min_digit
public uint16_t mid_digit
public uint16_t max_digit

Members

public pin_t output_pin

public pin_t input_pin

public pin_t ground_pin

public uint16_t min_digit

public uint16_t mid_digit

public uint16_t max_digit

struct joystick_t

Summary

Members Descriptions
public uint8_t buttons
public int16_t axes
public bool dirty

Members

public uint8_t buttons

public int16_t axes

public bool dirty