Go to the documentation of this file.
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 NANOPOWER3_CMD_VREG 0x11
74 #define NANOPOWER3_CMD_NVREG 0x21
75 #define NANOPOWER3_CMD_VREGxNVREG 0x51
76 #define NANOPOWER3_CMD_NVREGxVREG 0x61
82 #define NANOPOWER3_1V_OUT_VOLTAGE 0x00
83 #define NANOPOWER3_1V2_OUT_VOLTAGE 0x01
84 #define NANOPOWER3_1V5_OUT_VOLTAGE 0x02
85 #define NANOPOWER3_1V8_OUT_VOLTAGE 0x03
86 #define NANOPOWER3_2V_OUT_VOLTAGE 0x04
87 #define NANOPOWER3_2V5_OUT_VOLTAGE 0x05
88 #define NANOPOWER3_3V_OUT_VOLTAGE 0x06
89 #define NANOPOWER3_3V3_OUT_VOLTAGE 0x07
90 #define NANOPOWER3_3V5_OUT_VOLTAGE 0x08
91 #define NANOPOWER3_4V_OUT_VOLTAGE 0x09
92 #define NANOPOWER3_4V5_OUT_VOLTAGE 0x0A
98 #define NANOPOWER3_1V_RESISTANCE 187000
99 #define NANOPOWER3_1V2_RESISTANCE 93100
100 #define NANOPOWER3_1V5_RESISTANCE 53600
101 #define NANOPOWER3_1V8_RESISTANCE 37400
102 #define NANOPOWER3_2V_RESISTANCE 29000
103 #define NANOPOWER3_2V5_RESISTANCE 20000
104 #define NANOPOWER3_3V_RESISTANCE 15000
105 #define NANOPOWER3_3V3_RESISTANCE 13100
106 #define NANOPOWER3_3V5_RESISTANCE 12200
107 #define NANOPOWER3_4V_RESISTANCE 10000
108 #define NANOPOWER3_4V5_RESISTANCE 9000
114 #define NANOPOWER3_R11_RESISTANCE 7200
115 #define NANOPOWER3_DIGIPOT_MAX_RESISTANCE 200000
116 #define NANOPOWER3_DIGIPOT_MAX_VAL 255
117 #define NANOPOWER3_MAX_RESISTANCE 207200
118 #define NANOPOWER3_ROUND_TO_NEAREST_INT 0.5
124 #define NANOPOWER3_PIN_STATE_HIGH 0x01
125 #define NANOPOWER3_PIN_STATE_LOW 0x00
132 #define NANOPOWER3_DEVICE_ADDRESS_GND 0x28
133 #define NANOPOWER3_DEVICE_ADDRESS_VCC 0x29
151 #define NANOPOWER3_MAP_MIKROBUS( cfg, mikrobus ) \
152 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
153 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
154 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
155 cfg.ctr = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
156 cfg.pg = MIKROBUS( mikrobus, MIKROBUS_INT )
378 #endif // NANOPOWER3_H
uint8_t nanopower3_get_an_pin_state(nanopower3_t *ctx)
Nano Power 3 get AN pin state function.
err_t nanopower3_set_voltage(nanopower3_t *ctx, uint8_t out_vol)
Nano Power 3 set output voltage function.
pin_name_t an
Definition: nanopower3.h:191
uint8_t i2c_address
Definition: nanopower3.h:196
pin_name_t pg
Definition: nanopower3.h:193
err_t nanopower3_write_data(nanopower3_t *ctx, uint8_t cmd, uint8_t data_in)
Nano Power 3 command writing function.
err_t nanopower3_set_wiper_pos(nanopower3_t *ctx, uint8_t wiper_pos)
Nano Power 3 set wiper position function.
Nano Power 3 Click configuration object.
Definition: nanopower3.h:187
pin_name_t scl
Definition: nanopower3.h:188
Nano Power 3 Click context object.
Definition: nanopower3.h:166
void nanopower3_set_ctr_pin(nanopower3_t *ctx, uint8_t pin_state)
Nano Power 3 set CTRL pin state function.
@ NANOPOWER3_ERROR
Definition: nanopower3.h:207
digital_in_t an
Definition: nanopower3.h:171
digital_in_t pg
Definition: nanopower3.h:172
err_t nanopower3_default_cfg(nanopower3_t *ctx)
Nano Power 3 default configuration function.
i2c_master_t i2c
Definition: nanopower3.h:175
nanopower3_return_value_t
Nano Power 3 Click return value data.
Definition: nanopower3.h:205
err_t nanopower3_generic_write(nanopower3_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Nano Power 3 I2C writing function.
err_t nanopower3_init(nanopower3_t *ctx, nanopower3_cfg_t *cfg)
Nano Power 3 initialization function.
uint8_t nanopower3_get_pg_pin_state(nanopower3_t *ctx)
Nano Power 3 get PG pin state function.
pin_name_t sda
Definition: nanopower3.h:189
pin_name_t ctr
Definition: nanopower3.h:192
@ NANOPOWER3_OK
Definition: nanopower3.h:206
void nanopower3_cfg_setup(nanopower3_cfg_t *cfg)
Nano Power 3 configuration object setup function.
digital_out_t ctr
Definition: nanopower3.h:168
uint8_t slave_address
Definition: nanopower3.h:178
uint32_t i2c_speed
Definition: nanopower3.h:195
err_t nanopower3_generic_read(nanopower3_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Nano Power 3 I2C reading function.
err_t nanopower3_set_resistance(nanopower3_t *ctx, uint32_t resistance)
Nano Power 3 set resistance function.