WALL-E Ultrasonic Sensor Class for range and distance detection from an object.
More...
#include <hcsr04.h>
|
| | HCSR04 (GPIO_TypeDef *trigPort, uint16_t trigPin, GPIO_TypeDef *echoPort, uint16_t echoPin, TIM_HandleTypeDef *htim) |
| | Constructor Function that initializes the class variables/instances.
|
| void | trigger () |
| | Function Triggers the 10us Pulse on the trigger pin to be read from the echo pin.
|
| bool | measure () |
| | Function if the sensor is ready to measure the function triggers then calculates the distance an object is away from the sensor and updates it's variable.
|
| uint32_t | getDistanceCm () |
| | Function allows the user to extract the Distance in cm the object is.
|
WALL-E Ultrasonic Sensor Class for range and distance detection from an object.
◆ HCSR04()
| HCSR04::HCSR04 |
( |
GPIO_TypeDef * | trigPort, |
|
|
uint16_t | trigPin, |
|
|
GPIO_TypeDef * | echoPort, |
|
|
uint16_t | echoPin, |
|
|
TIM_HandleTypeDef * | htim ) |
Constructor Function that initializes the class variables/instances.
◆ getDistanceCm()
| uint32_t HCSR04::getDistanceCm |
( |
| ) |
|
Function allows the user to extract the Distance in cm the object is.
- Returns
- uint32_t
◆ measure()
Function if the sensor is ready to measure the function triggers then calculates the distance an object is away from the sensor and updates it's variable.
- Returns
- Boolean
◆ trigger()
Function Triggers the 10us Pulse on the trigger pin to be read from the echo pin.
- Returns
- None
◆ distanceCm
| uint32_t HCSR04::distanceCm |
|
private |
Private variable distanceCm that holds the centimeter readings from the HCSR04 Sensor
◆ echoPin
Private variable echoPin that takes in the Echo GPIO pin value
◆ echoPort
| GPIO_TypeDef* HCSR04::echoPort |
|
private |
Private variable trigPort that takes in the trigger Port definition from the STM32 Config
◆ htim
| TIM_HandleTypeDef* HCSR04::htim |
|
private |
Private variable htim that takes in the Timer definition from the STM32 Config
◆ trigPin
Private variable trigPin that takes in the trigger GPIO pin value
◆ trigPort
| GPIO_TypeDef* HCSR04::trigPort |
|
private |
Private variable trigPort that takes in the trigger Port definition from the STM32 Config
The documentation for this class was generated from the following files:
- C:/Users/arath/OneDrive/Documents/ME 507/Project-WALLE/Code/Inc/hcsr04.h
- C:/Users/arath/OneDrive/Documents/ME 507/Project-WALLE/Code/src/hcsr04.cpp