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"
53#include "drv_analog_in.h"
75#define VTOHZ3_MAXIMAL_IN_FREQUENCY 1000000
76#define VTOHZ3_MINIMAL_IN_FREQUENCY 32000
77#define VTOHZ3_DEFAULT_IN_FREQUENCY 100000
83#define VTOHZ3_VREF_3V3 3.3
84#define VTOHZ3_VREF_5V 5.0
85#define VTOHZ3_VREF_INTERNAL_2V5 2.5
95#define VTOHZ3_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
96#define VTOHZ3_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
114#define VTOHZ3_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.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
120 cfg.buf = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
121 cfg.fout = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t vtohz3_read_an_pin_voltage(vtohz3_t *ctx, float *data_out)
V to Hz 3 read AN pin voltage level function.
err_t vtohz3_disable_input_frequency(vtohz3_t *ctx)
V to Hz 3 disable input frequency function.
void vtohz3_set_buf_pin(vtohz3_t *ctx, uint8_t state)
V to Hz 3 set buf pin function.
err_t vtohz3_set_input_frequency(vtohz3_t *ctx, uint32_t freq)
V to Hz 3 set input frequency function.
err_t vtohz3_read_an_pin_value(vtohz3_t *ctx, uint16_t *data_out)
V to Hz 3 read AN pin value function.
uint8_t vtohz3_get_fout_pin(vtohz3_t *ctx)
V to Hz 3 get fout pin function.
uint32_t vtohz3_get_frequency(vtohz3_t *ctx, float voltage, float vref_in)
V to Hz 3 get frequency function.
void vtohz3_cfg_setup(vtohz3_cfg_t *cfg)
V to Hz 3 configuration object setup function.
err_t vtohz3_init(vtohz3_t *ctx, vtohz3_cfg_t *cfg)
V to Hz 3 initialization function.
This file contains SPI specific macros, functions, etc.
V to Hz 3 Click configuration object.
Definition vtohz3.h:153
pin_name_t buf
Definition vtohz3.h:162
analog_in_resolution_t resolution
Definition vtohz3.h:170
float vref
Definition vtohz3.h:171
pin_name_t fout
Definition vtohz3.h:163
spi_master_chip_select_polarity_t cs_polarity
Definition vtohz3.h:168
pin_name_t sck
Definition vtohz3.h:157
spi_master_mode_t spi_mode
Definition vtohz3.h:167
pin_name_t mosi
Definition vtohz3.h:156
uint32_t spi_speed
Definition vtohz3.h:166
pin_name_t miso
Definition vtohz3.h:155
pin_name_t an
Definition vtohz3.h:159
pin_name_t cs
Definition vtohz3.h:158
V to Hz 3 Click context object.
Definition vtohz3.h:131
spi_master_t spi
Definition vtohz3.h:139
digital_out_t buf
Definition vtohz3.h:133
uint32_t clock_in_freq
Definition vtohz3.h:144
digital_in_t fout
Definition vtohz3.h:136
pin_name_t chip_select
Definition vtohz3.h:142
analog_in_t adc
Definition vtohz3.h:140
vtohz3_return_value_t
V to Hz 3 Click return value data.
Definition vtohz3.h:180
@ VTOHZ3_ERROR
Definition vtohz3.h:182
@ VTOHZ3_OK
Definition vtohz3.h:181