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"
74#define ACCEL16_CMD_WRITE_REG 0x0A
75#define ACCEL16_CMD_READ_REG 0x0B
76#define ACCEL16_CMD_READ_FIFO 0x0D
82#define ACCEL16_REG_DEVID_AD 0x00
83#define ACCEL16_REG_DEVID_MST 0x01
84#define ACCEL16_REG_DEVID 0x02
85#define ACCEL16_REG_REVID 0x03
86#define ACCEL16_REG_XDATA 0x08
87#define ACCEL16_REG_YDATA 0x09
88#define ACCEL16_REG_ZDATA 0x0A
89#define ACCEL16_REG_STATUS 0x0B
90#define ACCEL16_REG_FIFO_ENTRIES_L 0x0C
91#define ACCEL16_REG_FIFO_ENTRIES_H 0x0D
92#define ACCEL16_REG_XDATA_L 0x0E
93#define ACCEL16_REG_XDATA_H 0x0F
94#define ACCEL16_REG_YDATA_L 0x10
95#define ACCEL16_REG_YDATA_H 0x11
96#define ACCEL16_REG_ZDATA_L 0x12
97#define ACCEL16_REG_ZDATA_H 0x13
98#define ACCEL16_REG_TEMP_L 0x14
99#define ACCEL16_REG_TEMP_H 0x15
100#define ACCEL16_REG_ADC_DATA_L 0x16
101#define ACCEL16_REG_ADC_DATA_H 0x17
102#define ACCEL16_REG_SOFT_RESET 0x1F
103#define ACCEL16_REG_THRESH_ACT_L 0x20
104#define ACCEL16_REG_THRESH_ACT_H 0x21
105#define ACCEL16_REG_TIME_ACT 0x22
106#define ACCEL16_REG_THRESH_INACT_L 0x23
107#define ACCEL16_REG_THRESH_INACT_H 0x24
108#define ACCEL16_REG_TIME_INACT_L 0x25
109#define ACCEL16_REG_TIME_INACT_H 0x26
110#define ACCEL16_REG_ACT_INACT_CTL 0x27
111#define ACCEL16_REG_FIFO_CONTROL 0x28
112#define ACCEL16_REG_FIFO_SAMPLES 0x29
113#define ACCEL16_REG_INTMAP1 0x2A
114#define ACCEL16_REG_INTMAP2 0x2B
115#define ACCEL16_REG_FILTER_CTL 0x2C
116#define ACCEL16_REG_POWER_CTL 0x2D
117#define ACCEL16_REG_SELF_CTL 0x2E
135#define ACCEL16_APPLICATION_FIFO 0xAA
136#define ACCEL16_APPLICATION_REG 0xBB
142#define ACCEL16_ROOM_TEMPERATURE 25.0
143#define ACCEL16_TEMPERATURE_BIAS 350
144#define ACCEL16_TEMPERATURE_RES 0.065
145#define ACCEL16_TEMPERATURE_CAL_SAMPLE_NUM 100
155#define ACCEL16_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
156#define ACCEL16_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
174#define ACCEL16_MAP_MIKROBUS( cfg, mikrobus ) \
175 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
176 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
177 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
178 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
179 cfg.int2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
180 cfg.int1 = MIKROBUS( mikrobus, MIKROBUS_INT )
accel16_gain_t
Accel 16 Click gain.
Definition accel16.h:256
@ ACCEL16_4G
Definition accel16.h:258
@ ACCEL16_8G
Definition accel16.h:259
@ ACCEL16_2G
Definition accel16.h:257
accel16_return_value_t
Accel 16 Click return value data.
Definition accel16.h:245
@ ACCEL16_ERROR
Definition accel16.h:247
@ ACCEL16_OK
Definition accel16.h:246
accel16_output_rate_t
Accel 16 Click output data rate.
Definition accel16.h:268
@ ACCEL16_12p5HZ
Definition accel16.h:269
@ ACCEL16_200HZ
Definition accel16.h:273
@ ACCEL16_400HZ
Definition accel16.h:274
@ ACCEL16_50HZ
Definition accel16.h:271
@ ACCEL16_100HZ
Definition accel16.h:272
@ ACCEL16_25HZ
Definition accel16.h:270
err_t accel16_calibrate_temperature(accel16_t *ctx, float room_temperature)
Accel 16 calibrate temperature function.
uint8_t accel16_get_interrupt_1(accel16_t *ctx)
Get interrupt 1 state.
err_t accel16_get_temperature(accel16_t *ctx, float *temperature)
Get temperature data.
err_t accel16_init(accel16_t *ctx, accel16_cfg_t *cfg)
Accel 16 initialization function.
err_t accel16_get_axes(accel16_t *ctx, accel16_axes_t *axes)
Get axes data.
err_t accel16_filter_configuration(accel16_t *ctx, accel16_gain_t gain, accel16_output_rate_t odr)
Filter configuration.
err_t accel16_single_reg_write(accel16_t *ctx, uint8_t reg, uint8_t data_in)
Write single register.
void accel16_cfg_setup(accel16_cfg_t *cfg)
Accel 16 configuration object setup function.
err_t accel16_get_adc(accel16_t *ctx, float *v_adc)
Get adc data.
err_t accel16_single_reg_read(accel16_t *ctx, uint8_t reg, uint8_t *data_out)
Read single registers.
err_t accel16_default_cfg(accel16_t *ctx)
Accel 16 default configuration function.
err_t accel16_multiple_reg_write(accel16_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Write multiple registers.
uint8_t accel16_get_interrupt_2(accel16_t *ctx)
Get interrupt 2 state.
err_t accel16_multiple_reg_read(accel16_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Read multiple registers.
err_t accel16_fifo_read(accel16_t *ctx, uint8_t *data_out, uint16_t len)
Read fifo.
This file contains SPI specific macros, functions, etc.
Accel 16 Click axes data.
Definition accel16.h:233
float y
Definition accel16.h:235
float x
Definition accel16.h:234
float z
Definition accel16.h:236
Accel 16 Click configuration object.
Definition accel16.h:210
pin_name_t int1
Definition accel16.h:219
pin_name_t int2
Definition accel16.h:218
spi_master_chip_select_polarity_t cs_polarity
Definition accel16.h:224
pin_name_t sck
Definition accel16.h:214
spi_master_mode_t spi_mode
Definition accel16.h:223
pin_name_t mosi
Definition accel16.h:213
uint32_t spi_speed
Definition accel16.h:222
pin_name_t miso
Definition accel16.h:212
pin_name_t cs
Definition accel16.h:215
Accel 16 Click context object.
Definition accel16.h:190
digital_in_t int2
Definition accel16.h:192
spi_master_t spi
Definition accel16.h:196
float resolution
Definition accel16.h:199
uint8_t application_type
Definition accel16.h:201
digital_in_t int1
Definition accel16.h:193
float room_temp_offset
Definition accel16.h:200
pin_name_t chip_select
Definition accel16.h:198