The touchpads class implements some easier ways to work with the MCU's capacitive touch architecture.
More...
#include <touchpad_driver.h>
|
uint32_t | read_touchpads (uint32_t tsc_readings[14]) |
| read_touchpads() checks if someone is touching the capacitive touch pads.
|
|
uint32_t | discern_press (uint32_t tsc_readings[14]) |
| discern_press() compares capacitive touch readings with the calibration values in order to discern if a key is being pressed.
|
|
void | init () |
| The init function essentially runs the read_touchpads function and places the readings into a calibration struct.
|
|
| touchpads (TSC_HandleTypeDef *htsc) |
|
The touchpads class implements some easier ways to work with the MCU's capacitive touch architecture.
◆ touchpads()
◆ discern_press()
uint32_t touchpads::discern_press |
( |
uint32_t |
tsc_readings[14] | ) |
|
discern_press() compares capacitive touch readings with the calibration values in order to discern if a key is being pressed.
This function takes the readings from the read_touchpads() function and compares them against the calibration values found during initialization in order to discern a key press.
- Parameters
-
[in] | tsc_readings | Readings from the touchpads |
[out] | readings | Bit mask showing which touchpads are being pressed |
◆ init()
The init function essentially runs the read_touchpads function and places the readings into a calibration struct.
◆ read_touchpads()
uint32_t touchpads::read_touchpads |
( |
uint32_t |
tsc_readings[14] | ) |
|
read_touchpads() checks if someone is touching the capacitive touch pads.
Reading the capacitive touchpads is a multi-step process. The capacitive touch (tsc) pins are organized into groups of four, one of which must be configured to be the sampling pin (the pin connected to the capacitor). Before any measurement, the capacitor must be discharged to ensure an accurate reading. Then, the pins must be configured - you can't read individual pins in a group, just the group, so to read all pins, each group must be configured and read three times. Once all the pins are read, we compare them with thresholds to determine if a key press is occurring.
- Parameters
-
[in] | tsc_readings | Readings from the touchpads @paramou[out] key_presses Bit mask showing which touchpads are being pressed |
◆ all_ios
TSC_IOConfigTypeDef touchpads::all_ios = {0b00000000101110111011000010111011,0,0b00000000010001000100000001000100} |
Bit mask to activate all TSC pins.
◆ calibration_values
◆ io1
TSC_IOConfigTypeDef touchpads::io1 = {0b00000000000100010000000100010001,0,0b00000000010001000000010001000100} |
Bit mask to activate the first pin in each TSC group.
◆ io2
TSC_IOConfigTypeDef touchpads::io2 = {0b00000000001000100000001000100010,0,0b00000000010001000000010001000100} |
Bit mask to activate the second pin in each TSC group.
◆ io4
TSC_IOConfigTypeDef touchpads::io4 = {0b00000000100010000000100010001000,0,0b00000000010001000000010001000100} |
Bit mask to activate the third pin in each TSC group.
◆ touch
Touch sensor object type (defined by the HAL)
The documentation for this class was generated from the following files: