Nol.A SDK Library 26.11.2
For IoT System Software Development
Loading...
Searching...
No Matches
MaxBotix_HRXL_MaxSonar_WR Class Reference

UART ultrasonic range reader. Call begin() then turnOn(). The driver and serial port must remain alive while receiving or awaiting timeout. More...

#include <MaxBotix_HRXL_MaxSonar_WR.hpp>

Public Member Functions

 MaxBotix_HRXL_MaxSonar_WR (SerialPort &)
 Bind the sensor serial port without starting it.
void begin (void(*func)(MaxBotix_HRXL_MaxSonar_WR &, int16_t mm), uint16_t timeoutMsec)
 Configure the receive callback and one-shot timeout.
virtual void turnOn ()
 Start 9600-baud listening and arm the one-shot timeout.
virtual void turnOff ()
 Stop the timer and UART listening.

Protected Attributes

SerialPort & s

Detailed Description

UART ultrasonic range reader. Call begin() then turnOn(). The driver and serial port must remain alive while receiving or awaiting timeout.

Member Function Documentation

◆ begin()

void MaxBotix_HRXL_MaxSonar_WR::begin ( void(* func )(MaxBotix_HRXL_MaxSonar_WR &, int16_t mm),
uint16_t timeoutMsec )

Configure the receive callback and one-shot timeout.

Parameters
funcReceives this driver and distance in millimeters, or -1 on timeout; nullptr disables notification. Successful reads do not cancel or restart the timer.
timeoutMsecTimeout in milliseconds, measured from turnOn().

◆ turnOff()

virtual void MaxBotix_HRXL_MaxSonar_WR::turnOff ( )
inlinevirtual

Stop the timer and UART listening.

50 {
51 this->timeout.stop();
52 this->s.stopListening();
53 };

◆ turnOn()

virtual void MaxBotix_HRXL_MaxSonar_WR::turnOn ( )
inlinevirtual

Start 9600-baud listening and arm the one-shot timeout.

41 {
42 this->s.begin(9600);
43 this->s.listen();
44 this->timeout.startOneShot(this->timeoutMsec);
45 };

The documentation for this class was generated from the following file: