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_i2c_master.h"
78#define VIBRASENSE2_RESOLUTION 4096
79#define VIBRASENSE2_12_BIT_DATA 0x0FFF
85#define VIBRASENSE2_VIBRA_LVL_ERROR -1
86#define VIBRASENSE2_VIBRA_LVL_0 0
87#define VIBRASENSE2_VIBRA_LVL_1 1
88#define VIBRASENSE2_VIBRA_LVL_2 2
89#define VIBRASENSE2_VIBRA_LVL_3 3
90#define VIBRASENSE2_VIBRA_LVL_4 4
91#define VIBRASENSE2_VIBRA_LVL_5 5
92#define VIBRASENSE2_VIBRA_LVL_6 6
99#define VIBRASENSE2_SET_DEV_ADDR 0x4D
117#define VIBRASENSE2_MAP_MIKROBUS( cfg, mikrobus ) \
118 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
119 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
uint16_t vibrasense2_read_data(vibrasense2_t *ctx)
Read data function.
int8_t vibrasense2_vibration_level(vibrasense2_t *ctx)
Get Vibration Level function.
err_t vibrasense2_generic_write(vibrasense2_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
Vibra Sense 2 I2C writing function.
err_t vibrasense2_generic_read(vibrasense2_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
Vibra Sense 2 I2C reading function.
void vibrasense2_cfg_setup(vibrasense2_cfg_t *cfg)
Vibra Sense 2 configuration object setup function.
err_t vibrasense2_init(vibrasense2_t *ctx, vibrasense2_cfg_t *cfg)
Vibra Sense 2 initialization function.
uint16_t vibrasense2_read_voltage(vibrasense2_t *ctx, uint16_t v_ref)
Read voltage function.
Vibra Sense 2 Click configuration object.
Definition vibrasense2.h:142
uint32_t i2c_speed
Definition vibrasense2.h:146
pin_name_t scl
Definition vibrasense2.h:143
pin_name_t sda
Definition vibrasense2.h:144
uint8_t i2c_address
Definition vibrasense2.h:147
Vibra Sense 2 Click context object.
Definition vibrasense2.h:128
i2c_master_t i2c
Definition vibrasense2.h:130
uint8_t slave_address
Definition vibrasense2.h:133
vibrasense2_return_value_t
Vibra Sense 2 Click return value data.
Definition vibrasense2.h:156
@ VIBRASENSE2_OK
Definition vibrasense2.h:157
@ VIBRASENSE2_ERROR
Definition vibrasense2.h:158