C++ DevKit
C++ set of OOP library
Loading...
Searching...
No Matches
rtos_HCSR04 Class Reference

class for the ultrasonic ranging module HC-SR04 compliant with FreeRTOS More...

#include <rtos_hc_sr04.h>

Collaboration diagram for rtos_HCSR04:
Collaboration graph

Public Member Functions

 rtos_HCSR04 (uint trig_pin, uint echo_pin, QueueHandle_t input_timer_queue, QueueHandle_t output_range_queue, gpio_irq_callback_t echo_irq_call_back, uint32_t event_mask_config=GPIO_IRQ_EDGE_FALL|GPIO_IRQ_EDGE_RISE)
 Construct a new rtos_HCSR04 object.
 
void get_distance ()
 request a measure from HCSR04
 

Private Attributes

uint trig_pin
 the GPIO pin that send trigger signal to the HC-SR04 module
 
uint echo_pin
 the GPIO pin where the HC-SR04 return echo signal
 
uint32_t echo_irq_mask_config
 A memory slot reserved to store the irq_event_mask.
 
QueueHandle_t input_timer_queue
 the queue from which echo time measurement are received
 
QueueHandle_t output_range_queue
 the queue to which the resulting range is sent
 
bool measure_completed
 Flag indicating if the measurement is completed.
 

Detailed Description

class for the ultrasonic ranging module HC-SR04 compliant with FreeRTOS

Constructor & Destructor Documentation

◆ rtos_HCSR04()

rtos_HCSR04::rtos_HCSR04 ( uint trig_pin,
uint echo_pin,
QueueHandle_t input_timer_queue,
QueueHandle_t output_range_queue,
gpio_irq_callback_t echo_irq_call_back,
uint32_t event_mask_config = GPIO_IRQ_EDGE_FALL | GPIO_IRQ_EDGE_RISE )

Construct a new rtos_HCSR04 object.

Parameters
trig_pinthe pin attached to the triggering signal
echo_pinthe pin used to measure round-trip time of ultrasonic pulses
input_timer_queuethe input queue that receives data from IRQ
output_range_queuethe output queue that receives computed range
echo_irq_call_backThe ISR (interrupt Service Routine) that process IRQ event
event_mask_configthe rising/falling edge configuratio of the irq

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