rs232toi2c 2.0.0.0
RS232 to I2C Click Driver

API for configuring and manipulating RS232 to I2C Click driver. More...

Topics

 RS232 to I2C Registers List
 List of registers of RS232 to I2C Click driver.
 
 RS232 to I2C Registers Settings
 Settings for registers of RS232 to I2C Click driver.
 
 RS232 to I2C MikroBUS Map
 MikroBUS pin mapping of RS232 to I2C Click driver.
 

Functions

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

Detailed Description

API for configuring and manipulating RS232 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.

Function Documentation

◆ rs232toi2c_cfg_setup()

void rs232toi2c_cfg_setup ( rs232toi2c_cfg_t * cfg)

RS232 to I2C configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See rs232toi2c_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ rs232toi2c_default_cfg()

err_t rs232toi2c_default_cfg ( rs232toi2c_t * ctx)

RS232 to I2C default configuration function.

This function executes a default configuration of RS232 to I2C click board.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ rs232toi2c_enable_interrupts()

err_t rs232toi2c_enable_interrupts ( rs232toi2c_t * ctx,
uint8_t int_mask )

RS232 to I2C enable interrupts function.

This function enables the specified interrupts.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[in]int_mask: Interrupt enable mask.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_enable_uart()

err_t rs232toi2c_enable_uart ( rs232toi2c_t * ctx,
uint8_t state )

RS232 to I2C enable uart function.

This function enables the UART RX/TX features.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[in]state:
  • 0 - disable RX/TX,
  • 1 - enable RX.
  • 2 - enable TX.
  • 3 - enable RX/TX.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_erase_eeprom_page()

err_t rs232toi2c_erase_eeprom_page ( rs232toi2c_t * ctx,
uint8_t page_num )

RS232 to I2C erase eeprom page function.

This function erases the specified eeprom memory page.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[in]page_num: EEPROM page number [0-15].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_get_baud_rate()

err_t rs232toi2c_get_baud_rate ( rs232toi2c_t * ctx,
uint32_t * baud_rate )

RS232 to I2C get baud rate function.

This function reads the actual UART baud rate.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[out]baud_rate: Baud rate.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_get_gpio_in()

err_t rs232toi2c_get_gpio_in ( rs232toi2c_t * ctx,
uint8_t * state )

RS232 to I2C get gpio in function.

This function reads the GPIO in pins logic state.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[out]state: GPIO pin state [3-bit, 1-HIGH, 0-LOW].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The pins must be configured as INPUT.

◆ rs232toi2c_get_gpio_status()

err_t rs232toi2c_get_gpio_status ( rs232toi2c_t * ctx,
uint8_t * gpio_status )

RS232 to I2C get gpio status function.

This function reads the gpio status register and clears it.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[out]gpio_status: GPIO status register read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_get_int_pin()

uint8_t rs232toi2c_get_int_pin ( rs232toi2c_t * ctx)

RS232 to I2C get int pin function.

This function returns the INT pin logic state.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ rs232toi2c_get_interrupt_status()

err_t rs232toi2c_get_interrupt_status ( rs232toi2c_t * ctx,
uint8_t * int_status )

RS232 to I2C get interrupt status function.

This function reads the interrupt status register and clears it.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[out]int_status: Interrupt status register read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_get_uart_status()

err_t rs232toi2c_get_uart_status ( rs232toi2c_t * ctx,
uint8_t * uart_status )

RS232 to I2C get uart status function.

This function reads the uart status register and clears it.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[out]uart_status: UART status register read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_init()

err_t rs232toi2c_init ( rs232toi2c_t * ctx,
rs232toi2c_cfg_t * cfg )

RS232 to I2C initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See rs232toi2c_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_read_command()

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.

This function reads a desired number of data bytes from the selected command by using I2C serial interface.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[in]cmd: Command address.
[out]data_out: Output read data.
[in]data_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_read_eeprom()

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.

This function reads a desired number of data bytes from the selected eeprom address by using I2C serial interface.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[in]address: EEPROM address [0-511].
[out]data_out: Output read data.
[in]data_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_read_gpio_config()

