Source file for the ADES1754 Driver. More...
#include "ades1754.h"
#include "no_os_alloc.h"
#include "no_os_crc8.h"
#include "no_os_delay.h"
#include "no_os_error.h"
Functions | |
NO_OS_DECLARE_CRC8_TABLE (crc_table) | |
int | ades1754_hello_all (struct ades1754_desc *desc) |
ADES1754 HELLO ALL specific command message to wake-up devices alongside daisy-chain. | |
int | ades1754_write_dev (struct ades1754_desc *desc, uint8_t reg, uint16_t data) |
ADES1754 write device command message. | |
int | ades1754_write_all (struct ades1754_desc *desc, uint8_t reg, uint16_t data) |
ADES1754 write all command message. | |
int | ades1754_read_dev (struct ades1754_desc *desc, uint8_t reg, uint16_t *data) |
ADES1754 read device command message. | |
int | ades1754_read_all (struct ades1754_desc *desc, uint8_t reg, uint16_t *data) |
ADES1754 read all command message. | |
int | ades1754_read_block (struct ades1754_desc *desc, uint8_t block, uint8_t reg, uint16_t *data, bool double_size) |
ADES1754 read block command message. | |
int | ades1754_update_dev (struct ades1754_desc *desc, uint8_t reg, uint16_t mask, uint16_t val) |
ADES1754 update device command message. | |
int | ades1754_set_adc_method (struct ades1754_desc *desc, enum ades1754_scan_method scan_method) |
Set ADC scan method. | |
int | ades1754_switch_scan_mode (struct ades1754_desc *desc, enum ades1754_scan_mode mode) |
Select Scan Mode of the cells. | |
int | ades1754_set_cell_pol (struct ades1754_desc *desc, enum ades1754_cell_polarity cell_polarity) |
Set Cell Polarity. | |
int | ades1754_start_scan (struct ades1754_desc *desc, bool meas, uint16_t cell_mask) |
ADES1754 Start/Stop Scanning function. | |
int | ades1754_get_cell_data (struct ades1754_desc *desc, uint8_t cell_nb, int32_t *cell_voltage) |
ADES1754 read cell data. | |
int | ades1754_set_iir (struct ades1754_desc *desc, enum ades1754_iir_filter_coef coef) |
Set IIR filter coefficient. | |
int | ades1754_set_iir_ctrl (struct ades1754_desc *desc, bool alrtfilt, bool acc, bool output) |
Set speciic IIR filter settings. | |
int | ades1754_set_buffer_mode (struct ades1754_desc *desc, enum ades1754_buffer_mode mode) |
Set Buffer mode for data acquisition. | |
int | ades1754_set_alert_thr (struct ades1754_desc *desc, enum ades1754_alert alert, uint16_t thr) |
Set specific alert thershold value. | |
int | ades1754_get_alert (struct ades1754_desc *desc, enum ades1754_alert alert, bool *enable) |
Read specific alert state. | |
int | ades1754_set_balancing_mode (struct ades1754_desc *desc, enum ades1754_bal_mode mode) |
Set Cell Balancing mode. | |
int | ades1754_set_balancing_meas (struct ades1754_desc *desc, enum ades1754_bal_meas meas) |
Cell-Ballancing Measurement Enable/Disable. | |
int | ades1754_set_balancing_calib (struct ades1754_desc *desc, enum ades1754_bal_calib calib) |
Cell-Balancing Calibration Period Selection. | |
int | ades1754_init (struct ades1754_desc **desc, struct ades1754_init_param *init_param) |
ADES1754 device intialization function. | |
int | ades1754_remove (struct ades1754_desc *desc) |
Deallocate any resources used by the initialization function.. | |
Source file for the ADES1754 Driver.
Copyright 2025(c) Analog Devices, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
int ades1754_get_alert | ( | struct ades1754_desc * | desc, |
enum ades1754_alert | alert, | ||
bool * | enable ) |
Read specific alert state.
desc | - ADES1754 device descriptor. |
alert | - Specific pre-defined Alert selection. |
enable | - true - Specific alert has triggered. false - Specific alert didn't trigger. |
int ades1754_get_cell_data | ( | struct ades1754_desc * | desc, |
uint8_t | cell_nb, | ||
int32_t * | cell_voltage ) |
ADES1754 read cell data.
desc | - ADES1754 device descriptor. |
cell_nb | - Selected Cell Number (0 to 15). |
cell_voltage | - Raw Cell Voltage data. |
int ades1754_hello_all | ( | struct ades1754_desc * | desc | ) |
ADES1754 HELLO ALL specific command message to wake-up devices alongside daisy-chain.
desc | - ADES1754 device descriptor. |
int ades1754_init | ( | struct ades1754_desc ** | desc, |
struct ades1754_init_param * | init_param ) |
ADES1754 device intialization function.
desc | - ADES1754 device descriptor. |
init_param | - ADES1754 initialization parameter. |
int ades1754_read_all | ( | struct ades1754_desc * | desc, |
uint8_t | reg, | ||
uint16_t * | data ) |
ADES1754 read all command message.
desc | - ADES1754 device descriptor. |
reg | - Register Address. |
data | - Data to be read. |
int ades1754_read_block | ( | struct ades1754_desc * | desc, |
uint8_t | block, | ||
uint8_t | reg, | ||
uint16_t * | data, | ||
bool | double_size ) |
ADES1754 read block command message.
desc | - ADES1754 device descriptor. |
block | - Block number. |
reg | - Register Address. |
data | - Data to be read. |
double_size | - true - Block is double sized (16 bits). false - Block is single sized (8 bits). |
int ades1754_read_dev | ( | struct ades1754_desc * | desc, |
uint8_t | reg, | ||
uint16_t * | data ) |
ADES1754 read device command message.
desc | - ADES1754 device descriptor. |
reg | - Register Address. |
data | - Data to be read. |
int ades1754_remove | ( | struct ades1754_desc * | desc | ) |
Deallocate any resources used by the initialization function..
desc | - ADES1754 device descriptor. |
int ades1754_set_adc_method | ( | struct ades1754_desc * | desc, |
enum ades1754_scan_method | scan_method ) |
Set ADC scan method.
desc | - ADES1754 device descriptor. |
scan_method | - Specific pre-defined value for the Scan Method. |
int ades1754_set_alert_thr | ( | struct ades1754_desc * | desc, |
enum ades1754_alert | alert, | ||
uint16_t | thr ) |
Set specific alert thershold value.
desc | - ADES1754 device descriptor. |
alert | - Specific pre-defined Alert selection. |
thr | - Threshold value. |
int ades1754_set_balancing_calib | ( | struct ades1754_desc * | desc, |
enum ades1754_bal_calib | calib ) |
Cell-Balancing Calibration Period Selection.
desc | - ADES1754 device descriptor. |
calib | - Specific pre-defined value for Cell-Balancing Calibration Period number. |
int ades1754_set_balancing_meas | ( | struct ades1754_desc * | desc, |
enum ades1754_bal_meas | meas ) |
Cell-Ballancing Measurement Enable/Disable.
desc | - ADES1754 device descriptor. |
meas | - Specific pre-defined value for Cell-Balancing Measurement state. |
int ades1754_set_balancing_mode | ( | struct ades1754_desc * | desc, |
enum ades1754_bal_mode | mode ) |
Set Cell Balancing mode.
desc | - ADES1754 device descriptor. |
mode | - Specfic pre-defined value for Cell Balancing mode. |
int ades1754_set_buffer_mode | ( | struct ades1754_desc * | desc, |
enum ades1754_buffer_mode | mode ) |
Set Buffer mode for data acquisition.
desc | - ADES1754 device descriptor. |
mode | - Specific pre-defined value for Buffer mode. |
int ades1754_set_cell_pol | ( | struct ades1754_desc * | desc, |
enum ades1754_cell_polarity | cell_polarity ) |
Set Cell Polarity.
desc | - ADES1754 device descriptor. |
cell_polarity | - Specific pre-defined value for cell polarity. |
int ades1754_set_iir | ( | struct ades1754_desc * | desc, |
enum ades1754_iir_filter_coef | coef ) |
Set IIR filter coefficient.
desc | - ADES1754 device descriptor. |
coef | - Specific pre-defined IIR coefficient value. |
int ades1754_set_iir_ctrl | ( | struct ades1754_desc * | desc, |
bool | alrtfilt, | ||
bool | acc, | ||
bool | output ) |
Set speciic IIR filter settings.
desc | - ADES1754 device descriptor. |
alrtfilt | - true - Alert Issuance Based on IIR Filter Results. false - Alert Issuance Based on Raw Sequencer Results. |
acc | - true - ADC result is included in the IIR accumulator. false - ADC result is not included in the IIR accumulator. |
output | - true - IIR Filtered ADC data is loaded into the output data registers. false - Unfiltered ADC data is loaded into the output data registers. |
int ades1754_start_scan | ( | struct ades1754_desc * | desc, |
bool | meas, | ||
uint16_t | cell_mask ) |
ADES1754 Start/Stop Scanning function.
desc | - ADES1754 device descriptor. |
meas | - true - Starts scan. false - Stops scan. |
cell_mask | - Specific Cell Mask word (each bit set means the cell is selected for measurement). |
int ades1754_switch_scan_mode | ( | struct ades1754_desc * | desc, |
enum ades1754_scan_mode | mode ) |
Select Scan Mode of the cells.
desc | - ADES1754 device descriptor. |
mode | - Specific pre-defined value for the Cell Scan Mode. |
int ades1754_update_dev | ( | struct ades1754_desc * | desc, |
uint8_t | reg, | ||
uint16_t | mask, | ||
uint16_t | val ) |
ADES1754 update device command message.
desc | - ADES1754 device descriptor. |
reg | - Register Address. |
mask | - Mask of field to be updated. |
val | - Data to be updated. |
int ades1754_write_all | ( | struct ades1754_desc * | desc, |
uint8_t | reg, | ||
uint16_t | data ) |
ADES1754 write all command message.
desc | - ADES1754 device descriptor. |
reg | - Register Address. |
data | - Data to be written. |
int ades1754_write_dev | ( | struct ades1754_desc * | desc, |
uint8_t | reg, | ||
uint16_t | data ) |
ADES1754 write device command message.
desc | - ADES1754 device descriptor. |
reg | - Register Address. |
data | - Data to be written. |
NO_OS_DECLARE_CRC8_TABLE | ( | crc_table | ) |