rstransceiver 2.1.0.0
RS Transceiver Click Driver

API for configuring and manipulating RS Transceiver Click driver. More...

Topics

 RS Transceiver Registers List
 List of registers of RS Transceiver Click driver.
 
 RS Transceiver Registers Settings
 Settings for registers of RS Transceiver Click driver.
 
 RS Transceiver MikroBUS Map
 MikroBUS pin mapping of RS Transceiver Click driver.
 

Functions

void rstransceiver_cfg_setup (rstransceiver_cfg_t *cfg)
 RS Transceiver configuration object setup function.
 
err_t rstransceiver_init (rstransceiver_t *ctx, rstransceiver_cfg_t *cfg)
 RS Transceiver initialization function.
 
err_t rstransceiver_default_cfg (rstransceiver_t *ctx)
 RS Transceiver default configuration function.
 
void rstransceiver_device_enable (rstransceiver_t *ctx)
 RS Transceiver enables the device function.
 
void rstransceiver_device_disable (rstransceiver_t *ctx)
 RS Transceiver disable the device function.
 
void rstransceiver_set_slew (rstransceiver_t *ctx, uint8_t slew)
 RS Transceiver sets the slew limit function.
 
void rstransceiver_set_rts (rstransceiver_t *ctx, uint8_t rts)
 RS Transceiver request to send function.
 
uint8_t rstransceiver_get_cts (rstransceiver_t *ctx)
 RS Transceiver clear to send function.
 
err_t rstransceiver_set_op_mode (rstransceiver_t *ctx, uint8_t op_mode)
 RS Transceiver sets the operating mode function.
 
err_t rstransceiver_mode_loopback (rstransceiver_t *ctx)
 RS Transceiver sets the loopback mode function.
 
err_t rstransceiver_mode_rs232 (rstransceiver_t *ctx, uint8_t slew)
 RS Transceiver sets the RS-232 mode function.
 
err_t rstransceiver_mode_half_duplex (rstransceiver_t *ctx, uint8_t slew, uint8_t dir1, uint8_t term)
 RS Transceiver sets the Half-Duplex mode function.
 
err_t rstransceiver_mode_full_duplex (rstransceiver_t *ctx, uint8_t slew, uint8_t dir1, uint8_t term)
 RS Transceiver sets the Full-Duplex mode function.
 
err_t rstransceiver_set_dir1 (rstransceiver_t *ctx, uint8_t dir1)
 RS Transceiver sets the DIR1 pin function.
 
err_t rstransceiver_term_enable (rstransceiver_t *ctx)
 RS Transceiver term enable function.
 
err_t rstransceiver_term_disable (rstransceiver_t *ctx)
 RS Transceiver term disable function.
 
err_t rstransceiver_generic_write (rstransceiver_t *ctx, char *data_in, uint16_t len)
 RS Transceiver data writing function.
 
err_t rstransceiver_generic_read (rstransceiver_t *ctx, char *data_out, uint16_t len)
 RS Transceiver data reading function.
 

Detailed Description

API for configuring and manipulating RS Transceiver 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

◆ rstransceiver_cfg_setup()

void rstransceiver_cfg_setup ( rstransceiver_cfg_t * cfg)

RS Transceiver configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ rstransceiver_default_cfg()

err_t rstransceiver_default_cfg ( rstransceiver_t * ctx)

RS Transceiver default configuration function.

This function executes a default configuration of RS Transceiver click board.

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

◆ rstransceiver_device_disable()

void rstransceiver_device_disable ( rstransceiver_t * ctx)

RS Transceiver disable the device function.

This function performs shutdown the device by config the RST pin logic low of the XR34350, RS-232/RS-485/RS-422 Serial Transceiver with Internal Termination and Wide Output Swing on the RS Transceiver Click board™.

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

◆ rstransceiver_device_enable()

void rstransceiver_device_enable ( rstransceiver_t * ctx)

RS Transceiver enables the device function.

This function performs enables the device by config the RST pin logic high of the XR34350, RS-232/RS-485/RS-422 Serial Transceiver with Internal Termination and Wide Output Swing on the RS Transceiver Click board™.

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

◆ rstransceiver_generic_read()

