123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- #ifndef ZEPHYR_INCLUDE_DRIVERS_DAC_H_
- #define ZEPHYR_INCLUDE_DRIVERS_DAC_H_
- #include <device.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- struct dac_channel_cfg {
- uint8_t channel_id;
- uint8_t resolution;
- };
- typedef int (*dac_api_channel_setup)(const struct device *dev,
- const struct dac_channel_cfg *channel_cfg);
- typedef int (*dac_api_write_value)(const struct device *dev,
- uint8_t channel, uint32_t value);
- __subsystem struct dac_driver_api {
- dac_api_channel_setup channel_setup;
- dac_api_write_value write_value;
- };
- __syscall int dac_channel_setup(const struct device *dev,
- const struct dac_channel_cfg *channel_cfg);
- static inline int z_impl_dac_channel_setup(const struct device *dev,
- const struct dac_channel_cfg *channel_cfg)
- {
- const struct dac_driver_api *api =
- (const struct dac_driver_api *)dev->api;
- return api->channel_setup(dev, channel_cfg);
- }
- __syscall int dac_write_value(const struct device *dev, uint8_t channel,
- uint32_t value);
- static inline int z_impl_dac_write_value(const struct device *dev,
- uint8_t channel, uint32_t value)
- {
- const struct dac_driver_api *api =
- (const struct dac_driver_api *)dev->api;
- return api->write_value(dev, channel, value);
- }
- #ifdef __cplusplus
- }
- #endif
- #include <syscalls/dac.h>
- #endif
|