Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Interfaces for haptic devices. More...

Topics

 Device-specific Haptics API extensions

Files

file  haptics.h
 Main header file for haptics driver API.

Data Structures

struct  haptics_driver_api
 Haptic device API. More...

Typedefs

typedef int(* haptics_stop_output_t) (const struct device *dev)
 Set the haptic device to stop output.
typedef int(* haptics_start_output_t) (const struct device *dev)
 Set the haptic device to start output for a playback event.
typedef void(* haptics_error_callback_t) (const struct device *dev, const uint32_t errors, void *const user_data)
 Callback function for error interrupt.
typedef int(* haptics_register_error_callback_t) (const struct device *dev, haptics_error_callback_t cb, void *const user_data)
 Register a callback function for haptics errors.

Enumerations

enum  haptics_error_type {
  HAPTICS_ERROR_OVERCURRENT = BIT(0) , HAPTICS_ERROR_OVERTEMPERATURE = BIT(1) , HAPTICS_ERROR_UNDERVOLTAGE = BIT(2) , HAPTICS_ERROR_OVERVOLTAGE = BIT(3) ,
  HAPTICS_ERROR_DC = BIT(4) , HAPTICS_ERROR_PRIV_START = BIT(5)
}
 Haptics error types. More...

Functions

int haptics_start_output (const struct device *dev)
 Set the haptic device to start output for a playback event.
int haptics_stop_output (const struct device *dev)
 Set the haptic device to stop output for a playback event.
static int haptics_register_error_callback (const struct device *dev, haptics_error_callback_t cb, void *const user_data)
 Register a callback function for haptics errors.

Detailed Description

Interfaces for haptic devices.

Typedef Documentation

◆ 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>

Callback function for error interrupt.

Parameters
devPointer to the haptic device
errorsDevice errors (bitmask of haptics_error_type values)
user_dataUser data provided when the error callback was registered

◆ haptics_register_error_callback_t

typedef int(* haptics_register_error_callback_t) (const struct device *dev, haptics_error_callback_t cb, void *const user_data)

#include <zephyr/drivers/haptics.h>

Register a callback function for haptics errors.

◆ haptics_start_output_t

typedef int(* haptics_start_output_t) (const struct device *dev)

#include <zephyr/drivers/haptics.h>

Set the haptic device to start output for a playback event.

◆ haptics_stop_output_t

typedef int(* haptics_stop_output_t) (const struct device *dev)

#include <zephyr/drivers/haptics.h>

Set the haptic device to stop output.

Enumeration Type Documentation

◆ 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_ERROR_PRIV_START 

Function Documentation

◆ haptics_register_error_callback()

int haptics_register_error_callback ( const struct device * dev,
haptics_error_callback_t cb,
void *const user_data )
inlinestatic

#include <zephyr/drivers/haptics.h>

Register a callback function for haptics errors.

Parameters
devPointer to the haptic device
cbCallback function (of type haptics_error_callback_t)
user_dataUser data to be provided back to the application via the callback
Return values
0if successful
<0if 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
devPointer to the device structure for haptic device instance
Return values
0if successful
<0if 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
devPointer to the device structure for haptic device instance
Return values
0if successful
<0if failed