err_t rstransceiver_generic_read ( rstransceiver_t * ctx,
char * data_out,
uint16_t len )

RS Transceiver data reading function.

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

Parameters
[in]ctx: Click context object. See rstransceiver_t object definition for detailed explanation.
[out]data_out: Output read data.
[in]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.

◆ rstransceiver_generic_write()

err_t rstransceiver_generic_write ( rstransceiver_t * ctx,
char * data_in,
uint16_t len )

RS Transceiver data writing function.

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

Parameters
[in]ctx: Click context object. See rstransceiver_t object definition for detailed explanation.
[in]data_in: 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.

◆ rstransceiver_get_cts()

uint8_t rstransceiver_get_cts ( rstransceiver_t * ctx)

RS Transceiver clear to send function.

This function CTS flow control uses the check the clear to send of the XR34350, RS-232/RS-485/RS-422 Serial Transceiver with Internal Termination and Wide Output Swing on the RS Transceiver Click board™.

Parameters
[in]ctx: Click context object. See rstransceiver_t object definition for detailed explanation.
Returns
Check the clear to send (CTS).
Note
None.

◆ rstransceiver_init()

err_t rstransceiver_init ( rstransceiver_t * ctx,
rstransceiver_cfg_t * cfg )

RS Transceiver initialization function.

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

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

◆ rstransceiver_mode_full_duplex()

err_t rstransceiver_mode_full_duplex ( rstransceiver_t * ctx,
uint8_t slew,
uint8_t dir1,
uint8_t term )

RS Transceiver sets the Full-Duplex mode function.

This function sets the Full-Duplex RS-485/422 operating mode of the XR34350, RS-232/RS-485/RS-422 Serial Transceiver with Internal Termination and Wide Output Swing on the RS Transceiver Click board™.

Parameters
[in]ctx: Click context object. See rstransceiver_t object definition for detailed explanation.
[in]slew:
  • 0x00 (RSTRANSCEIVER_SLEW_DISABLE) - Disable slew limiting,
  • 0x01 (RSTRANSCEIVER_SLEW_ENABLE) - Enables 250 kbps slew limiting.
[in]dir1:
  • 0x00 (RSTRANSCEIVER_DIR_DISABLE) - Disable,
  • 0x01 (RSTRANSCEIVER_DIR_T1_EN_R1_DIS) - RX (T1) enable, TX (R1) disable.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rstransceiver_mode_half_duplex()

err_t rstransceiver_mode_half_duplex ( rstransceiver_t * ctx,
uint8_t slew,
uint8_t dir1,
uint8_t term )

RS Transceiver sets the Half-Duplex mode function.

This function sets the Half-Duplex RS-485 operating mode of the XR34350, RS-232/RS-485/RS-422 Serial Transceiver with Internal Termination and Wide Output Swing on the RS Transceiver Click board™.

Parameters
[in]ctx: Click context object. See rstransceiver_t object definition for detailed explanation.
[in]slew:
  • 0x00 (RSTRANSCEIVER_SLEW_DISABLE) - Disable slew limiting,
  • 0x01 (RSTRANSCEIVER_SLEW_ENABLE) - Enables 250 kbps slew limiting.
[in]dir1:
  • 0x00 (RSTRANSCEIVER_DIR_DISABLE) - Disable,
  • 0x01 (RSTRANSCEIVER_DIR_T1_EN) - RX (T1) enable.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rstransceiver_mode_loopback()

err_t rstransceiver_mode_loopback ( rstransceiver_t * ctx)

RS Transceiver sets the loopback mode function.

This function sets the loopback operating mode of the XR34350, RS-232/RS-485/RS-422 Serial Transceiver with Internal Termination and Wide Output Swing on the RS Transceiver Click board™.

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

◆ rstransceiver_mode_rs232()

err_t rstransceiver_mode_rs232 ( rstransceiver_t * ctx,
uint8_t slew )

RS Transceiver sets the RS-232 mode function.

This function sets the RS-232 operating mode of the XR34350, RS-232/RS-485/RS-422 Serial Transceiver with Internal Termination and Wide Output Swing on the RS Transceiver Click board™.

