opto7 2.1.0.0
Modules | Functions
Opto 7 Click Driver

API for configuring and manipulating Opto 7 Click driver. More...

Modules

 Opto 7 Device Settings
 Settings for registers of Opto 7 Click driver.
 
 Opto 7 MikroBUS Map
 MikroBUS pin mapping of Opto 7 Click driver.
 

Functions

void opto7_cfg_setup (opto7_cfg_t *cfg)
 Opto 7 configuration object setup function. More...
 
err_t opto7_init (opto7_t *ctx, opto7_cfg_t *cfg)
 Opto 7 initialization function. More...
 
err_t opto7_default_cfg (opto7_t *ctx)
 Opto 7 default configuration function. More...
 
err_t opto7_generic_write (opto7_t *ctx, uint8_t *data_in, uint16_t len)
 Opto 7 data writing function. More...
 
err_t opto7_generic_read (opto7_t *ctx, uint8_t *data_out, uint16_t len)
 Opto 7 data reading function. More...
 
void opto7_set_gp1_pin (opto7_t *ctx, uint8_t pin_state)
 Opto 7 set GP1 pin function. More...
 
uint8_t opto7_get_gp2_pin (opto7_t *ctx)
 Opto 7 get GP2 pin function. More...
 

Detailed Description

API for configuring and manipulating Opto 7 Click driver.

Function Documentation

◆ opto7_cfg_setup()

void opto7_cfg_setup ( opto7_cfg_t cfg)

Opto 7 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ opto7_default_cfg()

err_t opto7_default_cfg ( opto7_t ctx)

Opto 7 default configuration function.

This function executes a default configuration of Opto 7 click board.

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

◆ opto7_generic_read()

err_t opto7_generic_read ( opto7_t ctx,
uint8_t *  data_out,
uint16_t  len 
)

Opto 7 data reading function.

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

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

◆ opto7_generic_write()

err_t opto7_generic_write ( opto7_t ctx,
uint8_t *  data_in,
uint16_t  len 
)

Opto 7 data writing function.

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

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

◆ opto7_get_gp2_pin()

uint8_t opto7_get_gp2_pin ( opto7_t ctx)

Opto 7 get GP2 pin function.

This function is used to get GP2 pin state.

Parameters
[in]ctx: Click context object. See opto7_t object definition for detailed explanation.
Returns
  • 1 - Pin state high,
  • 0 - Pin state low.
Note
None.

◆ opto7_init()

err_t opto7_init ( opto7_t ctx,
opto7_cfg_t cfg 
)

Opto 7 initialization function.

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

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

◆ opto7_set_gp1_pin()

void opto7_set_gp1_pin ( opto7_t ctx,
uint8_t  pin_state 
)

Opto 7 set GP1 pin function.

This function is used to set GP1 pin state.

Parameters
[in]ctx: Click context object. See opto7_t object definition for detailed explanation.
[in]pin_state: GP1 Pin state.
Returns
Nothing.
Note
None.