rs232toi2c  2.0.0.0
Data Structures | Macros | Enumerations | Functions
rs232toi2c.h File Reference

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

#include "mikrosdk_version.h"
#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  rs232toi2c_t
 RS232 to I2C Click context object. More...
 
struct  rs232toi2c_cfg_t
 RS232 to I2C Click configuration object. More...
 

Macros

#define RS232TOI2C_CMD_WRITE_EEPROM   0x00
 RS232 to I2C Command List. More...
 
#define RS232TOI2C_CMD_READ_EEPROM   0x01
 
#define RS232TOI2C_CMD_WRITE_CURRENT_EEPROM   0x02
 
#define RS232TOI2C_CMD_READ_CURRENT_EEPROM   0x03
 
#define RS232TOI2C_CMD_ERASE_EEPROM_PAGE   0x04
 
#define RS232TOI2C_CMD_SET_GPIO_OUT   0x06
 
#define RS232TOI2C_CMD_GET_GPIO_IN   0x07
 
#define RS232TOI2C_CMD_WRITE_GPIO_CFG   0x08
 
#define RS232TOI2C_CMD_READ_GPIO_CFG   0x09
 
#define RS232TOI2C_CMD_READ_GPIO_INT_STATUS   0x0F
 
#define RS232TOI2C_CMD_READ_UART_STATUS   0x21
 
#define RS232TOI2C_CMD_ENABLE_INT   0x22
 
#define RS232TOI2C_CMD_INT_STATUS   0x23
 
#define RS232TOI2C_CMD_WRITE_TX_FIFO   0x24
 
#define RS232TOI2C_CMD_READ_RX_FIFO   0x25
 
#define RS232TOI2C_CMD_WRITE_BAUD_RATE   0x26
 
#define RS232TOI2C_CMD_READ_BAUD_RATE   0x27
 
#define RS232TOI2C_CMD_WRITE_UART_CFG   0x28
 
#define RS232TOI2C_CMD_READ_UART_CFG   0x29
 
#define RS232TOI2C_CMD_WRITE_TRANSMIT_WATERMARK   0x2A
 
#define RS232TOI2C_CMD_READ_TRANSMIT_WATERMARK   0x2B
 
#define RS232TOI2C_CMD_WRITE_RECEIVE_WATERMARK   0x2C
 
#define RS232TOI2C_CMD_READ_RECIEVE_WATERMARK   0x2D
 
#define RS232TOI2C_CMD_ENABLE_UART   0x2E
 
#define RS232TOI2C_CMD_READ_RX_TX_FIFO_LEVEL   0x31
 
#define RS232TOI2C_CMD_READ_SYSTEM_STATUS   0xE1
 
#define RS232TOI2C_CMD_READ_LAST_OP_RESULT   0xE3
 
#define RS232TOI2C_CMD_READ_SYSTEM_VERSION   0xE5
 
#define RS232TOI2C_CMD_READ_INT_SOURCE   0xEF
 
#define RS232TOI2C_GPIO_SUB_CMD_DIR   0x01
 RS232 to I2C GPIO config. More...
 
#define RS232TOI2C_GPIO_SUB_CMD_PULL_UP   0x02
 
#define RS232TOI2C_GPIO_SUB_CMD_OPEN_DRAIN   0x03
 
#define RS232TOI2C_GPIO_SUB_CMD_DEBOUNCE   0x04
 
#define RS232TOI2C_GPIO_SUB_CMD_INTERRUPT   0x05
 
#define RS232TOI2C_GPIO_SUB_CMD_RESET_DEFAULT   0x0A
 
#define RS232TOI2C_GPIO_MASK_NONE   0x00
 RS232 to I2C GPIO bit mask. More...
 
#define RS232TOI2C_GPIO_0_MASK   0x01
 
#define RS232TOI2C_GPIO_1_MASK   0x02
 
#define RS232TOI2C_GPIO_2_MASK   0x04
 
#define RS232TOI2C_GPIO_MASK_ALL   0x07
 
#define RS232TOI2C_UART_SUB_CMD_DATABITS   0x01
 RS232 to I2C UART config sub cmd. More...
 
#define RS232TOI2C_UART_SUB_CMD_PARITY   0x02
 
#define RS232TOI2C_UART_SUB_CMD_STOP_BITS   0x03
 
#define RS232TOI2C_UART_SUB_CMD_FLOW_CONTROL   0x04
 
#define RS232TOI2C_UART_SUB_CMD_RESET_FIFO   0x06
 
#define RS232TOI2C_UART_SUB_CMD_LOOPBACK   0x08
 
