|
upm
0.4.0
Sensor/Actuator repository for libmraa (v0.8.0)
|
API for the HC-SR04 Ultrasonic Sensor. More...
This module defines the HC-SR04 interface for libhcsr04
Public Member Functions | |
| HCSR04 (uint8_t triggerPin, uint8_t echoPin, void(*fptr)(void *)) | |
| ~HCSR04 () | |
| double | getDistance (int sys) |
| void | ackEdgeDetected () |
| std::string | name () |
Data Fields | |
| uint8_t | m_doWork |
| HCSR04 | ( | uint8_t | triggerPin, |
| uint8_t | echoPin, | ||
| void(*)(void *) | fptr | ||
| ) |
Instantiates an HCSR04 object
| triggerPin | Pin to trigger the sensor for distance |
| echoPin | Pulse response to triggering |
| fptr | Function pointer to handle rising-edge and falling-edge interrupts |
| double getDistance | ( | int | sys | ) |
Gets the distance from the sensor
| void ackEdgeDetected | ( | ) |
On each interrupt, this function detects if the interrupt was falling-edge or rising-edge. Should be called from the interrupt handler.
|
inline |
Returns the name of the sensor
| uint8_t m_doWork |
Flag to control blocking function while waiting for a falling-edge interrupt
1.8.9.1