expand18  2.1.0.0
Data Structures | Macros | Enumerations | Functions
expand18.h File Reference

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

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  expand18_t
 Expand 18 Click context object. More...
 
struct  expand18_cfg_t
 Expand 18 Click configuration object. More...
 

Macros

#define EXPAND18_REG_INPUT_P0   0x00
 Expand 18 register list. More...
 
#define EXPAND18_REG_INPUT_P1   0x01
 
#define EXPAND18_REG_OUTPUT_P0   0x02
 
#define EXPAND18_REG_OUTPUT_P1   0x03
 
#define EXPAND18_REG_POLARITY_INV_P0   0x04
 
#define EXPAND18_REG_POLARITY_INV_P1   0x05
 
#define EXPAND18_REG_CONFIG_P0   0x06
 
#define EXPAND18_REG_CONFIG_P1   0x07
 
#define EXPAND18_REG_OUTPUT_DRIVE_P0A   0x40
 
#define EXPAND18_REG_OUTPUT_DRIVE_P0B   0x41
 
#define EXPAND18_REG_OUTPUT_DRIVE_P1A   0x42
 
#define EXPAND18_REG_OUTPUT_DRIVE_P1B   0x43
 
#define EXPAND18_REG_INPUT_LATCH_P0   0x44
 
#define EXPAND18_REG_INPUT_LATCH_P1   0x45
 
#define EXPAND18_REG_PULL_ENABLE_P0   0x46
 
#define EXPAND18_REG_PULL_ENABLE_P1   0x47
 
#define EXPAND18_REG_PULL_SELECTION_P0   0x48
 
#define EXPAND18_REG_PULL_SELECTION_P1   0x49
 
#define EXPAND18_REG_INT_MASK_P0   0x4A
 
#define EXPAND18_REG_INT_MASK_P1   0x4B
 
#define EXPAND18_REG_INT_STATUS_P0   0x4C
 
#define EXPAND18_REG_INT_STATUS_P1   0x4D
 
#define EXPAND18_REG_OUTPUT_PORT_CONFIG   0x4F
 
#define EXPAND18_REG_INT_EDGE_P0A   0x50
 
#define EXPAND18_REG_INT_EDGE_P0B   0x51
 
#define EXPAND18_REG_INT_EDGE_P1A   0x52
 
#define EXPAND18_REG_INT_EDGE_P1B   0x53
 
#define EXPAND18_REG_INT_CLEAR_P0   0x54
 
#define EXPAND18_REG_INT_CLEAR_P1   0x55
 
#define EXPAND18_REG_INPUT_STATUS_P0   0x56
 
#define EXPAND18_REG_INPUT_STATUS_P1   0x57
 
#define EXPAND18_REG_PIN_OUTPUT_P0_CONFIG   0x58
 
#define EXPAND18_REG_PIN_OUTPUT_P1_CONFIG   0x59
 
#define EXPAND18_REG_SWITCH_DEBOUNCE_EN_0   0x5A
 
#define EXPAND18_REG_SWITCH_DEBOUNCE_EN_1   0x5B
 
#define EXPAND18_REG_SWITCH_DEBOUNCE_CNT   0x5C
 
#define EXPAND18_NO_PIN_MASK   0x00
 Expand 18 pin mask values. More...
 
#define EXPAND18_PIN_0_MASK   0x01
 
#define EXPAND18_PIN_1_MASK   0x02
 
#define EXPAND18_PIN_2_MASK   0x04
 
#define EXPAND18_PIN_3_MASK   0x08
 
#define EXPAND18_PIN_4_MASK   0x10
 
#define EXPAND18_PIN_5_MASK   0x20
 
#define EXPAND18_PIN_6_MASK   0x40
 
#define EXPAND18_PIN_7_MASK   0x80
 
#define EXPAND18_ALL_PINS_MASK   0xFF
 
#define EXPAND18_PORT_0   0x00
 Expand 18 port values. More...
 
#define EXPAND18_PORT_1   0x01
 
#define EXPAND18_OUTPUT_DIRECTION   0x00
 Expand 18 pin direction values. More...
 
#define EXPAND18_INPUT_DIRECTION   0x01
 
#define EXPAND18_PIN_LOW_LEVEL   0x00
 Expand 18 pin logic level values. More...
 
#define EXPAND18_PIN_HIGH_LEVEL   0x01
 
#define EXPAND18_AUTO_INCREMENT_BIT   0x80
 Expand 18 auto increment bit mask. More...
 
#define EXPAND18_DEVICE_ID   0x000830
 Expand 18 device ID value. More...
 
#define EXPAND18_DEVICE_ADDRESS_0   0x40
 Expand 18 device address setting. More...
 
#define EXPAND18_DEVICE_ADDRESS_1   0x42
 
#define EXPAND18_ADDRESS_READ_BIT   0x01
 
#define EXPAND18_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection. More...
 
#define EXPAND18_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define EXPAND18_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping. More...
 

Enumerations

enum  expand18_return_value_t { EXPAND18_OK = 0, EXPAND18_ERROR = -1 }
 Expand 18 Click return value data. More...
 

Functions

void expand18_cfg_setup (expand18_cfg_t *cfg)
 Expand 18 configuration object setup function. More...
 
err_t expand18_init (expand18_t *ctx, expand18_cfg_t *cfg)
 Expand 18 initialization function. More...
 
err_t expand18_default_cfg (expand18_t *ctx)
 Expand 18 default configuration function. More...
 
err_t expand18_generic_write (expand18_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Expand 18 data writing function. More...
 
err_t expand18_generic_read (expand18_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Expand 18 data reading function. More...
 
err_t expand18_write_register (expand18_t *ctx, uint8_t reg, uint8_t data_in)
 Expand 18 write register function. More...
 
err_t expand18_read_register (expand18_t *ctx, uint8_t reg, uint8_t *data_out)
 Expand 18 read register function. More...
 
void expand18_set_rst_pin (expand18_t *ctx, uint8_t state)
 Expand 18 set RST pin function. More...
 
void expand18_reset_device (expand18_t *ctx)
 Expand 18 reset device function. More...
 
uint8_t expand18_get_int_pin (expand18_t *ctx)
 Expand 18 get INT pin function. More...
 
err_t expand18_set_pin_direction (expand18_t *ctx, uint8_t direction, uint8_t port, uint8_t pin_mask)
 Expand 18 set pin direction function. More...
 
err_t expand18_set_all_pins_direction (expand18_t *ctx, uint8_t direction)
 Expand 18 set all pins direction function. More...
 
err_t expand18_set_all_pins_value (expand18_t *ctx, uint8_t set_mask)
 Expand 18 set all pins value function. More...
 
err_t expand18_set_pin_value (expand18_t *ctx, uint8_t port, uint8_t clr_mask, uint8_t set_mask)
 Expand 18 set pin value function. More...
 
err_t expand18_read_port_value (expand18_t *ctx, uint8_t port, uint8_t *data_out)
 Expand 18 read port value function. More...
 

Detailed Description

This file contains API for Expand 18 Click Driver.

Enumeration Type Documentation

◆ expand18_return_value_t

Expand 18 Click return value data.

Predefined enum values for driver return values.

Enumerator
EXPAND18_OK 
EXPAND18_ERROR