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"
52#include "drv_analog_in.h"
80#define ANALOGMUX2_SET_CHANNEL_0 0x00
81#define ANALOGMUX2_SET_CHANNEL_1 0x01
82#define ANALOGMUX2_SET_CHANNEL_2 0x02
83#define ANALOGMUX2_SET_CHANNEL_3 0x03
84#define ANALOGMUX2_SET_CHANNEL_4 0x04
85#define ANALOGMUX2_SET_CHANNEL_5 0x05
86#define ANALOGMUX2_SET_CHANNEL_6 0x06
87#define ANALOGMUX2_SET_CHANNEL_7 0x07
88#define ANALOGMUX2_SET_NO_CHANNEL 0xFF
95#define ANALOGMUX2_VAL_CHANNEL_OFF 0x00
96#define ANALOGMUX2_VAL_CHANNEL_0 0x01
97#define ANALOGMUX2_VAL_CHANNEL_1 0x02
98#define ANALOGMUX2_VAL_CHANNEL_2 0x04
99#define ANALOGMUX2_VAL_CHANNEL_3 0x08
100#define ANALOGMUX2_VAL_CHANNEL_4 0x10
101#define ANALOGMUX2_VAL_CHANNEL_5 0x20
102#define ANALOGMUX2_VAL_CHANNEL_6 0x40
103#define ANALOGMUX2_VAL_CHANNEL_7 0x80
110#define ANALOGMUX2_SET_DEV_ADDR_0 0x4C
111#define ANALOGMUX2_SET_DEV_ADDR_1 0x4D
112#define ANALOGMUX2_SET_DEV_ADDR_2 0x4E
113#define ANALOGMUX2_SET_DEV_ADDR_3 0x4F
127#define ANALOGMUX2_SUCCESS 0
128#define ANALOGMUX2_ERROR -1
148#define ANALOGMUX2_MAP_MIKROBUS( cfg, mikrobus ) \
149 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
150 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
151 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
152 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST )
uint8_t analogmux2_get_channel(analogmux2_t *ctx)
Analog MUX 2 get channel function.
void analogmux2_hw_reset(analogmux2_t *ctx)
Analog MUX 2 reset the device function.
void analogmux2_default_cfg(analogmux2_t *ctx)
Analog MUX 2 default configuration function.
void analogmux2_cfg_setup(analogmux2_cfg_t *cfg)
Analog MUX 2 configuration object setup function.
uint8_t analogmux2_generic_read(analogmux2_t *ctx)
Analog MUX 2 I2C reading function.
err_t analogmux2_read_an_pin_value(analogmux2_t *ctx, uint16_t *data_out)
Analog MUX 2 read AN pin value function.
err_t analogmux2_generic_write(analogmux2_t *ctx, uint8_t tx_data)
Analog MUX 2 I2C writing function.
err_t analogmux2_init(analogmux2_t *ctx, analogmux2_cfg_t *cfg)
Analog MUX 2 initialization function.
err_t analogmux2_set_channel(analogmux2_t *ctx, uint8_t mux_ch)
Analog MUX 2 set channel function.
err_t analogmux2_read_an_pin_voltage(analogmux2_t *ctx, float *data_out)
Analog MUX 2 read AN pin voltage level function.
Analog MUX 2 Click configuration object.
Definition analogmux2.h:184
analog_in_resolution_t resolution
Definition analogmux2.h:194
float vref
Definition analogmux2.h:195
uint32_t i2c_speed
Definition analogmux2.h:191
pin_name_t scl
Definition analogmux2.h:185
pin_name_t sda
Definition analogmux2.h:186
pin_name_t rst
Definition analogmux2.h:189
pin_name_t an
Definition analogmux2.h:188
uint8_t i2c_address
Definition analogmux2.h:192
Analog MUX 2 Click context object.
Definition analogmux2.h:162
i2c_master_t i2c
Definition analogmux2.h:171
digital_out_t rst
Definition analogmux2.h:165
uint8_t slave_address
Definition analogmux2.h:175
analog_in_t adc
Definition analogmux2.h:169