41#ifdef PREINIT_SUPPORTED
45#ifdef MikroCCoreVersion
46 #if MikroCCoreVersion >= 1
51#include "drv_digital_out.h"
52#include "drv_analog_in.h"
53#include "drv_spi_master.h"
64#define RMETER_MAP_MIKROBUS( cfg, mikrobus ) \
65 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
66 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
67 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ) ; \
68 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ) ; \
69 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ) ; \
70 cfg.s3 = MIKROBUS( mikrobus, MIKROBUS_RST ) ; \
71 cfg.s2 = MIKROBUS( mikrobus, MIKROBUS_INT ) ; \
72 cfg.s1 = MIKROBUS( mikrobus, MIKROBUS_PWM )
80#define RMETER_INIT_ERROR (-1)
298 // End click Driver group
err_t rmeter_calculate_resistance(rmeter_t *ctx, float *data_out, uint16_t data_in)
Resistance Calculation function.
void rmeter_set_range_up_to_17k_ohms(rmeter_t *ctx)
Range Setup Up To 17k Ohms function.
uint16_t rmeter_auto_scale_range_execution(rmeter_t *ctx)
Auto Scale Range Execution function.
void rmeter_set_range_up_to_1k9_ohms(rmeter_t *ctx)
Range Setup Up To 1k9 Ohms function.
err_t rmeter_read_an_voltage(rmeter_t *ctx, float *data_out)
AN Voltage Level Reading function.
void rmeter_cfg_setup(rmeter_cfg_t *cfg)
Config Object Setup function.
void rmeter_set_range_up_to_1M9_ohms(rmeter_t *ctx)
Range Setup Up To 1M9 Ohms function.
void rmeter_set_callback_handler(rmeter_t *ctx, rmeter_callback_t handler)
Callback Handler Setup function.
err_t rmeter_init(rmeter_t *ctx, rmeter_cfg_t *cfg)
Initialization function.
err_t rmeter_read_measurement(rmeter_t *ctx, uint16_t *data_out)
Measurement Reading function.
err_t rmeter_read_an(rmeter_t *ctx, uint16_t *data_out)
AN Pin Reading function.
void(* rmeter_callback_t)(char *)
Click callback handler definition.
Definition rmeter.h:93
Click configuration structure definition.
Definition rmeter.h:130
pin_name_t s2
Definition rmeter.h:142
pin_name_t s3
Definition rmeter.h:141
spi_master_chip_select_polarity_t cs_polarity
Definition rmeter.h:149
pin_name_t sck
Definition rmeter.h:135
pin_name_t s1
Definition rmeter.h:143
spi_master_mode_t spi_mode
Definition rmeter.h:148
float adc_vref
Definition rmeter.h:154
analog_in_resolution_t adc_resolution
Definition rmeter.h:153
pin_name_t mosi
Definition rmeter.h:134
uint32_t spi_speed
Definition rmeter.h:147
pin_name_t miso
Definition rmeter.h:133
pin_name_t an
Definition rmeter.h:140
pin_name_t cs
Definition rmeter.h:136
Click ctx object definition.
Definition rmeter.h:99
spi_master_t spi
Definition rmeter.h:112
digital_out_t s3
Definition rmeter.h:102
float ifb
Definition rmeter.h:118
digital_out_t s2
Definition rmeter.h:103
digital_out_t s1
Definition rmeter.h:104
rmeter_callback_t callback
Definition rmeter.h:122
analog_in_t an
Definition rmeter.h:108
pin_name_t chip_select
Definition rmeter.h:114