26 uint16_t thumb_reading;
27 uint16_t index_reading;
28 uint16_t middle_reading;
29 uint16_t ring_reading;
30 uint16_t pinkie_reading;
31 uint16_t palm_reading;
42 QueueHandle_t thumb_queue;
43 QueueHandle_t index_queue;
44 QueueHandle_t middle_queue;
45 QueueHandle_t ring_queue;
46 QueueHandle_t pinkie_queue;
47 QueueHandle_t palm_queue;
55 thumb_queue = xQueueCreate(10,
sizeof(uint16_t));
56 index_queue = xQueueCreate(10,
sizeof(uint16_t));
57 middle_queue = xQueueCreate(10,
sizeof(uint16_t));
58 ring_queue = xQueueCreate(10,
sizeof(uint16_t));
59 pinkie_queue = xQueueCreate(10,
sizeof(uint16_t));
60 palm_queue = xQueueCreate(10,
sizeof(uint16_t));
68const uint32_t THUMB_PIN = GPIO_NUM_36;
69const uint32_t INDEX_PIN = GPIO_NUM_39;
70const uint32_t MIDDLE_PIN = GPIO_NUM_34;
71const uint32_t RING_PIN = GPIO_NUM_35;
72const uint32_t PINKIE_PIN = GPIO_NUM_32;
73const uint32_t PALM_PIN = GPIO_NUM_33;
90const uint8_t BROADCAST_ADDRESS[] = {0x24, 0xDC, 0xC3, 0x82, 0x7F, 0xB4};
95BaseType_t
SendToQueue(
const uint32_t pin, QueueHandle_t queue);
98void OnDataSent(
const uint8_t *mac_addr, esp_now_send_status_t status);
Hand()
Construct a new Hand object and create all sensor queues.
Definition main.h:54
bool InitComms()
Initialize ESP-NOW communication subsystem.
Definition main.cpp:133
void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status)
ESP-NOW send callback called after a packet is transmitted.
Definition main.cpp:188
BaseType_t SendToQueue(const uint32_t pin, QueueHandle_t queue)
Read a single ADC value and send it to a FreeRTOS queue.
Definition main.cpp:117
uint16_t ReadQueue(QueueHandle_t queue)
Empty a queue and return the average of all readings.
Definition main.cpp:137
void ReadSensorsTask(void *p_params)
FreeRTOS task that continuously reads flex sensors and pushes values into per-finger queues.
Definition main.cpp:24
void TransmitTask(void *p_params)
FreeRTOS task that averages queue data for each finger and sends packets over ESP-NOW.
Definition main.cpp:78
const adc_attenuation_t ADC_ATTENUATION
ADC attenuation configuration. Used with analogSetAttenuation to set the input range.
Definition main.h:86
void PrintReadings(packet *hand)
Print formatted finger readings to the Serial monitor.
Definition main.cpp:159
const uint8_t ADC_RESOLUTION
ADC configuration: resolution in bits. Used with analogReadResolution.
Definition main.h:80
Packet containing averaged flex sensor readings for each finger and the palm.
Definition main.h:25