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

This file contains API for DIGI IN 2 Click Driver. More...

#include "mikrosdk_version.h"
#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  digiin2_t
 DIGI IN 2 Click context object. More...
 
struct  digiin2_cfg_t
 DIGI IN 2 Click configuration object. More...
 

Macros

#define DIGIIN2_REG_DISTATE   0x00
 DIGI IN 2 description register. More...
 
#define DIGIIN2_REG_FAULT   0x01
 
#define DIGIIN2_REG_F1MASK   0x02
 
#define DIGIIN2_REG_CNFG1   0x03
 
#define DIGIIN2_REG_CNFG2   0x04
 
#define DIGIIN2_REG_CNFG3   0x05
 
#define DIGIIN2_REG_CNFG4   0x06
 
#define DIGIIN2_REG_CNFG5   0x07
 
#define DIGIIN2_REG_CNFG6   0x08
 
#define DIGIIN2_REG_CNFG7   0x09
 
#define DIGIIN2_REG_CNFG8   0x0A
 
#define DIGIIN2_REG_GLOBLCFG   0x0B
 
#define DIGIIN2_REG_LED   0x0C
 
#define DIGIIN2_REG_FAULT2   0x0D
 
#define DIGIIN2_REG_F2MASK   0x0E
 
#define DIGIIN2_REG_START_STOP   0x0F
 
#define DIGIIN2_REG_CNT1_LSB   0x10
 
#define DIGIIN2_REG_CNT1_MSB   0x11
 
#define DIGIIN2_REG_CNT2_LSB   0x12
 
#define DIGIIN2_REG_CNT2_MSB   0x13
 
#define DIGIIN2_REG_CNT3_LSB   0x14
 
#define DIGIIN2_REG_CNT3_MSB   0x15
 
#define DIGIIN2_REG_CNT4_LSB   0x16
 
#define DIGIIN2_REG_CNT4_MSB   0x17
 
#define DIGIIN2_REG_CNT5_LSB   0x18
 
#define DIGIIN2_REG_CNT5_MSB   0x19
 
#define DIGIIN2_REG_CNT6_LSB   0x1A
 
#define DIGIIN2_REG_CNT6_MSB   0x1B
 
#define DIGIIN2_REG_CNT7_LSB   0x1C
 
#define DIGIIN2_REG_CNT7_MSB   0x1D
 
#define DIGIIN2_REG_CNT8_LSB   0x1E
 
#define DIGIIN2_REG_CNT8_MSB   0x1F
 
#define DIGIIN2_CHANNEL_1_MASK   0x01
 DIGI IN 2 DISTATE register setting. More...
 
#define DIGIIN2_CHANNEL_2_MASK   0x02
 
#define DIGIIN2_CHANNEL_3_MASK   0x04
 
#define DIGIIN2_CHANNEL_4_MASK   0x08
 
#define DIGIIN2_CHANNEL_5_MASK   0x10
 
#define DIGIIN2_CHANNEL_6_MASK   0x20
 
#define DIGIIN2_CHANNEL_7_MASK   0x40
 
#define DIGIIN2_CHANNEL_8_MASK   0x80
 
#define DIGIIN2_CHANNEL_1_SEL   0x00
 DIGI IN 2 Channel selection setting. More...
 
#define DIGIIN2_CHANNEL_2_SEL   0x01
 
#define DIGIIN2_CHANNEL_3_SEL   0x02
 
#define DIGIIN2_CHANNEL_4_SEL   0x03
 
#define DIGIIN2_CHANNEL_5_SEL   0x04
 
#define DIGIIN2_CHANNEL_6_SEL   0x05
 
#define DIGIIN2_CHANNEL_7_SEL   0x06
 
#define DIGIIN2_CHANNEL_8_SEL   0x07
 
#define DIGIIN2_CRC_ERROR_FLAG   0x80
 DIGI IN 2 FAULT1 register setting. More...
 
#define DIGIIN2_POR   0x40
 
