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_spi_master.h"
52#include "drv_analog_in.h"
70#define PIEZOACCEL_MEAS_MODE_AN_PIN 0x00
71#define PIEZOACCEL_MEAS_MODE_ADC 0x01
85#define PIEZOACCEL_SENSOR_VOLTAGE_5V 0x00
86#define PIEZOACCEL_SENSOR_VOLTAGE_3V3 0x01
104#define PIEZOACCEL_MAP_MIKROBUS( cfg, mikrobus ) \
105 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
106 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
107 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
108 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
109 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN )
void piezoaccel_default_cfg(piezoaccel_t *ctx, piezoaccel_setup_t *setup_cfg_data)
Piezo Accel default configuration function.
float piezoaccel_adc_voltage_read(piezoaccel_t *ctx)
Piezo Accel read adc converted to voltage function.
void piezoaccel_calibration(piezoaccel_t *ctx, piezoaccel_setup_t *cfg_data)
Piezo Accel calibration function.
err_t piezoaccel_read_an_pin_voltage(piezoaccel_t *ctx, float *data_out)
Piezo Accel read AN pin voltage level function.
void piezoaccel_cfg_setup(piezoaccel_cfg_t *cfg)
Piezo Accel configuration object setup function.
float piezoaccel_g_unit_read(piezoaccel_t *ctx, piezoaccel_setup_t *cfg_data)
Piezo Accel read force of acceleration function.
err_t piezoaccel_read_an_pin_value(piezoaccel_t *ctx, uint16_t *data_out)
Piezo Accel read AN pin value function.
uint16_t piezoaccel_adc_raw_read(piezoaccel_t *ctx)
Piezo Accel read raw adc function.
err_t piezoaccel_init(piezoaccel_t *ctx, piezoaccel_cfg_t *cfg)
Piezo Accel initialization function.
Piezo Accel Click configuration object.
Definition piezoaccel.h:135
analog_in_resolution_t resolution
Definition piezoaccel.h:153
float vref
Definition piezoaccel.h:154
spi_master_chip_select_polarity_t cs_polarity
Definition piezoaccel.h:151
pin_name_t sck
Definition piezoaccel.h:140
spi_master_mode_t spi_mode
Definition piezoaccel.h:150
pin_name_t mosi
Definition piezoaccel.h:139
uint32_t spi_speed
Definition piezoaccel.h:149
pin_name_t miso
Definition piezoaccel.h:138
pin_name_t an
Definition piezoaccel.h:145
pin_name_t cs
Definition piezoaccel.h:141
Piezo Accel Click Configuration setup structure.
Definition piezoaccel.h:163
float offset_data
Definition piezoaccel.h:166
uint8_t measurement_mode
Definition piezoaccel.h:164
uint8_t sensor_voltage
Definition piezoaccel.h:165
Piezo Accel Click context object.
Definition piezoaccel.h:119
spi_master_t spi
Definition piezoaccel.h:124
pin_name_t chip_select
Definition piezoaccel.h:126
analog_in_t adc
Definition piezoaccel.h:122