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 TIMERRELAY_PIN_STATE_HIGH 0x01
75#define TIMERRELAY_PIN_STATE_LOW 0x00
81#define TIMERRELAY_5V_MAX_DELAY 60
82#define TIMERRELAY_3V3_MAX_DELAY 160
83#define TIMERRELAY_5V_CALCULATION_MULTIPLIER 0.2353f
84#define TIMERRELAY_3V3_CALCULATION_MULTIPLIER 0.6275f
90#define TIMERRELAY_VCC_5V 0x01
91#define TIMERRELAY_VCC_3V3 0x00
101#define TIMERRELAY_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
102#define TIMERRELAY_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
120#define TIMERRELAY_MAP_MIKROBUS( cfg, mikrobus ) \
121 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
122 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
123 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
124 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
125 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
126 cfg.trg = MIKROBUS( mikrobus, MIKROBUS_INT )
void timerrelay_activate_trigger(timerrelay_t *ctx)
Timer Relay activate trigger function.
void timerrelay_cfg_setup(timerrelay_cfg_t *cfg)
Timer Relay configuration object setup function.
err_t timerrelay_generic_write(timerrelay_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Timer Relay data writing function.
void timerrelay_set_trg_pin(timerrelay_t *ctx, uint8_t pin_state)
Timer Relay set TRG pin state function.
void timerrelay_activate_reset(timerrelay_t *ctx)
Timer Relay reset timer function.
err_t timerrelay_set_wiper_pos(timerrelay_t *ctx, uint8_t wiper_pos)
Timer Relay set wiper position function.
err_t timerrelay_init(timerrelay_t *ctx, timerrelay_cfg_t *cfg)
Timer Relay initialization function.
err_t timerrelay_default_cfg(timerrelay_t *ctx)
Timer Relay default configuration function.
void timerrelay_set_vcc_sel(timerrelay_t *ctx, uint8_t vcc_sel)
Timer Relay set Vcc select settings function.
err_t timerrelay_set_delay(timerrelay_t *ctx, uint8_t delay)
Timer Relay set delay function.
void timerrelay_set_rst_pin(timerrelay_t *ctx, uint8_t pin_state)
Timer Relay set RST pin state function.
This file contains SPI specific macros, functions, etc.
Timer Relay Click configuration object.
Definition timerrelay.h:155
spi_master_chip_select_polarity_t cs_polarity
Definition timerrelay.h:169
pin_name_t sck
Definition timerrelay.h:159
spi_master_mode_t spi_mode
Definition timerrelay.h:168
pin_name_t mosi
Definition timerrelay.h:158
uint32_t spi_speed
Definition timerrelay.h:167
pin_name_t trg
Definition timerrelay.h:164
pin_name_t miso
Definition timerrelay.h:157
pin_name_t rst
Definition timerrelay.h:163
pin_name_t cs
Definition timerrelay.h:160
Timer Relay Click context object.
Definition timerrelay.h:136
spi_master_t spi
Definition timerrelay.h:142
digital_out_t trg
Definition timerrelay.h:139
digital_out_t rst
Definition timerrelay.h:138
uint8_t vcc_sel
Definition timerrelay.h:146
pin_name_t chip_select
Definition timerrelay.h:144
timerrelay_return_value_t
Timer Relay Click return value data.
Definition timerrelay.h:178
@ TIMERRELAY_ERROR
Definition timerrelay.h:180
@ TIMERRELAY_OK
Definition timerrelay.h:179