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_i2c_master.h"
73#define STEPDOWN10_PFM_PWM_MODE 0x00
74#define STEPDOWN10_FORCED_PWM_MODE 0x01
75#define STEPDOWN10_R1_RPROG_ADDRESS 0x00
93#define STEPDOWN10_R1_VALUE 100000ul
94#define STEPDOWN10_DIGIPOT_MAX_VALUE 100000ul
95#define STEPDOWN10_DIGIPOT_RESOLUTION 257
96#define STEPDOWN10_ROUND_TO_NEAREST_INT 0.5
97#define STEPDOWN10_R13_VALUE 1000u
98#define STEPDOWN10_MAX_OUTPUT 20
99#define STEPDOWN10_MIN_OUTPUT 2
105#define STEPDOWN10_PIN_STATE_HIGH 0x01
106#define STEPDOWN10_PIN_STATE_LOW 0x00
113#define STEPDOWN10_ADDR_A2A1A0_000 0x28
114#define STEPDOWN10_ADDR_A2A1A0_001 0x29
115#define STEPDOWN10_ADDR_A2A1A0_010 0x2A
116#define STEPDOWN10_ADDR_A2A1A0_011 0x2B
117#define STEPDOWN10_ADDR_A2A1A0_100 0x2C
118#define STEPDOWN10_ADDR_A2A1A0_101 0x2D
119#define STEPDOWN10_ADDR_A2A1A0_110 0x2E
120#define STEPDOWN10_ADDR_A2A1A0_111 0x2F
138#define STEPDOWN10_MAP_MIKROBUS( cfg, mikrobus ) \
139 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
140 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
141 cfg.en = MIKROBUS( mikrobus, MIKROBUS_RST ); \
142 cfg.md = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
143 cfg.pg = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t stepdown10_set_r2_resistance(stepdown10_t *ctx, uint32_t resistance)
Step Down 10 set potentiometer resistance.
err_t stepdown10_set_wiper_pos(stepdown10_t *ctx, uint16_t wiper_pos)
Step Down 10 set wiper position.
void stepdown10_set_en_pin(stepdown10_t *ctx, uint8_t pin_state)
Step Down 10 set EN pin state function.
uint8_t stepdown10_get_pg_state(stepdown10_t *ctx)
Step Down 10 get PG pin state function.
void stepdown10_cfg_setup(stepdown10_cfg_t *cfg)
Step Down 10 configuration object setup function.
err_t stepdown10_generic_read(stepdown10_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Step Down 10 I2C reading function.
err_t stepdown10_set_output(stepdown10_t *ctx, float voltage)
Step Down 10 set output voltage.
err_t stepdown10_init(stepdown10_t *ctx, stepdown10_cfg_t *cfg)
Step Down 10 initialization function.
err_t stepdown10_default_cfg(stepdown10_t *ctx)
Step Down 10 default configuration function.
void stepdown10_set_md(stepdown10_t *ctx, uint8_t mode)
Step Down 10 mode selection function.
err_t stepdown10_generic_write(stepdown10_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Step Down 10 I2C writing function.
stepdown10_return_value_t
Step Down 10 Click return value data.
Definition stepdown10.h:192
@ STEPDOWN10_OK
Definition stepdown10.h:193
@ STEPDOWN10_ERROR
Definition stepdown10.h:194
Step Down 10 Click configuration object.
Definition stepdown10.h:174
uint32_t i2c_speed
Definition stepdown10.h:182
pin_name_t md
Definition stepdown10.h:179
pin_name_t scl
Definition stepdown10.h:175
pin_name_t en
Definition stepdown10.h:178
pin_name_t sda
Definition stepdown10.h:176
pin_name_t pg
Definition stepdown10.h:180
uint8_t i2c_address
Definition stepdown10.h:183
Step Down 10 Click context object.
Definition stepdown10.h:153
digital_out_t md
Definition stepdown10.h:156
i2c_master_t i2c
Definition stepdown10.h:162
digital_out_t en
Definition stepdown10.h:155
uint8_t slave_address
Definition stepdown10.h:165
digital_in_t pg
Definition stepdown10.h:159