Go to the documentation of this file.
49 #define LTC4306_CTRL_REG0 0x00
50 #define LTC4306_CTRL_REG1 0x01
51 #define LTC4306_CTRL_REG2 0x02
52 #define LTC4306_CTRL_REG3 0x03
53 #define LTC4306_OUT_OF_BOUNDS 0x04
56 #define LTC4306_MASS_WRITE_ADDR 0xBA
57 #define LTC4306_ALERT_RESPONSE_ADDR 0x19
61 #define LTC4306_DOWNSTREAM_CONNECT NO_OS_BIT(7)
62 #define LTC4306_ALERT_LOGIC(x) NO_OS_BIT(7 - (x))
63 #define LTC4306_FAILED_CONN NO_OS_BIT(2)
64 #define LTC4306_LATCHED_TOUT NO_OS_BIT(1)
65 #define LTC4306_REALTIME_TOUT NO_OS_BIT(0)
68 #define LTC4306_UPSTREAM_EN NO_OS_BIT(7)
69 #define LTC4306_DOWNSTREAM_EN NO_OS_BIT(6)
70 #define LTC4306_OUT_DRV_STATE(x) NO_OS_BIT(6 - (x))
71 #define LTC4306_GPIO_LOGIC(x) NO_OS_BIT(2 - (x))
74 #define LTC4306_GPIO_MODE_MASK NO_OS_GENMASK(7, 6)
75 #define LTC4306_GPIO_MODE_CONFIG(x) NO_OS_BIT(8 - (x))
76 #define LTC4306_CONN_REQ NO_OS_BIT(5)
77 #define LTC4306_OUT_MODE_MASK NO_OS_GENMASK(4, 3)
78 #define LTC4306_OUT_MODE_CONFIG(x) NO_OS_BIT(5 - (x))
79 #define LTC4306_MASS_WRITE NO_OS_BIT(2)
80 #define LTC4306_TOUT NO_OS_GENMASK(1, 0)
83 #define LTC4306_FET_STATE_MASK NO_OS_GENMASK(7, 4)
84 #define LTC4306_FET_STATE(x) NO_OS_BIT(8 - (x))
85 #define LTC4306_BUS_LOGIC_STATE_MASK NO_OS_GENMASK(3, 0)
86 #define LTC4306_LOGIC_STATE(x) NO_OS_BIT(4 - (x))
89 #define LTC4306_MIN_CHANNEL_INDEX 1
90 #define LTC4306_CHANNEL_TWO 2
91 #define LTC4306_CHANNEL_THREE 3
92 #define LTC4306_MAX_CHANNEL_INDEX 4
93 #define LTC4306_GPIO_MIN 1
94 #define LTC4306_GPIO_MAX 2
164 uint8_t alert_pin_number,
bool *is_high);
207 bool gpio2,
bool gpio1_is_pushpull,
bool gpio2_is_pushpull);
229 uint8_t bus_num,
bool connect);
233 uint8_t bus_num,
bool *connect);
#define LTC4306_OUT_OF_BOUNDS
Definition: ltc4306.h:53
#define LTC4306_CONN_REQ
Definition: ltc4306.h:76
bool downstream
Definition: ltc4306.h:124
int32_t no_os_i2c_write(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Write data to slave device.
Definition: no_os_i2c.c:159
int32_t no_os_i2c_init(struct no_os_i2c_desc **desc, const struct no_os_i2c_init_param *param)
Initialize the I2C communication peripheral.
Definition: no_os_i2c.c:52
struct no_os_i2c_desc * i2c_desc
Definition: ltc4306.h:114
int ltc4306_set_downstream_channel(struct ltc4306_dev *dev, uint8_t bus_num, bool connect)
Dis/connects to a downstream bus. Bus logic state must be 1 for connection to occur EXCEPT when conn_...
Definition: ltc4306.c:753
int ltc4306_set_upstream_accel(struct ltc4306_dev *dev, bool upstream_en)
En/Disables upstream accelerator.
Definition: ltc4306.c:382
int ltc4306_read_bus_logic_state(struct ltc4306_dev *dev, uint8_t bus_number, bool *is_high)
Reads bus logic state.
Definition: ltc4306.c:720
#define LTC4306_FAILED_CONN
Definition: ltc4306.h:63
int ltc4306_write(struct ltc4306_dev *dev, uint8_t addr, uint8_t *write_data, uint8_t bytes)
Writes data into a register (I2C).
Definition: ltc4306.c:146
int ltc4306_read_bus_logic_state(struct ltc4306_dev *dev, uint8_t bus_num, bool *is_high)
Reads bus logic state.
Definition: ltc4306.c:720
int32_t no_os_i2c_remove(struct no_os_i2c_desc *desc)
Free the resources allocated by no_os_i2c_init().
Definition: no_os_i2c.c:113
int ltc4306_write(struct ltc4306_dev *dev, uint8_t addr, uint8_t *write_data, uint8_t bytes)
Writes data into a register (I2C).
Definition: ltc4306.c:146
int ltc4306_read_failed_conn(struct ltc4306_dev *dev, bool *is_high)
Reads Failed Connection Attempt bit.
Definition: ltc4306.c:316
int ltc4306_get_latched_timeout(struct ltc4306_dev *dev, bool *timed_out)
Reads Latched Timeout status.
Definition: ltc4306.c:338
@ LTC4306_DISABLED
Definition: ltc4306.h:107
#define LTC4306_MIN_CHANNEL_INDEX
Definition: ltc4306.h:89
int ltc4306_get_conn_req(struct ltc4306_dev *dev, bool *connect_regardless)
Gets Connection Requirement bit field.
Definition: ltc4306.c:560
int ltc4306_get_mass_write(struct ltc4306_dev *dev, bool *mass_write_en)
Gets Mass Write Bit Field status.
Definition: ltc4306.c:657
int ltc4306_get_gpio_output_state(struct ltc4306_dev *dev, int gpio, bool *is_high)
Gets GPIO Output Driver state.
Definition: ltc4306.c:489
int ltc4306_get_upstream_accel(struct ltc4306_dev *dev, bool *upstream_en)
Get status of upstream accelerator enable bit field.
Definition: ltc4306.c:401
int ltc4306_get_realtime_timeout(struct ltc4306_dev *dev, bool *timed_out)
Reads Realtime Timeout status.
Definition: ltc4306.c:360
Definition: ad9361_util.h:69
#define LTC4306_GPIO_MODE_CONFIG(x)
Definition: ltc4306.h:75
int ltc4306_get_conn_req(struct ltc4306_dev *dev, bool *connect_regardless)
Gets Connection Requirement bit field.
Definition: ltc4306.c:560
int ltc4306_get_downstream_channel(struct ltc4306_dev *dev, uint8_t bus_num, bool *connect)
Get the connection status of the selected FET.
Definition: ltc4306.c:795
int ltc4306_addr_gen(struct ltc4306_init_param *init_param, enum ltc4306_addr_conn addr0, enum ltc4306_addr_conn addr1, enum ltc4306_addr_conn addr2)
Gives the equivalent hex device address based on the input combination of addr0, addr1,...
Definition: ltc4306.c:235
@ LTC4306_NO_CONN
Definition: ltc4306.h:103
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
@ LTC4306_7P5MS
Definition: ltc4306.h:110
int ltc4306_get_downstream_channel(struct ltc4306_dev *dev, uint8_t bus_num, bool *connect)
Get the connection status of the selected FET.
Definition: ltc4306.c:795
int ltc4306_downstream_check(struct ltc4306_dev *dev, bool *downstream_conn)
Get downstream connect bit status to see if any downstream bus connected.
Definition: ltc4306.c:266
int ltc4306_set_downstream_accel(struct ltc4306_dev *dev, bool downstream_en)
En/Disables downstream accelerator.
Definition: ltc4306.c:424
bool
Definition: common.h:48
int ltc4306_read_gpio_logic_state(struct ltc4306_dev *dev, int gpio, bool *is_high)
Reads logic of selected GPIO.
Definition: ltc4306.c:516
Definition: ltc4306.h:127
int ltc4306_get_mass_write(struct ltc4306_dev *dev, bool *mass_write_en)
Gets Mass Write Bit Field status.
Definition: ltc4306.c:657
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
int ltc4306_read_alert_logic_state(struct ltc4306_dev *dev, uint8_t alert_pin_number, bool *is_high)
Reads Alert Logic State of selected ALERT pin.
Definition: ltc4306.c:289
int ltc4306_remove(struct ltc4306_dev *dev)
Free the resources allocated by ltc4306_init().
Definition: ltc4306.c:125
@ LTC4306_HIGH
Definition: ltc4306.h:102
#define LTC4306_TOUT
Definition: ltc4306.h:80
int ltc4306_addr_gen(struct ltc4306_init_param *init_param, enum ltc4306_addr_conn addr0, enum ltc4306_addr_conn addr1, enum ltc4306_addr_conn addr2)
Gives the equivalent hex device address based on the input combination of addr0, addr1,...
Definition: ltc4306.c:235
@ LTC4306_LOW
Definition: ltc4306.h:101
#define LTC4306_GPIO_MAX
Definition: ltc4306.h:94
int ltc4306_set_gpio_output_state(struct ltc4306_dev *dev, int gpio, bool is_high)
Sets GPIO Output Driver state.
Definition: ltc4306.c:466
int ltc4306_get_latched_timeout(struct ltc4306_dev *dev, bool *timed_out)
Reads Latched Timeout status.
Definition: ltc4306.c:338
#define LTC4306_CTRL_REG2
Definition: ltc4306.h:51
int ltc4306_set_upstream_accel(struct ltc4306_dev *dev, bool upstream_en)
En/Disables upstream accelerator.
Definition: ltc4306.c:382
bool is_push_pull[LTC4306_GPIO_MAX]
Definition: ltc4306.h:118
#define LTC4306_REALTIME_TOUT
Definition: ltc4306.h:65
struct no_os_i2c_init_param i2c_init
Definition: ltc4306.h:129
int ltc4306_read(struct ltc4306_dev *dev, uint8_t addr, uint8_t *read_data, uint8_t bytes)
Reads the value of a register.
Definition: ltc4306.c:178
#define LTC4306_MASS_WRITE
Definition: ltc4306.h:79
int ltc4306_set_downstream_accel(struct ltc4306_dev *dev, bool downstream_en)
En/Disables downstream accelerator.
Definition: ltc4306.c:424
#define LTC4306_DOWNSTREAM_EN
Definition: ltc4306.h:69
int ltc4306_set_timeout_mode(struct ltc4306_dev *dev, enum ltc4306_timeout_mode tout)
Sets LTC4306's Timeout Mode.
Definition: ltc4306.c:679
int ltc4306_reg_update(struct ltc4306_dev *dev, uint8_t addr, int update_mask, int update_val)
Update selected I2C register contents.
Definition: ltc4306.c:208
int ltc4306_set_mass_write(struct ltc4306_dev *dev, bool mass_write_en)
Enables Mass Write.
Definition: ltc4306.c:640
int ltc4306_init(struct ltc4306_dev **device, struct ltc4306_init_param init_param)
Initializes the communication peripheral and checks if the ltc4306 part is present.
Definition: ltc4306.c:94
#define LTC4306_OUT_MODE_CONFIG(x)
Definition: ltc4306.h:78
int ltc4306_read_failed_conn(struct ltc4306_dev *dev, bool *is_high)
Reads Failed Connection Attempt bit.
Definition: ltc4306.c:316
#define LTC4306_ALERT_LOGIC(x)
Definition: ltc4306.h:62
Header file of ltc4306 driver.
int ltc4306_reg_update(struct ltc4306_dev *dev, uint8_t addr, int update_mask, int update_val)
Update selected I2C register contents.
Definition: ltc4306.c:208
int ltc4306_downstream_check(struct ltc4306_dev *dev, bool *downstream_conn)
Get downstream connect bit status to see if any downstream bus connected.
Definition: ltc4306.c:266
int ltc4306_set_gpio_output_state(struct ltc4306_dev *dev, int gpio, bool is_high)
Sets GPIO Output Driver state.
Definition: ltc4306.c:466
int ltc4306_get_downstream_accel(struct ltc4306_dev *dev, bool *downstream_en)
Get status of downstream accelerator enable bit field.
Definition: ltc4306.c:443
bool is_input[LTC4306_GPIO_MAX]
Definition: ltc4306.h:116
#define LTC4306_CTRL_REG1
Definition: ltc4306.h:50
int ltc4306_read(struct ltc4306_dev *dev, uint8_t addr, uint8_t *read_data, uint8_t bytes)
Reads the value of a register.
Definition: ltc4306.c:178
int ltc4306_set_downstream_channel(struct ltc4306_dev *dev, uint8_t bus_num, bool connect)
Dis/connects to a downstream bus. Bus logic state must be 1 for connection to occur EXCEPT when conn_...
Definition: ltc4306.c:753
int ltc4306_set_conn_req(struct ltc4306_dev *dev, bool connect_regardless)
Sets Connection Requirement bit field.
Definition: ltc4306.c:543
@ LTC4306_15MS
Definition: ltc4306.h:109
int ltc4306_set_timeout_mode(struct ltc4306_dev *dev, enum ltc4306_timeout_mode tout)
Sets LTC4306's Timeout Mode.
Definition: ltc4306.c:679
#define LTC4306_DOWNSTREAM_CONNECT
Definition: ltc4306.h:61
int ltc4306_init(struct ltc4306_dev **device, struct ltc4306_init_param init_param)
Initializes the communication peripheral and checks if the ltc4306 part is present.
Definition: ltc4306.c:94
@ LTC4306_30MS
Definition: ltc4306.h:108
int ltc4306_get_gpio_output_state(struct ltc4306_dev *dev, int gpio, bool *is_high)
Gets GPIO Output Driver state.
Definition: ltc4306.c:489
Structure holding I2C address descriptor.
Definition: no_os_i2c.h:101
#define LTC4306_CTRL_REG0
Definition: ltc4306.h:49
int32_t no_os_i2c_read(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Read data from slave device.
Definition: no_os_i2c.c:190
Header file of I2C Interface.
int ltc4306_get_timeout_mode(struct ltc4306_dev *dev, enum ltc4306_timeout_mode *tout)
Gets LTC4306's Timeout Mode.
Definition: ltc4306.c:696
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
ltc4306_timeout_mode
Definition: ltc4306.h:106
#define LTC4306_LATCHED_TOUT
Definition: ltc4306.h:64
int ltc4306_get_timeout_mode(struct ltc4306_dev *dev, enum ltc4306_timeout_mode *tout)
Gets LTC4306's Timeout Mode.
Definition: ltc4306.c:696
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
Definition: ltc4306.h:113
const uint8_t ltc4306_addresses[]
Definition: ltc4306.c:50
bool is_closed[LTC4306_MAX_CHANNEL_INDEX]
Definition: ltc4306.h:120
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:64
#define LTC4306_CTRL_REG3
Definition: ltc4306.h:52
ltc4306_addr_conn
Definition: ltc4306.h:100
#define LTC4306_UPSTREAM_EN
Definition: ltc4306.h:68
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
#define LTC4306_OUT_DRV_STATE(x)
Definition: ltc4306.h:70
int ltc4306_set_mass_write(struct ltc4306_dev *dev, bool mass_write_en)
Enables Mass Write.
Definition: ltc4306.c:640
int ltc4306_remove(struct ltc4306_dev *dev)
Free the resources allocated by ltc4306_init().
Definition: ltc4306.c:125
int ltc4306_gpio_configure(struct ltc4306_dev *dev, bool gpio1, bool gpio2, bool gpio1_is_pushpull, bool gpio2_is_pushpull)
Configures GPIO1 and GPIO2 as input or output mode. If selected as output mode, can be configured as ...
Definition: ltc4306.c:590
int ltc4306_get_upstream_accel(struct ltc4306_dev *dev, bool *upstream_en)
Get status of upstream accelerator enable bit field.
Definition: ltc4306.c:401
#define LTC4306_LOGIC_STATE(x)
Definition: ltc4306.h:86
Header file of utility functions.
int ltc4306_get_realtime_timeout(struct ltc4306_dev *dev, bool *timed_out)
Reads Realtime Timeout status.
Definition: ltc4306.c:360
#define LTC4306_GPIO_LOGIC(x)
Definition: ltc4306.h:71
int ltc4306_gpio_configure(struct ltc4306_dev *dev, bool gpio1, bool gpio2, bool gpio1_is_pushpull, bool gpio2_is_pushpull)
Configures GPIO1 and GPIO2 as input or output mode. If selected as output mode, can be configured as ...
Definition: ltc4306.c:590
int ltc4306_read_gpio_logic_state(struct ltc4306_dev *dev, int gpio, bool *is_high)
Reads logic of selected GPIO.
Definition: ltc4306.c:516
int ltc4306_read_alert_logic_state(struct ltc4306_dev *dev, uint8_t alert_pin_number, bool *is_high)
Reads Alert Logic State of selected ALERT pin.
Definition: ltc4306.c:289
int ltc4306_get_downstream_accel(struct ltc4306_dev *dev, bool *downstream_en)
Get status of downstream accelerator enable bit field.
Definition: ltc4306.c:443
bool upstream
Definition: ltc4306.h:122
#define LTC4306_FET_STATE(x)
Definition: ltc4306.h:84
#define LTC4306_MAX_CHANNEL_INDEX
Definition: ltc4306.h:92
int ltc4306_set_conn_req(struct ltc4306_dev *dev, bool connect_regardless)
Sets Connection Requirement bit field.
Definition: ltc4306.c:543