Zephyr API Documentation 4.0.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_GEN_CTRL 0x03U
17#define AD559X_REG_ADC_CONFIG 0x04U
18#define AD559X_REG_LDAC_EN 0x05U
19#define AD559X_REG_GPIO_PULLDOWN 0x06U
20#define AD559X_REG_READ_AND_LDAC 0x07U
21#define AD559X_REG_GPIO_OUTPUT_EN 0x08U
22#define AD559X_REG_GPIO_SET 0x09U
23#define AD559X_REG_GPIO_INPUT_EN 0x0AU
24#define AD559X_REG_PD_REF_CTRL 0x0BU
25#define AD559X_REG_IO_TS_CONFIG 0x0DU
26
27#define AD559X_DAC_RANGE BIT(4)
28#define AD559X_ADC_RANGE BIT(5)
29#define AD559X_EN_REF BIT(9)
30
31#define AD559X_PIN_MAX 8U
32
47
58int mfd_ad559x_read_raw(const struct device *dev, uint8_t *val, size_t len);
59
70int mfd_ad559x_write_raw(const struct device *dev, uint8_t *val, size_t len);
71
83int mfd_ad559x_read_reg(const struct device *dev, uint8_t reg, uint8_t reg_data, uint16_t *val);
84
95int mfd_ad559x_write_reg(const struct device *dev, uint8_t reg, uint16_t val);
96
107int mfd_ad559x_read_adc_chan(const struct device *dev, uint8_t channel, uint16_t *result);
108
119int mfd_ad559x_write_dac_chan(const struct device *dev, uint8_t channel, uint16_t value);
120
131int mfd_ad559x_gpio_port_get_raw(const struct device *dev, uint8_t gpio, uint16_t *value);
136#ifdef __cplusplus
137}
138#endif
139
140#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:411