opto7 2.1.0.0
opto7.h File Reference

This file contains API for Opto 7 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_uart.h"

Go to the source code of this file.

Data Structures

struct  opto7_t
 Opto 7 Click context object. More...
 
struct  opto7_cfg_t
 Opto 7 Click configuration object. More...
 

Macros

#define OPTO7_PIN_STATE_HIGH   0x01
 Opto 7 control commands.
 
#define OPTO7_PIN_STATE_LOW   0x00
 
#define OPTO7_TX_DRV_BUFFER_SIZE   100
 Opto 7 driver buffer size.
 
#define OPTO7_RX_DRV_BUFFER_SIZE   300
 
#define OPTO7_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  opto7_drv_t { OPTO7_DRV_SEL_GPIO , OPTO7_DRV_SEL_UART }
 Opto 7 Click driver selector. More...
 
enum  opto7_return_value_t { OPTO7_OK = 0 , OPTO7_ERROR = -1 }
 Opto 7 Click return value data. More...
 

Functions

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

Detailed Description

This file contains API for Opto 7 Click Driver.

Enumeration Type Documentation

◆ opto7_drv_t

Opto 7 Click driver selector.

Selects target driver interface of Opto 7 Click driver.

Enumerator
OPTO7_DRV_SEL_GPIO 

GPIO driver descriptor.

OPTO7_DRV_SEL_UART 

UART driver descriptor.

◆ opto7_return_value_t

Opto 7 Click return value data.

Predefined enum values for driver return values.

Enumerator
OPTO7_OK 
OPTO7_ERROR