expand3 2.1.0.0
expand3.h File Reference

This file contains API for Expand 3 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_one_wire.h"

Go to the source code of this file.

Data Structures

struct  expand3_t
 Expand 3 Click context object. More...
 
struct  expand3_cfg_t
 Expand 3 Click configuration object. More...
 

Macros

#define EXPAND3_CMD_READ_PIO_REGISTERS   0xF0
 Expand 3 commands list.
 
#define EXPAND3_CMD_CHANNEL_ACCESS_READ   0xF5
 
#define EXPAND3_CMD_CHANNEL_ACCESS_WRITE   0x5A
 
#define EXPAND3_CMD_WRITE_CONDITIONAL   0xCC
 
#define EXPAND3_CMD_RESET_ACTIVITY_LATCHES   0xC3
 
#define EXPAND3_REG_PIO_LOGIC   0x0088
 Expand 3 registers list.
 
#define EXPAND3_REG_PIO_OUT_LATCH   0x0089
 
#define EXPAND3_REG_PIO_ACTIVITY_LATCH   0x008A
 
#define EXPAND3_REG_CHANNEL_MASK   0x008B
 
#define EXPAND3_REG_CHANNEL_POLARITY   0x008C
 
#define EXPAND3_REG_CONTROL   0x008D
 
#define EXPAND3_STATUS_VCCP   0x80
 Expand 3 Control/Status/Mask/Polarity register setting.
 
#define EXPAND3_CONTROL_PORL   0x08
 
#define EXPAND3_CONTROL_ROS   0x04
 
#define EXPAND3_CONTROL_CT   0x02
 
#define EXPAND3_CONTROL_PLS   0x01
 
#define EXPAND3_CONTROL_DEFAULT   0x00
 
#define EXPAND3_MASK_DEFAULT   0x00
 
#define EXPAND3_POLARITY_DEFAULT   0x00
 
#define EXPAND3_CONFIRMATION_BYTE   0xAA
 Expand 3 confirmation byte.
 
#define EXPAND3_PIN_0   0x01
 Expand 3 pin mask setting.
 
#define EXPAND3_PIN_1   0x02
 
#define EXPAND3_PIN_2   0x04
 
#define EXPAND3_PIN_3   0x08
 
#define EXPAND3_PIN_4   0x10
 
#define EXPAND3_PIN_5   0x20
 
#define EXPAND3_PIN_6   0x40
 
#define EXPAND3_PIN_7   0x80
 
#define EXPAND3_FAMILY_CODE   0x29
 Expand 3 family code value.
 
#define EXPAND3_ADDRESS_0   0x00
 Expand 3 address selection macros.
 
#define EXPAND3_ADDRESS_ALL   0xFF
 
#define EXPAND3_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  expand3_gpio_sel_t { EXPAND3_GPIO_OW0 , EXPAND3_GPIO_OW1 }
 Expand 3 Click gpio selector. More...
 
enum  expand3_return_value_t { EXPAND3_OK = 0 , EXPAND3_ERROR = -1 }
 Expand 3 Click return value data. More...
 

Functions

void expand3_cfg_setup (expand3_cfg_t *cfg)
 Expand 3 configuration object setup function.
 
void expand3_gpio_selection (expand3_cfg_t *cfg, expand3_gpio_sel_t gpio_sel)
 Expand 3 driver interface setup function.
 
err_t expand3_init (expand3_t *ctx, expand3_cfg_t *cfg)
 Expand 3 initialization function.
 
err_t expand3_default_cfg (expand3_t *ctx)
 Expand 3 default configuration function.
 
err_t expand3_check_communication (expand3_t *ctx)
 Expand 3 check communication function.
 
err_t expand3_select_device (expand3_t *ctx)
 Expand 3 select device function.
 
err_t expand3_read_register (expand3_t *ctx, uint16_t reg, uint8_t *data_out)
 Expand 3 read register function.
 
err_t expand3_write_register (expand3_t *ctx, uint16_t reg, uint8_t data_in)
 Expand 3 write register function.
 
err_t expand3_read_state (expand3_t *ctx, uint8_t *state)
 Expand 3 read state function.
 
err_t expand3_write_state (expand3_t *ctx, uint8_t state)
 Expand 3 write state function.
 
err_t expand3_reset_activity (expand3_t *ctx)
 Expand 3 reset activity function.
 
err_t expand3_write_mask (expand3_t *ctx, uint8_t mask)
 Expand 3 write mask function.
 
err_t expand3_write_polarity (expand3_t *ctx, uint8_t polarity)
 Expand 3 write polarity function.
 
err_t expand3_write_control (expand3_t *ctx, uint8_t control)
 Expand 3 write control function.
 
err_t expand3_read_control (expand3_t *ctx, uint8_t *control)
 Expand 3 read control function.
 
err_t expand3_read_current_state (expand3_t *ctx, uint8_t *curr_state)
 Expand 3 read current state function.
 
err_t expand3_read_last_state (expand3_t *ctx, uint8_t *last_state)
 Expand 3 read last state function.
 
err_t expand3_read_activity (expand3_t *ctx, uint8_t *activity)
 Expand 3 read activity function.
 
void expand3_set_rst_pin (expand3_t *ctx, uint8_t state)
 Expand 3 set rst pin function.
 
void expand3_reset_device (expand3_t *ctx)
 Expand 3 reset device function.
 

Detailed Description

This file contains API for Expand 3 Click Driver.

Enumeration Type Documentation

◆ expand3_gpio_sel_t

Expand 3 Click gpio selector.

Selects gpio pin of Expand 3 Click driver.

Enumerator
EXPAND3_GPIO_OW0 

GPIO OW0 pin.

EXPAND3_GPIO_OW1 

GPIO OW1 pin.

◆ expand3_return_value_t

Expand 3 Click return value data.

Predefined enum values for driver return values.

Enumerator
EXPAND3_OK 
EXPAND3_ERROR