uarttoi2c 2.1.0.0
uarttoi2c.h File Reference

This file contains API for UART to I2C Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_uart.h"

Go to the source code of this file.

Data Structures

struct  uarttoi2c_t
 UART to I2C Click context object. More...
 
struct  uarttoi2c_cfg_t
 UART to I2C Click configuration object. More...
 

Macros

#define UARTTOI2C_CMD_START   'S'
 UART to I2C control commands.
 
#define UARTTOI2C_CMD_STOP   'P'
 
#define UARTTOI2C_CMD_READ_REG   'R'
 
#define UARTTOI2C_CMD_WRITE_REG   'W'
 
#define UARTTOI2C_CMD_READ_GPIO   'I'
 
#define UARTTOI2C_CMD_WRITE_GPIO   'O'
 
#define UARTTOI2C_CMD_READ_VERSION   'V'
 
#define UARTTOI2C_CMD_POWER_DOWN   'Z'
 
#define UARTTOI2C_REG_BRG0   0x00
 UART to I2C registers list.
 
#define UARTTOI2C_REG_BRG1   0x01
 
#define UARTTOI2C_REG_PORT_CONF_1   0x02
 
#define UARTTOI2C_REG_PORT_CONF_2   0x03
 
#define UARTTOI2C_REG_IO_STATE   0x04
 
#define UARTTOI2C_REG_RESERVED   0x05
 
#define UARTTOI2C_REG_I2C_ADR   0x06
 
#define UARTTOI2C_REG_I2C_CLK_L   0x07
 
#define UARTTOI2C_REG_I2C_CLK_H   0x08
 
#define UARTTOI2C_REG_I2C_TO   0x09
 
#define UARTTOI2C_REG_I2C_STAT   0x0A
 
#define UARTTOI2C_TIMEOUT_MS   3000
 UART to I2C read timeout settings.
 
#define UARTTOI2C_POWER_UP_BYTE_0   0x4F
 UART to I2C power up bytes (ASCII "OK").
 
#define UARTTOI2C_POWER_UP_BYTE_1   0x4B
 
#define UARTTOI2C_NO_PIN_MASK   0x00
 UART to I2C pin mask values.
 
#define UARTTOI2C_PIN_0_MASK   0x01
 
#define UARTTOI2C_PIN_1_MASK   0x02
 
#define UARTTOI2C_PIN_2_MASK   0x04
 
#define UARTTOI2C_PIN_3_MASK   0x08
 
#define UARTTOI2C_PIN_4_MASK   0x10
 
#define UARTTOI2C_PIN_5_MASK   0x20
 
#define UARTTOI2C_PIN_6_MASK   0x40
 
#define UARTTOI2C_PIN_7_MASK   0x80
 
#define UARTTOI2C_ALL_PINS_MASK   0xFF
 
#define UARTTOI2C_PIN_DIR_INPUT   0x00
 UART to I2C pin direction settings.
 
#define UARTTOI2C_PIN_DIR_OUTPUT_PP   0x02
 
#define UARTTOI2C_PIN_DIR_OUTPUT_OD   0x03
 
#define UARTTOI2C_PIN_DIR_OUTPUT_MASK   0x03
 
#define UARTTOI2C_TX_DRV_BUFFER_SIZE   100
 UART to I2C driver buffer size.
 
#define UARTTOI2C_RX_DRV_BUFFER_SIZE   300
 
#define UARTTOI2C_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  uarttoi2c_return_value_t { UARTTOI2C_OK = 0 , UARTTOI2C_ERROR = -1 , UARTTOI2C_TIMEOUT_ERROR = -2 }
 UART to I2C Click return value data. More...
 

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.
 

Detailed Description

This file contains API for UART to I2C Click Driver.

Enumeration Type Documentation

◆ uarttoi2c_return_value_t

UART to I2C Click return value data.

Predefined enum values for driver return values.

Enumerator
UARTTOI2C_OK 
UARTTOI2C_ERROR 
UARTTOI2C_TIMEOUT_ERROR