expand2 2.0.0.0
expand2.h File Reference

This file contains API for Expand 2 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  expand2_t
 Click ctx object definition. More...
 
struct  expand2_cfg_t
 Click configuration structure definition. More...
 

Macros

#define EXPAND2_MAP_MIKROBUS(cfg, mikrobus)
 
#define EXPAND2_RETVAL   uint8_t
 
#define EXPAND2_OK   0x00
 
#define EXPAND2_INIT_ERROR   0xFF
 
#define EXPAND2_I2C_MODULE_ADDRESS_0   0x20
 
#define EXPAND2_I2C_MODULE_ADDRESS_1   0x21
 
#define EXPAND2_I2C_MODULE_ADDRESS_2   0x22
 
#define EXPAND2_I2C_MODULE_ADDRESS_3   0x23
 
#define EXPAND2_I2C_MODULE_ADDRESS_4   0x24
 
#define EXPAND2_I2C_MODULE_ADDRESS_5   0x25
 
#define EXPAND2_I2C_MODULE_ADDRESS_6   0x26
 
#define EXPAND2_I2C_MODULE_ADDRESS_7   0x27
 
#define EXPAND2_PORT_DIRECTION_OUTPUT   0x00
 
#define EXPAND2_PORT_DIRECTION_INPUT   0xFF
 
#define EXPAND2_IODIRA_BANK1   0x00
 
#define EXPAND2_IPOLA_BANK1   0x01
 
#define EXPAND2_GPINTENA_BANK1   0x02
 
#define EXPAND2_DEFVALA_BANK1   0x03
 
#define EXPAND2_INTCONA_BANK1   0x04
 
#define EXPAND2_IOCON_BANK1   0x05
 
#define EXPAND2_GPPUA_BANK1   0x06
 
#define EXPAND2_INTFA_BANK1   0x07
 
#define EXPAND2_INTCAPA_BANK1   0x08
 
#define EXPAND2_GPIOA_BANK1   0x09
 
#define EXPAND2_OLATA_BANK1   0x0A
 
#define EXPAND2_IODIRB_BANK1   0x10
 
#define EXPAND2_IPOLB_BANK1   0x11
 
#define EXPAND2_GPINTENB_BANK1   0x12
 
#define EXPAND2_DEFVALB_BANK1   0x13
 
#define EXPAND2_INTCONB_BANK1   0x14
 
#define EXPAND2_IOCONO_BANK1   0x15
 
#define EXPAND2_GPPUB_BANK1   0x16
 
#define EXPAND2_INTFB_BANK1   0x17
 
#define EXPAND2_INTCAPB_BANK1   0x18
 
#define EXPAND2_GPIOB_BANK1   0x19
 
#define EXPAND2_OLATB_BANK1   0x1A
 
#define EXPAND2_IODIRA_BANK0   0x00
 
#define EXPAND2_IODIRB_BANK0   0x01
 
#define EXPAND2_IPOLA_BANK0   0x02
 
#define EXPAND2_IPOLB_BANK0   0x03
 
#define EXPAND2_GPINTENA_BANK0   0x04
 
#define EXPAND2_GPINTENB_BANK0   0x05
 
#define EXPAND2_DEFVALA_BANK0   0x06
 
#define EXPAND2_DEFVALB_BANK0   0x07
 
#define EXPAND2_INTCONA_BANK0   0x08
 
#define EXPAND2_INTCONB_BANK0   0x09
 
#define EXPAND2_IOCON_BANK0   0x0A
 
#define EXPAND2_GPPUA_BANK0   0x0C
 
#define EXPAND2_GPPUB_BANK0   0x0D
 
#define EXPAND2_INTFA_BANK0   0x0E
 
#define EXPAND2_INTFB_BANK0   0x0F
 
#define EXPAND2_INTCAPA_BANK0   0x10
 
#define EXPAND2_INTCAPB_BANK0   0x11
 
#define EXPAND2_GPIOA_BANK0   0x12
 
#define EXPAND2_GPIOB_BANK0   0x13
 
#define EXPAND2_OLATA_BANK0   0x14
 
#define EXPAND2_OLATB_BANK0   0x15
 
#define EXPAND2_HD1_PA0   0x01
 
#define EXPAND2_HD1_PA1   0x02
 
#define EXPAND2_HD1_PA2   0x04
 
#define EXPAND2_HD1_PA3   0x08
 
#define EXPAND2_HD1_PA4   0x10
 
