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"
53#include "drv_analog_in.h"
75#define GAINAMP_CHANNEL_A_x0 0x00
76#define GAINAMP_CHANNEL_A_x1 0x01
77#define GAINAMP_CHANNEL_A_x2 0x02
78#define GAINAMP_CHANNEL_A_x5 0x03
79#define GAINAMP_CHANNEL_A_x10 0x04
80#define GAINAMP_CHANNEL_A_x20 0x05
81#define GAINAMP_CHANNEL_A_x50 0x06
82#define GAINAMP_CHANNEL_A_x100 0x07
83#define GAINAMP_CHANNEL_A_SHUTDOWN 0x08
85#define GAINAMP_CHANNEL_B_x0 0x00
86#define GAINAMP_CHANNEL_B_x1 0x10
87#define GAINAMP_CHANNEL_B_x2 0x20
88#define GAINAMP_CHANNEL_B_x5 0x30
89#define GAINAMP_CHANNEL_B_x10 0x40
90#define GAINAMP_CHANNEL_B_x20 0x50
91#define GAINAMP_CHANNEL_B_x50 0x60
92#define GAINAMP_CHANNEL_B_x100 0x70
93#define GAINAMP_CHANNEL_B_SHUTDOWN 0x80
103#define GAINAMP_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
104#define GAINAMP_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
122#define GAINAMP_MAP_MIKROBUS( cfg, mikrobus ) \
123 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
124 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
125 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
126 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
127 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
128 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST )
gainamp_return_value_t
GainAMP Click return value data.
Definition gainamp.h:182
@ GAINAMP_OK
Definition gainamp.h:183
@ GAINAMP_ERROR
Definition gainamp.h:184
void gainamp_set_gain(gainamp_t *ctx, uint8_t gain)
Function for sets gain of the GainAMP Click.
err_t gainamp_init(gainamp_t *ctx, gainamp_cfg_t *cfg)
GainAMP initialization function.
err_t gainamp_generic_write(gainamp_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
GainAMP data writing function.
void gainamp_reset(gainamp_t *ctx)
Function for reset chip of the GainAMP Click.
void gainamp_cfg_setup(gainamp_cfg_t *cfg)
GainAMP configuration object setup function.
err_t gainamp_read_an_pin_voltage(gainamp_t *ctx, float *data_out)
GainAMP read AN pin voltage level function.
err_t gainamp_generic_read(gainamp_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
GainAMP data reading function.
err_t gainamp_read_an_pin_value(gainamp_t *ctx, uint16_t *data_out)
GainAMP read AN pin value function.
This file contains SPI specific macros, functions, etc.
GainAMP Click configuration object.
Definition gainamp.h:155
analog_in_resolution_t resolution
Definition gainamp.h:172
float vref
Definition gainamp.h:173
spi_master_chip_select_polarity_t cs_polarity
Definition gainamp.h:168
pin_name_t sck
Definition gainamp.h:159
spi_master_mode_t spi_mode
Definition gainamp.h:167
pin_name_t mosi
Definition gainamp.h:158
uint32_t spi_speed
Definition gainamp.h:166
pin_name_t miso
Definition gainamp.h:157
pin_name_t rst
Definition gainamp.h:163
pin_name_t an
Definition gainamp.h:170
pin_name_t cs
Definition gainamp.h:160
GainAMP Click context object.
Definition gainamp.h:138
spi_master_t spi
Definition gainamp.h:143
digital_out_t rst
Definition gainamp.h:140
pin_name_t chip_select
Definition gainamp.h:145
analog_in_t adc
Definition gainamp.h:146