|
upm
0.2.0
Sensor/Actuator repository for libmraa (v0.6.1)
|
C++ API for HCSR04 (ultrasonic ranging module) component. More...
This file defines the HCSR04 C++ interface for libhcsr04
Public Member Functions | |
| HCSR04 (uint8_t triggerPin, uint8_t echoPin, void(*fptr)(void *)) | |
| ~HCSR04 () | |
| int | getDistance () |
| void | ackEdgeDetected () |
| std::string | name () |
Data Fields | |
| uint8_t | m_doWork |
| HCSR04 | ( | uint8_t | triggerPin, |
| uint8_t | echoPin, | ||
| void(*)(void *) | fptr | ||
| ) |
Instanciates a HCSR04 object
| triggerPin | pin for triggering the sensor for distance |
| echoPin | pulse response to triggering |
| fptr | function pointer for handling raising and falling interrupts |
| int getDistance | ( | ) |
Get the distance from the sensor.
| void ackEdgeDetected | ( | ) |
On each interrupt this function will detect if the interrupt was falling edge or rising. Should be called from the interrupt handler.
|
inline |
Return name of the component
| uint8_t m_doWork |
Flag to controll blocking function while waiting for falling edge interrupt
1.8.9.1