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_i2c_master.h"
67#define PIR_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
69 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
70 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN )
78#define PIR_RETVAL uint8_t
81#define PIR_INIT_ERROR 0xFF
#define PIR_RETVAL
Definition pir.h:78
PIR_RETVAL pir_init(pir_t *ctx, pir_cfg_t *cfg)
Initialization function.
float pir_get_mili_volt(pir_t *ctx, uint16_t ref_voltage)
Reading ADC data in mili Volts.
void pir_generic_write(pir_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
uint16_t pir_get_adc(pir_t *ctx)
Reading 12bit ADC value.
float pir_scale_results(pir_t *ctx, uint16_t in_val, uint16_t out_min, uint16_t out_max)
Scaling ADC results.
void pir_generic_read(pir_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
void pir_cfg_setup(pir_cfg_t *cfg)
Config Object Initialization function.
uint16_t pir_reg_read(pir_t *ctx)
Reading register.
Click configuration structure definition.
Definition pir.h:114
uint32_t i2c_speed
Definition pir.h:126
pin_name_t scl
Definition pir.h:117
pin_name_t sda
Definition pir.h:118
pin_name_t an
Definition pir.h:122
uint8_t i2c_address
Definition pir.h:127
Click ctx object definition.
Definition pir.h:95
i2c_master_t i2c
Definition pir.h:102
digital_in_t an
Definition pir.h:98
uint8_t slave_address
Definition pir.h:106