#define RS232TOI2C_UART_SUB_CMD_RESET_DEFAULT   0x0A
 
#define RS232TOI2C_UART_DATABITS_5   0x00
 RS232 to I2C UART config databits. More...
 
#define RS232TOI2C_UART_DATABITS_6   0x01
 
#define RS232TOI2C_UART_DATABITS_7   0x02
 
#define RS232TOI2C_UART_DATABITS_8   0x03
 
#define RS232TOI2C_UART_DATABITS_9   0x07
 
#define RS232TOI2C_UART_PARITY_NONE   0x00
 RS232 to I2C UART config parity. More...
 
#define RS232TOI2C_UART_PARITY_ODD   0x03
 
#define RS232TOI2C_UART_PARITY_EVEN   0x02
 
#define RS232TOI2C_UART_STOP_BIT_1   0x00
 RS232 to I2C UART config stop bit. More...
 
#define RS232TOI2C_UART_STOP_BIT_2   0x01
 
#define RS232TOI2C_UART_FLOW_CONTROL_NONE   0x00
 RS232 to I2C UART config flow control. More...
 
#define RS232TOI2C_UART_FLOW_CONTROL_HARDWARE   0x01
 
#define RS232TOI2C_UART_FLOW_CONTROL_SOFTWARE   0x02
 
#define RS232TOI2C_UART_RESET_TX_FIFO   0x01
 RS232 to I2C UART config reset fifo. More...
 
#define RS232TOI2C_UART_RESET_RX_FIFO   0x02
 
#define RS232TOI2C_UART_LOOPBACK_OFF   0x00
 RS232 to I2C UART config loopback. More...
 
#define RS232TOI2C_UART_LOOPBACK_ON   0x01
 
#define RS232TOI2C_UART_DISABLE_RX_TX   0x00
 RS232 to I2C UART enable bits. More...
 
#define RS232TOI2C_UART_ENABLE_RX   0x01
 
#define RS232TOI2C_UART_ENABLE_TX   0x02
 
#define RS232TOI2C_UART_ENABLE_RX_TX   0x03
 
#define RS232TOI2C_UART_STATUS_PARITY_ERROR   0x01
 RS232 to I2C uart status bit mask. More...
 
#define RS232TOI2C_UART_STATUS_FRAME_ERROR   0x02
 
#define RS232TOI2C_UART_STATUS_OVERRUN_ERROR   0x04
 
#define RS232TOI2C_UART_STATUS_BREAK_RECEIVED   0x08
 
#define RS232TOI2C_UART_STATUS_RX_EMPTY   0x20
 
#define RS232TOI2C_UART_STATUS_TX_FULL   0x40
 
#define RS232TOI2C_UART_STATUS_TX_EMPTY   0x80
 
#define RS232TOI2C_INTERRUPT_TX_RX_ERROR   0x01
 RS232 to I2C enable interrupt bit mask. More...
 
#define RS232TOI2C_INTERRUPT_RX_FULL   0x02
 
#define RS232TOI2C_INTERRUPT_RX_WATERMARK   0x04
 
#define RS232TOI2C_INTERRUPT_RX_DATA   0x08
 
#define RS232TOI2C_INTERRUPT_TX_FULL   0x20
 
#define RS232TOI2C_INTERRUPT_TX_WATERMARK   0x40
 
#define RS232TOI2C_INTERRUPT_TX_EMPTY   0x80
 
#define RS232TOI2C_EEPROM_PAGE_SIZE   32
 RS232 to I2C EEPROM range values. More...
 
#define RS232TOI2C_EEPROM_PAGE_NUM   16
 
#define RS232TOI2C_EEPROM_SIZE   512
 
#define RS232TOI2C_CMD_ACCESS_BIT   0x08
 RS232 to I2C CMD Access bit mask. More...
 
#define RS232TOI2C_SET_DEV_ADDR_A2_GND   0x53
 RS232 to I2C device address setting. More...
 
#define RS232TOI2C_SET_DEV_ADDR_A2_VCC   0x57
 
#define RS232TOI2C_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping. More...
 

Enumerations

enum  rs232toi2c_return_value_t { RS232TOI2C_OK = 0, RS232TOI2C_ERROR = -1 }
 RS232 to I2C Click return value data. More...
 

Functions

void rs232toi2c_cfg_setup (rs232toi2c_cfg_t *cfg)
 RS232 to I2C configuration object setup function. More...
 
err_t rs232toi2c_init (rs232toi2c_t *ctx, rs232toi2c_cfg_t *cfg)
 RS232 to I2C initialization function. More...
 
err_t rs232toi2c_default_cfg (rs232toi2c_t *ctx)
 RS232 to I2C default configuration function. More...
 
