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"
54#include "drv_analog_in.h"
76#define DIGIISOLATOR_VREF_3V3 3.3
77#define DIGIISOLATOR_VREF_5V 5.0
84#define DIGIISOLATOR_TX_DRV_BUFFER_SIZE 100
85#define DIGIISOLATOR_RX_DRV_BUFFER_SIZE 300
95#define DIGIISOLATOR_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
96#define DIGIISOLATOR_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
114#define DIGIISOLATOR_MAP_MIKROBUS( cfg, mikrobus ) \
115 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
116 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
117 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
118 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
119 cfg.d1 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
120 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
121 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
122 cfg.d2 = MIKROBUS( mikrobus, MIKROBUS_INT )
digiisolator_return_value_t
DIGI Isolator Click return value data.
Definition digiisolator.h:187
@ DIGIISOLATOR_OK
Definition digiisolator.h:188
@ DIGIISOLATOR_ERROR
Definition digiisolator.h:189
#define DIGIISOLATOR_TX_DRV_BUFFER_SIZE
DIGI Isolator driver buffer size.
Definition digiisolator.h:84
#define DIGIISOLATOR_RX_DRV_BUFFER_SIZE
Definition digiisolator.h:85
err_t digiisolator_get_d1_pin_voltage(digiisolator_t *ctx, float *data_out)
DIGI Isolator read D1 pin voltage level function.
err_t digiisolator_uart_read(digiisolator_t *ctx, char *data_out, uint16_t len)
DIGI Isolator UART data reading function.
err_t digiisolator_spi_transfer(digiisolator_t *ctx, uint8_t *data_in, uint8_t *data_out, uint8_t len)
DIGI Isolator SPI transfer function.
err_t digiisolator_uart_write(digiisolator_t *ctx, char *data_in, uint16_t len)
DIGI Isolator UART data writing function.
err_t digiisolator_get_d1_pin_value(digiisolator_t *ctx, uint16_t *data_out)
DIGI Isolator read D1 pin value function.
err_t digiisolator_spi_write(digiisolator_t *ctx, uint8_t *data_in, uint8_t len)
DIGI Isolator SPI data writing function.
void digiisolator_cfg_setup(digiisolator_cfg_t *cfg)
DIGI Isolator configuration object setup function.
uint8_t digiisolator_get_d2(digiisolator_t *ctx)
DIGI Isolator get D2 function.
err_t digiisolator_spi_write_read(digiisolator_t *ctx, uint8_t *data_in, uint8_t len_in, uint8_t *data_out, uint8_t len_out)
DIGI Isolator SPI write then read function.
err_t digiisolator_spi_read(digiisolator_t *ctx, uint8_t *data_out, uint8_t len)
DIGI Isolator SPI data reading function.
err_t digiisolator_init(digiisolator_t *ctx, digiisolator_cfg_t *cfg)
DIGI Isolator initialization function.
This file contains SPI specific macros, functions, etc.
DIGI Isolator Click configuration object.
Definition digiisolator.h:154
uint32_t baud_rate
Definition digiisolator.h:171
analog_in_resolution_t resolution
Definition digiisolator.h:177
float vref
Definition digiisolator.h:178
spi_master_chip_select_polarity_t cs_polarity
Definition digiisolator.h:170
bool uart_blocking
Definition digiisolator.h:172
pin_name_t sck
Definition digiisolator.h:158
uart_data_bits_t data_bit
Definition digiisolator.h:173
spi_master_mode_t spi_mode
Definition digiisolator.h:169
pin_name_t d1
Definition digiisolator.h:164
pin_name_t tx_pin
Definition digiisolator.h:161
pin_name_t mosi
Definition digiisolator.h:157
uint32_t spi_speed
Definition digiisolator.h:168
pin_name_t d2
Definition digiisolator.h:165
pin_name_t rx_pin
Definition digiisolator.h:160
uart_stop_bits_t stop_bit
Definition digiisolator.h:175
pin_name_t miso
Definition digiisolator.h:156
uart_parity_t parity_bit
Definition digiisolator.h:174
pin_name_t cs
Definition digiisolator.h:159
DIGI Isolator Click context object.
Definition digiisolator.h:132
spi_master_t spi
Definition digiisolator.h:138
digital_in_t d2
Definition digiisolator.h:135
uart_t uart
Definition digiisolator.h:139
pin_name_t chip_select
Definition digiisolator.h:141
analog_in_t adc
Definition digiisolator.h:134