42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_spi_master.h"
55#include "drv_analog_in.h"
69#define WHEATSTONE_MAP_MIKROBUS( cfg, mikrobus ) \
70 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
71 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
72 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
73 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
74 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN )
81#define WHEATSTONE_OK 0
82#define WHEATSTONE_ERROR -1
89#define WHEATSTONE_POT_RESOLUTION 256
90#define WHEATSTONE_POT_MAX 255
91#define WHEATSTONE_POT_MIN 0
98#define WHEATSTONE_MAX_POT_KOHM 100
99#define WHEATSTONE_R8_KOHM 1
100#define WHEATSTONE_GAIN_R1_KOHM 1
101#define WHEATSTONE_VCC_5V 5.0f
102#define WHEATSTONE_VCC_3V3 3.3f
err_t wheatstone_read_an_pin_voltage(wheatstone_t *ctx, float *data_out)
Wheatstone read AN pin voltage level function.
err_t wheatstone_init(wheatstone_t *ctx, wheatstone_cfg_t *cfg)
Initialization function.
void wheatstone_set_potentiometer(wheatstone_t *ctx, uint8_t pot_value)
Set potentiometer ( 0 - 100k )
err_t wheatstone_read_an_pin_value(wheatstone_t *ctx, uint16_t *data_out)
Wheatstone read AN pin value function.
void wheatstone_cfg_setup(wheatstone_cfg_t *cfg)
Config Object Initialization function.
Click configuration structure definition.
Definition wheatstone.h:131
analog_in_resolution_t resolution
Definition wheatstone.h:144
float vref
Definition wheatstone.h:145
spi_master_chip_select_polarity_t cs_polarity
Definition wheatstone.h:142
pin_name_t sck
Definition wheatstone.h:135
spi_master_mode_t spi_mode
Definition wheatstone.h:141
pin_name_t mosi
Definition wheatstone.h:134
uint32_t spi_speed
Definition wheatstone.h:140
pin_name_t miso
Definition wheatstone.h:133
pin_name_t an
Definition wheatstone.h:137
pin_name_t cs
Definition wheatstone.h:136
Click ctx object definition.
Definition wheatstone.h:116
spi_master_t spi
Definition wheatstone.h:118
float gain
Definition wheatstone.h:123
pin_name_t chip_select
Definition wheatstone.h:120
analog_in_t adc
Definition wheatstone.h:119