uarttoi2c 2.1.0.0
|
API for configuring and manipulating UART to I2C Click driver. More...
Topics | |
UART to I2C Device Settings | |
Settings for registers of UART to I2C Click driver. | |
UART to I2C MikroBUS Map | |
MikroBUS pin mapping of UART to I2C Click driver. | |
Functions | |
void | uarttoi2c_cfg_setup (uarttoi2c_cfg_t *cfg) |
UART to I2C configuration object setup function. | |
err_t | uarttoi2c_init (uarttoi2c_t *ctx, uarttoi2c_cfg_t *cfg) |
UART to I2C initialization function. | |
err_t | uarttoi2c_default_cfg (uarttoi2c_t *ctx) |
UART to I2C default configuration function. | |
err_t | uarttoi2c_generic_write (uarttoi2c_t *ctx, char *data_in, uint16_t len) |
UART to I2C data writing function. | |
err_t | uarttoi2c_generic_read (uarttoi2c_t *ctx, char *data_out, uint16_t len) |
UART to I2C data reading function. | |
void | uarttoi2c_set_rst_pin (uarttoi2c_t *ctx, uint8_t state) |
UART to I2C set rst pin function. | |
err_t | uarttoi2c_reset_device (uarttoi2c_t *ctx) |
UART to I2C reset device function. | |
err_t | uarttoi2c_write_register (uarttoi2c_t *ctx, uint8_t reg, uint8_t data_in) |
UART to I2C write register function. | |
err_t | uarttoi2c_read_register (uarttoi2c_t *ctx, uint8_t reg, uint8_t *data_out) |
UART to I2C read register function. | |
void | uarttoi2c_gpio_write (uarttoi2c_t *ctx, uint8_t gpio_data) |
UART to I2C gpio write function. | |
err_t | uarttoi2c_gpio_read (uarttoi2c_t *ctx, uint8_t *gpio_data) |
UART to I2C gpio read function. | |
err_t | uarttoi2c_gpio_config (uarttoi2c_t *ctx, uint8_t direction, uint8_t pin_mask) |
UART to I2C gpio config function. | |
err_t | uarttoi2c_read_version (uarttoi2c_t *ctx, uint8_t *version) |
UART to I2C read version function. | |
err_t | uarttoi2c_i2c_write (uarttoi2c_t *ctx, uint8_t slave_addr, uint8_t *data_in, uint8_t len) |
UART to I2C i2c write function. | |
err_t | uarttoi2c_i2c_read (uarttoi2c_t *ctx, uint8_t slave_addr, uint8_t *data_out, uint8_t len) |
UART to I2C i2c read function. | |
err_t | uarttoi2c_i2c_write_then_read (uarttoi2c_t *ctx, uint8_t slave_addr, uint8_t *data_in, uint8_t in_len, uint8_t *data_out, uint8_t out_len) |
UART to I2C i2c write then read function. | |
API for configuring and manipulating UART to I2C Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void uarttoi2c_cfg_setup | ( | uarttoi2c_cfg_t * | cfg | ) |
UART to I2C configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See uarttoi2c_cfg_t object definition for detailed explanation. |
err_t uarttoi2c_default_cfg | ( | uarttoi2c_t * | ctx | ) |
UART to I2C default configuration function.
This function executes a default configuration of UART to I2C click board.
[in] | ctx | : Click context object. See uarttoi2c_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t uarttoi2c_generic_read | ( | uarttoi2c_t * | ctx, |
char * | data_out, | ||
uint16_t | len ) |
UART to I2C data reading function.
This function reads a desired number of data bytes by using UART serial interface.
[in] | ctx | : Click context object. See uarttoi2c_t object definition for detailed explanation. |
[out] | data_out | : Output read data. |
[in] | len | : Number of bytes to be read. |
>0
- Number of data bytes read, <=0
- Error/Empty Ring buffer. See #err_t definition for detailed explanation. err_t uarttoi2c_generic_write | ( | uarttoi2c_t * | ctx, |
char * | data_in, | ||
uint16_t | len ) |
UART to I2C data writing function.
This function writes a desired number of data bytes by using UART serial interface.
[in] | ctx | : Click context object. See uarttoi2c_t object definition for detailed explanation. |
[in] | data_in | : Data buffer for sending. |
[in] | len | : Number of bytes for sending. |
>=0
- Success, <0
- Error. See #err_t definition for detailed explanation. err_t uarttoi2c_gpio_config | ( | uarttoi2c_t * | ctx, |
uint8_t | direction, | ||
uint8_t | pin_mask ) |
UART to I2C gpio config function.
This function sets the gpio direction config for the selected pins.
[in] | ctx | : Click context object. See uarttoi2c_t object definition for detailed explanation. |
[in] | direction | : GPIO direction:
|
[in] | pin_mask | : Mask for pins to configure. |
0
- Success, -1
- Error - wrong direction parameter, -2
- Timeout error. See #err_t definition for detailed explanation. err_t uarttoi2c_gpio_read | ( | uarttoi2c_t * | ctx, |
uint8_t * | gpio_data ) |
UART to I2C gpio read function.
This function reads data from the gpio port.
[in] | ctx | : Click context object. See uarttoi2c_t object definition for detailed explanation. |
[out] | gpio_data | : GPIO data read. |
0
- Success, -1
- Error - null pointer, -2
- Timeout error. See #err_t definition for detailed explanation. void uarttoi2c_gpio_write | ( | uarttoi2c_t * | ctx, |
uint8_t | gpio_data ) |
UART to I2C gpio write function.
This function writes a desired data to the gpio port.
[in] | ctx | : Click context object. See uarttoi2c_t object definition for detailed explanation. |
[in] | gpio_data | : GPIO data to be written. |
err_t uarttoi2c_i2c_read | ( | uarttoi2c_t * | ctx, |
uint8_t | slave_addr, | ||
uint8_t * | data_out, | ||
uint8_t | len ) |
UART to I2C i2c read function.
This function reads a desired number of data bytes from the I2C target device.
[in] | ctx | : Click context object. See uarttoi2c_t object definition for detailed explanation. |
[in] | slave_addr | : Target device slave address. |
[out] | data_out | : Output data read. |
[in] | len | : Number of bytes to be read. |
0
- Success, -1
- Error - parameter error or not enough bytes read, -2
- Timeout error. See #err_t definition for detailed explanation. err_t uarttoi2c_i2c_write | ( | uarttoi2c_t * | ctx, |
uint8_t | slave_addr, | ||
uint8_t * | data_in, | ||
uint8_t | len ) |
UART to I2C i2c write function.
This function writes a desired number of data bytes to the I2C target device.
[in] | ctx | : Click context object. See uarttoi2c_t object definition for detailed explanation. |
[in] | slave_addr | : Target device slave address. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of bytes to be written. |
0
- Success, -1
- Error - null pointer. See #err_t definition for detailed explanation. err_t uarttoi2c_i2c_write_then_read | ( | uarttoi2c_t * | ctx, |
uint8_t | slave_addr, | ||
uint8_t * | data_in, | ||
uint8_t | in_len, | ||
uint8_t * | data_out, | ||
uint8_t | out_len ) |
UART to I2C i2c write then read function.
This function performs a write then read with a repeated start to the I2C target device.
[in] | ctx | : Click context object. See uarttoi2c_t object definition for detailed explanation. |
[in] | slave_addr | : Target device slave address. |
[in] | data_in | : Data to be written. |
[in] | in_len | : Number of bytes to be written. |
[out] | data_out | : Output data read. |
[in] | out_len | : Number of bytes to be read. |
0
- Success, -1
- Error - null pointer or not enough bytes read, -2
- Timeout error. See #err_t definition for detailed explanation. err_t uarttoi2c_init | ( | uarttoi2c_t * | ctx, |
uarttoi2c_cfg_t * | cfg ) |
UART to I2C initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See uarttoi2c_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See uarttoi2c_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t uarttoi2c_read_register | ( | uarttoi2c_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out ) |
UART to I2C read register function.
This function reads data from the specified chip internal register.
[in] | ctx | : Click context object. See uarttoi2c_t object definition for detailed explanation. |
[in] | reg | : Chip internal register address. |
[out] | data_out | : Output data read. |
0
- Success, -1
- Error - unknown register or null pointer, -2
- Timeout error. See #err_t definition for detailed explanation. err_t uarttoi2c_read_version | ( | uarttoi2c_t * | ctx, |
uint8_t * | version ) |
UART to I2C read version function.
This function reads the firmware version (16-bytes string ending with a null terminator).
[in] | ctx | : Click context object. See uarttoi2c_t object definition for detailed explanation. |
[out] | version | : Firmware version (16-bytes string ending with a null terminator). |
0
- Success, -1
- Error - not enough bytes read, -2
- Timeout error. See #err_t definition for detailed explanation. err_t uarttoi2c_reset_device | ( | uarttoi2c_t * | ctx | ) |
UART to I2C reset device function.
This function resets the device and checks the power up response.
[in] | ctx | : Click context object. See uarttoi2c_t object definition for detailed explanation. |
0
- Success, -2
- Timeout error. See #err_t definition for detailed explanation. void uarttoi2c_set_rst_pin | ( | uarttoi2c_t * | ctx, |
uint8_t | state ) |
UART to I2C set rst pin function.
This function sets the RST pin logic state.
[in] | ctx | : Click context object. See uarttoi2c_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
err_t uarttoi2c_write_register | ( | uarttoi2c_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in ) |
UART to I2C write register function.
This function writes a desired data to the specified chip internal register.
[in] | ctx | : Click context object. See uarttoi2c_t object definition for detailed explanation. |
[in] | reg | : Chip internal register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error - unknown register. See #err_t definition for detailed explanation.