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 SOLIDSWITCH3_CH_OUT1 0x01
75#define SOLIDSWITCH3_CH_OUT2 0x02
76#define SOLIDSWITCH3_CH_OUT3 0x04
77#define SOLIDSWITCH3_CH_OUT4 0x08
78#define SOLIDSWITCH3_CH_OUT5 0x10
79#define SOLIDSWITCH3_CH_OUT6 0x20
80#define SOLIDSWITCH3_CH_OUT7 0x40
81#define SOLIDSWITCH3_CH_OUT8 0x80
82#define SOLIDSWITCH3_ALL_CHANNELS 0xFF
88#define SOLIDSWITCH3_DIR_MODE_SPI 0
89#define SOLIDSWITCH3_DIR_MODE_GPIO 1
95#define SOLIDSWITCH3_OUT_DISABLE 0u
96#define SOLIDSWITCH3_OUT_IN_TERMINAL 1u
97#define SOLIDSWITCH3_OUT_ENABLE 2u
98#define SOLIDSWITCH3_OUT_BITS_MASK 3u
108#define SOLIDSWITCH3_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
109#define SOLIDSWITCH3_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
127#define SOLIDSWITCH3_MAP_MIKROBUS( cfg, mikrobus ) \
128 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
129 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
130 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
131 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
132 cfg.dir = MIKROBUS( mikrobus, MIKROBUS_AN ); \
133 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
134 cfg.in1 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
135 cfg.in2 = MIKROBUS( mikrobus, MIKROBUS_INT )
void solidswitch3_reset(solidswitch3_t *ctx)
SolidSwitch 3 reset function.
void solidswitch3_set_in2_pin(solidswitch3_t *ctx, uint8_t state)
SolidSwitch 3 set in2 pin function.
void solidswitch3_set_rst_pin(solidswitch3_t *ctx, uint8_t state)
SolidSwitch 3 set rst pin function.
err_t solidswitch3_disable_output(solidswitch3_t *ctx, uint8_t channel)
SolidSwitch 3 disable output function.
void solidswitch3_cfg_setup(solidswitch3_cfg_t *cfg)
SolidSwitch 3 configuration object setup function.
err_t solidswitch3_init(solidswitch3_t *ctx, solidswitch3_cfg_t *cfg)
SolidSwitch 3 initialization function.
err_t solidswitch3_enable_output(solidswitch3_t *ctx, uint8_t channel)
SolidSwitch 3 enable output function.
err_t solidswitch3_default_cfg(solidswitch3_t *ctx)
SolidSwitch 3 default configuration function.
err_t solidswitch3_write_data(solidswitch3_t *ctx, uint16_t data_in)
SolidSwitch 3 write data function.
void solidswitch3_set_dir_mode(solidswitch3_t *ctx, uint8_t dir_mode)
SolidSwitch 3 set dir mode function.
void solidswitch3_set_in1_pin(solidswitch3_t *ctx, uint8_t state)
SolidSwitch 3 set in1 pin function.
solidswitch3_return_value_t
SolidSwitch 3 Click return value data.
Definition solidswitch3.h:191
@ SOLIDSWITCH3_ERROR
Definition solidswitch3.h:193
@ SOLIDSWITCH3_OK
Definition solidswitch3.h:192
This file contains SPI specific macros, functions, etc.
SolidSwitch 3 Click configuration object.
Definition solidswitch3.h:166
spi_master_chip_select_polarity_t cs_polarity
Definition solidswitch3.h:182
pin_name_t in2
Definition solidswitch3.h:177
pin_name_t sck
Definition solidswitch3.h:170
spi_master_mode_t spi_mode
Definition solidswitch3.h:181
pin_name_t mosi
Definition solidswitch3.h:169
uint32_t spi_speed
Definition solidswitch3.h:180
pin_name_t dir
Definition solidswitch3.h:174
pin_name_t in1
Definition solidswitch3.h:176
pin_name_t miso
Definition solidswitch3.h:168
pin_name_t rst
Definition solidswitch3.h:175
pin_name_t cs
Definition solidswitch3.h:171
SolidSwitch 3 Click context object.
Definition solidswitch3.h:145
uint16_t output_state
Definition solidswitch3.h:157
digital_out_t in2
Definition solidswitch3.h:150
spi_master_t spi
Definition solidswitch3.h:153
digital_out_t rst
Definition solidswitch3.h:148
pin_name_t chip_select
Definition solidswitch3.h:155
digital_out_t in1
Definition solidswitch3.h:149
digital_out_t dir
Definition solidswitch3.h:147