Go to the documentation of this file.
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"
66 #define EARTHQUAKE_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
69 cfg.st = MIKROBUS( mikrobus, MIKROBUS_CS ); \
70 cfg.int2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
71 cfg.int1 = MIKROBUS( mikrobus, MIKROBUS_INT );
78 #define EARTHQUAKE_STANDBY_MODE 0
79 #define EARTHQUAKE_NORMAL_MODE 1
80 #define EARTHQUAKE_INIT_INST 2
81 #define EARTHQUAKE_OFFSET_ACQ 3
82 #define EARTHQUAKE_SELF_DIAGNOSTIC 4
89 #define EARTHQUAKE_RETVAL uint8_t
91 #define EARTHQUAKE_OK 0x00
92 #define EARTHQUAKE_INIT_ERROR 0xFF
107 #define EARTHQUAKE_I2C_ADDRESS 0x55
114 #define EARTHQUAKE_CLICK_ERR 0xFF
115 #define EARTHQUAKE_CLICK_OK 0x00
122 #define EARTHQUAKE_STATE 0x1000
123 #define EARTHQUAKE_AXIS_STATE 0x1001
124 #define EARTHQUAKE_EVENT 0x1002
131 #define EARTHQUAKE_MODE 0x1003
132 #define EARTHQUAKE_CTRL 0x1004
133 #define EARTHQUAKE_CLEAR_COMMAND 0x1005
140 #define EARTHQUAKE_MAIN_SI_H 0x2000
141 #define EARTHQUAKE_MAIN_SI_L 0x2001
142 #define EARTHQUAKE_MAIN_PGA_H 0x2002
143 #define EARTHQUAKE_MAIN_PGA_L 0x2003
150 #define EARTHQUAKE_N1_MAIN_OFFSET_X_H 0x3000
151 #define EARTHQUAKE_N1_MAIN_OFFSET_X_L 0x3001
152 #define EARTHQUAKE_N1_MAIN_OFFSET_Y_H 0x3002
153 #define EARTHQUAKE_N1_MAIN_OFFSET_Y_L 0x3003
154 #define EARTHQUAKE_N1_MAIN_OFFSET_Z_H 0x3004
155 #define EARTHQUAKE_N1_MAIN_OFFSET_Z_L 0x3005
157 #define EARTHQUAKE_N1_MAIN_T_AVE_H 0x3006
158 #define EARTHQUAKE_N1_MAIN_T_AVE_L 0x3007
159 #define EARTHQUAKE_N1_MAIN_SI_H 0x3008
160 #define EARTHQUAKE_N1_MAIN_SI_L 0x3009
161 #define EARTHQUAKE_N1_MAIN_PGA_H 0x300A
162 #define EARTHQUAKE_N1_MAIN_PGA_L 0x300B
169 #define EARTHQUAKE_N2_MAIN_OFFSET_X_H 0x3100
170 #define EARTHQUAKE_N2_MAIN_OFFSET_X_L 0x3101
171 #define EARTHQUAKE_N2_MAIN_OFFSET_Y_H 0x3102
172 #define EARTHQUAKE_N2_MAIN_OFFSET_Y_L 0x3103
173 #define EARTHQUAKE_N2_MAIN_OFFSET_Z_H 0x3104
174 #define EARTHQUAKE_N2_MAIN_OFFSET_Z_L 0x3105
176 #define EARTHQUAKE_N2_MAIN_T_AVE_H 0x3106
177 #define EARTHQUAKE_N2_MAIN_T_AVE_L 0x3107
178 #define EARTHQUAKE_N2_MAIN_SI_H 0x3108
179 #define EARTHQUAKE_N2_MAIN_SI_L 0x3109
180 #define EARTHQUAKE_N2_MAIN_PGA_H 0x310A
181 #define EARTHQUAKE_N2_MAIN_PGA_L 0x310B
188 #define EARTHQUAKE_N3_MAIN_OFFSET_X_H 0x3200
189 #define EARTHQUAKE_N3_MAIN_OFFSET_X_L 0x3201
190 #define EARTHQUAKE_N3_MAIN_OFFSET_Y_H 0x3202
191 #define EARTHQUAKE_N3_MAIN_OFFSET_Y_L 0x3203
192 #define EARTHQUAKE_N3_MAIN_OFFSET_Z_H 0x3204
193 #define EARTHQUAKE_N3_MAIN_OFFSET_Z_L 0x3205
195 #define EARTHQUAKE_N3_MAIN_T_AVE_H 0x3206
196 #define EARTHQUAKE_N3_MAIN_T_AVE_L 0x3207
197 #define EARTHQUAKE_N3_MAIN_SI_H 0x3208
198 #define EARTHQUAKE_N3_MAIN_SI_L 0x3209
199 #define EARTHQUAKE_N3_MAIN_PGA_H 0x320A
200 #define EARTHQUAKE_N3_MAIN_PGA_L 0x320B
207 #define EARTHQUAKE_N4_MAIN_OFFSET_X_H 0x3300
208 #define EARTHQUAKE_N4_MAIN_OFFSET_X_L 0x3301
209 #define EARTHQUAKE_N4_MAIN_OFFSET_Y_H 0x3302
210 #define EARTHQUAKE_N4_MAIN_OFFSET_Y_L 0x3303
211 #define EARTHQUAKE_N4_MAIN_OFFSET_Z_H 0x3304
212 #define EARTHQUAKE_N4_MAIN_OFFSET_Z_L 0x3305
214 #define EARTHQUAKE_N4_MAIN_T_AVE_H 0x3306
215 #define EARTHQUAKE_N4_MAIN_T_AVE_L 0x3307
216 #define EARTHQUAKE_N4_MAIN_SI_H 0x3308
217 #define EARTHQUAKE_N4_MAIN_SI_L 0x3309
218 #define EARTHQUAKE_N4_MAIN_PGA_H 0x330A
219 #define EARTHQUAKE_N4_MAIN_PGA_L 0x330B
226 #define EARTHQUAKE_N5_MAIN_OFFSET_X_H 0x3400
227 #define EARTHQUAKE_N5_MAIN_OFFSET_X_L 0x3401
228 #define EARTHQUAKE_N5_MAIN_OFFSET_Y_H 0x3402
229 #define EARTHQUAKE_N5_MAIN_OFFSET_Y_L 0x3403
230 #define EARTHQUAKE_N5_MAIN_OFFSET_Z_H 0x3404
231 #define EARTHQUAKE_N5_MAIN_OFFSET_Z_L 0x3405
233 #define EARTHQUAKE_N5_MAIN_T_AVE_H 0x3406
234 #define EARTHQUAKE_N5_MAIN_T_AVE_L 0x3407
235 #define EARTHQUAKE_N5_MAIN_SI_H 0x3408
236 #define EARTHQUAKE_N5_MAIN_SI_L 0x3409
237 #define EARTHQUAKE_N5_MAIN_PGA_H 0x340A
238 #define EARTHQUAKE_N5_MAIN_PGA_L 0x340B
245 #define EARTHQUAKE_M1_MAIN_OFFSET_X_H 0x3500
246 #define EARTHQUAKE_M1_MAIN_OFFSET_X_L 0x3501
247 #define EARTHQUAKE_M1_MAIN_OFFSET_Y_H 0x3502
248 #define EARTHQUAKE_M1_MAIN_OFFSET_Y_L 0x3503
249 #define EARTHQUAKE_M1_MAIN_OFFSET_Z_H 0x3504
250 #define EARTHQUAKE_M1_MAIN_OFFSET_Z_L 0x3505
252 #define EARTHQUAKE_M1_MAIN_T_AVE_H 0x3506
253 #define EARTHQUAKE_M1_MAIN_T_AVE_L 0x3507
254 #define EARTHQUAKE_M1_MAIN_SI_H 0x3508
255 #define EARTHQUAKE_M1_MAIN_SI_L 0x3509
256 #define EARTHQUAKE_M1_MAIN_PGA_H 0x350A
257 #define EARTHQUAKE_M1_MAIN_PGA_L 0x350B
264 #define EARTHQUAKE_M2_MAIN_OFFSET_X_H 0x3600
265 #define EARTHQUAKE_M2_MAIN_OFFSET_X_L 0x3601
266 #define EARTHQUAKE_M2_MAIN_OFFSET_Y_H 0x3602
267 #define EARTHQUAKE_M2_MAIN_OFFSET_Y_L 0x3603
268 #define EARTHQUAKE_M2_MAIN_OFFSET_Z_H 0x3604
269 #define EARTHQUAKE_M2_MAIN_OFFSET_Z_L 0x3605
271 #define EARTHQUAKE_M2_MAIN_T_AVE_H 0x3606
272 #define EARTHQUAKE_M2_MAIN_T_AVE_L 0x3607
273 #define EARTHQUAKE_M2_MAIN_SI_H 0x3608
274 #define EARTHQUAKE_M2_MAIN_SI_L 0x3609
275 #define EARTHQUAKE_M2_MAIN_PGA_H 0x360A
276 #define EARTHQUAKE_M2_MAIN_PGA_L 0x360B
283 #define EARTHQUAKE_M3_MAIN_OFFSET_X_H 0x3700
284 #define EARTHQUAKE_M3_MAIN_OFFSET_X_L 0x3701
285 #define EARTHQUAKE_M3_MAIN_OFFSET_Y_H 0x3702
286 #define EARTHQUAKE_M3_MAIN_OFFSET_Y_L 0x3703
287 #define EARTHQUAKE_M3_MAIN_OFFSET_Z_H 0x3704
288 #define EARTHQUAKE_M3_MAIN_OFFSET_Z_L 0x3705
290 #define EARTHQUAKE_M3_MAIN_T_AVE_H 0x3706
291 #define EARTHQUAKE_M3_MAIN_T_AVE_L 0x3707
292 #define EARTHQUAKE_M3_MAIN_SI_H 0x3708
293 #define EARTHQUAKE_M3_MAIN_SI_L 0x3709
294 #define EARTHQUAKE_M3_MAIN_PGA_H 0x370A
295 #define EARTHQUAKE_M3_MAIN_PGA_L 0x370B
302 #define EARTHQUAKE_M4_MAIN_OFFSET_X_H 0x3800
303 #define EARTHQUAKE_M4_MAIN_OFFSET_X_L 0x3801
304 #define EARTHQUAKE_M4_MAIN_OFFSET_Y_H 0x3802
305 #define EARTHQUAKE_M4_MAIN_OFFSET_Y_L 0x3803
306 #define EARTHQUAKE_M4_MAIN_OFFSET_Z_H 0x3804
307 #define EARTHQUAKE_M4_MAIN_OFFSET_Z_L 0x3805
309 #define EARTHQUAKE_M4_MAIN_T_AVE_H 0x3806
310 #define EARTHQUAKE_M4_MAIN_T_AVE_L 0x3807
311 #define EARTHQUAKE_M4_MAIN_SI_H 0x3808
312 #define EARTHQUAKE_M4_MAIN_SI_L 0x3809
313 #define EARTHQUAKE_M4_MAIN_PGA_H 0x380A
314 #define EARTHQUAKE_M4_MAIN_PGA_L 0x380B
321 #define EARTHQUAKE_M5_MAIN_OFFSET_X_H 0x3900
322 #define EARTHQUAKE_M5_MAIN_OFFSET_X_L 0x3901
323 #define EARTHQUAKE_M5_MAIN_OFFSET_Y_H 0x3902
324 #define EARTHQUAKE_M5_MAIN_OFFSET_Y_L 0x3903
325 #define EARTHQUAKE_M5_MAIN_OFFSET_Z_H 0x3904
326 #define EARTHQUAKE_M5_MAIN_OFFSET_Z_L 0x3905
328 #define EARTHQUAKE_M5_MAIN_T_AVE_H 0x3906
329 #define EARTHQUAKE_M5_MAIN_T_AVE_L 0x3907
330 #define EARTHQUAKE_M5_MAIN_SI_H 0x3908
331 #define EARTHQUAKE_M5_MAIN_SI_L 0x3909
332 #define EARTHQUAKE_M5_MAIN_PGA_H 0x390A
333 #define EARTHQUAKE_M5_MAIN_PGA_L 0x390B
340 #define EARTHQUAKE_OFFSET_SET_X_H 0x4000
341 #define EARTHQUAKE_OFFSET_SET_X_L 0x4001
342 #define EARTHQUAKE_OFFSET_SET_Y_H 0x4002
343 #define EARTHQUAKE_OFFSET_SET_Y_L 0x4003
344 #define EARTHQUAKE_OFFSET_SET_Z_H 0x4004
345 #define EARTHQUAKE_OFFSET_SET_Z_L 0x4005
347 #define EARTHQUAKE_OFFSET_SET_T_AVE_H 0x4006
348 #define EARTHQUAKE_OFFSET_SET_T_AVE_L 0x4007
349 #define EARTHQUAKE_OFFSET_SET_MAX_X_H 0x4008
350 #define EARTHQUAKE_OFFSET_SET_MAX_X_L 0x4009
351 #define EARTHQUAKE_OFFSET_SET_MAX_Y_H 0x400A
352 #define EARTHQUAKE_OFFSET_SET_MAX_Y_L 0x400B
353 #define EARTHQUAKE_OFFSET_SET_MAX_Z_H 0x400C
354 #define EARTHQUAKE_OFFSET_SET_MAX_Z_L 0x400D
356 #define EARTHQUAKE_OFFSET_SET_MIN_X_H 0x400E
357 #define EARTHQUAKE_OFFSET_SET_MIN_X_L 0x400F
358 #define EARTHQUAKE_OFFSET_SET_MIN_Y_H 0x4010
359 #define EARTHQUAKE_OFFSET_SET_MIN_Y_L 0x4011
360 #define EARTHQUAKE_OFFSET_SET_MIN_Z_H 0x4012
361 #define EARTHQUAKE_OFFSET_SET_MIN_Z_L 0x4013
363 #define EARTHQUAKE_OFFSET_SET_AXIS 0x4014
370 #define EARTHQUAKE_OFFSET_RECENT_X_H 0x4100
371 #define EARTHQUAKE_OFFSET_RECENT_X_L 0x4101
372 #define EARTHQUAKE_OFFSET_RECENT_Y_H 0x4102
373 #define EARTHQUAKE_OFFSET_RECENT_Y_L 0x4103
374 #define EARTHQUAKE_OFFSET_RECENT_Z_H 0x4104
375 #define EARTHQUAKE_OFFSET_RECENT_Z_L 0x4105
377 #define EARTHQUAKE_OFFSET_RECENT_T_AVE_H 0x4106
378 #define EARTHQUAKE_OFFSET_RECENT_T_AVE_L 0x4107
380 #define EARTHQUAKE_OFFSET_RECENT_MAX_X_H 0x4108
381 #define EARTHQUAKE_OFFSET_RECENT_MAX_X_L 0x4109
382 #define EARTHQUAKE_OFFSET_RECENT_MAX_Y_H 0x410A
383 #define EARTHQUAKE_OFFSET_RECENT_MAX_Y_L 0x410B
384 #define EARTHQUAKE_OFFSET_RECENT_MAX_Z_H 0x410C
385 #define EARTHQUAKE_OFFSET_RECENT_MAX_Z_L 0x410D
387 #define EARTHQUAKE_OFFSET_RECENT_MIN_X_H 0x410E
388 #define EARTHQUAKE_OFFSET_RECENT_MIN_X_L 0x410F
389 #define EARTHQUAKE_OFFSET_RECENT_MIN_Y_H 0x4110
390 #define EARTHQUAKE_OFFSET_RECENT_MIN_Y_L 0x4111
391 #define EARTHQUAKE_OFFSET_RECENT_MIN_Z_H 0x4112
392 #define EARTHQUAKE_OFFSET_RECENT_MIN_Z_L 0x4113
394 #define EARTHQUAKE_OFFSET_RECENT_STATE 0x4114
401 #define EARTHQUAKE_SELFTEST_BEFORE_X_H 0x4200
402 #define EARTHQUAKE_SELFTEST_BEFORE_X_L 0x4201
403 #define EARTHQUAKE_SELFTEST_AFTER_X_H 0x4202
404 #define EARTHQUAKE_SELFTEST_AFTER_X_L 0x4203
405 #define EARTHQUAKE_SELFTEST_BEFORE_Y_H 0x4204
406 #define EARTHQUAKE_SELFTEST_BEFORE_Y_L 0x4205
407 #define EARTHQUAKE_SELFTEST_AFTER_Y_H 0x4206
408 #define EARTHQUAKE_SELFTEST_AFTER_Y_L 0x4207
409 #define EARTHQUAKE_SELFTEST_BEFORE_Z_H 0x4208
410 #define EARTHQUAKE_SELFTEST_BEFORE_Z_L 0x4209
411 #define EARTHQUAKE_SELFTEST_AFTER_Z_H 0x420A
412 #define EARTHQUAKE_SELFTEST_AFTER_Z_L 0x420B
414 #define EARTHQUAKE_SELFTEST_T_AVE_H 0x420C
415 #define EARTHQUAKE_SELFTEST_T_AVE_L 0x420D
417 #define EARTHQUAKE_SELFTEST_ERROR 0x420E
602 #endif // _EARTHQUAKE_H_
digital_in_t int2
Definition: earthquake.h:436
pin_name_t int1
Definition: earthquake.h:467
pin_name_t int2
Definition: earthquake.h:466
Click configuration structure definition.
Definition: earthquake.h:457
i2c_master_t i2c
Definition: earthquake.h:445
EARTHQUAKE_RETVAL earthquake_init(earthquake_t *ctx, earthquake_cfg_t *cfg)
Initialization function.
digital_in_t int1
Definition: earthquake.h:437
uint8_t i2c_address
Definition: earthquake.h:472
pin_name_t st
Definition: earthquake.h:465
uint8_t slave_address
Definition: earthquake.h:449
void earthquake_cfg_setup(earthquake_cfg_t *cfg)
Config Object Initialization function.
uint8_t earthquake_shutoff_output(earthquake_t *ctx)
Shutoff output function.
uint8_t earthquake_proc_notify(earthquake_t *ctx)
Shutoff output function.
#define EARTHQUAKE_RETVAL
Definition: earthquake.h:89
Click ctx object definition.
Definition: earthquake.h:433
pin_name_t scl
Definition: earthquake.h:460
uint8_t i2c_speed
Definition: earthquake.h:471
uint16_t earthquake_read_si(earthquake_t *ctx)
Read SI function.
void earthquake_clear_memory(earthquake_t *ctx)
Clear Memory function.
digital_out_t st
Definition: earthquake.h:441
void earthquake_generic_read(earthquake_t *ctx, uint16_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
uint8_t earthquake_read_status(earthquake_t *ctx)
Read status function.
void earthquake_generic_write(earthquake_t *ctx, uint16_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
pin_name_t sda
Definition: earthquake.h:461