expand5 2.0.0.0
expand5.h File Reference

This file contains API for Expand 5 Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  expand5_t
 Click ctx object definition. More...
 
struct  expand5_cfg_t
 Click configuration structure definition. More...
 

Macros

#define EXPAND5_MAP_MIKROBUS(cfg, mikrobus)
 
#define EXPAND5_RETVAL   uint8_t
 
#define EXPAND5_OK   0x00
 
#define EXPAND5_INIT_ERROR   0xFF
 
#define EXPAND5_I2C_ADR_GND   0x22
 
#define EXPAND5_I2C_ADR_VCC   0x23
 
#define EXPAND5_RA_IN_0   0x00
 
#define EXPAND5_RA_IN_1   0x01
 
#define EXPAND5_RA_IN_2   0x02
 
#define EXPAND5_RA_OUT_0   0x04
 
#define EXPAND5_RA_OUT_1   0x05
 
#define EXPAND5_RA_OUT_2   0x06
 
#define EXPAND5_RA_POL_0   0x08
 
#define EXPAND5_RA_POL_1   0x09
 
#define EXPAND5_RA_POL_2   0x0A
 
#define EXPAND5_RA_CFG_0   0x0C
 
#define EXPAND5_RA_CFG_1   0x0D
 
#define EXPAND5_RA_CFG_2   0x0E
 
#define EXPAND5_AUTO_INC   0x80
 
#define EXPAND5_LOW   0
 
#define EXPAND5_HIGH   1
 
#define EXPAND5_POL_NORMAL   0
 
#define EXPAND5_POL_INVERTED   1
 
#define EXPAND5_OUT   0
 
#define EXPAND5_IN   1
 
#define EXPAND5_P00   0
 
#define EXPAND5_P01   1
 
#define EXPAND5_P02   2
 
#define EXPAND5_P03   3
 
#define EXPAND5_P04   4
 
#define EXPAND5_P05   5
 
#define EXPAND5_P06   6
 
#define EXPAND5_P07   7
 
#define EXPAND5_P10   8
 
#define EXPAND5_P11   9
 
#define EXPAND5_P12   10
 
#define EXPAND5_P13   11
 
#define EXPAND5_P14   12
 
#define EXPAND5_P15   13
 
#define EXPAND5_P16   14
 
#define EXPAND5_P17   15
 
#define EXPAND5_P20   16
 
#define EXPAND5_P21   17
 
#define EXPAND5_P22   18
 
#define EXPAND5_P23   19
 
#define EXPAND5_P24   20
 
#define EXPAND5_P25   21
 
#define EXPAND5_P26   22
 
#define EXPAND5_P27   23
 

Functions

void expand5_cfg_setup (expand5_cfg_t *cfg)
 Config Object Initialization function.
 
EXPAND5_RETVAL expand5_init (expand5_t *ctx, expand5_cfg_t *cfg)
 Initialization function.
 
void expand5_generic_write (expand5_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void expand5_generic_read (expand5_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
uint8_t expand5_read_bit (expand5_t *ctx, uint8_t reg_adr, uint8_t bit_num)
 Read bit function.
 
void expand5_write_bit (expand5_t *ctx, uint8_t reg_adr, uint8_t bit_num, uint8_t pin_val)
 Write bit function.
 
uint8_t expand5_read_pin (expand5_t *ctx, uint16_t pin)
 Get a single INPUT pin's logic level function.
 
uint8_t expand5_read_bank (expand5_t *ctx, uint8_t bank)
 Get all pin logic levels from one bank function.
 
void expand5_read_all_banks (expand5_t *ctx, uint8_t *bank0, uint8_t *bank1, uint8_t *bank2)
 Get all pins logic levels from all banks function.
 
uint8_t expand5_get_pin_out_lvl (expand5_t *ctx, uint16_t pin)
 Get a single OUTPUT pin's setting function.
 
uint8_t expand5_get_bank_out_lvl (expand5_t *ctx, uint8_t bank)
 Get all pin output settings from one bank function.
 
void expand5_get_all_banks_out_lvl (expand5_t *ctx, uint8_t *bank0, uint8_t *bank1, uint8_t *bank2)
 Get all pin output settings from all banks function.
 
void expand5_write_pin (expand5_t *ctx, uint16_t pin, uint8_t pin_val)
 Set a single OUTPUT pin's logic level function.
 
void expand5_write_bank (expand5_t *ctx, uint8_t bank, uint8_t value)
 Set all OUTPUT pins' logic levels in one bank function.
 
void expand5_write_all_banks (expand5_t *ctx, uint8_t bank0, uint8_t bank1, uint8_t bank2)
 Set all OUTPUT pins' logic levels in all banks function.
 
uint8_t expand5_get_pin_pol (expand5_t *ctx, uint16_t pin)
 Get a single pin's polarity ( normal/inverted ) setting function.
 
uint8_t expand5_get_bank_pol (expand5_t *ctx, uint8_t bank)
 Get all pin polarity ( normal/inverted ) settings from one bank function.
 
void expand5_get_all_banks_pol (expand5_t *ctx, uint8_t *bank0, uint8_t *bank1, uint8_t *bank2)
 Get all pin polarity ( normal/inverted ) settings from all banks function.
 
void expand5_set_pin_pol (expand5_t *ctx, uint16_t pin, uint8_t polarity)
 Set a single pin's polarity ( normal/inverted ) setting function.
 
void expand5_set_bank_pol (expand5_t *ctx, uint8_t bank, uint8_t polarity)
 Set all pin polarity ( normal/inverted ) settings in one bank function.
 
void expand5_set_all_banks_pol (expand5_t *ctx, uint8_t bank0, uint8_t bank1, uint8_t bank2)
 Set all pin polarity ( normal/inverted ) settings in all banks function.
 
uint8_t expand5_get_pin_dir (expand5_t *ctx, uint16_t pin)
 Get a single pin's direction ( I/O ) setting function.
 
uint8_t expand5_get_bank_dir (expand5_t *ctx, uint8_t bank)
 Get all pin direction ( I/O ) settings from one bank function.
 
void expand5_get_all_dir (expand5_t *ctx, uint8_t *bank0, uint8_t *bank1, uint8_t *bank2)
 Get all pin direction ( I/O ) settings from all banks function.
 
void expand5_set_pin_dir (expand5_t *ctx, uint16_t pin, uint8_t direction)
 Set a single pin's direction ( I/O ) setting function.
 
void expand5_set_bank_dir (expand5_t *ctx, uint8_t bank, uint8_t direction)
 Set all pin direction ( I/O ) settings in one bank function.
 
void expand5_set_all_dir (expand5_t *ctx, uint8_t bank0, uint8_t bank1, uint8_t bank2)
 Set all pin direction ( I/O ) settings in all banks function.
 
void expand5_reset (expand5_t *ctx)
 Reset function.
 
uint8_t expand5_check_int (expand5_t *ctx)
 Get Interrupt state function.
 

Detailed Description

This file contains API for Expand 5 Click driver.