usbcsource 2.0.0.0
|
API for configuring and manipulating USB-C Source Click driver. More...
Topics | |
USB-C Source Registers List | |
List of registers of USB-C Source Click driver. | |
USB-C Source Registers Settings | |
Settings for registers of USB-C Source Click driver. | |
USB-C Source MikroBUS Map | |
MikroBUS pin mapping of USB-C Source Click driver. | |
Functions | |
void | usbcsource_cfg_setup (usbcsource_cfg_t *cfg) |
USB-C Source configuration object setup function. | |
err_t | usbcsource_init (usbcsource_t *ctx, usbcsource_cfg_t *cfg) |
USB-C Source initialization function. | |
err_t | usbcsource_generic_write (usbcsource_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len) |
USB-C Source I2C writing function. | |
err_t | usbcsource_generic_read (usbcsource_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len) |
USB-C Source I2C reading function. | |
void | usbcsource_write_byte (usbcsource_t *ctx, uint8_t reg, uint8_t tx_data) |
Generic write function. | |
uint8_t | usbcsource_read_byte (usbcsource_t *ctx, uint8_t reg) |
Generic read function. | |
void | usbcsource_hw_reset (usbcsource_t *ctx) |
HW reset function. | |
uint8_t | usbcsource_int_pin_state (usbcsource_t *ctx) |
Get INT pin state function. | |
void | usbcsource_get_alert_status (usbcsource_t *ctx, alert_status_t *alert_status_data) |
Get alert status function. | |
void | usbcsource_set_alert_status (usbcsource_t *ctx, alert_status_t alert_status_data) |
Set alert status function. | |
uint8_t | usbcsource_check_attach_trans (usbcsource_t *ctx) |
Check attach trans function. | |
void | usbcsource_get_port_status (usbcsource_t *ctx, port_status_t *port_status_data) |
Get port status function. | |
void | usbcsource_get_monitoring_status (usbcsource_t *ctx, monitor_status_t *monitor_status_data) |
Get monitoring status function. | |
void | usbcsource_get_connection_status (usbcsource_t *ctx, connection_status_t *conn_data) |
Get connection status function. | |
void | usbcsource_get_fault_status (usbcsource_t *ctx, fault_status_t *fault_data) |
Get fault status function. | |
void | usbcsource_sw_reset (usbcsource_t *ctx) |
SW reset function. | |
uint8_t | usbcsource_set_pdo_config (usbcsource_t *ctx, pdo_config_t pdo_cfg_data) |
Set PDO configuration function. | |
uint8_t | usbcsource_get_pdo_config (usbcsource_t *ctx, uint8_t pdo_numb, pdo_config_t *pdo_cfg_data) |
Get PDO configuration function. | |
void | usbcsource_default_config (usbcsource_t *ctx) |
Default configuration function. | |
API for configuring and manipulating USB-C Source Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void usbcsource_cfg_setup | ( | usbcsource_cfg_t * | cfg | ) |
USB-C Source configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See usbcsource_cfg_t object definition for detailed explanation. |
uint8_t usbcsource_check_attach_trans | ( | usbcsource_t * | ctx | ) |
Check attach trans function.
The function check attach transition of the STUSB4700, Standalone autonomous USB PD controller with short-to-VBUS protections on USB-C Source Click board.
[in] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
0
- Transition not detected in Attached state. 1
- Transition detected in Attached state. void usbcsource_default_config | ( | usbcsource_t * | ctx | ) |
Default configuration function.
The function set the default configuration of the STUSB4700, Standalone autonomous USB PD controller with short-to-VBUS protections on USB-C Source Click board.
[in] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
err_t usbcsource_generic_read | ( | usbcsource_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | rx_buf, | ||
uint8_t | rx_len ) |
USB-C Source I2C reading function.
This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | rx_buf | : Output read data. |
[in] | rx_len | : Number of bytes to be read. |
0
- Success, -1
- Error.err_t usbcsource_generic_write | ( | usbcsource_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | tx_buf, | ||
uint8_t | tx_len ) |
USB-C Source I2C writing function.
This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | tx_buf | : Data to be written. |
[in] | tx_len | : Number of bytes to be written. |
0
- Success, -1
- Error.void usbcsource_get_alert_status | ( | usbcsource_t * | ctx, |
alert_status_t * | alert_status_data ) |
Get alert status function.
The function get alert status by read the byte of data from a register USBCSOURCE_REG_ALERT_STATUS_REG of the STUSB4700, Standalone autonomous USB PD controller with short-to-VBUS protections on USB-C Source Click board.
[in] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
[out] | alert_status_data | : Pointer to the memory location where data be stored. |
void usbcsource_get_connection_status | ( | usbcsource_t * | ctx, |
connection_status_t * | conn_data ) |
Get connection status function.
The function get connection status by read the byte of data from a register USBCSOURCE_REG_CC_CONNECTION_STATUS_2 of the STUSB4700, Standalone autonomous USB PD controller with short-to-VBUS protections on USB-C Source Click board.
[in] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
[out] | port_connection_data | : Pointer to the memory location where data be stored. |
void usbcsource_get_fault_status | ( | usbcsource_t * | ctx, |
fault_status_t * | fault_data ) |
Get fault status function.
The function get fault status by read the byte of data from a registers USBCSOURCE_REG_HW_FAULT_STATUS_TRANS and USBCSOURCE_REG_HW_FAULT_STATUS of the STUSB4700, Standalone autonomous USB PD controller with short-to-VBUS protections on USB-C Source Click board.
[in] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
[out] | port_fault_data | : Pointer to the memory location where data be stored. |
void usbcsource_get_monitoring_status | ( | usbcsource_t * | ctx, |
monitor_status_t * | monitor_status_data ) |
Get monitoring status function.
The function get monitoring status by read the byte of data from a registers USBCSOURCE_REG_MONITORING_STATUS_TRANS and USBCSOURCE_REG_MONITORING_STATUS of the STUSB4700, Standalone autonomous USB PD controller with short-to-VBUS protections on USB-C Source Click board.
[in] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
[out] | port_monitoring_data | : Pointer to the memory location where data be stored. |
uint8_t usbcsource_get_pdo_config | ( | usbcsource_t * | ctx, |
uint8_t | pdo_numb, | ||
pdo_config_t * | pdo_cfg_data ) |
Get PDO configuration function.
The function get the configuration of the desired PDO of the STUSB4700, Standalone autonomous USB PD controller with short-to-VBUS protections on USB-C Source Click board.
[in] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
[in] | pdo_numb | : Number of the source PDOs[ 1 - 5 ]. |
[out] | pdo_cfg_data | Pointer to the memory location where data be stored. |
void usbcsource_get_port_status | ( | usbcsource_t * | ctx, |
port_status_t * | port_status_data ) |
Get port status function.
The function get port status by read the byte of data from a register USBCSOURCE_REG_CC_CONNECTION_STATUS_1 of the STUSB4700, Standalone autonomous USB PD controller with short-to-VBUS protections on USB-C Source Click board.
[in] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
[out] | port_status_data | : Pointer to the memory location where data be stored. |
void usbcsource_hw_reset | ( | usbcsource_t * | ctx | ) |
HW reset function.
The function hardware reset, reset the STUSB4700, Standalone autonomous USB PD controller with short-to-VBUS protections on USB-C Source Click board.
[out] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
err_t usbcsource_init | ( | usbcsource_t * | ctx, |
usbcsource_cfg_t * | cfg ) |
USB-C Source initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See usbcsource_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.uint8_t usbcsource_int_pin_state | ( | usbcsource_t * | ctx | ) |
Get INT pin state function.
The function get INT pin state reset the STUSB4700, Standalone autonomous USB PD controller with short-to-VBUS protections on USB-C Source Click board.
[out] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
uint8_t usbcsource_read_byte | ( | usbcsource_t * | ctx, |
uint8_t | reg ) |
Generic read function.
The function read the the byte of data from the target 8-bit register address of the STUSB4700, Standalone autonomous USB PD controller with short-to-VBUS protections on USB-C Source Click board.
[in] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
[in] | reg | : 8-bit register address. |
void usbcsource_set_alert_status | ( | usbcsource_t * | ctx, |
alert_status_t | alert_status_data ) |
Set alert status function.
The function set alert status by write the byte of data to a register USBCSOURCE_REG_ALERT_STATUS_REG of the STUSB4700, Standalone autonomous USB PD controller with short-to-VBUS protections on USB-C Source Click board.
[in] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
[out] | alert_status_data | : Structure where data be stored. |
uint8_t usbcsource_set_pdo_config | ( | usbcsource_t * | ctx, |
pdo_config_t | pdo_cfg_data ) |
Set PDO configuration function.
The function set the configuration of the desired PDO of the STUSB4700, Standalone autonomous USB PD controller with short-to-VBUS protections on USB-C Source Click board.
[in] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
[out] | pdo_cfg_data | : Structure where data be stored. |
void usbcsource_sw_reset | ( | usbcsource_t * | ctx | ) |
SW reset function.
The function software reset, reset the STUSB4700, Standalone autonomous USB PD controller with short-to-VBUS protections on USB-C Source Click board.
[in] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
void usbcsource_write_byte | ( | usbcsource_t * | ctx, |
uint8_t | reg, | ||
uint8_t | tx_data ) |
Generic write function.
The function write the byte of data to the target 8-bit register address of the STUSB4700, Standalone autonomous USB PD controller with short-to-VBUS protections on USB-C Source Click board.
[in] | ctx | : Click context object. See usbcsource_t object definition for detailed explanation. |
[in] | reg | : 8-bit register address. |
[in] | tx_data | : Byte of data to write. |