Go to the documentation of this file.
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_analog_in.h"
48 #include "drv_i2c_master.h"
70 #define POT4_PERCENTS 100
71 #define POT4_ROUND_TO_NEAREST_INT 0.5
77 #define POT4_ADC_RESOLUTION 0x0FFF
78 #define POT4_VREF_3V3 3.3
79 #define POT4_VREF_5V 5.0
86 #define POT4_SET_DEV_ADDR 0x4D
104 #define POT4_MAP_MIKROBUS( cfg, mikrobus ) \
105 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
106 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
107 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
108 cfg.sw = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t pot4_read_voltage(pot4_t *ctx, float *voltage)
POT 4 read voltage level function.
@ POT4_ERROR
Definition: pot4.h:170
analog_in_resolution_t resolution
Definition: pot4.h:153
float vref
Definition: pot4.h:154
uint8_t pot4_get_switch_pin(pot4_t *ctx)
POT 4 get switch pin function.
i2c_master_t i2c
Definition: pot4.h:133
pin_name_t an
Definition: pot4.h:148
void pot4_cfg_setup(pot4_cfg_t *cfg)
POT 4 configuration object setup function.
err_t pot4_init(pot4_t *ctx, pot4_cfg_t *cfg)
POT 4 initialization function.
pin_name_t chip_select
Definition: pot4.h:136
pin_name_t scl
Definition: pot4.h:149
analog_in_t adc
Definition: pot4.h:132
@ POT4_DRV_SEL_ADC
Definition: pot4.h:119
pin_name_t sw
Definition: pot4.h:151
pot4_drv_t drv_sel
Definition: pot4.h:159
uint32_t i2c_speed
Definition: pot4.h:156
pot4_drv_t drv_sel
Definition: pot4.h:138
err_t pot4_read_raw_adc(pot4_t *ctx, uint16_t *raw_adc)
POT 4 read raw ADC value function.
uint8_t slave_address
Definition: pot4.h:135
POT 4 Click configuration object.
Definition: pot4.h:147
err_t pot4_set_vref(pot4_t *ctx, float vref)
POT 4 set vref function.
pot4_drv_t
POT 4 Click driver selector.
Definition: pot4.h:118
void pot4_drv_interface_selection(pot4_cfg_t *cfg, pot4_drv_t drv_sel)
POT 4 driver interface setup function.
POT 4 Click context object.
Definition: pot4.h:129
pin_name_t sda
Definition: pot4.h:150
pot4_return_value_t
POT 4 Click return value data.
Definition: pot4.h:168
uint8_t i2c_address
Definition: pot4.h:157
uint8_t pot4_convert_voltage_to_percents(pot4_t *ctx, float voltage)
POT 4 convert voltage to percents function.
float vref
Definition: pot4.h:137
digital_in_t sw
Definition: pot4.h:130
@ POT4_OK
Definition: pot4.h:169
@ POT4_DRV_SEL_I2C
Definition: pot4.h:120