Go to the documentation of this file.
51 #define AD7280A_PD_OUT no_os_gpio_direction_output(dev->gpio_pd, \
53 #define AD7280A_PD_HIGH no_os_gpio_set_value(dev->gpio_pd, \
55 #define AD7280A_PD_LOW no_os_gpio_set_value(dev->gpio_pd, \
57 #define AD7280A_CNVST_OUT no_os_gpio_direction_output(dev->gpio_cnvst, \
59 #define AD7280A_CNVST_HIGH no_os_gpio_set_value(dev->gpio_cnvst, \
61 #define AD7280A_CNVST_LOW no_os_gpio_set_value(dev->gpio_cnvst, \
64 #define AD7280A_ALERT_IN no_os_gpio_direction_input(dev->gpio_alert)
65 #define AD7280_ALERT (1 << 6)
68 #define AD7280A_ACQ_TIME_400ns 0
69 #define AD7280A_ACQ_TIME_800ns 1
70 #define AD7280A_ACQ_TIME_1200ns 2
71 #define AD7280A_ACQ_TIME_1600ns 3
74 #define AD7280A_CONV_AVG_DIS 0
75 #define AD7280A_CONV_AVG_2 1
76 #define AD7280A_CONV_AVG_4 2
77 #define AD7280A_CONV_AVG_8 3
80 #define AD7280A_ALERT_REMOVE_VIN5 (1 << 2)
81 #define AD7280A_ALERT_REMOVE_VIN4_VIN5 (2 << 2)
82 #define AD7280A_ALERT_REMOVE_AUX5 (1 << 0)
83 #define AD7280A_ALERT_REMOVE_AUX4_AUX5 (2 << 0)
86 #define AD7280A_CELL_VOLTAGE_1 0x0
87 #define AD7280A_CELL_VOLTAGE_2 0x1
88 #define AD7280A_CELL_VOLTAGE_3 0x2
89 #define AD7280A_CELL_VOLTAGE_4 0x3
90 #define AD7280A_CELL_VOLTAGE_5 0x4
91 #define AD7280A_CELL_VOLTAGE_6 0x5
92 #define AD7280A_AUX_ADC_1 0x6
93 #define AD7280A_AUX_ADC_2 0x7
94 #define AD7280A_AUX_ADC_3 0x8
95 #define AD7280A_AUX_ADC_4 0x9
96 #define AD7280A_AUX_ADC_5 0xA
97 #define AD7280A_AUX_ADC_6 0xB
98 #define AD7280A_SELF_TEST 0xC
99 #define AD7280A_CONTROL_HB 0xD
100 #define AD7280A_CONTROL_LB 0xE
101 #define AD7280A_CELL_OVERVOLTAGE 0xF
102 #define AD7280A_CELL_UNDERVOLTAGE 0x10
103 #define AD7280A_AUX_ADC_OVERVOLTAGE 0x11
104 #define AD7280A_AUX_ADC_UNDERVOLTAGE 0x12
105 #define AD7280A_ALERT 0x13
106 #define AD7280A_CELL_BALANCE 0x14
107 #define AD7280A_CB1_TIMER 0x15
108 #define AD7280A_CB2_TIMER 0x16
109 #define AD7280A_CB3_TIMER 0x17
110 #define AD7280A_CB4_TIMER 0x18
111 #define AD7280A_CB5_TIMER 0x19
112 #define AD7280A_CB6_TIMER 0x1A
113 #define AD7280A_PD_TIMER 0x1B
114 #define AD7280A_READ 0x1C
115 #define AD7280A_CNVST_N_CONTROL 0x1D
118 #define AD7280A_CTRL_HB_CONV_INPUT_ALL (0 << 6)
119 #define AD7280A_CTRL_HB_CONV_INPUT_6CELL_AUX1_3_4 (1 << 6)
120 #define AD7280A_CTRL_HB_CONV_INPUT_6CELL (2 << 6)
121 #define AD7280A_CTRL_HB_CONV_INPUT_SELF_TEST (3 << 6)
122 #define AD7280A_CTRL_HB_CONV_RES_READ_ALL (0 << 4)
123 #define AD7280A_CTRL_HB_CONV_RES_READ_6CELL_AUX1_3_4 (1 << 4)
124 #define AD7280A_CTRL_HB_CONV_RES_READ_6CELL (2 << 4)
125 #define AD7280A_CTRL_HB_CONV_RES_READ_NO (3 << 4)
126 #define AD7280A_CTRL_HB_CONV_START_CNVST (0 << 3)
127 #define AD7280A_CTRL_HB_CONV_START_CS (1 << 3)
128 #define AD7280A_CTRL_HB_CONV_AVG_DIS (0 << 1)
129 #define AD7280A_CTRL_HB_CONV_AVG_2 (1 << 1)
130 #define AD7280A_CTRL_HB_CONV_AVG_4 (2 << 1)
131 #define AD7280A_CTRL_HB_CONV_AVG_8 (3 << 1)
132 #define AD7280A_CTRL_HB_CONV_AVG(x) ((x) << 1)
133 #define AD7280A_CTRL_HB_PWRDN_SW (1 << 0)
135 #define AD7280A_CTRL_LB_SWRST (1 << 7)
136 #define AD7280A_CTRL_LB_ACQ_TIME_400ns (0 << 5)
137 #define AD7280A_CTRL_LB_ACQ_TIME_800ns (1 << 5)
138 #define AD7280A_CTRL_LB_ACQ_TIME_1200ns (2 << 5)
139 #define AD7280A_CTRL_LB_ACQ_TIME_1600ns (3 << 5)
140 #define AD7280A_CTRL_LB_ACQ_TIME(x) ((x) << 5)
141 #define AD7280A_CTRL_LB_MUST_SET (1 << 4)
142 #define AD7280A_CTRL_LB_THERMISTOR_EN (1 << 3)
143 #define AD7280A_CTRL_LB_LOCK_DEV_ADDR (1 << 2)
144 #define AD7280A_CTRL_LB_INC_DEV_ADDR (1 << 1)
145 #define AD7280A_CTRL_LB_DAISY_CHAIN_RB_EN (1 << 0)
147 #define AD7280A_ALERT_GEN_STATIC_HIGH (1 << 6)
148 #define AD7280A_ALERT_RELAY_SIG_CHAIN_DOWN (3 << 6)
150 #define AD7280A_ALL_CELLS (0xAD << 16)
152 #define AD7280A_DEVADDR_MASTER 0
153 #define AD7280A_DEVADDR_ALL 0x1F
156 #define AD7280A_READ_TXVAL 0xF800030A
158 #define NUMBITS_READ 22 // Number of bits for CRC when reading
159 #define NUMBITS_WRITE 21 // Number of bits for CRC when writing
236 float *self_test_reg_a,
237 float *self_test_reg_b);
#define AD7280A_AUX_ADC_UNDERVOLTAGE
Definition: ad7280a.h:104
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
void ad7280a_write_register(struct ad7280a_dev *dev, uint8_t dev_addr, uint8_t read_reg, uint8_t reg_val)
Definition: ad7280a.c:542
#define AD7280A_READ_TXVAL
Definition: ad7280a.h:156
int16_t ad7280a_read_register(struct ad7280a_dev *dev, uint8_t dev_addr, uint8_t read_reg)
Definition: ad7280a.c:378
struct no_os_gpio_desc * gpio_cnvst
Definition: ad7280a.h:169
int32_t ad7280a_remove(struct ad7280a_dev *dev)
Free the resources allocated by AD7280A_Init().
Definition: ad7280a.c:120
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:159
#define AD7280A_CNVST_HIGH
Definition: ad7280a.h:59
#define AD7280A_CELL_UNDERVOLTAGE
Definition: ad7280a.h:102
float cell_voltage[12]
Definition: ad7280a.h:173
int16_t ad7280a_read_register(struct ad7280a_dev *dev, uint8_t dev_addr, uint8_t read_reg)
Definition: ad7280a.c:378
Header file of SPI Interface.
#define AD7280A_CTRL_LB_LOCK_DEV_ADDR
Definition: ad7280a.h:143
int32_t no_os_gpio_get_value(struct no_os_gpio_desc *desc, uint8_t *value)
Get the value of the specified GPIO.
Definition: no_os_gpio.c:221
#define AD7280A_CELL_VOLTAGE_1
Definition: ad7280a.h:86
Header file of Delay functions.
int8_t ad7280a_init(struct ad7280a_dev **device, struct ad7280a_init_param init_param)
Definition: ad7280a.c:57
#define AD7280A_CB1_TIMER
Definition: ad7280a.h:107
int8_t ad7280a_convert_data_all(struct ad7280a_dev *dev)
Definition: ad7280a.c:347
#define NUMBITS_WRITE
Definition: ad7280a.h:159
Definition: ad9361_util.h:69
int32_t ad7280a_crc_read(uint32_t message)
Definition: ad7280a.c:228
#define AD7280A_PD_TIMER
Definition: ad7280a.h:113
int16_t ad7280a_read_conversion(struct ad7280a_dev *dev, uint8_t dev_addr, uint8_t read_reg)
Definition: ad7280a.c:438
uint8_t ad7280a_alert_pin(struct ad7280a_dev *dev)
Definition: ad7280a.c:748
Definition: ad7280a.h:164
#define AD7280A_CONTROL_LB
Definition: ad7280a.h:100
#define AD7280A_CNVST_N_CONTROL
Definition: ad7280a.h:115
#define AD7280A_PD_OUT
Definition: ad7280a.h:51
#define AD7280A_CELL_OVERVOLTAGE
Definition: ad7280a.h:101
#define AD7280A_CTRL_HB_CONV_RES_READ_NO
Definition: ad7280a.h:125
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
#define AD7280A_CONTROL_HB
Definition: ad7280a.h:99
#define AD7280A_ALERT_IN
Definition: ad7280a.h:64
float ad7280a_convert_data(uint8_t type, uint16_t data)
Definition: ad7280a.c:512
int32_t ad7280a_crc_read(uint32_t message)
Definition: ad7280a.c:228
int8_t ad7280a_convert_read_all(struct ad7280a_dev *dev)
Definition: ad7280a.c:283
#define AD7280A_CELL_BALANCE
Definition: ad7280a.h:106
#define AD7280A_CNVST_OUT
Definition: ad7280a.h:57
float ad7280a_convert_data(uint8_t type, uint16_t data)
Definition: ad7280a.c:512
void ad7280a_write_register(struct ad7280a_dev *dev, uint8_t dev_addr, uint8_t read_reg, uint8_t reg_val)
Definition: ad7280a.c:542
int8_t ad7280a_convert_read_all(struct ad7280a_dev *dev)
Definition: ad7280a.c:283
#define AD7280A_CB2_TIMER
Definition: ad7280a.h:108
#define AD7280A_CB5_TIMER
Definition: ad7280a.h:111
int16_t ad7280a_read_conversion(struct ad7280a_dev *dev, uint8_t dev_addr, uint8_t read_reg)
Definition: ad7280a.c:438
void ad7280a_selftest_all(struct ad7280a_dev *dev, float *self_test_reg_a, float *self_test_reg_b)
Definition: ad7280a.c:683
struct no_os_gpio_init_param gpio_alert
Definition: ad7280a.h:183
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:104
#define AD7280A_SELF_TEST
Definition: ad7280a.h:98
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
#define AD7280A_CTRL_HB_CONV_RES_READ_ALL
Definition: ad7280a.h:122
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
uint32_t ad7280a_crc_write(uint32_t message)
Definition: ad7280a.c:176
#define AD7280A_READ
Definition: ad7280a.h:114
#define AD7280A_AUX_ADC_OVERVOLTAGE
Definition: ad7280a.h:103
#define AD7280A_PD_HIGH
Definition: ad7280a.h:53
int32_t no_os_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: no_os_gpio.c:49
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
struct no_os_gpio_init_param gpio_cnvst
Definition: ad7280a.h:182
#define AD7280A_CTRL_LB_MUST_SET
Definition: ad7280a.h:141
uint32_t ad7280a_crc_write(uint32_t message)
Definition: ad7280a.c:176
struct no_os_spi_init_param spi_init
Definition: ad7280a.h:179
#define AD7280A_CTRL_HB_CONV_AVG_8
Definition: ad7280a.h:131
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
float aux_adc[12]
Definition: ad7280a.h:174
#define NUMBITS_READ
Definition: ad7280a.h:158
struct no_os_gpio_init_param gpio_pd
Definition: ad7280a.h:181
#define AD7280A_CNVST_LOW
Definition: ad7280a.h:61
Definition: ad7280a.h:177
#define AD7280A_CB4_TIMER
Definition: ad7280a.h:110
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
uint32_t ad7280a_transfer_32bits(struct ad7280a_dev *dev, uint32_t data)
Definition: ad7280a.c:143
int8_t ad7280a_init(struct ad7280a_dev **device, struct ad7280a_init_param init_param)
Definition: ad7280a.c:57
struct no_os_spi_desc * spi_desc
Definition: ad7280a.h:166
int8_t ad7280a_convert_data_all(struct ad7280a_dev *dev)
Definition: ad7280a.c:347
#define AD7280A_ALERT
Definition: ad7280a.h:105
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:116
Header file of GPIO Interface.
struct no_os_gpio_desc * gpio_pd
Definition: ad7280a.h:168
#define AD7280A_CTRL_HB_CONV_INPUT_ALL
Definition: ad7280a.h:118
int32_t ad7280a_remove(struct ad7280a_dev *dev)
Free the resources allocated by AD7280A_Init().
Definition: ad7280a.c:120
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:52
uint8_t ad7280a_alert_pin(struct ad7280a_dev *dev)
Definition: ad7280a.c:748
#define AD7280A_CTRL_HB_CONV_INPUT_SELF_TEST
Definition: ad7280a.h:121
uint32_t ad7280a_transfer_32bits(struct ad7280a_dev *dev, uint32_t data)
Definition: ad7280a.c:143
uint32_t read_data[24]
Definition: ad7280a.h:172
void ad7280a_selftest_all(struct ad7280a_dev *dev, float *self_test_reg_a, float *self_test_reg_b)
Definition: ad7280a.c:683
#define AD7280A_CTRL_LB_DAISY_CHAIN_RB_EN
Definition: ad7280a.h:145
#define AD7280A_CB3_TIMER
Definition: ad7280a.h:109
struct no_os_gpio_desc * gpio_alert
Definition: ad7280a.h:170
#define AD7280A_CB6_TIMER
Definition: ad7280a.h:112
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140