Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ad559x.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Grinn
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6#ifndef ZEPHYR_INCLUDE_DRIVERS_MFD_AD559X_H_
7#define ZEPHYR_INCLUDE_DRIVERS_MFD_AD559X_H_
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13#include <zephyr/device.h>
14
15#define AD559X_REG_SEQ_ADC 0x02U
16#define AD559X_REG_ADC_CONFIG 0x04U
17#define AD559X_REG_LDAC_EN 0x05U
18#define AD559X_REG_GPIO_PULLDOWN 0x06U
19#define AD559X_REG_READ_AND_LDAC 0x07U
20#define AD559X_REG_GPIO_OUTPUT_EN 0x08U
21#define AD559X_REG_GPIO_SET 0x09U
22#define AD559X_REG_GPIO_INPUT_EN 0x0AU
23#define AD559X_REG_PD_REF_CTRL 0x0BU
24
25#define AD559X_EN_REF BIT(9)
26
27#define AD559X_PIN_MAX 8U
28
43
54int mfd_ad559x_read_raw(const struct device *dev, uint8_t *val, size_t len);
55
66int mfd_ad559x_write_raw(const struct device *dev, uint8_t *val, size_t len);
67
79int mfd_ad559x_read_reg(const struct device *dev, uint8_t reg, uint8_t reg_data, uint16_t *val);
80
91int mfd_ad559x_write_reg(const struct device *dev, uint8_t reg, uint16_t val);
92
103int mfd_ad559x_read_adc_chan(const struct device *dev, uint8_t channel, uint16_t *result);
104
115int mfd_ad559x_write_dac_chan(const struct device *dev, uint8_t channel, uint16_t value);
116
127int mfd_ad559x_gpio_port_get_raw(const struct device *dev, uint8_t gpio, uint16_t *value);
132#ifdef __cplusplus
133}
134#endif
135
136#endif /* ZEPHYR_INCLUDE_DRIVERS_MFD_AD559X_H_ */
int mfd_ad559x_write_raw(const struct device *dev, uint8_t *val, size_t len)
Write raw data to chip.
int mfd_ad559x_read_raw(const struct device *dev, uint8_t *val, size_t len)
Read raw data from the chip.
int mfd_ad559x_read_reg(const struct device *dev, uint8_t reg, uint8_t reg_data, uint16_t *val)
Read data from provided register.
bool mfd_ad559x_has_pointer_byte_map(const struct device *dev)
Check if the chip has a pointer byte map.
int mfd_ad559x_write_dac_chan(const struct device *dev, uint8_t channel, uint16_t value)
Write ADC channel data to the chip.
int mfd_ad559x_write_reg(const struct device *dev, uint8_t reg, uint16_t val)
Write data to provided register.
int mfd_ad559x_read_adc_chan(const struct device *dev, uint8_t channel, uint16_t *result)
Read ADC channel data from the chip.
int mfd_ad559x_gpio_port_get_raw(const struct device *dev, uint8_t gpio, uint16_t *value)
Read GPIO port from the chip.
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition: device.h:399