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 STEPDOWN9_VOUT_10V_RESISTANCE 8700
75#define STEPDOWN9_VOUT_9V5_RESISTANCE 11500
76#define STEPDOWN9_VOUT_9V_RESISTANCE 11700
77#define STEPDOWN9_VOUT_8V5_RESISTANCE 12500
78#define STEPDOWN9_VOUT_8V_RESISTANCE 13000
79#define STEPDOWN9_VOUT_7V5_RESISTANCE 13700
80#define STEPDOWN9_VOUT_7V_RESISTANCE 14700
81#define STEPDOWN9_VOUT_6V5_RESISTANCE 15800
82#define STEPDOWN9_VOUT_6V_RESISTANCE 17000
83#define STEPDOWN9_VOUT_5V5_RESISTANCE 19000
84#define STEPDOWN9_VOUT_5V_RESISTANCE 21000
85#define STEPDOWN9_VOUT_4V5_RESISTANCE 23500
86#define STEPDOWN9_VOUT_4V_RESISTANCE 27000
87#define STEPDOWN9_VOUT_3V5_RESISTANCE 32000
88#define STEPDOWN9_VOUT_3V3_RESISTANCE 34000
89#define STEPDOWN9_VOUT_3V_RESISTANCE 38000
90#define STEPDOWN9_VOUT_2V5_RESISTANCE 50000
91#define STEPDOWN9_VOUT_2V_RESISTANCE 70000
92#define STEPDOWN9_VOUT_1V6_RESISTANCE 100000
98#define STEPDOWN9_VOUT_10V 0x12
99#define STEPDOWN9_VOUT_9V5 0x11
100#define STEPDOWN9_VOUT_9V 0x10
101#define STEPDOWN9_VOUT_8V5 0x0F
102#define STEPDOWN9_VOUT_8V 0x0E
103#define STEPDOWN9_VOUT_7V5 0x0D
104#define STEPDOWN9_VOUT_7V 0x0C
105#define STEPDOWN9_VOUT_6V5 0x0B
106#define STEPDOWN9_VOUT_6V 0x0A
107#define STEPDOWN9_VOUT_5V5 0x09
108#define STEPDOWN9_VOUT_5V 0x08
109#define STEPDOWN9_VOUT_4V5 0x07
110#define STEPDOWN9_VOUT_4V 0x06
111#define STEPDOWN9_VOUT_3V5 0x05
112#define STEPDOWN9_VOUT_3V3 0x04
113#define STEPDOWN9_VOUT_3V 0x03
114#define STEPDOWN9_VOUT_2V5 0x02
115#define STEPDOWN9_VOUT_2V 0x01
116#define STEPDOWN9_VOUT_1V6 0x00
122#define STEPDOWN9_PIN_STATE_HIGH 0x01
123#define STEPDOWN9_PIN_STATE_LOW 0x00
130#define STEPDOWN9_RESISTANCE_MIN 8700
131#define STEPDOWN9_FULL_SCALE_RES_100_KOHM 100000
132#define STEPDOWN9_WIPER_POS_MAX 0xFF
133#define STEPDOWN9_ROUND_TO_NEAREST_INT 0.5
143#define STEPDOWN9_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
144#define STEPDOWN9_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
162#define STEPDOWN9_MAP_MIKROBUS( cfg, mikrobus ) \
163 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
164 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
165 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
166 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
167 cfg.en = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
168 cfg.pg = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t stepdown9_set_wiper_pos(stepdown9_t *ctx, uint8_t wiper_pos)
Step Down 9 set wiper position.
err_t stepdown9_init(stepdown9_t *ctx, stepdown9_cfg_t *cfg)
Step Down 9 initialization function.
err_t stepdown9_set_resistance(stepdown9_t *ctx, uint32_t res_ohm)
Step Down 9 set potentiometer resistance.
void stepdown9_cfg_setup(stepdown9_cfg_t *cfg)
Step Down 9 configuration object setup function.
err_t stepdown9_default_cfg(stepdown9_t *ctx)
Step Down 9 default configuration function.
void stepdown9_set_en_pin(stepdown9_t *ctx, uint8_t pin_state)
Step Down 9 set EN pin state function.
uint8_t stepdown9_get_pg_pin(stepdown9_t *ctx)
Step Down 9 get PG pin state function.
err_t stepdown9_set_output(stepdown9_t *ctx, uint8_t voltage)
Step Down 9 set output voltage.
err_t stepdown9_generic_read(stepdown9_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Step Down 9 data reading function.
err_t stepdown9_generic_write(stepdown9_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Step Down 9 data writing function.
This file contains SPI specific macros, functions, etc.
stepdown9_return_value_t
Step Down 9 Click return value data.
Definition stepdown9.h:220
@ STEPDOWN9_OK
Definition stepdown9.h:221
@ STEPDOWN9_ERROR
Definition stepdown9.h:222
Step Down 9 Click configuration object.
Definition stepdown9.h:197
spi_master_chip_select_polarity_t cs_polarity
Definition stepdown9.h:211
pin_name_t sck
Definition stepdown9.h:201
spi_master_mode_t spi_mode
Definition stepdown9.h:210
pin_name_t mosi
Definition stepdown9.h:200
uint32_t spi_speed
Definition stepdown9.h:209
pin_name_t en
Definition stepdown9.h:205
pin_name_t miso
Definition stepdown9.h:199
pin_name_t pg
Definition stepdown9.h:206
pin_name_t cs
Definition stepdown9.h:202
Step Down 9 Click context object.
Definition stepdown9.h:178
spi_master_t spi
Definition stepdown9.h:186
digital_out_t en
Definition stepdown9.h:180
pin_name_t chip_select
Definition stepdown9.h:188
digital_in_t pg
Definition stepdown9.h:183