hcsr04 base driver modules
More...
hcsr04 base driver modules
◆ HCSR04_READ_RETRY_TIMES
| #define HCSR04_READ_RETRY_TIMES 3 |
hcsr04 read retry times definition
retry 3 times
Definition at line 65 of file driver_hcsr04.h.
◆ hcsr04_handle_t
hcsr04 handle structure definition
◆ hcsr04_info_t
hcsr04 information structure definition
◆ hcsr04_time_t
hcsr04 time structure definition
◆ hcsr04_deinit()
close the chip
- Parameters
-
| [in] | *handle | pointer to an hcsr04 handle structure |
- Returns
- status code
- 0 success
- 1 trig or echo deinit failed
- 2 handle is NULL
- 3 handle is not initialized
- Note
- none
Definition at line 155 of file driver_hcsr04.c.
◆ hcsr04_info()
get chip's information
- Parameters
-
| [out] | *info | pointer to an hcsr04 info structure |
- Returns
- status code
- 0 success
- 2 handle is NULL
- Note
- none
Definition at line 325 of file driver_hcsr04.c.
◆ hcsr04_init()
initialize the chip
- Parameters
-
| [in] | *handle | pointer to an hcsr04 handle structure |
- Returns
- status code
- 0 success
- 1 trig or echo init failed
- 2 handle is NULL
- 3 linked functions is NULL
- Note
- none
Definition at line 62 of file driver_hcsr04.c.
◆ hcsr04_read()
| uint8_t hcsr04_read |
( |
hcsr04_handle_t * | handle, |
|
|
uint32_t * | time_us, |
|
|
float * | m ) |
read the distance
- Parameters
-
| [in] | *handle | pointer to an hcsr04 handle structure |
| [out] | *time_us | pointer to a us buffer |
| [out] | *m | pointer to a distance buffer |
- Returns
- status code
- 0 success
- 1 read failed
- 2 handle is NULL
- 3 handle is not initialized
- Note
- none
Definition at line 195 of file driver_hcsr04.c.