102 uint8_t register_data;
105 bit_mask = 0x01 << bit_number;
107 register_data = register_data | bit_mask;
115 uint8_t register_data;
118 bit_mask = 0x01 << bit_number;
120 register_data = register_data & (~bit_mask);
128 uint8_t register_data;
131 bit_mask = 0x01 << bit_number;
133 register_data = register_data & (~bit_mask);
134 register_data = register_data | ((bit_data & 0x01) << bit_number);
142 uint8_t register_data;
145 register_data = register_data >> bit_number;
146 return (register_data & 0x01);
153 uint8_t register_data;
156 if (register_address == 0x32 | register_address == 0x33)
166 uint8_t register_data;
169 if (register_address == 0x23 | register_address == 0x24)
174 if (register_address == 0x26 | register_address == 0x27)
179 if (register_address == 0x29 | register_address == 0x2A)
189 uint8_t register_data;
190 uint8_t fb_ref_data = 0;
192 fb_ref_data = (uint8_t) ((fb_ref_voltage + 6.25 - 362.5) / 12.5);
195 register_data = register_data | fb_ref_data;
198 return (362.5 + (fb_ref_data * 12.5));
204 uint8_t register_data;
205 uint8_t fb_ref_data = 0;
207 fb_ref_data = (uint8_t) ((fb_ref_voltage + 6.25 - 362.5) / 12.5);
210 register_data = register_data | fb_ref_data;
213 return (362.5 + (fb_ref_data * 12.5));
268 else if (ref_char ==
'2')
278 if (buck_number == 0xFF)
287 else if (ref_char ==
'2')
296 uint8_t register_data;
298 if (buck_number == 0xFF)
307 register_data = register_data | (mode << ((buck_number*2)-2));
315 uint8_t register_data;
350 uint8_t register_data;
353 register_data = register_data | (ldo4_output_voltage_code << 5);
361 uint8_t register_data;
362 uint8_t bit_shift = log(regulator_mask/3) / log(2);
364 if (regulator_mask == 0xFF)
373 register_data = register_data & (~regulator_mask);
374 register_data = register_data | (slew_rate << bit_shift);
382 uint8_t register_data;
386 register_data = register_data | (dvdt_control_bits << 6);
#define LTC3589_BUCKBOOST_MODE
float LTC3589_set_ldo2_fb_ref(uint8_t i2c_address, uint8_t register_address, float fb_ref_voltage)
Writes the Feedback Reference Voltage of LDO2.
#define LTC3589_BUCK1_SLEW_MASK
int8_t LTC3589_bit_write(uint8_t i2c_address, uint8_t register_address, uint8_t bit_number, uint8_t bit_data)
Writes any bit inside the LTC3589 using the standard I2C repeated start format.
int8_t LTC3589_set_switch_dvdt_control(uint8_t i2c_address, uint8_t dvdt_control_bits)
Sets the switch DV/DT control for the buck regulators.
#define LTC3589_BUCK_MODE_MASK(num)
#define LTC3589_LDO3_STARTUP
#define LTC3589_LDO2_STARTUP
#define LTC3589_BUCK1_STARTUP
#define LTC3589_LDO4_STARTUP
#define LTC3589_RES_BUCK3_RBOT
#define LTC3589_LDO2_PG_MASK
int8_t i2c_read_byte_data(uint8_t address, uint8_t command, uint8_t *value)
Read a byte of data at register specified by "command", store in "value".
float LTC3589_ldo2_vout_min()
Calculates the minimum output voltage of LDO2 mV based on the feedback resistors. ...
int8_t LTC3589_select_ldo2_reference(uint8_t i2c_address, int8_t ref_char)
Selects the reference for LDO2.
#define LTC3589_REG_B2DTV1
Header File for Linduino Libraries and Demo Code.
LTC3589: 8-Output Regulator with Sequencing and I2C.
#define LTC3589_BUCK3_STARTUP
float LTC3589_ldo2_vout_max()
Calculates the maximum output voltage of LDO2 in mV based on the feedback resistors.
#define LTC3589_RES_BUCK2_RBOT
#define LTC3589_BUCK2_STARTUP
int8_t LTC3589_set_startup_mode(uint8_t i2c_address, uint8_t startup_bit)
Sets the start-up mode for all regulators.
#define LTC3589_REG_VRRCR
#define LTC3589_RES_LDO2_RTOP
#define LTC3589_I2C_ADDRESS
#define LTC3589_BUCK2_SLEW_MASK
float LTC3589_set_buck_fb_ref(uint8_t i2c_address, uint8_t register_address, float fb_ref_voltage)
Writes the Feedback Reference Voltage of any buck.
int8_t LTC3589_set_go_bits(uint8_t i2c_address)
Sets all of the GO bits in the VCCR register.
#define LTC3589_BUCK_PG_MASK
#define LTC3589_REG_L2DTV2
#define LTC3589_LDO2_SLEW_MASK
#define LTC3589_RES_BUCK1_RTOP
#define LTC3589_RES_BUCK1_RBOT
float LTC3589_buck_vout_max(uint8_t buck_number)
Calculates the maximum output voltage of any buck in mV based on the feedback resistors.
#define LTC3589_LDO2_REF_SELECT
int8_t LTC3589_register_write(uint8_t i2c_address, uint8_t register_address, uint8_t register_data)
Writes to an 8-bit register inside the LTC3589 using the standard I2C repeated start format...
#define LTC3589_FB_REF_MASK
int8_t i2c_write_byte_data(uint8_t address, uint8_t command, uint8_t value)
Write a byte of data to register specified by "command".
float LTC3589_buck_vout_min(uint8_t buck_number)
Calculates the minimum output voltage of any buck in mV based on the feedback resistors.
#define LTC3589_RES_BUCK3_RTOP
#define LTC3589_BUCK_DVDT_MASK
#define LTC3589_BB_STARTUP
int8_t LTC3589_select_buck_reference(uint8_t i2c_address, uint8_t buck_number, int8_t ref_char)
Selects the reference for the specified buck regulator(s).
int8_t LTC3589_set_regulator_slew(uint8_t i2c_address, uint8_t regulator_mask, uint8_t slew_rate)
Sets the dynamnic reference slew rate for the regulator(s).
uint8_t LTC3589_bit_is_set(uint8_t i2c_address, uint8_t register_address, uint8_t bit_number)
Reads the value of any bit in any register or the LTC3589.
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
#define LTC3589_REG_B1DTV1
int8_t LTC3589_set_buckboost_mode(uint8_t i2c_address, uint8_t mode)
Sets the switching mode for the buck-boost regulator.
float LTC3589_set_buck_output_voltage(uint8_t i2c_address, uint8_t register_address, float output_voltage)
Sets the output voltage of any buck.
int8_t LTC3589_register_read(uint8_t i2c_address, uint8_t register_address, uint8_t *register_data)
Reads an 8-bit register from the LTC3589 using the standard repeated start format.
#define LTC3589_REG_L2DTV1
int8_t LTC3589_set_buck_mode(uint8_t i2c_address, uint8_t buck_number, uint8_t mode)
Sets the switching mode for the specified buck regulator(s).
int8_t LTC3589_bit_clear(uint8_t i2c_address, uint8_t register_address, uint8_t bit_number)
Clears any bit inside the LTC3589 using the standard I2C repeated start format.
float LTC3589_set_ldo2_output_voltage(uint8_t i2c_address, uint8_t register_address, float output_voltage)
Sets the output voltage of LDO2.
#define LTC3589_RES_LDO2_RBOT
int8_t LTC3589_set_pgood_mask(uint8_t i2c_address, uint8_t pgood_bit)
Sets the PGOOD mask bit for all bucks and LDO2.
#define LTC3589_BUCK3_SLEW_MASK
#define LTC3589_RES_BUCK2_RTOP
int8_t LTC3589_set_ldo4_voltage(uint8_t i2c_address, uint8_t ldo4_output_voltage_code)
Sets LDO4 output voltage on the LTC3589.
#define LTC3589_LDO4_VOLTAGE_MASK
#define LTC3589_REG_B3DTV1
int8_t LTC3589_bit_set(uint8_t i2c_address, uint8_t register_address, uint8_t bit_number)
Sets any bit inside the LTC3589 using the standard I2C repeated start format.