JM9 XRCU Board 0.1.3a
Libraries API Reference
Loading...
Searching...
No Matches
Uts_togglable Class Reference

Ultrasonic Sensor Driver (Hot Togglable) for XRCU. More...

#include <Uts_togglable.h>

Inheritance diagram for Uts_togglable:
Uts_general Supported_sensor Supported_module Uts_gpio Uts_i2c Uts_uart Vl53l0x Uts_gpio_int Uts_tic

Public Member Functions

virtual bool begin ()
 Activates this ultrasonic sensor.
 
virtual void end ()
 Deactivates this ultrasonic sensor.
 
virtual void disable ()
 Teporarily disables this ultrasonic sensor.
 
virtual void enable ()
 Re-enables this ultrasonic sensor.
 
- Public Member Functions inherited from Uts_general
virtual uint16_t read_dist_mm ()
 Reads the distance between this ultrasonic sensor and the obstacle in front of it.
 
uint16_t read_dist_cm ()
 Reads the distance between this ultrasonic sensor and the obstacle in front of it.
 

Protected Member Functions

void set_beginned (bool is_beginned)
 Sets whether this ultrasonic sensor is activated.
 
void set_enabled (bool is_enabled)
 Sets whether this ultrasonic sensor is enabled or not.
 
bool is_enabled ()
 Checks if this ultrasonic sensor is enabled or not.
 
 Uts_togglable ()
 Constructor for a togglable ultrasonic sensor driver.
 
- Protected Member Functions inherited from Uts_general
bool is_beginned ()
 Checks if this ultrasonic sensor is already activated.
 
void store_prev_dist_mm (uint16_t dist_mm)
 Stores the previous measured distance.
 
uint16_t get_prev_dist_mm ()
 Gets the previous measured distance.
 
 Uts_general ()
 Constructor for a generic ultrasonic sensor driver.
 
- Protected Member Functions inherited from Supported_sensor
 Supported_sensor ()
 Creates an object of a supported sensor.
 
- Protected Member Functions inherited from Supported_module
 Supported_module ()
 Creates an object of a supported module.
 

Additional Inherited Members

- Static Protected Attributes inherited from Uts_general
static const uint16_t ERROR_DIST_MM = 8888
 The distance representing a measurement error (in millimeters).
 

Detailed Description

Ultrasonic Sensor Driver (Hot Togglable) for XRCU.

Ultrasonic Sensor Driver that can hot toggle ON/OFF.

Author
YH Choi @ JM9

Constructor & Destructor Documentation

◆ Uts_togglable()

Uts_togglable::Uts_togglable ( )
protected

Constructor for a togglable ultrasonic sensor driver.

Uts_togglable.cpp - Ultrasonic Sensor Driver with Hot ON/OFF togglable for XRCU. Copyright (c) 2025 YH Choi @ JM9. All right reserved.

Member Function Documentation

◆ begin()

bool Uts_togglable::begin ( )
virtual

Activates this ultrasonic sensor.

YOU MUST CALL ME IN void setup () FUNCTION TO USE THIS OBJECT PROPERLY. Configures the settings of the pin mode(s), possible communication bus(es) and this ultrasonic sensor.

Returns
true if sensor is successfully activated, false otherwise

Reimplemented from Uts_general.

Reimplemented in Uts_gpio, Uts_gpio_int, Uts_i2c, Uts_tic, Uts_uart, and Vl53l0x.

◆ disable()

void Uts_togglable::disable ( )
virtual

Teporarily disables this ultrasonic sensor.

Reimplemented in Vl53l0x.

◆ enable()

void Uts_togglable::enable ( )
virtual

Re-enables this ultrasonic sensor.

This would not work if ultrasonic sensor is not beginned or already ended.

Reimplemented in Vl53l0x.

◆ end()

void Uts_togglable::end ( )
virtual

Deactivates this ultrasonic sensor.

Releases the communication pins and ports and clears the memory used for this ultrasonic sensor.

Reimplemented from Uts_general.

Reimplemented in Uts_gpio, Uts_gpio_int, Uts_i2c, Uts_tic, and Uts_uart.

◆ is_enabled()

bool Uts_togglable::is_enabled ( )
inlineprotected

Checks if this ultrasonic sensor is enabled or not.

Returns
true if this ultrasonic sensor is enabled, false otherwise

◆ set_beginned()

void Uts_togglable::set_beginned ( bool is_beginned)
inlineprotectedvirtual

Sets whether this ultrasonic sensor is activated.

Also disables this ultrasonic sensor if deactivated.

Parameters
is_beginnedtrue to set the beginned flag, false to clear the beginned flag

Reimplemented from Uts_general.

◆ set_enabled()

void Uts_togglable::set_enabled ( bool is_enabled)
inlineprotected

Sets whether this ultrasonic sensor is enabled or not.

This ultrasonic sensor could be enabled only if it is activated (i.e. beginned).

Parameters
is_enabledtrue to set the enabled flag, false to clear the enabled flag

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