|
Teleoperated Robot Hand
|
Glove transmitter interface for sensor acquisition and ESP-NOW communication. More...
#include <Arduino.h>#include "WiFi.h"#include "esp_now.h"Go to the source code of this file.
Classes | |
| struct | packet |
| Packet containing averaged flex sensor readings for each finger and the palm. More... | |
| class | Hand |
| Class holding FreeRTOS queues for all glove fingers and palm. More... | |
Functions | |
| void | ReadSensorsTask (void *p_params) |
| FreeRTOS task that continuously reads flex sensors and pushes values into per-finger queues. | |
| void | TransmitTask (void *p_params) |
| FreeRTOS task that averages queue data for each finger and sends packets over ESP-NOW. | |
| BaseType_t | SendToQueue (const uint32_t pin, QueueHandle_t queue) |
| Read a single ADC value and send it to a FreeRTOS queue. | |
| uint16_t | ReadQueue (QueueHandle_t queue) |
| Empty a queue and return the average of all readings. | |
| void | PrintReadings (packet *hand) |
| Print formatted finger readings to the Serial monitor. | |
| void | OnDataSent (const uint8_t *mac_addr, esp_now_send_status_t status) |
| ESP-NOW send callback called after a packet is transmitted. | |
| bool | InitComms () |
| Initialize ESP-NOW communication subsystem. | |
Glove transmitter interface for sensor acquisition and ESP-NOW communication.
This header defines the public interface for the glove-side firmware, including:
| bool InitComms | ( | ) |
Initialize ESP-NOW communication subsystem.
Initialize ESP-NOW communications and register the receiver peer.
Sets WiFi to station mode, initializes ESP-NOW, and registers the receive callback.
This function:
Initialize ESP-NOW communication subsystem.
This function:
| void OnDataSent | ( | const uint8_t * | mac_addr, |
| esp_now_send_status_t | status ) |
ESP-NOW send callback called after a packet is transmitted.
This callback is registered via ::esp_now_register_send_cb and reports whether the last transmission was successful.
| mac_addr | MAC address of the peer to which the data was sent. |
| status | Transmission status, e.g. ::ESP_NOW_SEND_SUCCESS on success. |
| void PrintReadings | ( | packet * | hand | ) |
Print formatted finger readings to the Serial monitor.
| hand | Pointer to a packet structure containing all finger readings. |
| uint16_t ReadQueue | ( | QueueHandle_t | queue | ) |
Empty a queue and return the average of all readings.
This function repeatedly calls ::xQueueReceive with zero block time until the queue is empty. It computes the average of all values removed.
| queue | Handle to the FreeRTOS queue containing sensor readings. |
| void ReadSensorsTask | ( | void * | p_params | ) |
FreeRTOS task that continuously reads flex sensors and pushes values into per-finger queues.
The task:
| p_params | Pointer to task parameters (unused). |
| BaseType_t SendToQueue | ( | const uint32_t | pin, |
| QueueHandle_t | queue ) |
Read a single ADC value and send it to a FreeRTOS queue.
This function performs an ADC reading on the specified pin (in millivolts) and attempts to enqueue the reading into the provided queue.
| pin | GPIO pin connected to the flex sensor (ADC input). |
| queue | Handle to the FreeRTOS queue for this sensor. |
| void TransmitTask | ( | void * | p_params | ) |
FreeRTOS task that averages queue data for each finger and sends packets over ESP-NOW.
The task:
| p_params | Pointer to task parameters (unused). |