C++ DevKit
C++ set of OOP library
Loading...
Searching...
No Matches
rtos_hc_sr04.h
Go to the documentation of this file.
1
11#pragma once
12
13#include "pico/stdlib.h"
14#include "FreeRTOS.h"
15#include "task.h"
16#include "queue.h"
17
20{
24 uint32_t event_mask;
25};
26
32{
33private:
35 uint trig_pin;
37 uint echo_pin;
39 uint32_t echo_irq_mask_config;
41 QueueHandle_t input_timer_queue;
43 QueueHandle_t output_range_queue;
44
45 bool measure_completed;
46
47public:
48
56 rtosHC_SR04(uint trig_pin, uint echo_pin,
57 QueueHandle_t input_timer_queue, QueueHandle_t output_range_queue,
58 gpio_irq_callback_t echo_irq_call_back, uint32_t event_mask_config = GPIO_IRQ_EDGE_FALL | GPIO_IRQ_EDGE_RISE);
59
61 void get_distance();
62};
rtosHC_SR04(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 rtosHC_SR04 object.
Definition rtos_hc_sr04.cpp:8
void get_distance()
request a measure from HC_SR04
Definition rtos_hc_sr04.cpp:26
data structure used by ISR to capture, mask, time.
Definition rtos_hc_sr04.h:20
uint32_t current_time_us
the current time at wich the IRQ occurred
Definition rtos_hc_sr04.h:22
uint32_t event_mask
the IRQ mask given by the IRQ harware
Definition rtos_hc_sr04.h:24