usbcsink3 2.1.0.0
|
API for configuring and manipulating USB-C Sink 3 Click driver. More...
Topics | |
USB-C Sink 3 Registers List | |
List of registers of USB-C Sink 3 Click driver. | |
USB-C Sink 3 Registers Settings | |
Settings for registers of USB-C Sink 3 Click driver. | |
USB-C Sink 3 MikroBUS Map | |
MikroBUS pin mapping of USB-C Sink 3 Click driver. | |
Usbcsink3_cmd | |
Functions | |
void | usbcsink3_cfg_setup (usbcsink3_cfg_t *cfg) |
USB-C Sink 3 configuration object setup function. | |
err_t | usbcsink3_init (usbcsink3_t *ctx, usbcsink3_cfg_t *cfg) |
USB-C Sink 3 initialization function. | |
err_t | usbcsink3_default_cfg (usbcsink3_t *ctx) |
USB-C Sink 3 default configuration function. | |
err_t | usbcsink3_i2c_write (usbcsink3_t *ctx, uint8_t reg, uint8_t data_in) |
USB-C Sink 3 I2C writing function. | |
err_t | usbcsink3_i2c_read (usbcsink3_t *ctx, uint8_t reg, uint8_t *data_out) |
USB-C Sink 3 I2C reading function. | |
err_t | usbcsink3_spi_write (usbcsink3_t *ctx, uint8_t reg, uint8_t data_in) |
USB-C Sink 3 SPI writing function. | |
err_t | usbcsink3_read_raw_adc (usbcsink3_t *ctx, uint16_t *raw_adc) |
USB-C Sink 3 read raw ADC value function. | |
err_t | usbcsink3_read_voltage (usbcsink3_t *ctx, float *voltage) |
USB-C Sink 3 read voltage level function. | |
err_t | usbcsink3_set_vref (usbcsink3_t *ctx, float vref) |
USB-C Sink 3 set vref function. | |
err_t | usbcsink3_get_vbus (usbcsink3_t *ctx, float *vbus) |
USB-C Sink 3 get VBUS function. | |
err_t | usbcsink3_set_wiper (usbcsink3_t *ctx, uint8_t wiper_pos) |
USB-C Sink 3 set the wiper position function. | |
err_t | usbcsink3_set_resistence (usbcsink3_t *ctx, float resistence) |
USB-C Sink 3 set the resistance function. | |
err_t | usbcsink3_set_voltage (usbcsink3_t *ctx, usbcsink3_vtg_sel_t voltage) |
USB-C Sink 3 set the voltage function. | |
err_t | usbcsink3_set_power (usbcsink3_t *ctx, usbcsink3_pwr_sel_t power) |
USB-C Sink 3 set the power function. | |
API for configuring and manipulating USB-C Sink 3 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void usbcsink3_cfg_setup | ( | usbcsink3_cfg_t * | cfg | ) |
USB-C Sink 3 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See usbcsink3_cfg_t object definition for detailed explanation. |
err_t usbcsink3_default_cfg | ( | usbcsink3_t * | ctx | ) |
USB-C Sink 3 default configuration function.
This function executes a default configuration of USB-C Sink 3 click board.
[in] | ctx | : Click context object. See usbcsink3_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t usbcsink3_get_vbus | ( | usbcsink3_t * | ctx, |
float * | vbus ) |
USB-C Sink 3 get VBUS function.
This function reads raw ADC value and converts it to proportional voltage level and calculate the output voltage using the voltage divider calculation.
[in] | ctx | : Click context object. See usbcsink3_t object definition for detailed explanation. |
[in] | vbus | : Output voltage [V]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t usbcsink3_i2c_read | ( | usbcsink3_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out ) |
USB-C Sink 3 I2C reading function.
This function reads a data byte from the selected register of the TCA9536, Remote 4-Bit I2C and SMBus I/O Expander with Configuration Registers on the USB-C Sink 3 Click board™.
[in] | ctx | : Click context object. See usbcsink3_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read data. |
[in] | len | : Number of bytes to be read. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t usbcsink3_i2c_write | ( | usbcsink3_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in ) |
USB-C Sink 3 I2C writing function.
This function writes a data byte to the selected register of the TCA9536, Remote 4-Bit I2C and SMBus I/O Expander with Configuration Registers on the USB-C Sink 3 Click board™.
[in] | ctx | : Click context object. See usbcsink3_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t usbcsink3_init | ( | usbcsink3_t * | ctx, |
usbcsink3_cfg_t * | cfg ) |
USB-C Sink 3 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See usbcsink3_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See usbcsink3_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t usbcsink3_read_raw_adc | ( | usbcsink3_t * | ctx, |
uint16_t * | raw_adc ) |
USB-C Sink 3 read raw ADC value function.
This function ads raw ADC value.
[in] | ctx | : Click context object. See usbcsink3_t object definition for detailed explanation. |
[out] | raw_adc | : Output ADC result. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t usbcsink3_read_voltage | ( | usbcsink3_t * | ctx, |
float * | voltage ) |
USB-C Sink 3 read voltage level function.
This function reads raw ADC value and converts it to proportional voltage level.
[in] | ctx | : Click context object. See usbcsink3_t object definition for detailed explanation. |
[out] | voltage | : Output voltage level [V]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t usbcsink3_set_power | ( | usbcsink3_t * | ctx, |
usbcsink3_pwr_sel_t | power ) |
USB-C Sink 3 set the power function.
This function sets the output power by sets desired resistance value of the MCP41100T, Single/Dual Digital Potentiometer with SPI Interface on the USB-C Sink 3 Click board™.
[in] | ctx | : Click context object. See usbcsink3_t object definition for detailed explanation. |
[in] | power | : Power from 12.0 to 100.0 [W]. See usbcsink3_pwr_sel_t definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t usbcsink3_set_resistence | ( | usbcsink3_t * | ctx, |
float | resistence ) |
USB-C Sink 3 set the resistance function.
This function sets the resistance of the MCP41100T, Single/Dual Digital Potentiometer with SPI Interface on the USB-C Sink 3 Click board™.
[in] | ctx | : Click context object. See usbcsink3_t object definition for detailed explanation. |
[in] | resistence | : Resistance from 6.8 to 91.0 [kOhm]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t usbcsink3_set_voltage | ( | usbcsink3_t * | ctx, |
usbcsink3_vtg_sel_t | voltage ) |
USB-C Sink 3 set the voltage function.
This function sets the output voltage of the TCA9536, Remote 4-Bit I2C and SMBus I/O Expander with Configuration Registers on the USB-C Sink 3 Click board™.
[in] | ctx | : Click context object. See usbcsink3_t object definition for detailed explanation. |
[in] | voltage | : Voltage from 5.0 to 17.2 [V]. See usbcsink3_vtg_sel_t definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t usbcsink3_set_vref | ( | usbcsink3_t * | ctx, |
float | vref ) |
USB-C Sink 3 set vref function.
This function sets the voltage reference for the USB-C Sink 3 click driver.
[in] | ctx | : Click context object. See usbcsink3_t object definition for detailed explanation. |
[in] | vref | : Reference voltage [V]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t usbcsink3_set_wiper | ( | usbcsink3_t * | ctx, |
uint8_t | wiper_pos ) |
USB-C Sink 3 set the wiper position function.
This function sets the position of the wiper of the MCP41100T, Single/Dual Digital Potentiometer with SPI Interface on the USB-C Sink 3 Click board™.
[in] | ctx | : Click context object. See usbcsink3_t object definition for detailed explanation. |
[in] | wiper_pos | : Wiper position [0-255]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t usbcsink3_spi_write | ( | usbcsink3_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in ) |
USB-C Sink 3 SPI writing function.
This function writes a data byte to the selected register of the MCP41100T, Single/Dual Digital Potentiometer with SPI Interface on the USB-C Sink 3 Click board™.
[in] | ctx | : Click context object. See usbcsink3_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of bytes to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.