6 #include <twr_scheduler.h>
43 bool _measurement_active;
44 bool _measurement_valid;
45 uint16_t _echo_duration;
46 twr_hc_sr04_echo_t _echo;
twr_gpio_channel_t
GPIO channels.
@ TWR_GPIO_P8
GPIO channel P8.
@ TWR_GPIO_P5
GPIO channel P5, A5, DAC1.
void twr_hc_sr04_init_sensor_module(twr_hc_sr04_t *self)
Initialize HC-SR04 for sensor module.
void twr_hc_sr04_set_update_interval(twr_hc_sr04_t *self, twr_tick_t interval)
Set measurement interval.
void twr_hc_sr04_init(twr_hc_sr04_t *self, twr_gpio_channel_t trig, twr_hc_sr04_echo_t echo)
Initialize HC-SR04.
struct twr_hc_sr04_t twr_hc_sr04_t
HC-SR04 instance.
bool twr_hc_sr04_measure(twr_hc_sr04_t *self)
Start measurement manually.
bool twr_hc_sr04_get_distance_millimeter(twr_hc_sr04_t *self, float *millimeter)
Get measured distance in millimeters.
void twr_hc_sr04_set_event_handler(twr_hc_sr04_t *self, void(*event_handler)(twr_hc_sr04_t *, twr_hc_sr04_event_t, void *), void *event_param)
Set callback function.
@ TWR_HC_SR04_EVENT_ERROR
Error event.
@ TWR_HC_SR04_EVENT_UPDATE
Update event.
size_t twr_scheduler_task_id_t
Task ID assigned by scheduler.
uint64_t twr_tick_t
Timestamp data type.