|
LD2410Async
Asynchronous Arduino ESP32 library for the LD2410 mmWave radar sensor
|
Go to the source code of this file.
Macros | |
| #define | RADAR_RX_PIN 32 |
| ESP32 pin receiving data from the radar (radar TX) | |
| #define | RADAR_TX_PIN 33 |
| ESP32 pin transmitting data to the radar (radar RX) | |
| #define | RADAR_BAUDRATE 256000 |
| UART baudrate for radar sensor (default is 256000) | |
| #define | LED_PIN 2 |
| GPIO for internal LED (adjust if needed) | |
Functions | |
| HardwareSerial | RadarSerial (1) |
| HardwareSerial instance bound to UART1. | |
| void | enableConfigModeCallback (LD2410Async *sender, LD2410Async::AsyncCommandResult result) |
| Callback for enableConfigModeAsync(). | |
| void | extraCommandCallback (LD2410Async *sender, LD2410Async::AsyncCommandResult result) |
| Callback for extra commands. | |
| void | disableConfigModeCallback (LD2410Async *sender, LD2410Async::AsyncCommandResult result) |
| Callback for disableConfigModeAsync(). | |
| void | printPaddedNumber (unsigned long value) |
| Print a number padded to 6 characters width. | |
| const char * | resultToString (LD2410Async::AsyncCommandResult result) |
| Convert AsyncCommandResult enum to human-readable text. | |
| void | scheduleNextSequence () |
| Schedule the next test sequence. | |
| void | onDetectionDataReceived (LD2410Async *sender, bool presenceDetected) |
| Callback triggered when new detection data is received. | |
| void | setup () |
| Arduino setup function. | |
| void | loop () |
| Arduino loop function. | |
Variables | |
| LD2410Async | ld2410 (RadarSerial) |
| LD2410Async driver instance. | |
| Ticker | delayTicker |
| Ticker for randomized delays. | |
| unsigned long | enableStartMs = 0 |
| Timestamp when enableConfigModeAsync() was called. | |
| unsigned long | minEnableDurationMs = ULONG_MAX |
| Minimum execution time measured so far. | |
| unsigned long | maxEnableDurationMs = 0 |
| Maximum execution time measured so far. | |
| unsigned long | totalEnableDurationMs = 0 |
| Sum of all measured durations. | |
| unsigned long | measurementCount = 0 |
| Number of successful measurements. | |
| unsigned long | failureCount = 0 |
| Number of failed measurements. | |
| unsigned long | delayMs = 0 |
| Delay before the tests. | |
| unsigned long | dataCount = 0 |
| Used to count received data frames. | |
| #define LED_PIN 2 |
GPIO for internal LED (adjust if needed)
Definition at line 32 of file enableConfigModeTest.ino.
| #define RADAR_BAUDRATE 256000 |
UART baudrate for radar sensor (default is 256000)
Definition at line 31 of file enableConfigModeTest.ino.
| #define RADAR_RX_PIN 32 |
ESP32 pin receiving data from the radar (radar TX)
Definition at line 29 of file enableConfigModeTest.ino.
| #define RADAR_TX_PIN 33 |
ESP32 pin transmitting data to the radar (radar RX)
Definition at line 30 of file enableConfigModeTest.ino.
| void disableConfigModeCallback | ( | LD2410Async * | sender, |
| LD2410Async::AsyncCommandResult | result ) |
Callback for disableConfigModeAsync().
Once config mode is disabled, schedules the next test sequence.
| sender | Pointer to the LD2410Async instance |
| result | Result of the command |
Definition at line 231 of file enableConfigModeTest.ino.
| void enableConfigModeCallback | ( | LD2410Async * | sender, |
| LD2410Async::AsyncCommandResult | result ) |
Callback for enableConfigModeAsync().
Updates statistics, prints results and triggers an extra command.
| sender | Pointer to the LD2410Async instance |
| result | Result of the command |
Definition at line 153 of file enableConfigModeTest.ino.
| void extraCommandCallback | ( | LD2410Async * | sender, |
| LD2410Async::AsyncCommandResult | result ) |
Callback for extra commands.
| sender | Pointer to the LD2410Async instance |
| result | Result of the command |
Definition at line 212 of file enableConfigModeTest.ino.
| void loop | ( | ) |
Arduino loop function.
Empty because everything is event-driven using callbacks and ticker.
Definition at line 300 of file enableConfigModeTest.ino.
| void onDetectionDataReceived | ( | LD2410Async * | sender, |
| bool | presenceDetected ) |
Callback triggered when new detection data is received.
| sender | Pointer to the LD2410Async instance |
| presenceDetected | Convenience flag for presence detection |
Definition at line 249 of file enableConfigModeTest.ino.
| void printPaddedNumber | ( | unsigned long | value | ) |
Print a number padded to 6 characters width.
| value | Number to print |
Definition at line 71 of file enableConfigModeTest.ino.
| HardwareSerial RadarSerial | ( | 1 | ) |
HardwareSerial instance bound to UART1.
| const char * resultToString | ( | LD2410Async::AsyncCommandResult | result | ) |
Convert AsyncCommandResult enum to human-readable text.
| result | Enum value from LD2410Async |
Definition at line 83 of file enableConfigModeTest.ino.
| void scheduleNextSequence | ( | ) |
Schedule the next test sequence.
Waits a random time between 1–5000 ms before calling enableConfigModeAsync().
Definition at line 102 of file enableConfigModeTest.ino.
| void setup | ( | ) |
Arduino setup function.
Initializes Serial, the radar UART, and the LD2410Async library. Starts the first test sequence by calling scheduleNextSequence().
Definition at line 267 of file enableConfigModeTest.ino.
| unsigned long dataCount = 0 |
Used to count received data frames.
Definition at line 52 of file enableConfigModeTest.ino.
| unsigned long delayMs = 0 |
Delay before the tests.
Definition at line 51 of file enableConfigModeTest.ino.
| Ticker delayTicker |
Ticker for randomized delays.
Definition at line 39 of file enableConfigModeTest.ino.
| unsigned long enableStartMs = 0 |
Timestamp when enableConfigModeAsync() was called.
Definition at line 45 of file enableConfigModeTest.ino.
| unsigned long failureCount = 0 |
Number of failed measurements.
Definition at line 50 of file enableConfigModeTest.ino.
| LD2410Async ld2410(RadarSerial) | ( | RadarSerial | ) |
LD2410Async driver instance.
| unsigned long maxEnableDurationMs = 0 |
Maximum execution time measured so far.
Definition at line 47 of file enableConfigModeTest.ino.
| unsigned long measurementCount = 0 |
Number of successful measurements.
Definition at line 49 of file enableConfigModeTest.ino.
| unsigned long minEnableDurationMs = ULONG_MAX |
Minimum execution time measured so far.
Definition at line 46 of file enableConfigModeTest.ino.
| unsigned long totalEnableDurationMs = 0 |
Sum of all measured durations.
Definition at line 48 of file enableConfigModeTest.ino.