12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #ifndef ZEPHYR_INCLUDE_DRIVERS_VIBRATOR_H_
- #define ZEPHYR_INCLUDE_DRIVERS_VIBRATOR_H_
- #include <zephyr/types.h>
- #include <device.h>
- #include <sys/util.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- struct vibrat_driver_api {
- int (*start)(const struct device *dev, u32_t chan, u8_t dutycycle);
- int (*stop)(const struct device *dev, u32_t chan);
- int (*set_freq_param)(const struct device *dev, u32_t chan, u32_t freq);
- };
- static inline int vibrat_start(const struct device *dev, u32_t chan, u8_t dutycycle)
- {
- const struct vibrat_driver_api *api = (const struct vibrat_driver_api *) dev->api;
- return api->start(dev, chan, dutycycle);
- }
- static inline int vibrat_stop(const struct device *dev, u32_t chan)
- {
- const struct vibrat_driver_api *api = (const struct vibrat_driver_api *) dev->api;
- return api->stop(dev, chan);
- }
- static inline int vibrat_set_freq_param(const struct device *dev, u32_t chan, u32_t freq)
- {
- const struct vibrat_driver_api *api = (const struct vibrat_driver_api *) dev->api;
- return api->set_freq_param(dev, chan, freq);
- }
- #ifdef __cplusplus
- }
- #endif
- #endif
|