Documentation
¶
Index ¶
- type Config
- type Direction
- type LD2451
- func (ld2451 *LD2451) Close()
- func (ld2451 *LD2451) EnableConfigCmd() error
- func (ld2451 *LD2451) EndConfigCmd() error
- func (ld2451 *LD2451) GetFirmwareVersion() (string, error)
- func (ld2451 *LD2451) GetRadarSensitivity() (trigger_times bool, snr uint8, err error)
- func (ld2451 *LD2451) GetTargetDetectionCfg() (max_distance uint8, direction Direction, min_speed uint8, target_delay uint8, ...)
- func (ld2451 *LD2451) ReadTarget() (Target, error)
- func (ld2451 *LD2451) ReadTargetNoBlock() (*Target, error)
- func (ld2451 *LD2451) RestartModule() error
- func (ld2451 *LD2451) RestoreFactorySettings() error
- func (ld2451 *LD2451) SetRadarSensitivity(trigger_times bool, snr uint8) error
- func (ld2451 *LD2451) SetSerialPortBaudRate(serial_rate SerialPortBaudRate) error
- func (ld2451 *LD2451) SetTargetDetectionCfg(max_distance uint8, direction Direction, min_speed uint8, target_delay uint8) error
- func (ld2451 *LD2451) StartReadThread()
- func (ld2451 *LD2451) StartSyncReadThread()
- func (ld2451 *LD2451) StopReadThread()
- type SerialPortBaudRate
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LD2451 ¶
type LD2451 struct {
// contains filtered or unexported fields
}
func OpenLD2451 ¶
func (*LD2451) EnableConfigCmd ¶
Enabling Configuration Commands Any other command issued to the radar must be executed after this command is issued, otherwise it will be invalid.
func (*LD2451) EndConfigCmd ¶
End configuration command End the configuration command, and the radar will resume working mode after execution. If you need to send other commands again, you need to send the enable configuration command first.
func (*LD2451) GetFirmwareVersion ¶
func (*LD2451) GetRadarSensitivity ¶
This command queries the motion sensitivity of each range gate.
func (*LD2451) GetTargetDetectionCfg ¶
func (ld2451 *LD2451) GetTargetDetectionCfg() (max_distance uint8, direction Direction, min_speed uint8, target_delay uint8, err error)
Read target detection parameter command This command can read the radar's current target detection parameters.
func (*LD2451) ReadTarget ¶
func (*LD2451) ReadTargetNoBlock ¶
func (*LD2451) RestartModule ¶
When the module receives this command, it will automatically restart after the response is sent.
func (*LD2451) RestoreFactorySettings ¶
This command is used to restore all configuration values to factory settings. The configuration values take effect after the module is restarted.
func (*LD2451) SetRadarSensitivity ¶
Radar sensitivity parameter configuration command
func (*LD2451) SetSerialPortBaudRate ¶
func (ld2451 *LD2451) SetSerialPortBaudRate(serial_rate SerialPortBaudRate) error
Setting the serial port baud rate This command is used to set the baud rate of the module serial port. The configuration value will not be lost when the power is off. The configuration value will take effect after the module is restarted.
func (*LD2451) SetTargetDetectionCfg ¶
func (ld2451 *LD2451) SetTargetDetectionCfg(max_distance uint8, direction Direction, min_speed uint8, target_delay uint8) error
Target detection parameter configuration commands Any other command issued to the radar must be executed after this command is issued, otherwise it will be invalid.
func (*LD2451) StartReadThread ¶
func (ld2451 *LD2451) StartReadThread()
func (*LD2451) StartSyncReadThread ¶
func (ld2451 *LD2451) StartSyncReadThread()
func (*LD2451) StopReadThread ¶
func (ld2451 *LD2451) StopReadThread()
type SerialPortBaudRate ¶
type SerialPortBaudRate uint8
const ( SerialPortBaudRate9600 SerialPortBaudRate = 0x0001 SerialPortBaudRate19200 SerialPortBaudRate = 0x0002 SerialPortBaudRate38400 SerialPortBaudRate = 0x0003 SerialPortBaudRate57600 SerialPortBaudRate = 0x0004 SerialPortBaudRate115200 SerialPortBaudRate = 0x0005 // default SerialPortBaudRate230400 SerialPortBaudRate = 0x0006 SerialPortBaudRate256000 SerialPortBaudRate = 0x0007 SerialPortBaudRate460800 SerialPortBaudRate = 0x0008 )