28#ifndef DIGIISOLATOR2_H
29#define DIGIISOLATOR2_H
39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_spi_master.h"
74#define DIGIISOLATOR2_REG_INPUT_DATA 0x00
75#define DIGIISOLATOR2_REG_WIRE_BREAK 0x01
76#define DIGIISOLATOR2_REG_FAULT 0x02
77#define DIGIISOLATOR2_REG_FILTER_CH1_CH2 0x03
78#define DIGIISOLATOR2_REG_FILTER_CH3_CH4 0x04
79#define DIGIISOLATOR2_REG_FILTER_CH5_CH6 0x05
80#define DIGIISOLATOR2_REG_FILTER_CH7_CH8 0x06
98#define DIGIISOLATOR2_CHANNEL_IN1 0x01
99#define DIGIISOLATOR2_CHANNEL_IN2 0x02
100#define DIGIISOLATOR2_CHANNEL_IN3 0x04
101#define DIGIISOLATOR2_CHANNEL_IN4 0x08
102#define DIGIISOLATOR2_CHANNEL_IN5 0x10
103#define DIGIISOLATOR2_CHANNEL_IN6 0x20
104#define DIGIISOLATOR2_CHANNEL_IN7 0x40
105#define DIGIISOLATOR2_CHANNEL_IN8 0x80
106#define DIGIISOLATOR2_CHANNEL_ALL 0xFF
116#define DIGIISOLATOR2_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
117#define DIGIISOLATOR2_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
135#define DIGIISOLATOR2_MAP_MIKROBUS( cfg, mikrobus ) \
136 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
137 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
138 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
139 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
140 cfg.en = MIKROBUS( mikrobus, MIKROBUS_AN ); \
141 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
142 cfg.sync = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
143 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
digiisolator2_drv_t
DIGI Isolator 2 Click driver selector.
Definition digiisolator2.h:153
@ DIGIISOLATOR2_DRV_SEL_SPI
Definition digiisolator2.h:154
@ DIGIISOLATOR2_DRV_SEL_GPIO
Definition digiisolator2.h:155
digiisolator2_return_value_t
DIGI Isolator 2 Click return value data.
Definition digiisolator2.h:220
@ DIGIISOLATOR2_OK
Definition digiisolator2.h:221
@ DIGIISOLATOR2_ERROR
Definition digiisolator2.h:222
uint8_t digiisolator2_get_out1_pin(digiisolator2_t *ctx)
DIGI Isolator 2 get out1 pin function.
uint8_t digiisolator2_get_out4_pin(digiisolator2_t *ctx)
DIGI Isolator 2 get out4 pin function.
uint8_t digiisolator2_get_out2_pin(digiisolator2_t *ctx)
DIGI Isolator 2 get out2 pin function.
void digiisolator2_drv_interface_sel(digiisolator2_cfg_t *cfg, digiisolator2_drv_t drv_sel)
DIGI Isolator 2 driver interface setup function.
uint8_t digiisolator2_get_out3_pin(digiisolator2_t *ctx)
DIGI Isolator 2 get out3 pin function.
uint8_t digiisolator2_get_out8_pin(digiisolator2_t *ctx)
DIGI Isolator 2 get out8 pin function.
err_t digiisolator2_read_inputs(digiisolator2_t *ctx, uint8_t *data_out)
DIGI Isolator 2 read inputs function.
uint8_t digiisolator2_get_out6_pin(digiisolator2_t *ctx)
DIGI Isolator 2 get out6 pin function.
err_t digiisolator2_init(digiisolator2_t *ctx, digiisolator2_cfg_t *cfg)
DIGI Isolator 2 initialization function.
uint8_t digiisolator2_get_sync_pin(digiisolator2_t *ctx)
DIGI Isolator 2 get sync pin function.
err_t digiisolator2_spi_write(digiisolator2_t *ctx, uint8_t reg, uint8_t data_in)
DIGI Isolator 2 SPI writing function.
void digiisolator2_set_rst_pin(digiisolator2_t *ctx, uint8_t state)
DIGI Isolator 2 set rst pin function.
void digiisolator2_enable_output(digiisolator2_t *ctx)
DIGI Isolator 2 enable output function.
void digiisolator2_disable_output(digiisolator2_t *ctx)
DIGI Isolator 2 disable output function.
uint8_t digiisolator2_get_out5_pin(digiisolator2_t *ctx)
DIGI Isolator 2 get out5 pin function.
uint8_t digiisolator2_get_int_pin(digiisolator2_t *ctx)
DIGI Isolator 2 get int pin function.
void digiisolator2_cfg_setup(digiisolator2_cfg_t *cfg)
DIGI Isolator 2 configuration object setup function.
err_t digiisolator2_spi_read(digiisolator2_t *ctx, uint8_t reg, uint8_t *data_out)
DIGI Isolator 2 SPI reading function.
This file contains SPI specific macros, functions, etc.
DIGI Isolator 2 Click configuration object.
Definition digiisolator2.h:196
pin_name_t sync
Definition digiisolator2.h:204
spi_master_chip_select_polarity_t cs_polarity
Definition digiisolator2.h:209
pin_name_t sck
Definition digiisolator2.h:199
spi_master_mode_t spi_mode
Definition digiisolator2.h:208
pin_name_t mosi
Definition digiisolator2.h:198
uint32_t spi_speed
Definition digiisolator2.h:207
pin_name_t en
Definition digiisolator2.h:202
pin_name_t int_pin
Definition digiisolator2.h:205
pin_name_t miso
Definition digiisolator2.h:197
digiisolator2_drv_t drv_sel
Definition digiisolator2.h:211
pin_name_t rst
Definition digiisolator2.h:203
pin_name_t cs
Definition digiisolator2.h:200
DIGI Isolator 2 Click context object.
Definition digiisolator2.h:164
digital_in_t out6
Definition digiisolator2.h:179
spi_master_t spi
Definition digiisolator2.h:183
digital_in_t sync
Definition digiisolator2.h:170
digital_in_t out1
Definition digiisolator2.h:174
digital_in_t out2
Definition digiisolator2.h:175
digital_in_t out5
Definition digiisolator2.h:178
digital_in_t out8
Definition digiisolator2.h:180
digital_in_t int_pin
Definition digiisolator2.h:171
digital_in_t out3
Definition digiisolator2.h:176
digital_in_t out4
Definition digiisolator2.h:177
digital_out_t en
Definition digiisolator2.h:166
digital_out_t rst
Definition digiisolator2.h:167
digiisolator2_drv_t drv_sel
Definition digiisolator2.h:187
pin_name_t chip_select
Definition digiisolator2.h:185