|
Swadge ESP32-S2
APIs to develop for the Magfest Swadge
|
Go to the source code of this file.
Data Structures | |
| struct | touchSpinState_t |
Enumerations | |
| enum | touchJoystick_t { TB_CENTER = 0x0100 , TB_RIGHT = 0x0200 , TB_UP = 0x0400 , TB_LEFT = 0x0800 , TB_DOWN = 0x1000 , TB_UP_RIGHT = 0x0600 , TB_UP_LEFT = 0x0C00 , TB_DOWN_LEFT = 0x1800 , TB_DOWN_RIGHT = 0x1200 } |
| Bitmask values for all the virtual joystick positions of getTouchJoystickZones(). More... | |
Functions | |
| 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. | |
| struct touchSpinState_t |
| enum 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 | |
| void getTouchCartesian | ( | int32_t | angle, |
| int32_t | radius, | ||
| int32_t * | x, | ||
| int32_t * | y ) |
Convert touchpad angle and radius to cartesian coordinates.
| 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 |
| 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.
| 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 |
| 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.
| 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 |
| void getTouchSpins | ( | touchSpinState_t * | state, |
| int32_t | angle, | ||
| int32_t | radius ) |
Calculate the number of times the touchpad was circled.
When the touch is done, reset startSet to 0
| [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 |