41#ifdef PREINIT_SUPPORTED
45#ifdef MikroCCoreVersion
46 #if MikroCCoreVersion >= 1
51#include "drv_digital_out.h"
52#include "drv_spi_master.h"
66#define DAC_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
68 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
69 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
70 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS )
77#define DAC_RETVAL uint8_t
80#define DAC_INIT_ERROR 0xFF
87#define DAC_APPLY_SETTINGS 0x30
89#define DAC_4_BIT_DATA 0x0F
90#define DAC_8_BIT_DATA 0xFF
91#define DAC_PERCENTAGE 100
92#define DAC_ONE_STEP_VAL 819
93#define DAC_CLAC_VAL 20
94#define DAC_CALIB_VAL_1 220
95#define DAC_CALIB_VAL_2 273
96#define DAC_RESOLUTION 4096
97#define DAC_STEP_VALUE 1000
150 // End constants group
158 // End variable group
#define DAC_RETVAL
Definition dac.h:77
DAC_RETVAL dac_init(dac_t *ctx, dac_cfg_t *cfg)
Initialization function.
void dac_cfg_setup(dac_cfg_t *cfg)
Config Object Initialization function.
void dac_set_voltage_pct(dac_t *ctx, uint8_t v_out_pct)
Function write procentage value.
void dac_set_voltage(dac_t *ctx, uint16_t v_out)
Set voltage function.
Click configuration structure definition.
Definition dac.h:125
spi_master_chip_select_polarity_t cs_polarity
Definition dac.h:137
pin_name_t sck
Definition dac.h:130
spi_master_mode_t spi_mode
Definition dac.h:136
pin_name_t mosi
Definition dac.h:129
uint32_t spi_speed
Definition dac.h:135
pin_name_t miso
Definition dac.h:128
pin_name_t cs
Definition dac.h:131
Click ctx object definition.
Definition dac.h:111
digital_out_t cs
Definition dac.h:112
spi_master_t spi
Definition dac.h:116
pin_name_t chip_select
Definition dac.h:117