#define EXPAND2_HD1_PA5   0x20
 
#define EXPAND2_HD1_PA6   0x40
 
#define EXPAND2_HD1_PA7   0x80
 
#define EXPAND2_HD2_PB0   0x01
 
#define EXPAND2_HD2_PB1   0x02
 
#define EXPAND2_HD2_PB2   0x04
 
#define EXPAND2_HD2_PB3   0x08
 
#define EXPAND2_HD2_PB4   0x10
 
#define EXPAND2_HD2_PB5   0x20
 
#define EXPAND2_HD2_PB6   0x40
 
#define EXPAND2_HD2_PB7   0x80
 
#define EXPAND2_HD_START_POSITION   0x01
 
#define EXPAND2_INT_ERR   0xFF
 

Functions

void expand2_cfg_setup (expand2_cfg_t *cfg)
 Config Object Initialization function.
 
EXPAND2_RETVAL expand2_init (expand2_t *ctx, expand2_cfg_t *cfg)
 Initialization function.
 
void expand2_default_cfg (expand2_t *ctx)
 Click Default Configuration function.
 
void expand2_generic_write (expand2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void expand2_generic_read (expand2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void expand2_set_bits (expand2_t *ctx, uint8_t module_address, uint8_t reg_address, uint8_t bit_mask)
 Set register bits function.
 
void expand2_clear_bits (expand2_t *ctx, uint8_t module_address, uint8_t reg_address, uint8_t bit_mask)
 Clear register bits function.
 
void expand2_toggle_bits (expand2_t *ctx, uint8_t module_address, uint8_t reg_address, uint8_t bit_mask)
 Toggle register bits function.
 
uint8_t expand2_read_port_a (expand2_t *ctx, uint8_t module_address)
 Read one byte of data from PORTA function.
 
uint8_t expand2_read_port_b (expand2_t *ctx, uint8_t module_address)
 Read one byte of data from PORTB function.
 
uint16_t expand2_read_both_ports (expand2_t *ctx, uint8_t module_address)
 Read two byte of data from PORTA & PORTB function.
 
void expand2_write_port_a (expand2_t *ctx, uint8_t module_address, uint8_t write_data)
 Write one byte of data to register for PORTA function.
 
void expand2_clear_bit_port_a (expand2_t *ctx, uint8_t moduleAddress, uint8_t bitMask)
 Clear bit from register for PORTA function.
 
void expand2_set_bit_port_a (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Set bit to register for PORTA function.
 
void expand2_toggle_bit_port_a (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Toggle bit to register for PORTA function.
 
void expand2_write_port_b (expand2_t *ctx, uint8_t module_address, uint8_t write_data)
 Write one byte of data to register for PORTB function.
 
void expand2_clear_bit_port_b (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Clear bit from register for PORTB function.
 
void expand2_setBitPortB (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Set bit to register for PORTB function.
 
void expand2_toggle_bit_port_b (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Toggle bit to register for PORTB function.
 
void expand2_set_direction_port_a (expand2_t *ctx, uint8_t module_address, uint8_t write_data)
 Set expander PORTA direction function.
 
void expand2_set_input_dir_port_a (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Set expander PORTA input direction function.
 
void expand2_set_output_dir_port_a (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Set expander PORTA output direction function.
 
void expand2_set_direction_port_b (expand2_t *ctx, uint8_t module_address, uint8_t write_data)
 Set expander PORTB direction function.
 
void expand2_set_input_dir_port_b (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Set expander PORTB input direction function.
 
void expand2_set_output_dir_port_b (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Set expander PORTB output direction function.
 
void expand2_set_pull_ups_port_a (expand2_t *ctx, uint8_t module_address, uint8_t write_data)
 Set pull-ups of the expander for PORTA pins function.
 
void expand2_set_pull_ups_port_b (expand2_t *ctx, uint8_t module_address, uint8_t write_data)
 Set pull-ups of the expander for PORTB pins function.
 
void expand2_set_port_a (expand2_t *ctx, uint8_t module_address, uint8_t position)
 Active pin by position on PORTA function.
 
void expand2_set_port_b (expand2_t *ctx, uint8_t module_address, uint8_t position)
 Active pin by position on PORTB function.
 
void expand2_reset (expand2_t *ctx)
 Reset function.
 
uint8_t expand2_getInterrupt (expand2_t *ctx)
 Get state of interrupt pin function.
 

Detailed Description

This file contains API for Expand 2 Click driver.