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 BUCK20_CMD_NOP 0
75#define BUCK20_CMD_RESTORE_EEMEM 1
76#define BUCK20_CMD_STORE_RDAC 2
77#define BUCK20_CMD_STORE_USER_DATA 3
78#define BUCK20_CMD_DECREMENT_6DB 4
79#define BUCK20_CMD_DECREMENT_ALL_6DB 5
80#define BUCK20_CMD_DECREMENT_ONE_STEP 6
81#define BUCK20_CMD_DECREMENT_ALL_ONE_STEP 7
82#define BUCK20_CMD_RESET_EEMEM 8
83#define BUCK20_CMD_READ_EEMEM 9
84#define BUCK20_CMD_READ_RDAC 10
85#define BUCK20_CMD_WRITE_DATA 11
86#define BUCK20_CMD_INCREMENT_6DB 12
87#define BUCK20_CMD_INCREMENT_ALL_6DB 13
88#define BUCK20_CMD_INCREMENT_ONE_STEP 14
89#define BUCK20_CMD_INCREMENT_ALL_ONE_STEP 15
95#define BUCK20_ADDRESS_RDAC1 0
96#define BUCK20_ADDRESS_RDAC2 1
97#define BUCK20_ADDRESS_USER_DATA_0 2
98#define BUCK20_ADDRESS_USER_DATA_1 3
99#define BUCK20_ADDRESS_USER_DATA_2 4
100#define BUCK20_ADDRESS_USER_DATA_3 5
101#define BUCK20_ADDRESS_USER_DATA_4 6
102#define BUCK20_ADDRESS_USER_DATA_5 7
103#define BUCK20_ADDRESS_USER_DATA_6 8
104#define BUCK20_ADDRESS_USER_DATA_7 9
105#define BUCK20_ADDRESS_USER_DATA_8 10
106#define BUCK20_ADDRESS_USER_DATA_9 11
107#define BUCK20_ADDRESS_USER_DATA_10 12
108#define BUCK20_ADDRESS_USER_DATA_11 13
109#define BUCK20_ADDRESS_USER_DATA_12 14
110#define BUCK20_ADDRESS_FACTORY_USAGE 15
128#define BUCK20_WIPER_FULL_SCALE 1023
129#define BUCK20_WIPER_MID_SCALE 512
130#define BUCK20_WIPER_ZERO_SCALE 0
136#define BUCK20_RESISTOR_R6_KOHM 47.0f
137#define BUCK20_DIGIPOT_MAX_KOHM 250.0f
138#define BUCK20_BUCK_R2_KOHM 40.2f
139#define BUCK20_BUCK_VREF 0.6f
149#define BUCK20_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
150#define BUCK20_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
168#define BUCK20_MAP_MIKROBUS( cfg, mikrobus ) \
169 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
170 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
171 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
172 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
173 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
174 cfg.rdy = MIKROBUS( mikrobus, MIKROBUS_INT )
buck20_return_value_t
Buck 20 Click return value data.
Definition buck20.h:226
@ BUCK20_ERROR
Definition buck20.h:228
@ BUCK20_OK
Definition buck20.h:227
err_t buck20_set_wiper_1(buck20_t *ctx, uint16_t data_in)
Buck 20 Set wiper 1 function.
uint8_t buck20_get_rdy_pin(buck20_t *ctx)
Buck 20 get rdy pin function.
void buck20_enable_device(buck20_t *ctx)
Buck 20 enable device function.
err_t buck20_write_user_data(buck20_t *ctx, uint8_t address, uint16_t data_in)
Buck 20 write user data function.
void buck20_disable_device(buck20_t *ctx)
Buck 20 disable device function.
void buck20_cfg_setup(buck20_cfg_t *cfg)
Buck 20 configuration object setup function.
err_t buck20_generic_read(buck20_t *ctx, uint8_t command, uint8_t address, uint16_t *data_out)
Buck 20 data reading function.
err_t buck20_read_user_data(buck20_t *ctx, uint8_t address, uint16_t *data_out)
Buck 20 read user data function.
err_t buck20_generic_write(buck20_t *ctx, uint8_t command, uint8_t address, uint16_t data_in)
Buck 20 data writing function.
err_t buck20_init(buck20_t *ctx, buck20_cfg_t *cfg)
Buck 20 initialization function.
This file contains SPI specific macros, functions, etc.
Buck 20 Click configuration object.
Definition buck20.h:203
spi_master_chip_select_polarity_t cs_polarity
Definition buck20.h:217
pin_name_t sck
Definition buck20.h:207
spi_master_mode_t spi_mode
Definition buck20.h:216
pin_name_t mosi
Definition buck20.h:206
uint32_t spi_speed
Definition buck20.h:215
pin_name_t rdy
Definition buck20.h:212
pin_name_t miso
Definition buck20.h:205
pin_name_t rst
Definition buck20.h:211
pin_name_t cs
Definition buck20.h:208
Buck 20 Click context object.
Definition buck20.h:184
spi_master_t spi
Definition buck20.h:192
digital_out_t rst
Definition buck20.h:186
pin_name_t chip_select
Definition buck20.h:194
digital_in_t rdy
Definition buck20.h:189