5#define LTC6811_CELLS_IN_REG 3
6#define LTC6811_GPIOS_IN_REG 3
9#define AUX_ADG731_NUM_PINS 32
12#define LTC6811_CMD_SIZE 4
15#define LTC6811_NUM_COMM_REG_BYTES 3
18 LTC_AFE_REGISTER_CONFIG = 0,
19 LTC_AFE_REGISTER_CELL_VOLTAGE_A,
20 LTC_AFE_REGISTER_CELL_VOLTAGE_B,
21 LTC_AFE_REGISTER_CELL_VOLTAGE_C,
22 LTC_AFE_REGISTER_CELL_VOLTAGE_D,
23 LTC_AFE_REGISTER_AUX_A,
24 LTC_AFE_REGISTER_AUX_B,
25 LTC_AFE_REGISTER_STATUS_A,
26 LTC_AFE_REGISTER_STATUS_B,
27 LTC_AFE_REGISTER_READ_COMM,
28 LTC_AFE_REGISTER_START_COMM,
32typedef enum { LTC_AFE_VOLTAGE_REGISTER_A = 0, LTC_AFE_VOLTAGE_REGISTER_B, LTC_AFE_VOLTAGE_REGISTER_C, LTC_AFE_VOLTAGE_REGISTER_D, NUM_LTC_AFE_VOLTAGE_REGISTERS } LtcAfeVoltageRegister;
35 LTC_AFE_DISCHARGE_TIMEOUT_DISABLED = 0,
36 LTC_AFE_DISCHARGE_TIMEOUT_30_S,
37 LTC_AFE_DISCHARGE_TIMEOUT_1_MIN,
38 LTC_AFE_DISCHARGE_TIMEOUT_2_MIN,
39 LTC_AFE_DISCHARGE_TIMEOUT_3_MIN,
40 LTC_AFE_DISCHARGE_TIMEOUT_4_MIN,
41 LTC_AFE_DISCHARGE_TIMEOUT_5_MIN,
42 LTC_AFE_DISCHARGE_TIMEOUT_10_MIN,
43 LTC_AFE_DISCHARGE_TIMEOUT_15_MIN,
44 LTC_AFE_DISCHARGE_TIMEOUT_20_MIN,
45 LTC_AFE_DISCHARGE_TIMEOUT_30_MIN,
46 LTC_AFE_DISCHARGE_TIMEOUT_40_MIN,
47 LTC_AFE_DISCHARGE_TIMEOUT_60_MIN,
48 LTC_AFE_DISCHARGE_TIMEOUT_75_MIN,
49 LTC_AFE_DISCHARGE_TIMEOUT_90_MIN,
50 LTC_AFE_DISCHARGE_TIMEOUT_120_MIN
51} LtcAfeDischargeTimeout;
61 uint32_t undervoltage : 12;
62 uint32_t overvoltage : 12;
64 uint16_t discharge_bitset : 12;
65 uint8_t discharge_timeout : 4;
66}
_PACKED LtcAfeConfigRegisterData;
67static_assert(
sizeof(LtcAfeConfigRegisterData) == 6,
"LtcAfeConfigRegisterData must be 6 bytes");
82}
_PACKED LtcAfeCommRegisterData;
83static_assert(
sizeof(LtcAfeCommRegisterData) == 6,
"LtcAfeCommRegisterData must be 6 bytes");
87 LtcAfeConfigRegisterData reg;
90}
_PACKED LtcAfeWriteDeviceConfigPacket;
94 uint8_t wrcomm[LTC6811_CMD_SIZE];
95 LtcAfeCommRegisterData reg;
97}
_PACKED LtcAfeWriteCommRegPacket;
101 uint8_t stcomm[LTC6811_CMD_SIZE];
102 uint8_t clk[LTC6811_NUM_COMM_REG_BYTES];
103}
_PACKED LtcAfeSendCommRegPacket;
107 uint8_t wrcfg[LTC6811_CMD_SIZE];
110 LtcAfeWriteDeviceConfigPacket devices[LTC_AFE_MAX_CELLS_PER_DEVICE];
111}
_PACKED LtcAfeWriteConfigPacket;
112#define SIZEOF_LTC_AFE_WRITE_CONFIG_PACKET(devices) (LTC6811_CMD_SIZE + (devices) * sizeof(LtcAfeWriteDeviceConfigPacket))
115 uint16_t voltages[3];
125}
_PACKED LtcAfeVoltageRegisterGroup;
126static_assert(
sizeof(LtcAfeVoltageRegisterGroup) == 8,
"LtcAfeVoltageRegisterGroup must be 8 bytes");
132}
_PACKED LtcAfeAuxRegisterGroupPacket;
133static_assert(
sizeof(LtcAfeAuxRegisterGroupPacket) == 8,
"LtcAfeAuxRegisterGroupPacket must be 8 bytes");
137#define LTC6811_WRCFG_RESERVED (1 << 0)
139#define LTC6811_RDCFG_RESERVED (1 << 1)
141#define LTC6811_RDCVA_RESERVED (1 << 2)
143#define LTC6811_RDCVB_RESERVED (1 << 2) | (1 << 1)
145#define LTC6811_RDCVC_RESERVED (1 << 3)
147#define LTC6811_RDCVD_RESERVED (1 << 3) | (1 << 1)
149#define LTC6811_RDAUXA_RESERVED ((1 << 3) | (1 << 2))
151#define LTC6811_RDAUXB_RESERVED ((1 << 3) | (1 << 2)) | (1 << 1)
153#define LTC6811_RDSTATA_RESERVED (1 << 4)
155#define LTC6811_RDSTATB_RESERVED (1 << 4) | (1 << 1)
157#define LTC6811_ADCV_RESERVED ((1 << 9) | (1 << 6) | (1 << 5))
159#define LTC6811_ADCOW_RESERVED ((1 << 3) | (1 << 5) | (1 << 9))
161#define LTC6811_CVST_RESERVED ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 9))
163#define LTC6811_ADAX_RESERVED (1 << 10) | (1 << 6) | (1 << 5)
165#define LTC6811_CLRCELL_RESERVED (1 << 0) | (1 << 4) | (1 << 8) | (1 << 9) | (1 << 10)
167#define LTC6811_CLRAUX_RESERVED (1 << 1) | (1 << 4) | (1 << 8) | (1 << 9) | (1 << 10)
169#define LTC6811_CLRSTAT_RESERVED (1 << 0) | (1 << 1) | (1 << 4) | (1 << 8) | (1 << 9) | (1 << 10)
171#define LTC6811_PLADC_RESERVED (1 << 2) | (1 << 4) | (1 << 8) | (1 << 9) | (1 << 10)
173#define LTC6811_DIAGNC_RESERVED (1 << 0) | (1 << 2) | (1 << 4) | (1 << 8) | (1 << 9) | (1 << 10)
175#define LTC6811_WRCOMM_RESERVED (1 << 0) | (1 << 5) | (1 << 8) | (1 << 9) | (1 << 10)
177#define LTC6811_RDCOMM_RESERVED (1 << 1) | (1 << 5) | (1 << 8) | (1 << 9) | (1 << 10)
179#define LTC6811_STCOMM_RESERVED (1 << 0) | (1 << 1) | (1 << 5) | (1 << 8) | (1 << 9) | (1 << 10)
181#define LTC6811_WRPWM_RESERVED (1 << 5)
183#define LTC6811_RDPWM_RESERVED (1 << 5) | (1 << 2)
187#define LTC6811_GPIO1_PD_ON (0 << 3)
188#define LTC6811_GPIO1_PD_OFF (1 << 3)
189#define LTC6811_GPIO2_PD_ON (0 << 4)
190#define LTC6811_GPIO2_PD_OFF (1 << 4)
191#define LTC6811_GPIO3_PD_ON (0 << 5)
192#define LTC6811_GPIO3_PD_OFF (1 << 5)
193#define LTC6811_GPIO4_PD_ON (0 << 6)
194#define LTC6811_GPIO4_PD_OFF (1 << 6)
195#define LTC6811_GPIO5_PD_ON (0 << 7)
196#define LTC6811_GPIO5_PD_OFF (1 << 7)
198#define LTC6811_CNVT_CELL_ALL 0x00
199#define LTC6811_CNVT_CELL_1_7 0x01
200#define LTC6811_CNVT_CELL_2_8 0x02
201#define LTC6811_CNVT_CELL_3_9 0x03
202#define LTC6811_CNVT_CELL_4_10 0x04
203#define LTC6811_CNVT_CELL_5_11 0x05
204#define LTC6811_CNVT_CELL_6_12 0x06
206#define LTC6811_ADCV_DISCHARGE_NOT_PERMITTED (0 << 4)
207#define LTC6811_ADCV_DISCHARGE_PERMITTED (1 << 4)
209#define LTC6811_ADCOPT (1 << 0)
211#define LTC6811_SWTRD (1 << 1)
213#define LTC6811_ADAX_GPIO1 0x01
214#define LTC6811_ADAX_GPIO4 0x04
215#define LTC6811_ADAX_MODE_FAST (0 << 8) | (1 << 7)
217#define LTC6811_ICOM_CSBM_LOW (1 << 3)
218#define LTC6811_ICOM_CSBM_HIGH (1 << 3) | (1 << 0)
219#define LTC6811_ICOM_NO_TRANSMIT (1 << 3) | (1 << 2) | (1 << 1) | (1 << 0)
221#define LTC6811_FCOM_CSBM_LOW (0 << 0)
222#define LTC6811_FCOM_CSBM_HIGH (1 << 3) | (1 << 0)
225#define LTC6811_PWMC_DC_100 (0xF)
Definition: ltc6811.h:114