You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

6.1 KiB

group joystick

Summary

Members Descriptions
define JOYSTICK_BUTTON_COUNT
define JOYSTICK_AXIS_COUNT
define JOYSTICK_AXIS_RESOLUTION
define JOYSTICK_MAX_VALUE
define JOYSTICK_AXIS_VIRTUAL
define JOYSTICK_AXIS_IN
public void joystick_init(void) Handle the initialization of the subsystem.
public void joystick_task(void) Handle various subsystem background tasks.
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) Sample and process the all axis.
public void joystick_set_axis(uint8_t axis,int16_t value) Set the value of the given axis.
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 JOYSTICK_AXIS_VIRTUAL

define JOYSTICK_AXIS_IN

public void joystick_init(void)

Handle the initialization of the subsystem.

public void joystick_task(void)

Handle various subsystem background tasks.

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)

Sample and process the all axis.

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.

struct joystick_config_t

Summary

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

Members

public pin_t input_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