no-OS
|
Header file of ltc4306 driver. More...
Go to the source code of this file.
Classes | |
struct | ltc4306_dev |
struct | ltc4306_init_param |
Enumerations | |
enum | ltc4306_addr_conn { LTC4306_LOW, LTC4306_HIGH, LTC4306_NO_CONN } |
enum | ltc4306_timeout_mode { LTC4306_DISABLED, LTC4306_30MS, LTC4306_15MS, LTC4306_7P5MS } |
Functions | |
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, and addr2. (27 possible device address) More... | |
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. More... | |
int | ltc4306_write (struct ltc4306_dev *dev, uint8_t addr, uint8_t *write_data, uint8_t bytes) |
Writes data into a register (I2C). More... | |
int | ltc4306_read (struct ltc4306_dev *dev, uint8_t addr, uint8_t *read_data, uint8_t bytes) |
Reads the value of a register. More... | |
int | ltc4306_reg_update (struct ltc4306_dev *dev, uint8_t addr, int update_mask, int update_val) |
Update selected I2C register contents. More... | |
int | ltc4306_remove (struct ltc4306_dev *dev) |
Free the resources allocated by ltc4306_init(). More... | |
int | ltc4306_downstream_check (struct ltc4306_dev *dev, bool *downstream_conn) |
Get downstream connect bit status to see if any downstream bus connected. More... | |
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. More... | |
int | ltc4306_read_failed_conn (struct ltc4306_dev *dev, bool *is_high) |
Reads Failed Connection Attempt bit. More... | |
int | ltc4306_get_latched_timeout (struct ltc4306_dev *dev, bool *timed_out) |
Reads Latched Timeout status. More... | |
int | ltc4306_get_realtime_timeout (struct ltc4306_dev *dev, bool *timed_out) |
Reads Realtime Timeout status. More... | |
int | ltc4306_set_upstream_accel (struct ltc4306_dev *dev, bool upstream_en) |
En/Disables upstream accelerator. More... | |
int | ltc4306_get_upstream_accel (struct ltc4306_dev *dev, bool *upstream_en) |
Get status of upstream accelerator enable bit field. More... | |
int | ltc4306_set_downstream_accel (struct ltc4306_dev *dev, bool downstream_en) |
En/Disables downstream accelerator. More... | |
int | ltc4306_get_downstream_accel (struct ltc4306_dev *dev, bool *downstream_en) |
Get status of downstream accelerator enable bit field. More... | |
int | ltc4306_set_gpio_output_state (struct ltc4306_dev *dev, int gpio, bool is_high) |
Sets GPIO Output Driver state. More... | |
int | ltc4306_get_gpio_output_state (struct ltc4306_dev *dev, int gpio, bool *is_high) |
Gets GPIO Output Driver state. More... | |
int | ltc4306_read_gpio_logic_state (struct ltc4306_dev *dev, int gpio, bool *is_high) |
Reads logic of selected GPIO. More... | |
int | ltc4306_set_conn_req (struct ltc4306_dev *dev, bool connect_regardless) |
Sets Connection Requirement bit field. More... | |
int | ltc4306_get_conn_req (struct ltc4306_dev *dev, bool *connect_regardless) |
Gets Connection Requirement bit field. More... | |
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 open-drain or push-pull. More... | |
int | ltc4306_set_mass_write (struct ltc4306_dev *dev, bool mass_write_en) |
Enables Mass Write. More... | |
int | ltc4306_get_mass_write (struct ltc4306_dev *dev, bool *mass_write_en) |
Gets Mass Write Bit Field status. More... | |
int | ltc4306_set_timeout_mode (struct ltc4306_dev *dev, enum ltc4306_timeout_mode tout) |
Sets LTC4306's Timeout Mode. More... | |
int | ltc4306_get_timeout_mode (struct ltc4306_dev *dev, enum ltc4306_timeout_mode *tout) |
Gets LTC4306's Timeout Mode. More... | |
int | ltc4306_read_bus_logic_state (struct ltc4306_dev *dev, uint8_t bus_number, bool *is_high) |
Reads bus logic state. More... | |
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_req is 0. Controller will connect to downstream bus regardless of its logic state if conn_req is 1. More... | |
int | ltc4306_get_downstream_channel (struct ltc4306_dev *dev, uint8_t bus_num, bool *connect) |
Get the connection status of the selected FET. More... | |
Header file of ltc4306 driver.
Copyright 2023(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.
#define LTC4306_ALERT_LOGIC | ( | x | ) | NO_OS_BIT(7 - (x)) |
#define LTC4306_ALERT_RESPONSE_ADDR 0x19 |
#define LTC4306_BUS_LOGIC_STATE_MASK NO_OS_GENMASK(3, 0) |
#define LTC4306_CHANNEL_THREE 3 |
#define LTC4306_CHANNEL_TWO 2 |
#define LTC4306_CONN_REQ NO_OS_BIT(5) |
#define LTC4306_CTRL_REG0 0x00 |
#define LTC4306_CTRL_REG1 0x01 |
#define LTC4306_CTRL_REG2 0x02 |
#define LTC4306_CTRL_REG3 0x03 |
#define LTC4306_DOWNSTREAM_CONNECT NO_OS_BIT(7) |
#define LTC4306_DOWNSTREAM_EN NO_OS_BIT(6) |
#define LTC4306_FAILED_CONN NO_OS_BIT(2) |
#define LTC4306_FET_STATE | ( | x | ) | NO_OS_BIT(8 - (x)) |
#define LTC4306_FET_STATE_MASK NO_OS_GENMASK(7, 4) |
#define LTC4306_GPIO_LOGIC | ( | x | ) | NO_OS_BIT(2 - (x)) |
#define LTC4306_GPIO_MAX 2 |
#define LTC4306_GPIO_MIN 1 |
#define LTC4306_GPIO_MODE_CONFIG | ( | x | ) | NO_OS_BIT(8 - (x)) |
#define LTC4306_GPIO_MODE_MASK NO_OS_GENMASK(7, 6) |
#define LTC4306_LATCHED_TOUT NO_OS_BIT(1) |
#define LTC4306_LOGIC_STATE | ( | x | ) | NO_OS_BIT(4 - (x)) |
#define LTC4306_MASS_WRITE NO_OS_BIT(2) |
#define LTC4306_MASS_WRITE_ADDR 0xBA |
#define LTC4306_MAX_CHANNEL_INDEX 4 |
#define LTC4306_MIN_CHANNEL_INDEX 1 |
#define LTC4306_OUT_DRV_STATE | ( | x | ) | NO_OS_BIT(6 - (x)) |
#define LTC4306_OUT_MODE_CONFIG | ( | x | ) | NO_OS_BIT(5 - (x)) |
#define LTC4306_OUT_MODE_MASK NO_OS_GENMASK(4, 3) |
#define LTC4306_OUT_OF_BOUNDS 0x04 |
#define LTC4306_REALTIME_TOUT NO_OS_BIT(0) |
#define LTC4306_TOUT NO_OS_GENMASK(1, 0) |
#define LTC4306_UPSTREAM_EN NO_OS_BIT(7) |
enum ltc4306_addr_conn |
enum ltc4306_timeout_mode |
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, and addr2. (27 possible device address)
init_param | - init param structure. |
addr0 | - addr0 logic level |
addr1 | - addr1 logic level |
addr2 | - addr2 logic level |
int ltc4306_downstream_check | ( | struct ltc4306_dev * | dev, |
bool * | downstream_conn | ||
) |
Get downstream connect bit status to see if any downstream bus connected.
dev | - The device structure. |
downstream_conn | - Stores status of downstream connect bit. |
int ltc4306_get_conn_req | ( | struct ltc4306_dev * | dev, |
bool * | connect_regardless | ||
) |
Gets Connection Requirement bit field.
dev | - The device structure. |
connect_regardless | - Stores connection requirement bit status |
int ltc4306_get_downstream_accel | ( | struct ltc4306_dev * | dev, |
bool * | downstream_en | ||
) |
Get status of downstream accelerator enable bit field.
dev | - The device structure. |
downstream_en | - Stores status of Downstream Connected bit. |
int ltc4306_get_downstream_channel | ( | struct ltc4306_dev * | dev, |
uint8_t | bus_num, | ||
bool * | connect | ||
) |
Get the connection status of the selected FET.
dev | - The device structure. |
bus_num | - Bus number that the user wants to connect to. (can be any value from 1 to 4) |
connect | - Stores the status of the bus FET state. |
int ltc4306_get_gpio_output_state | ( | struct ltc4306_dev * | dev, |
int | gpio, | ||
bool * | is_high | ||
) |
Gets GPIO Output Driver state.
dev | - The device structure. |
gpio | - GPIO to set / reset. |
is_high | - Stores status of selected GPIO. |
int ltc4306_get_latched_timeout | ( | struct ltc4306_dev * | dev, |
bool * | timed_out | ||
) |
Reads Latched Timeout status.
dev | - The device structure. |
timed_out | - Stores status of Latched Timeout bit. |
int ltc4306_get_mass_write | ( | struct ltc4306_dev * | dev, |
bool * | mass_write_en | ||
) |
Gets Mass Write Bit Field status.
dev | - The device structure. |
mass_write_en | - Stores the status of the mass write bit field. |
int ltc4306_get_realtime_timeout | ( | struct ltc4306_dev * | dev, |
bool * | timed_out | ||
) |
Reads Realtime Timeout status.
dev | - The device structure. |
timed_out | - Stores status of Realtime Timeout bit. |
int ltc4306_get_timeout_mode | ( | struct ltc4306_dev * | dev, |
enum ltc4306_timeout_mode * | tout | ||
) |
Gets LTC4306's Timeout Mode.
dev | - The device structure. |
tout | - Stores the timeout read. |
int ltc4306_get_upstream_accel | ( | struct ltc4306_dev * | dev, |
bool * | upstream_en | ||
) |
Get status of upstream accelerator enable bit field.
dev | - The device structure. |
upstream_en | - Stores status of Upstream Connected bit. |
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 open-drain or push-pull.
dev | - The device structure. |
gpio1 | - Set true to configure GPIO1 to input mode; false for output mode. |
gpio2 | - Set true to configure GPIO2 to input mode; false for output mode. |
gpio1_is_pushpull | - Set true to configure GPIO1 output mode to push-pull; false for open-drain. |
gpio2_is_pushpull | - Set true to configure GPIO2 output mode to push-pull; false for open-drain. |
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.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
int ltc4306_read | ( | struct ltc4306_dev * | dev, |
uint8_t | addr, | ||
uint8_t * | read_data, | ||
uint8_t | bytes | ||
) |
Reads the value of a register.
dev | - The device structure. |
addr | - Address of the register. |
read_data | - Read data bufer |
bytes | - Number of bytes to read from starting register address |
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.
dev | - The device structure. |
alert_pin_number | - ALERT pin to be read (1 to 4). |
is_high | - Stores status of selected ALERT pin. |
int ltc4306_read_bus_logic_state | ( | struct ltc4306_dev * | dev, |
uint8_t | bus_num, | ||
bool * | is_high | ||
) |
Reads bus logic state.
dev | - The device structure. |
bus_num | - Selects what bus to read (any number from 1 to 4) |
is_high | - Stores logic status of selected bus. |
int ltc4306_read_failed_conn | ( | struct ltc4306_dev * | dev, |
bool * | is_high | ||
) |
Reads Failed Connection Attempt bit.
dev | - The device structure. |
is_high | - Stores status of Failed Connection Attempt bit |
int ltc4306_read_gpio_logic_state | ( | struct ltc4306_dev * | dev, |
int | gpio, | ||
bool * | is_high | ||
) |
Reads logic of selected GPIO.
dev | - The device structure. |
gpio | - GPIO number (only 1 or 2) |
is_high | - Stores logic state value of selected GPIO. |
int ltc4306_reg_update | ( | struct ltc4306_dev * | dev, |
uint8_t | addr, | ||
int | update_mask, | ||
int | update_val | ||
) |
Update selected I2C register contents.
dev | - The device structure. |
addr | - Starting / selected register address. |
update_mask | - Mask to update to selected register bit/s |
update_val | - Value used to update on selected register |
int ltc4306_remove | ( | struct ltc4306_dev * | dev | ) |
Free the resources allocated by ltc4306_init().
dev | - The device structure. |
int ltc4306_set_conn_req | ( | struct ltc4306_dev * | dev, |
bool | connect_regardless | ||
) |
Sets Connection Requirement bit field.
dev | - The device structure. |
connect_regardless | - Set true to configure controller to connect to downstream bus regardless of bus logic state; otherwise, set false. |
int ltc4306_set_downstream_accel | ( | struct ltc4306_dev * | dev, |
bool | downstream_en | ||
) |
En/Disables downstream accelerator.
dev | - The device structure. |
downstream_en | - Set true to enable downstream rise time accelerator; false to disable |
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_req is 0. Controller will connect to downstream bus regardless of its logic state if conn_req is 1.
dev | - The device structure. |
bus_num | - Bus number to dis/connect (1 to 4). |
connect | - Set true to connect selecetd downstream to upstream, false otherwise. |
int ltc4306_set_gpio_output_state | ( | struct ltc4306_dev * | dev, |
int | gpio, | ||
bool | is_high | ||
) |
Sets GPIO Output Driver state.
dev | - The device structure. |
gpio | - GPIO to set / reset. |
is_high | - GPIO logic level. |
int ltc4306_set_mass_write | ( | struct ltc4306_dev * | dev, |
bool | mass_write_en | ||
) |
Enables Mass Write.
dev | - The device structure. |
mass_write_en | - Set true to enable mass write address; false to disable. |
int ltc4306_set_timeout_mode | ( | struct ltc4306_dev * | dev, |
enum ltc4306_timeout_mode | tout | ||
) |
Sets LTC4306's Timeout Mode.
dev | - The device structure. |
tout | - Timeout mode to configure. |
int ltc4306_set_upstream_accel | ( | struct ltc4306_dev * | dev, |
bool | upstream_en | ||
) |
En/Disables upstream accelerator.
dev | - The device structure. |
upstream_en | - Set true to enable upstream rise time accelerator, false otherwise. |
int ltc4306_write | ( | struct ltc4306_dev * | dev, |
uint8_t | addr, | ||
uint8_t * | write_data, | ||
uint8_t | bytes | ||
) |
Writes data into a register (I2C).
dev | - The device structure. |
addr | - Starting / selected register address. |
write_data | - Write data buffer |
bytes | - number of bytes to write |