Go to the source code of this file.
|
| void | getTouchCartesian (int32_t angle, int32_t radius, int32_t *x, int32_t *y) |
| | Convert touchpad angle and radius to cartesian coordinates.
|
| |
| void | getTouchCartesianSquircle (int32_t angle, int32_t radius, int32_t *x, int32_t *y) |
| | Convert touchpad angle and radius to cartesian coordinates, deforming the corners to make a square. This is an implementation of an algorithm described at https://squircular.blogspot.com/2015/09/fg-squircle-mapping.html.
|
| |
| touchJoystick_t | getTouchJoystickZones (int32_t angle, int32_t radius, bool useCenter, bool useDiagonals) |
| | Convert touchpad angle and radius to a joystick enum, with either 4 or 8 directions and an optional center dead-zone.
|
| |
| void | getTouchSpins (touchSpinState_t *state, int32_t angle, int32_t radius) |
| | Calculate the number of times the touchpad was circled.
|
| |
◆ touchSpinState_t
| Data Fields |
|
bool |
startSet |
|
|
int32_t |
startAngle |
|
|
int32_t |
startRadius |
|
|
int32_t |
lastAngle |
|
|
int32_t |
lastRadius |
|
|
int32_t |
spins |
The number of complete CCW spins made. Negative indicates clockwise spins. |
|
int32_t |
remainder |
The angle of the partial CCW spin, or negative for a CW spin. |
◆ touchJoystick_t
Bitmask values for all the virtual joystick positions of getTouchJoystickZones()
| Enumerator |
|---|
| TB_CENTER | |
| TB_RIGHT | |
| TB_UP | |
| TB_LEFT | |
| TB_DOWN | |
| TB_UP_RIGHT | |
| TB_UP_LEFT | |
| TB_DOWN_LEFT | |
| TB_DOWN_RIGHT | |
◆ getTouchCartesian()
| void getTouchCartesian |
( |
int32_t | angle, |
|
|
int32_t | radius, |
|
|
int32_t * | x, |
|
|
int32_t * | y ) |
Convert touchpad angle and radius to cartesian coordinates.
- Parameters
-
| angle | The touchpad angle to convert |
| radius | The touchpad radius to convert |
| [out] | x | A pointer to be set to the X touch coordinate, from 0 to 1023 |
| [out] | y | A pointer to be set to the Y touch coordinate, from 0 to 1023 |
◆ getTouchCartesianSquircle()
| void getTouchCartesianSquircle |
( |
int32_t | angle, |
|
|
int32_t | radius, |
|
|
int32_t * | x, |
|
|
int32_t * | y ) |
Convert touchpad angle and radius to cartesian coordinates, deforming the corners to make a square. This is an implementation of an algorithm described at https://squircular.blogspot.com/2015/09/fg-squircle-mapping.html.
- Parameters
-
| angle | The touchpad angle to convert |
| radius | The touchpad radius to convert |
| [out] | x | A pointer to be set to the X touch coordinate, from 0 to 1023 |
| [out] | y | A pointer to be set to the Y touch coordinate, from 0 to 1023 |
◆ getTouchJoystickZones()
| touchJoystick_t getTouchJoystickZones |
( |
int32_t | angle, |
|
|
int32_t | radius, |
|
|
bool | useCenter, |
|
|
bool | useDiagonals ) |
Convert touchpad angle and radius to a joystick enum, with either 4 or 8 directions and an optional center dead-zone.
- Parameters
-
| angle | The touch angle reported by getTouchJoystick() |
| radius | The touch radius reported by getTouchJoystick() |
| useCenter | If true, TB_CENTER will be returned if the stick is touched but inside the dead-zone |
| useDiagonals | If true, diagonal directions will be returned as the bitwise OR of two directions |
- Returns
- touchJoystick_t The joystick direction, or 0 if no direction could be determined.
◆ getTouchSpins()
Calculate the number of times the touchpad was circled.
When the touch is done, reset startSet to 0
- Parameters
-
| [in,out] | state | A pointer to a touchSpinState_t to use for state. |
| angle | The current angle of the touch |
| radius | The current radius of the touch |