#define DIGIIN2_FAULT2   0x20
 
#define DIGIIN2_TERMAL_SHUTDOWN   0x10
 
#define DIGIIN2_TEMPERATURE_ALARM   0x08
 
#define DIGIIN2_V24_UNDERVOLTAGE   0x04
 
#define DIGIIN2_VM_VOLTAGE_LOW   0x02
 
#define DIGIIN2_CRC_ERROR_FLAG_MASK   0x80
 DIGI IN 2 F1MASK register setting. More...
 
#define DIGIIN2_FAULT2_MASK   0x20
 
#define DIGIIN2_TERMAL_SHUTDOWN_MASK   0x10
 
#define DIGIIN2_TEMPERATURE_ALARM_MASK   0x08
 
#define DIGIIN2_V24_UNDERVOLTAGE_MASK   0x04
 
#define DIGIIN2_VM_VOLTAGE_LOW_MASK   0x02
 
#define DIGIIN2_HITHR_HIGH   0x80
 DIGI IN 2 CNFGx register setting. More...
 
#define DIGIIN2_HITHR_LOW   0x00
 
#define DIGIIN2_SINK_MODE   0x00
 
#define DIGIIN2_SOURCE_MODE   0x40
 
#define DIGIIN2_CURR_OFF   0x00
 
#define DIGIIN2_CURR_X1   0x10
 
#define DIGIIN2_CURR_X3   0x20
 
#define DIGIIN2_CURR_TTL_OFF   0x30
 
#define DIGIIN2_GLITCH_FIL_EN   0x08
 
#define DIGIIN2_GLITCH_FIL_DIS   0x00
 
#define DIGIIN2_GLITCH_FIL_DELAY_50_US   0x00
 
#define DIGIIN2_GLITCH_FIL_DELAY_100_US   0x01
 
#define DIGIIN2_GLITCH_FIL_DELAY_400_US   0x02
 
#define DIGIIN2_GLITCH_FIL_DELAY_800_US   0x03
 
#define DIGIIN2_GLITCH_FIL_DELAY_1600_US   0x04
 
#define DIGIIN2_GLITCH_FIL_DELAY_3200_US   0x05
 
#define DIGIIN2_GLITCH_FIL_DELAY_12800_US   0x06
 
#define DIGIIN2_GLITCH_FIL_DELAY_20_MS   0x07
 
#define DIGIIN2_GPO_CFG_LED   0x80
 DIGI IN 2 GLOBLCFG register setting. More...
 
#define DIGIIN2_GPO_CFG_LEDINT   0x00
 
#define DIGIIN2_LEDINT_CFG_GPO   0x00
 
#define DIGIIN2_LEDINT_CFG_VMLOW   0x40
 
#define DIGIIN2_LED9_ON   0x00
 
#define DIGIIN2_LED9_OFF   0x20
 
#define DIGIIN2_FSPICLEAR_READ   0x10
 
#define DIGIIN2_FSPICLEAR_AUTO   0x00
 
#define DIGIIN2_CLR_FILTER_ON   0x08
 
#define DIGIIN2_CLR_FILTER_OFF   0x00
 
#define DIGIIN2_REFDISHTCFG_DIS   0x00
 
#define DIGIIN2_REFDISHTCFG_EN   0x01
 
#define DIGIIN2_LED_1_MASK   0x01
 DIGI IN 2 LED register setting. More...
 
#define DIGIIN2_LED_2_MASK   0x02
 
#define DIGIIN2_LED_3_MASK   0x04
 
#define DIGIIN2_LED_4_MASK   0x08
 
#define DIGIIN2_LED_5_MASK   0x10
 
#define DIGIIN2_LED_6_MASK   0x20
 
#define DIGIIN2_LED_7_MASK   0x40
 
#define DIGIIN2_LED_8_MASK   0x80
 
#define DIGIIN2_VAUV_UNDER_TRESHOLD   0x10
 DIGI IN 2 FAULT2 register setting. More...
 