err_t rs232toi2c_write_command (rs232toi2c_t *ctx, uint8_t cmd, uint8_t *data_in, uint8_t data_len)
 RS232 to I2C write command function. More...
 
err_t rs232toi2c_read_command (rs232toi2c_t *ctx, uint8_t cmd, uint8_t *data_out, uint8_t data_len)
 RS232 to I2C read command function. More...
 
err_t rs232toi2c_write_eeprom (rs232toi2c_t *ctx, uint16_t address, uint8_t *data_in, uint8_t data_len)
 RS232 to I2C write eeprom function. More...
 
err_t rs232toi2c_read_eeprom (rs232toi2c_t *ctx, uint16_t address, uint8_t *data_out, uint8_t data_len)
 RS232 to I2C read eeprom function. More...
 
err_t rs232toi2c_erase_eeprom_page (rs232toi2c_t *ctx, uint8_t page_num)
 RS232 to I2C erase eeprom page function. More...
 
err_t rs232toi2c_set_gpio_out (rs232toi2c_t *ctx, uint8_t mask, uint8_t state)
 RS232 to I2C set gpio out function. More...
 
err_t rs232toi2c_get_gpio_in (rs232toi2c_t *ctx, uint8_t *state)
 RS232 to I2C get gpio in function. More...
 
err_t rs232toi2c_write_gpio_config (rs232toi2c_t *ctx, uint8_t sub_cmd, uint8_t mask, uint8_t config)
 RS232 to I2C write gpio config function. More...
 
err_t rs232toi2c_read_gpio_config (rs232toi2c_t *ctx, uint8_t sub_cmd, uint8_t *config)
 RS232 to I2C read gpio config function. More...
 
err_t rs232toi2c_write_uart_config (rs232toi2c_t *ctx, uint8_t sub_cmd, uint8_t config)
 RS232 to I2C write uart config function. More...
 
err_t rs232toi2c_read_uart_config (rs232toi2c_t *ctx, uint8_t *config)
 RS232 to I2C read uart config function. More...
 
err_t rs232toi2c_enable_uart (rs232toi2c_t *ctx, uint8_t state)
 RS232 to I2C enable uart function. More...
 
err_t rs232toi2c_set_baud_rate (rs232toi2c_t *ctx, uint32_t baud_rate)
 RS232 to I2C set baud rate function. More...
 
err_t rs232toi2c_get_baud_rate (rs232toi2c_t *ctx, uint32_t *baud_rate)
 RS232 to I2C get baud rate function. More...
 
err_t rs232toi2c_enable_interrupts (rs232toi2c_t *ctx, uint8_t int_mask)
 RS232 to I2C enable interrupts function. More...
 
err_t rs232toi2c_get_interrupt_status (rs232toi2c_t *ctx, uint8_t *int_status)
 RS232 to I2C get interrupt status function. More...
 
err_t rs232toi2c_get_uart_status (rs232toi2c_t *ctx, uint8_t *uart_status)
 RS232 to I2C get uart status function. More...
 
err_t rs232toi2c_get_gpio_status (rs232toi2c_t *ctx, uint8_t *gpio_status)
 RS232 to I2C get gpio status function. More...
 
err_t rs232toi2c_write_tx_fifo (rs232toi2c_t *ctx, uint8_t *data_in, uint8_t data_len)
 RS232 to I2C write tx fifo function. More...
 
err_t rs232toi2c_read_rx_fifo (rs232toi2c_t *ctx, uint8_t *data_out, uint8_t *data_len)
 RS232 to I2C read rx fifo function. More...
 
err_t rs232toi2c_read_system_version (rs232toi2c_t *ctx, uint32_t *system_version)
 RS232 to I2C read system version function. More...
 
void rs232toi2c_set_rst_pin (rs232toi2c_t *ctx, uint8_t state)
 RS232 to I2C set rst pin function. More...
 
void rs232toi2c_set_wp_pin (rs232toi2c_t *ctx, uint8_t state)
 RS232 to I2C set wp pin function. More...
 
void rs232toi2c_reset_device (rs232toi2c_t *ctx)
 RS232 to I2C reset device function. More...
 
uint8_t rs232toi2c_get_int_pin (rs232toi2c_t *ctx)
 RS232 to I2C get int pin function. More...
 

Detailed Description

This file contains API for RS232 to I2C Click Driver.

Enumeration Type Documentation

◆ rs232toi2c_return_value_t

RS232 to I2C Click return value data.

Predefined enum values for driver return values.

Enumerator
RS232TOI2C_OK 
RS232TOI2C_ERROR