42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_spi_master.h"
67#define RFMETER_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
69 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
70 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
71 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS )
78#define RFMETER_RETVAL uint8_t
80#define RFMETER_OK 0x00
81#define RFMETER_INIT_ERROR 0xFF
88#define RFMETER_FILTER_USEFULL_DATA 0x1FFE
89#define RFMETER_ADC_RESOLUTION 4096
90#define RFMETER_DATA_SAMPLE_NUM 10
91#define RFMETER_DEF_VREF 2.5
92#define RFMETER_DEF_SLOPE -0.025
93#define RFMETER_DEF_INTERCEPT 20.0
94#define RFMETER_DEF_LIMIT_HIGH 2.0
95#define RFMETER_DEF_LIMIT_LOW 0.5
148 // End constants group
156 // End variable group
#define RFMETER_RETVAL
Definition rfmeter.h:78
void rfmeter_cfg_setup(rfmeter_cfg_t *cfg)
Config Object Initialization function.
uint16_t rfmeter_read_data(rfmeter_t *ctx)
Data read function.
RFMETER_RETVAL rfmeter_init(rfmeter_t *ctx, rfmeter_cfg_t *cfg)
Initialization function.
float rfmeter_get_voltage(rfmeter_t *ctx)
Get voltage function.
float rfmeter_get_signal_strenght(rfmeter_t *ctx, float slope, float intercept)
Get signal strenght function.
uint16_t rfmeter_get_raw_data(rfmeter_t *ctx)
Get raw data function.
Click configuration structure definition.
Definition rfmeter.h:123
spi_master_chip_select_polarity_t cs_polarity
Definition rfmeter.h:135
pin_name_t sck
Definition rfmeter.h:128
spi_master_mode_t spi_mode
Definition rfmeter.h:134
pin_name_t mosi
Definition rfmeter.h:127
uint32_t spi_speed
Definition rfmeter.h:133
pin_name_t miso
Definition rfmeter.h:126
pin_name_t cs
Definition rfmeter.h:129
Click ctx object definition.
Definition rfmeter.h:109
digital_out_t cs
Definition rfmeter.h:110
spi_master_t spi
Definition rfmeter.h:114
pin_name_t chip_select
Definition rfmeter.h:115