#define DIGIIN2_SPI8_CLK_ERROR   0x08
 
#define DIGIIN2_OTSHDN2_ERROR   0x04
 
#define DIGIIN2_RFDIO_ERROR   0x02
 
#define DIGIIN2_RFDIS_ERROR   0x01
 
#define DIGIIN2_VAUV_UNDER_TRESHOLD_MASK   0x10
 DIGI IN 2 F2MASK register setting. More...
 
#define DIGIIN2_SPI8_CLK_ERROR_MASK   0x08
 
#define DIGIIN2_OTSHDN2_ERROR_MASK   0x04
 
#define DIGIIN2_RFDIO_ERROR_MASK   0x02
 
#define DIGIIN2_RFDIS_ERROR_MASK   0x01
 
#define DIGIIN2_PIN_STATE_HIGH   0x01
 DIGI IN 2 pin state setting. More...
 
#define DIGIIN2_PIN_STATE_LOW   0x00
 
#define DIGIIN2_CRC_ENABLED   0x01
 DIGI IN 2 CRC Settings setting. More...
 
#define DIGIIN2_CRC_DISABLED   0x00
 
#define DIGIIN2_CHIP_ADDRESS_00   0x00
 DIGI IN 2 chip address setting. More...
 
#define DIGIIN2_CHIP_ADDRESS_01   0x40
 
#define DIGIIN2_CHIP_ADDRESS_10   0x80
 
#define DIGIIN2_CHIP_ADDRESS_11   0xC0
 
#define DIGIIN2_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection. More...
 
#define DIGIIN2_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define DIGIIN2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping. More...
 

Enumerations

enum  digiin2_return_value_t { DIGIIN2_OK = 0 , DIGIIN2_ERROR = -1 }
 DIGI IN 2 Click return value data. More...
 

Functions

void digiin2_cfg_setup (digiin2_cfg_t *cfg)
 DIGI IN 2 configuration object setup function. More...
 
err_t digiin2_init (digiin2_t *ctx, digiin2_cfg_t *cfg)
 DIGI IN 2 initialization function. More...
 
err_t digiin2_default_cfg (digiin2_t *ctx)
 DIGI IN 2 default configuration function. More...
 
void digiin2_set_dev_address (digiin2_t *ctx, uint8_t device_address)
 DIGI IN 2 set device address function. More...
 
err_t digiin2_generic_write (digiin2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 DIGI IN 2 data writing function. More...
 
err_t digiin2_generic_read (digiin2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 DIGI IN 2 data reading function. More...
 
void digiin2_set_ltc_pin (digiin2_t *ctx, uint8_t pin_state)
 DIGI IN 2 set LTC pin function. More...
 
uint8_t digiin2_get_rdy_pin (digiin2_t *ctx)
 DIGI IN 2 get RDY pin state function. More...
 
uint8_t digiin2_get_flt_pin (digiin2_t *ctx)
 DIGI IN 2 get FLT pin state function. More...
 
err_t digiin2_write_reg (digiin2_t *ctx, uint8_t reg, uint8_t data_in)
 DIGI IN 2 register write function. More...
 
err_t digiin2_read_reg (digiin2_t *ctx, uint8_t reg, uint8_t *data_out)
 DIGI IN 2 register reading function. More...
 
err_t digiin2_read_ch_counter (digiin2_t *ctx, uint8_t channel_sel, uint16_t *data_out)
 DIGI IN 2 channel counter reading function. More...
 
void digiin2_pulse_latch (digiin2_t *ctx)
 DIGI IN 2 send latch pulse function. More...
 

Detailed Description

This file contains API for DIGI IN 2 Click Driver.

Enumeration Type Documentation

◆ digiin2_return_value_t

DIGI IN 2 Click return value data.

Predefined enum values for driver return values.

Enumerator
DIGIIN2_OK 
DIGIIN2_ERROR