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"
52#include "drv_analog_in.h"
80#define ANALOGMUX3_SET_CHANNEL_0 0x00
81#define ANALOGMUX3_SET_CHANNEL_1 0x01
82#define ANALOGMUX3_SET_CHANNEL_2 0x02
83#define ANALOGMUX3_SET_CHANNEL_3 0x03
84#define ANALOGMUX3_SET_CHANNEL_4 0x04
85#define ANALOGMUX3_SET_CHANNEL_5 0x05
86#define ANALOGMUX3_SET_CHANNEL_6 0x06
87#define ANALOGMUX3_SET_CHANNEL_7 0x07
88#define ANALOGMUX3_SET_NO_CHANNEL 0xFF
95#define ANALOGMUX3_VAL_CHANNEL_OFF 0x00
96#define ANALOGMUX3_VAL_CHANNEL_0 0x01
97#define ANALOGMUX3_VAL_CHANNEL_1 0x02
98#define ANALOGMUX3_VAL_CHANNEL_2 0x04
99#define ANALOGMUX3_VAL_CHANNEL_3 0x08
100#define ANALOGMUX3_VAL_CHANNEL_4 0x10
101#define ANALOGMUX3_VAL_CHANNEL_5 0x20
102#define ANALOGMUX3_VAL_CHANNEL_6 0x40
103#define ANALOGMUX3_VAL_CHANNEL_7 0x80
110#define ANALOGMUX3_SET_DEV_ADDR_0 0x4C
111#define ANALOGMUX3_SET_DEV_ADDR_1 0x4D
112#define ANALOGMUX3_SET_DEV_ADDR_2 0x4E
113#define ANALOGMUX3_SET_DEV_ADDR_3 0x4F
131#define ANALOGMUX3_MAP_MIKROBUS( cfg, mikrobus ) \
132 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
133 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
134 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
135 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
136 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
137 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST )
analogmux3_return_value_t
Analog MUX 3 Click return value data.
Definition analogmux3.h:195
@ ANALOGMUX3_ERROR
Definition analogmux3.h:197
@ ANALOGMUX3_OK
Definition analogmux3.h:196
void analogmux3_cfg_setup(analogmux3_cfg_t *cfg)
Analog MUX 3 configuration object setup function.
err_t analogmux3_init(analogmux3_t *ctx, analogmux3_cfg_t *cfg)
Analog MUX 3 initialization function.
void analogmux3_hw_reset(analogmux3_t *ctx)
Analog MUX 3 reset the device function.
err_t analogmux3_set_channel(analogmux3_t *ctx, uint8_t mux_ch)
Analog MUX 3 set channel function.
err_t analogmux3_generic_write(analogmux3_t *ctx, uint8_t data_in)
Analog MUX 3 data writing function.
err_t analogmux3_read_an_pin_voltage(analogmux3_t *ctx, float *data_out)
Analog MUX 3 read AN pin voltage level function.
err_t analogmux3_default_cfg(analogmux3_t *ctx)
Analog MUX 3 default configuration function.
err_t analogmux3_read_an_pin_value(analogmux3_t *ctx, uint16_t *data_out)
Analog MUX 3 read AN pin value function.
Analog MUX 3 Click configuration object.
Definition analogmux3.h:166
analog_in_resolution_t resolution
Definition analogmux3.h:185
float vref
Definition analogmux3.h:186
spi_master_chip_select_polarity_t cs_polarity
Definition analogmux3.h:183
pin_name_t sck
Definition analogmux3.h:171
spi_master_mode_t spi_mode
Definition analogmux3.h:182
pin_name_t mosi
Definition analogmux3.h:170
uint32_t spi_speed
Definition analogmux3.h:181
pin_name_t miso
Definition analogmux3.h:169
pin_name_t rst
Definition analogmux3.h:177
pin_name_t an
Definition analogmux3.h:173
pin_name_t cs
Definition analogmux3.h:172
Analog MUX 3 Click context object.
Definition analogmux3.h:147
spi_master_t spi
Definition analogmux3.h:155
digital_out_t rst
Definition analogmux3.h:150
pin_name_t chip_select
Definition analogmux3.h:157
analog_in_t adc
Definition analogmux3.h:154