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_spi_master.h"
68#define VREG_MAP_MIKROBUS( cfg, mikrobus ) \
69 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
70 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
71 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
72 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
73 cfg.cs2 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
74 cfg.sw = MIKROBUS( mikrobus, MIKROBUS_PWM );
81#define VREG_RETVAL uint8_t
84#define VREG_INIT_ERROR 0xFF
87#define VREG_CHANNEL_0 0x00
88#define VREG_CHANNEL_1 0x01
89#define VREG_CHANNEL_2 0x02
90#define VREG_CHANNEL_3 0x03
91#define VREG_SINGLE_DIFFERENTIAL 0x00
92#define VREG_SINGLE_ENDED 0x02
93#define VREG_START_BIT 0x04
#define VREG_RETVAL
Definition vreg.h:81
void vreg_cfg_setup(vreg_cfg_t *cfg)
Config Object Initialization function.
void vreg_stop_measuring(vreg_t *ctx)
Stop the measuring function.
VREG_RETVAL vreg_init(vreg_t *ctx, vreg_cfg_t *cfg)
Initialization function.
uint16_t vreg_get_adc(vreg_t *ctx, uint8_t channel)
Get ADC value function.
void vreg_generic_transfer(vreg_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
Generic transfer function.
void vreg_set_output_voltage_procentage(vreg_t *ctx, uint8_t value_dac_pct)
Set output voltage procentage function.
void vreg_set_out_voltage(vreg_t *ctx, uint16_t value_dac)
Set output voltage function.
void vreg_start_measuring(vreg_t *ctx)
Start the measuring function.
Click configuration structure definition.
Definition vreg.h:124
pin_name_t cs2
Definition vreg.h:134
spi_master_chip_select_polarity_t cs_polarity
Definition vreg.h:141
pin_name_t sck
Definition vreg.h:129
spi_master_mode_t spi_mode
Definition vreg.h:140
pin_name_t mosi
Definition vreg.h:128
uint32_t spi_speed
Definition vreg.h:139
pin_name_t sw
Definition vreg.h:135
pin_name_t miso
Definition vreg.h:127
pin_name_t cs
Definition vreg.h:130
Click ctx object definition.
Definition vreg.h:106
digital_out_t cs
Definition vreg.h:109
spi_master_t spi
Definition vreg.h:115
digital_out_t sw
Definition vreg.h:111
digital_out_t cs2
Definition vreg.h:110
pin_name_t chip_select
Definition vreg.h:116