41#ifdef PREINIT_SUPPORTED
45#ifdef MikroCCoreVersion
46 #if MikroCCoreVersion >= 1
51#include "drv_digital_out.h"
52#include "drv_digital_in.h"
53#include "drv_i2c_master.h"
66#define ACCEL7_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
69 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT );
76#define ACCEL7_RETVAL uint8_t
79#define ACCEL7_INIT_ERROR 0xFF
86#define ACCEL7_AXIS_X 0x06
87#define ACCEL7_AXIS_Y 0x08
88#define ACCEL7_AXIS_Z 0x0A
89#define ACCEL7_DATA_RESP_8bit 0x10
90#define ACCEL7_DATA_RESP_12bit 0x20
91#define ACCEL7_DATA_RESP_14bit 0x30
92#define ACCEL7_RANGE_2g 0x01
93#define ACCEL7_RANGE_4g 0x02
94#define ACCEL7_RANGE_8g 0x03
95#define ACCEL7_RANGE_16g 0x04
102#define ACCEL7_REG_AXIS_X_LSB 0x06
103#define ACCEL7_REG_AXIS_X_MSB 0x07
104#define ACCEL7_REG_AXIS_Y_LSB 0x08
105#define ACCEL7_REG_AXIS_Y_MSB 0x09
106#define ACCEL7_REG_AXIS_Z_LSB 0x0A
107#define ACCEL7_REG_AXIS_Z_MSB 0x0B
108#define ACCEL7_REG_DCST_RESP 0x0C
109#define ACCEL7_REG_WHO_AM_I 0x0F
110#define ACCEL7_REG_INT_SOURCE1 0x16
111#define ACCEL7_REG_INT_SOURCE2 0x17
112#define ACCEL7_REG_STATUS 0x18
113#define ACCEL7_REG_INT_REL 0x1A
114#define ACCEL7_REG_CTRL_REG1 0x1B
115#define ACCEL7_REG_CTRL_REG2 0x1D
116#define ACCEL7_REG_INT_CTRL_REG1 0x1E
117#define ACCEL7_REG_INT_CTRL_REG2 0x1F
118#define ACCEL7_REG_DATA_CTRL_REG 0x21
119#define ACCEL7_REG_WAKEUP_COUNTER 0x29
120#define ACCEL7_REG_NA_CAUNTER 0x2A
121#define ACCEL7_REG_SELF_TEST 0x3A
122#define ACCEL7_REG_WAKEUP_THRESHOLD_MSB 0x6A
123#define ACCEL7_REG_WAKEUP_THRESHOLD_LSB 0x6B
130#define ACCEL7_CTRL_REG1_MODE_OPERATING 0x80
131#define ACCEL7_CTRL_REG1_MODE_STANDBY 0x00
132#define ACCEL7_CTRL_REG1_RES_LOW_CURRENT 0x00
133#define ACCEL7_CTRL_REG1_RES_HIGH_RESOLUTION 0x40
134#define ACCEL7_CTRL_REG1_DRDYE_ENABLE 0x20
135#define ACCEL7_CTRL_REG1_DRDYE_DISABLE 0x00
136#define ACCEL7_CTRL_REG1_RANGE_2g 0x00
137#define ACCEL7_CTRL_REG1_RANGE_4g 0x08
138#define ACCEL7_CTRL_REG1_RANGE_8g 0x10
139#define ACCEL7_CTRL_REG1_RANGE_16g 0x04
140#define ACCEL7_CTRL_REG1_RANGE_HIGH_RES_8g 0x18
141#define ACCEL7_CTRL_REG1_RANGE_HIGH_RES_16g 0x1C
142#define ACCEL7_CTRL_REG1_WAKEUP_DISABLE 0x00
143#define ACCEL7_CTRL_REG1_WAKEUP_ENABLE 0x02
150#define ACCEL7_CTRL_REG2_START_RAM_REBOOT 0x80
151#define ACCEL7_CTRL_REG2_DCST_ENABLE 0x10
152#define ACCEL7_CTRL_REG2_DCST_DISABLE 0x00
153#define ACCEL7_CTRL_REG2_OUT_DATA_RATE_0_781Hz 0x00
154#define ACCEL7_CTRL_REG2_OUT_DATA_RATE_1_563Hz 0x01
155#define ACCEL7_CTRL_REG2_OUT_DATA_RATE_3_125Hz 0x02
156#define ACCEL7_CTRL_REG2_OUT_DATA_RATE_6_25Hz 0x03
157#define ACCEL7_CTRL_REG2_OUT_DATA_RATE_12_5Hz 0x04
158#define ACCEL7_CTRL_REG2_OUT_DATA_RATE_25Hz 0x05
159#define ACCEL7_CTRL_REG2_OUT_DATA_RATE_50Hz 0x06
160#define ACCEL7_CTRL_REG2_OUT_DATA_RATE_100Hz 0x07
167#define ACCEL7_INT_CTRL_REG1_IEN_DISABLE 0x00
168#define ACCEL7_INT_CTRL_REG1_IEN_ENABLE 0x20
169#define ACCEL7_INT_CTRL_REG1_IEA_DISABLE 0x00
170#define ACCEL7_INT_CTRL_REG1_IEA_ENABLE 0x10
171#define ACCEL7_INT_CTRL_REG1_IEL_DISABLE 0x00
172#define ACCEL7_INT_CTRL_REG1_IEL_ENABLE 0x08
173#define ACCEL7_INT_CTRL_REG1_SELF_TEST_POL_NEGATIVE 0x00
174#define ACCEL7_INT_CTRL_REG1_SELF_TEST_POL_POSITIVE 0x02
181#define ACCEL7_INT_CTRL_REG2_ULMODE_ENABLE 0x80
182#define ACCEL7_INT_CTRL_REG2_ULMODE_DISABLE 0x00
183#define ACCEL7_INT_CTRL_REG2_X_NEGATIVE_ENABLE 0x20
184#define ACCEL7_INT_CTRL_REG2_X_NEGATIVE_DISABLE 0x00
185#define ACCEL7_INT_CTRL_REG2_Y_NEGATIVE_ENABLE 0x08
186#define ACCEL7_INT_CTRL_REG2_Y_NEGATIVE_DISABLE 0x00
187#define ACCEL7_INT_CTRL_REG2_Z_NEGATIVE_ENABLE 0x02
188#define ACCEL7_INT_CTRL_REG2_Z_NEGATIVE_DISABLE 0x00
189#define ACCEL7_INT_CTRL_REG2_X_POSITIVE_ENABLE 0x10
190#define ACCEL7_INT_CTRL_REG2_X_POSITIVE_DISABLE 0x00
191#define ACCEL7_INT_CTRL_REG2_Y_POSITIVE_ENABLE 0x04
192#define ACCEL7_INT_CTRL_REG2_Y_POSITIVE_DISABLE 0x00
193#define ACCEL7_INT_CTRL_REG2_Z_POSITIVE_ENABLE 0x01
194#define ACCEL7_INT_CTRL_REG2_Z_POSITIVE_DISABLE 0x00
201#define ACCEL7_DATA_CTRL_REG_ODR_0_781Hz 0x08
202#define ACCEL7_DATA_CTRL_REG_ODR_1_563Hz 0x09
203#define ACCEL7_DATA_CTRL_REG_ODR_3_125Hz 0x0A
204#define ACCEL7_DATA_CTRL_REG_ODR_6_25Hz 0x0B
205#define ACCEL7_DATA_CTRL_REG_ODR_12_5Hz 0x00
206#define ACCEL7_DATA_CTRL_REG_ODR_25Hz 0x01
207#define ACCEL7_DATA_CTRL_REG_ODR_50Hz 0x02
208#define ACCEL7_DATA_CTRL_REG_ODR_100Hz 0x03
209#define ACCEL7_DATA_CTRL_REG_ODR_200Hz 0x04
210#define ACCEL7_DATA_CTRL_REG_ODR_400Hz 0x05
211#define ACCEL7_DATA_CTRL_REG_ODR_800Hz 0x06
212#define ACCEL7_DATA_CTRL_REG_ODR_1600Hz 0x07
219#define ACCEL7_DEVICE_ADDRESS 0x0F
#define ACCEL7_RETVAL
Definition accel7.h:76
uint8_t accel7_read_byte(accel7_t *ctx, uint8_t reg)
Read byte function.
void accel7_res_range_cfg(accel7_t *ctx, uint8_t *resolution, uint8_t *range)
Resolution/range configuration function.
void accel7_cfg_setup(accel7_cfg_t *cfg)
Config Object Initialization function.
void accel7_generic_write(accel7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void accel7_default_cfg(accel7_t *ctx, uint8_t resolution, uint8_t range)
Click Default Configuration function.
int16_t accel7_get_axis(accel7_t *ctx, uint8_t axis)
Get axi function.
void accel7_write_byte(accel7_t *ctx, uint8_t reg, uint8_t input_data)
Write byte function.
ACCEL7_RETVAL accel7_init(accel7_t *ctx, accel7_cfg_t *cfg)
Initialization function.
uint8_t accel7_get_interrupt_state(accel7_t *ctx)
Get interrupt state function.
void accel7_generic_read(accel7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
Click configuration structure definition.
Definition accel7.h:253
uint8_t dev_data_resolution
Definition accel7.h:267
uint32_t i2c_speed
Definition accel7.h:265
pin_name_t scl
Definition accel7.h:256
pin_name_t int_pin
Definition accel7.h:261
pin_name_t sda
Definition accel7.h:257
uint8_t i2c_address
Definition accel7.h:266
Click ctx object definition.
Definition accel7.h:233
uint8_t data_resolution
Definition accel7.h:245
digital_in_t int_pin
Definition accel7.h:236
i2c_master_t i2c
Definition accel7.h:240
uint8_t slave_address
Definition accel7.h:244