err_t rs232toi2c_read_gpio_config ( rs232toi2c_t * ctx,
uint8_t sub_cmd,
uint8_t * config )

RS232 to I2C read gpio config function.

This function reads a desired config from the selected GPIO config sub command.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[in]sub_cmd: GPIO pin config sub command.
[out]config: GPIO pin config [3-bit].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_read_rx_fifo()

err_t rs232toi2c_read_rx_fifo ( rs232toi2c_t * ctx,
uint8_t * data_out,
uint8_t * data_len )

RS232 to I2C read rx fifo function.

This function reads all data from RX fifo.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[out]data_out: Output data read.
[out]data_len: Output number of data bytes read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_read_system_version()

err_t rs232toi2c_read_system_version ( rs232toi2c_t * ctx,
uint32_t * system_version )

RS232 to I2C read system version function.

This function reads the system version.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[out]system_version: System version [3 bytes].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_read_uart_config()

err_t rs232toi2c_read_uart_config ( rs232toi2c_t * ctx,
uint8_t * config )

RS232 to I2C read uart config function.

This function reads the UART config.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[out]config: UART config [2 bytes].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_reset_device()

void rs232toi2c_reset_device ( rs232toi2c_t * ctx)

RS232 to I2C reset device function.

This function resets the device by toggling the RST pin.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ rs232toi2c_set_baud_rate()

err_t rs232toi2c_set_baud_rate ( rs232toi2c_t * ctx,
uint32_t baud_rate )

RS232 to I2C set baud rate function.

This function sets the UART baud rate.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[in]baud_rate: Baud rate.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_set_gpio_out()

err_t rs232toi2c_set_gpio_out ( rs232toi2c_t * ctx,
uint8_t mask,
uint8_t state )

RS232 to I2C set gpio out function.

This function sets the specified GPIO out pin logic state.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[in]mask: GPIO pin mask [3-bit].
[in]state: GPIO pin state [3-bit, 1-HIGH, 0-LOW].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The pins must be configured as OUTPUT.

◆ rs232toi2c_set_rst_pin()

void rs232toi2c_set_rst_pin ( rs232toi2c_t * ctx,
uint8_t state )

RS232 to I2C set rst pin function.

This function sets the RST pin logic state.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ rs232toi2c_set_wp_pin()

void rs232toi2c_set_wp_pin ( rs232toi2c_t * ctx,
uint8_t state )

RS232 to I2C set wp pin function.

This function sets the WP pin logic state.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ rs232toi2c_write_command()

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.

This function writes a desired number of data bytes to the selected command by using I2C serial interface.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[in]cmd: Command address.
[in]data_in: Data to be written.
[in]data_len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_write_eeprom()

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.

This function writes a desired number of data bytes to the selected eeprom address by using I2C serial interface.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[in]address: EEPROM address [0-511].
[in]data_in: Data to be written.
[in]data_len: Number of bytes to be written (up to 32 bytes).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_write_gpio_config()

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.

This function writes a desired config to the selected GPIO config sub command.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[in]sub_cmd: GPIO pin config sub command.
[in]mask: GPIO pin mask [3-bit].
[in]config: GPIO pin config [3-bit].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_write_tx_fifo()

err_t rs232toi2c_write_tx_fifo ( rs232toi2c_t * ctx,
uint8_t * data_in,
uint8_t data_len )

RS232 to I2C write tx fifo function.

This function writes a desired number of data bytes to the TX fifo.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[in]data_in: Data to be written.
[in]data_len: Number of data bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rs232toi2c_write_uart_config()

err_t rs232toi2c_write_uart_config ( rs232toi2c_t * ctx,
uint8_t sub_cmd,
uint8_t config )

RS232 to I2C write uart config function.

This function writes a desired config to the selected UART config sub command.

Parameters
[in]ctx: Click context object. See rs232toi2c_t object definition for detailed explanation.
[in]sub_cmd: UART config sub command.
[in]config: Sub command config.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.