Parameters
[in]ctx: Click context object. See rstransceiver_t object definition for detailed explanation.
[in]slew:
  • 0x00 (RSTRANSCEIVER_SLEW_DISABLE) - Disable slew limiting,
  • 0x01 (RSTRANSCEIVER_SLEW_ENABLE) - Enables 250 kbps slew limiting.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rstransceiver_set_dir1()

err_t rstransceiver_set_dir1 ( rstransceiver_t * ctx,
uint8_t dir1 )

RS Transceiver sets the DIR1 pin function.

This function configures TX/RX signals of the XR34350, RS-232/RS-485/RS-422 Serial Transceiver with Internal Termination and Wide Output Swing on the RS Transceiver Click board™.

Parameters
[in]ctx: Click context object. See rstransceiver_t object definition for detailed explanation.
[in]dir1:
  • 0x00 (RSTRANSCEIVER_DIR_DISABLE) - Disable,
  • 0x01 (RSTRANSCEIVER_DIR_T1_EN_R1_DIS) - Full-Duplex, RX (T1) enable, TX (R1) disable,
  • 0x01 (RSTRANSCEIVER_DIR_T1_EN) - Half-Duplex, RX (T1) enable.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ rstransceiver_set_op_mode()

err_t rstransceiver_set_op_mode ( rstransceiver_t * ctx,
uint8_t op_mode )

RS Transceiver sets the operating mode function.

This function sets the desired operating mode of the XR34350, RS-232/RS-485/RS-422 Serial Transceiver with Internal Termination and Wide Output Swing on the RS Transceiver Click board™.

Parameters
[in]ctx: Click context object. See rstransceiver_t object definition for detailed explanation.
[in]op_mode:
  • 0x00 (RSTRANSCEIVER_OP_MODE_LOOPBACK) - Loopback mode,
  • 0x01 (RSTRANSCEIVER_OP_MODE_RS232) - RS-232 mode.,
  • 0x02 (RSTRANSCEIVER_OP_MODE_HALF_DUPLEX) - Half-Duplex RS-485,
  • 0x03 (RSTRANSCEIVER_OP_MODE_FULL_DUPLEX) - Full-Duplex RS-485/422,
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rstransceiver_set_rts()

void rstransceiver_set_rts ( rstransceiver_t * ctx,
uint8_t rts )

RS Transceiver request to send function.

This function RTS flow control uses the Request-to-Send of the XR34350, RS-232/RS-485/RS-422 Serial Transceiver with Internal Termination and Wide Output Swing on the RS Transceiver Click board™.

Parameters
[in]ctx: Click context object. See rstransceiver_t object definition for detailed explanation.
[in]rts: Request to send.
Returns
Nothing.
Note
None.

◆ rstransceiver_set_slew()

void rstransceiver_set_slew ( rstransceiver_t * ctx,
uint8_t slew )

RS Transceiver sets the slew limit function.

This function sets the 250 kbps slew limiting of the XR34350, RS-232/RS-485/RS-422 Serial Transceiver with Internal Termination and Wide Output Swing on the RS Transceiver Click board™.

Parameters
[in]ctx: Click context object. See rstransceiver_t object definition for detailed explanation.
[in]slew:
  • 0x00 (RSTRANSCEIVER_SLEW_DISABLE) - Disable slew limiting,
  • 0x01 (RSTRANSCEIVER_SLEW_ENABLE) - Enables 250 kbps slew limiting.
Returns
Nothing.
Note
None.

◆ rstransceiver_term_disable()

err_t rstransceiver_term_disable ( rstransceiver_t * ctx)

RS Transceiver term disable function.

This function disable the RS485/RS422 receiver termination of the XR34350, RS-232/RS-485/RS-422 Serial Transceiver with Internal Termination and Wide Output Swing on the RS Transceiver Click board™.

Parameters
[in]ctx: Click context object. See rstransceiver_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ rstransceiver_term_enable()

err_t rstransceiver_term_enable ( rstransceiver_t * ctx)

RS Transceiver term enable function.

This function enables the RS485/RS422 receiver termination of the XR34350, RS-232/RS-485/RS-422 Serial Transceiver with Internal Termination and Wide Output Swing on the RS Transceiver Click board™.

Parameters
[in]ctx: Click context object. See rstransceiver_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.