Swadge ESP32-S2
APIs to develop for the Magfest Swadge
Loading...
Searching...
No Matches
hdw-touch.h
Go to the documentation of this file.
1
73
74#pragma once
75
76#include <stdint.h>
77#include <stdbool.h>
78#include <driver/touch_pad.h>
79
83typedef struct
84{
85 uint8_t numTouchPads;
86 const uint8_t* touchPadIdxs;
88
92typedef struct
93{
94 int32_t position;
95 int32_t intensity;
96 bool touched;
98
99void initTouchPads(const touch_pad_t* touchPads, uint8_t numTouchPads, float touchPadSensitivity, bool denoiseEnable);
100void deinitTouchPads(void);
101void powerUpTouchPads(void);
102void powerDownTouchPads(void);
103
104void initTouchJoystick(uint8_t centerPadIdx, const uint8_t* ringPadIdxs);
105bool getTouchJoystick(int32_t* phi, int32_t* r, int32_t* intensity);
106
107void initTouchLinear(const touchLinearCfg_t* touchLinearCfgs, uint8_t numTouchLinearCfgs);
108uint8_t getTouchLinear(linearTouch_t* touches, uint8_t numLinearTouches);
void initTouchLinear(const touchLinearCfg_t *touchLinearCfgs, uint8_t numTouchLinearCfgs)
Initialize the touch pads as a set of linear arrays.
Definition hdw-touch.c:428
void powerUpTouchPads(void)
Power up the touchpad.
Definition hdw-touch.c:180
uint8_t numTouchPads
The number of touch pads in the linear configuration.
Definition hdw-touch.h:85
void initTouchPads(const touch_pad_t *touchPads, uint8_t numTouchPads, float touchPadSensitivity, bool denoiseEnable)
Initialize touchPad sensors.
Definition hdw-touch.c:83
int32_t intensity
How hard the touch is being pressed.
Definition hdw-touch.h:95
void powerDownTouchPads(void)
Power down the touchpad.
Definition hdw-touch.c:188
bool touched
true if a touch is registered, false if it isn't
Definition hdw-touch.h:96
int32_t position
The position of the touch, from 0 to 1023.
Definition hdw-touch.h:94
void initTouchJoystick(uint8_t centerPadIdx, const uint8_t *ringPadIdxs)
Initialize the touch pads as a virtual joystick. The arguments are indices into the array touchPads[]...
Definition hdw-touch.c:297
uint8_t getTouchLinear(linearTouch_t *touches, uint8_t numLinearTouches)
Get a high level touch input from each configured linear array.
Definition hdw-touch.c:445
bool getTouchJoystick(int32_t *phi, int32_t *r, int32_t *intensity)
Get high-level touch input, an analog input.
Definition hdw-touch.c:316
void deinitTouchPads(void)
Deinitialize the touch pads.
Definition hdw-touch.c:172
const uint8_t * touchPadIdxs
A list of touch pad indices into touchPads[] given to initTouchPads().
Definition hdw-touch.h:86
The result of a linear touch.
Definition hdw-touch.h:93
The configuration for a linear set of touch pads.
Definition hdw-touch.h:84