Interfaces for haptic devices.
More...
|
| file | haptics.h |
| | Main header file for haptics driver API.
|
Interfaces for haptic devices.
◆ haptics_error_callback_t
| typedef void(* haptics_error_callback_t) (const struct device *dev, const uint32_t errors, void *const user_data) |
#include <zephyr/drivers/haptics.h>
Function type of callback invoked when a haptic device error occurs.
- Parameters
-
| dev | Pointer to the haptic device |
| errors | Device errors (bitmask of haptics_error_type values) |
| user_data | User data provided when the error callback was registered |
◆ haptics_error_type
#include <zephyr/drivers/haptics.h>
Haptics error types.
| Enumerator |
|---|
| HAPTICS_ERROR_OVERCURRENT | Output overcurrent error.
|
| HAPTICS_ERROR_OVERTEMPERATURE | Device overtemperature error.
|
| HAPTICS_ERROR_UNDERVOLTAGE | Power source undervoltage error.
|
| HAPTICS_ERROR_OVERVOLTAGE | Power source overvoltage error.
|
| HAPTICS_ERROR_DC | Output direct-current error.
|
◆ haptics_register_error_callback()
#include <zephyr/drivers/haptics.h>
Register a callback function for haptics errors.
- Parameters
-
| dev | Pointer to the haptic device |
| cb | Callback function (of type haptics_error_callback_t) |
| user_data | User data to be provided back to the application via the callback |
- Return values
-
| 0 | if successful |
| <0 | if failed |
◆ haptics_start_output()
| int haptics_start_output |
( |
const struct device * | dev | ) |
|
#include <zephyr/drivers/haptics.h>
Set the haptic device to start output for a playback event.
- Parameters
-
| dev | Pointer to the device structure for haptic device instance |
- Return values
-
| 0 | if successful |
| <0 | if failed |
◆ haptics_stop_output()
| int haptics_stop_output |
( |
const struct device * | dev | ) |
|
#include <zephyr/drivers/haptics.h>
Set the haptic device to stop output for a playback event.
- Parameters
-
| dev | Pointer to the device structure for haptic device instance |
- Return values
-
| 0 | if successful |
| <0 | if failed |