42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
55#include "drv_spi_master.h"
68#define ADAPTER_MAP_MIKROBUS( cfg, mikrobus ) \
69 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
70 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
71 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
72 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
73 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
74 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
75 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
76 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT ); \
77 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
78 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX )
85#define ADAPTER_MASTER_I2C 0
86#define ADAPTER_MASTER_SPI 1
93#define ADAPTER_RETVAL uint8_t
95#define ADAPTER_OK 0x00
96#define ADAPTER_INIT_ERROR 0xFF
103#define I2C_SLAVE_ADDR_DEMO 0x4C
#define ADAPTER_RETVAL
Definition adapter.h:93
uint8_t adapter_check_int(adapter_t *ctx)
Check INT function.
void adapter_cfg_setup(adapter_cfg_t *cfg)
Config Object Initialization function.
void adapter_turn_rx_on(adapter_t *ctx)
Turn RX on function.
void adapter_turn_pwm_off(adapter_t *ctx)
Turn PWM off function.
void adapter_generic_write(adapter_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void adapter_turn_tx_on(adapter_t *ctx)
Turn TX on function.
void adapter_turn_pwm_on(adapter_t *ctx)
Turn PWM on function.
void adapter_generic_transfer(adapter_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
Generic transfer function.
void adapter_turn_tx_off(adapter_t *ctx)
Turn TX off function.
void adapter_generic_read(adapter_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
void adapter_turn_rx_off(adapter_t *ctx)
Turn RX off function.
ADAPTER_RETVAL adapter_init(adapter_t *ctx, adapter_cfg_t *cfg)
Initialization function.
struct adapter_s adapter_t
Click ctx object definition.
uint8_t adapter_select_t
Communication type.
Definition adapter.h:116
void(* adapter_master_io_t)(struct adapter_s *, uint8_t, uint8_t *, uint8_t)
Master Input/Output type.
Definition adapter.h:121
Click configuration structure definition.
Definition adapter.h:159
uint32_t i2c_speed
Definition adapter.h:178
spi_master_chip_select_polarity_t cs_polarity
Definition adapter.h:183
pin_name_t sck
Definition adapter.h:166
spi_master_mode_t spi_mode
Definition adapter.h:182
pin_name_t tx_pin
Definition adapter.h:169
pin_name_t mosi
Definition adapter.h:165
adapter_select_t sel
Definition adapter.h:185
uint32_t spi_speed
Definition adapter.h:181
pin_name_t rx_pin
Definition adapter.h:168
pin_name_t scl
Definition adapter.h:162
pin_name_t int_pin
Definition adapter.h:174
pin_name_t pwm
Definition adapter.h:173
pin_name_t miso
Definition adapter.h:164
pin_name_t sda
Definition adapter.h:163
pin_name_t cs
Definition adapter.h:167
uint8_t i2c_address
Definition adapter.h:179
Click ctx object definition.
Definition adapter.h:127
digital_out_t cs
Definition adapter.h:130
adapter_select_t master_sel
Definition adapter.h:151
spi_master_t spi
Definition adapter.h:142
adapter_master_io_t read_f
Definition adapter.h:150
adapter_master_io_t write_f
Definition adapter.h:149
digital_out_t pwm
Definition adapter.h:131
digital_in_t int_pin
Definition adapter.h:137
i2c_master_t i2c
Definition adapter.h:141
digital_out_t rx_pin
Definition adapter.h:133
uint8_t slave_address
Definition adapter.h:147
digital_out_t tx_pin
Definition adapter.h:132
pin_name_t chip_select
Definition adapter.h:148