Crate ld2410

Crate ld2410 

Source
Expand description

LD2410 Rust Driver

A no_std compatible driver for the HLK-LD2410 human presence radar sensor. Communicates over UART (default 256000 baud, 8N1) using a binary framed protocol.

§Protocol overview (very important)

  • Sensor report frames (radar -> host):

    • Header: F4 F3 F2 F1
    • Length: u16 LE (length of frame data)
    • Frame data: starts with type, then 0xAA, ends with 0x55 0x00
    • Footer: F8 F7 F6 F5
  • Command / ACK frames (host <-> radar):

    • Header: FD FC FB FA
    • Length: u16 LE (length of intra-frame data)
    • Intra-frame data: cmd_word: u16 LE + payload bytes
    • Footer: 04 03 02 01

There is no CRC16 in the vendor protocol. Integrity is via framing + length + footer.

This crate implements:

  • Robust parsing of continuous normal-mode reports (type 0x02)
  • Basic command framing + a few common commands (enter/exit config, firmware version, engineering mode enable/disable, restart, baud set)

Modules§

cmd
Command words (u16) used by LD2410 (subset)
frame
Frame protocol constants

Structs§

Ack
A parsed command ACK
LD2410
LD2410 driver for UART communication
PresenceData
Presence detection data from the LD2410 sensor (normal working mode report type 0x02)

Enums§

Error
Error types for LD2410 driver operations
TargetState
Normal-mode target state (from vendor docs)