usbuart2 2.0.0.0
USB UART 2 Click Driver

API for configuring and manipulating USB UART 2 Click driver. More...

Topics

 USB UART 2 Device Settings
 Settings for registers of USB UART 2 Click driver.
 
 USB UART 2 MikroBUS Map
 MikroBUS pin mapping of USB UART 2 Click driver.
 

Functions

void usbuart2_cfg_setup (usbuart2_cfg_t *cfg)
 USB UART 2 configuration object setup function.
 
err_t usbuart2_init (usbuart2_t *ctx, usbuart2_cfg_t *cfg)
 USB UART 2 initialization function.
 
void usbuart2_generic_write (usbuart2_t *ctx, char *data_buf, uint16_t len)
 USB UART 2 data writing function.
 
uint32_t usbuart2_generic_read (usbuart2_t *ctx, char *data_buf, uint16_t max_len)
 USB UART 2 data reading function.
 
void usbuart2_pwr_ctrl (usbuart2_t *ctx, uint8_t state)
 Power control.
 
void usbuart2_set_cts (usbuart2_t *ctx, uint8_t state)
 Set CTS (Clear to send)
 
void usbuart2_set_mode (usbuart2_t *ctx, uint8_t mode)
 Set device mode.
 
uint8_t usbuart2_get_rts (usbuart2_t *ctx)
 Set device mode.
 
void usbuart2_send_command (usbuart2_t *ctx, char *command)
 Function for send command.
 

Detailed Description

API for configuring and manipulating USB UART 2 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

◆ usbuart2_cfg_setup()

void usbuart2_cfg_setup ( usbuart2_cfg_t * cfg)

USB UART 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ usbuart2_generic_read()

uint32_t usbuart2_generic_read ( usbuart2_t * ctx,
char * data_buf,
uint16_t max_len )

USB UART 2 data reading function.

This function reads a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See usbuart2_t object definition for detailed explanation.
[out]data_buf: Output read data.
[in]max_len: Number of bytes to be read.
Returns
  • >0 - Number of data bytes read,
  • <=0 - Error/Empty Ring buffer.
See #err_t definition for detailed explanation.
Note
None.

◆ usbuart2_generic_write()

void usbuart2_generic_write ( usbuart2_t * ctx,
char * data_buf,
uint16_t len )

USB UART 2 data writing function.

This function writes a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See usbuart2_t object definition for detailed explanation.
[in]data_buf: Data buffer for sending.
[in]len: Number of bytes for sending.
Returns
  • >=0 - Success,
  • <0 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ usbuart2_get_rts()

uint8_t usbuart2_get_rts ( usbuart2_t * ctx)

Set device mode.

This function reads RTS pin state.

Parameters
[in]ctx: Click context object.
Returns
RTS (Request to send) pin state

◆ usbuart2_init()

err_t usbuart2_init ( usbuart2_t * ctx,
usbuart2_cfg_t * cfg )

USB UART 2 initialization function.

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

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

◆ usbuart2_pwr_ctrl()

void usbuart2_pwr_ctrl ( usbuart2_t * ctx,
uint8_t state )

Power control.

This function sets the click turns click on.

Parameters
[out]ctx: Click context object. See usbuart2_t object definition for detailed explanation.
[in]state: PWR pin state
Returns
Nothing.

◆ usbuart2_send_command()

void usbuart2_send_command ( usbuart2_t * ctx,
char * command )

Function for send command.

This function is used for sending commands.

Parameters
[in]ctx: Click context object.
[in]command: Data to be send.
Returns
Nothing.

◆ usbuart2_set_cts()

void usbuart2_set_cts ( usbuart2_t * ctx,
uint8_t state )

Set CTS (Clear to send)

This function sets CTS pin.

Parameters
[out]ctx: Click context object. See usbuart2_t object definition for detailed explanation.
[in]state: CTS pin state
Returns
Nothing.

◆ usbuart2_set_mode()

void usbuart2_set_mode ( usbuart2_t * ctx,
uint8_t mode )

Set device mode.

This function sets device mode.

Parameters
[out]ctx: Click context object. See usbuart2_t object definition for detailed explanation.
[in]mode: Device mode (Sleep or Normal)
Returns
Nothing.