usbuart 2.0.0.0
USB UART Click Driver

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

Topics

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

Functions

void usbuart_cfg_setup (usbuart_cfg_t *cfg)
 USB UART configuration object setup function.
 
err_t usbuart_init (usbuart_t *ctx, usbuart_cfg_t *cfg)
 USB UART initialization function.
 
void usbuart_generic_write (usbuart_t *ctx, char *data_buf, uint16_t len)
 USB UART data writing function.
 
uint32_t usbuart_generic_read (usbuart_t *ctx, char *data_buf, uint16_t max_len)
 USB UART data reading function.
 
void usbuart_pwr_ctrl (usbuart_t *ctx, uint8_t state)
 Power control.
 
void usbuart_set_cts (usbuart_t *ctx, uint8_t state)
 Set CTS (Clear to send)
 
void usbuart_set_mode (usbuart_t *ctx, uint8_t mode)
 Set device mode.
 
uint8_t usbuart_get_rts (usbuart_t *ctx)
 Set device mode.
 
void usbuart_send_command (usbuart_t *ctx, char *command)
 Function for send command.
 

Detailed Description

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

◆ usbuart_cfg_setup()

void usbuart_cfg_setup ( usbuart_cfg_t * cfg)

USB UART configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ usbuart_generic_read()

uint32_t usbuart_generic_read ( usbuart_t * ctx,
char * data_buf,
uint16_t max_len )

USB UART data reading function.

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

Parameters
[in]ctx: Click context object. See usbuart_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.

◆ usbuart_generic_write()

void usbuart_generic_write ( usbuart_t * ctx,
char * data_buf,
uint16_t len )

USB UART data writing function.

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

Parameters
[in]ctx: Click context object. See usbuart_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.

◆ usbuart_get_rts()

uint8_t usbuart_get_rts ( usbuart_t * ctx)

Set device mode.

This function reads RTS pin state.

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

◆ usbuart_init()

err_t usbuart_init ( usbuart_t * ctx,
usbuart_cfg_t * cfg )

USB UART initialization function.

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

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

◆ usbuart_pwr_ctrl()

void usbuart_pwr_ctrl ( usbuart_t * ctx,
uint8_t state )

Power control.

This function sets the click turns click on.

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

◆ usbuart_send_command()

void usbuart_send_command ( usbuart_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.

◆ usbuart_set_cts()

void usbuart_set_cts ( usbuart_t * ctx,
uint8_t state )

Set CTS (Clear to send)

This function sets CTS pin.

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

◆ usbuart_set_mode()

void usbuart_set_mode ( usbuart_t * ctx,
uint8_t mode )

Set device mode.

This function sets device mode.

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