27 void setup()
override;
39 static float us_to_m(uint32_t us);
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
This class simplifies creating components that periodically check a state.
Base-class for all sensors.
InternalGPIOPin * trigger_pin_
void set_echo_pin(InternalGPIOPin *echo_pin)
bool measurement_pending_
void send_trigger_pulse_()
void dump_config() override
InternalGPIOPin * echo_pin_
ISRInternalGPIOPin trigger_pin_isr_
static float us_to_m(uint32_t us)
Helper function to convert the specified echo duration in µs to meters.
void set_trigger_pin(InternalGPIOPin *trigger_pin)
UltrasonicSensorStore store_
void set_timeout_us(uint32_t timeout_us)
Set the maximum time in µs to wait for the echo to return.
void set_pulse_time_us(uint32_t pulse_time_us)
Set the time in µs the trigger pin should be enabled for in µs, defaults to 10µs (for HC-SR04)
uint32_t measurement_start_us_
volatile uint32_t wait_start_us
volatile uint32_t echo_end_us
ISRInternalGPIOPin echo_pin_isr
volatile uint32_t echo_start_us
static void gpio_intr(UltrasonicSensorStore *arg)