Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
cs40l5x.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Cirrus Logic, Inc.
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
11
12#ifndef ZEPHYR_INCLUDE_DRIVERS_HAPTICS_CS40L5X_H_
13#define ZEPHYR_INCLUDE_DRIVERS_HAPTICS_CS40L5X_H_
14
15#include <zephyr/drivers/gpio.h>
16#include <zephyr/drivers/i2c.h>
17#include <zephyr/drivers/spi.h>
19#include <zephyr/kernel.h>
21#include <sys/types.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif /* __cplusplus */
26
33
48
53 CS40L5X_SOURCE_BUZ = HAPTICS_SOURCE_PRIV_START,
55};
56
71
80
95int cs40l5x_configure_buzz(const struct device *const dev, const uint32_t frequency,
96 const uint8_t level, const uint32_t duration);
97
112int cs40l5x_configure_trigger(const struct device *const dev, const struct gpio_dt_spec *const gpio,
113 const enum haptics_source src, const union haptics_config *const cfg,
114 const enum cs40l5x_attenuation attenuation,
115 const enum cs40l5x_trigger_edge edge);
116
131int cs40l5x_upload_pcm(const struct device *const dev, const int index, const uint16_t redc,
132 const uint16_t f0, const int8_t *const samples, const uint16_t num_samples);
133
146int cs40l5x_upload_pwle(const struct device *const dev, const int index,
147 const struct cs40l5x_pwle_section *const sections,
148 const uint8_t num_sections);
149
151
152#ifdef __cplusplus
153}
154#endif /* __cplusplus */
155
156#endif /* ZEPHYR_INCLUDE_DRIVERS_HAPTICS_CS40L5X_H_ */
Main header file for GPIO driver API.
Main header file for I2C (Inter-Integrated Circuit) driver API.
Main header file for SPI (Serial Peripheral Interface) driver API.
int cs40l5x_upload_pwle(const struct device *const dev, const int index, const struct cs40l5x_pwle_section *const sections, const uint8_t num_sections)
Upload PWLE effect to the specified index.
int cs40l5x_upload_pcm(const struct device *const dev, const int index, const uint16_t redc, const uint16_t f0, const int8_t *const samples, const uint16_t num_samples)
Upload PCM effect to the specified index.
cs40l5x_attenuation
Attenuation options for triggered haptic effects.
Definition cs40l5x.h:38
cs40l5x_source
Wavetable sources for haptic effects.
Definition cs40l5x.h:52
cs40l5x_trigger_edge
Options for edge-triggered haptics effects.
Definition cs40l5x.h:76
int cs40l5x_configure_trigger(const struct device *const dev, const struct gpio_dt_spec *const gpio, const enum haptics_source src, const union haptics_config *const cfg, const enum cs40l5x_attenuation attenuation, const enum cs40l5x_trigger_edge edge)
Configure edge-triggered haptic effect.
int cs40l5x_configure_buzz(const struct device *const dev, const uint32_t frequency, const uint8_t level, const uint32_t duration)
Configure ROM buzz for haptic playback.
@ CS40L5X_ATTENUATION_2DB
Configure haptic effect with 2 dB attenuation.
Definition cs40l5x.h:44
@ CS40L5X_ATTENUATION_6DB
Configure haptic effect with 6 dB attenuation.
Definition cs40l5x.h:40
@ CS40L5X_ATTENUATION_5DB
Configure haptic effect with 5 dB attenuation.
Definition cs40l5x.h:41
@ CS40L5X_ATTENUATION_4DB
Configure haptic effect with 4 dB attenuation.
Definition cs40l5x.h:42
@ CS40L5X_ATTENUATION_7DB
Configure haptic effect with 7 dB attenuation.
Definition cs40l5x.h:39
@ CS40L5X_ATTENUATION_1DB
Configure haptic effect with 1 dB attenuation.
Definition cs40l5x.h:45
@ CS40L5X_ATTENUATION_0DB
Configure haptic effect with no attenuation.
Definition cs40l5x.h:46
@ CS40L5X_ATTENUATION_3DB
Configure haptic effect with 3 dB attenuation.
Definition cs40l5x.h:43
@ CS40L5X_SOURCE_RTH
Playback from the runtime library.
Definition cs40l5x.h:54
@ CS40L5X_SOURCE_BUZ
Playback from the buzz library.
Definition cs40l5x.h:53
@ CS40L5X_RISING_EDGE
Configure a rising-edge haptic effect.
Definition cs40l5x.h:77
@ CS40L5X_FALLING_EDGE
Configure a falling-edge haptic effect.
Definition cs40l5x.h:78
haptics_source
Haptics playback sources.
Definition haptics.h:114
Main header file for haptics driver API.
Public kernel APIs.
Header file for log instance registration.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
__INT8_TYPE__ int8_t
Definition stdint.h:72
PWLE section definition.
Definition cs40l5x.h:61
uint16_t frequency
Section frequency in unsigned Q10.2 format.
Definition cs40l5x.h:65
uint8_t flags
Section flags in unsigned Q4.0 format.
Definition cs40l5x.h:69
uint16_t level
Section level in unsigned Q0.11 format.
Definition cs40l5x.h:67
uint16_t duration
Section duration in unsigned Q14.2 format (time) or Q16.0 format (half-cycles).
Definition cs40l5x.h:63
Runtime device structure (in ROM) per driver instance.
Definition device.h:513
Container for GPIO pin information specified in devicetree.
Definition gpio.h:296
Haptics source configuration.
Definition haptics.h:138