Go to the documentation of this file.
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 #include "drv_i2c_master.h"
52 #define EARTHQUAKE_MAP_MIKROBUS( cfg, mikrobus ) \
53 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
54 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
55 cfg.st = MIKROBUS( mikrobus, MIKROBUS_CS ); \
56 cfg.int2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
57 cfg.int1 = MIKROBUS( mikrobus, MIKROBUS_INT );
64 #define EARTHQUAKE_STANDBY_MODE 0
65 #define EARTHQUAKE_NORMAL_MODE 1
66 #define EARTHQUAKE_INIT_INST 2
67 #define EARTHQUAKE_OFFSET_ACQ 3
68 #define EARTHQUAKE_SELF_DIAGNOSTIC 4
75 #define EARTHQUAKE_RETVAL uint8_t
77 #define EARTHQUAKE_OK 0x00
78 #define EARTHQUAKE_INIT_ERROR 0xFF
93 #define EARTHQUAKE_I2C_ADDRESS 0x55
100 #define EARTHQUAKE_CLICK_ERR 0xFF
101 #define EARTHQUAKE_CLICK_OK 0x00
108 #define EARTHQUAKE_STATE 0x1000
109 #define EARTHQUAKE_AXIS_STATE 0x1001
110 #define EARTHQUAKE_EVENT 0x1002
117 #define EARTHQUAKE_MODE 0x1003
118 #define EARTHQUAKE_CTRL 0x1004
119 #define EARTHQUAKE_CLEAR_COMMAND 0x1005
126 #define EARTHQUAKE_MAIN_SI_H 0x2000
127 #define EARTHQUAKE_MAIN_SI_L 0x2001
128 #define EARTHQUAKE_MAIN_PGA_H 0x2002
129 #define EARTHQUAKE_MAIN_PGA_L 0x2003
136 #define EARTHQUAKE_N1_MAIN_OFFSET_X_H 0x3000
137 #define EARTHQUAKE_N1_MAIN_OFFSET_X_L 0x3001
138 #define EARTHQUAKE_N1_MAIN_OFFSET_Y_H 0x3002
139 #define EARTHQUAKE_N1_MAIN_OFFSET_Y_L 0x3003
140 #define EARTHQUAKE_N1_MAIN_OFFSET_Z_H 0x3004
141 #define EARTHQUAKE_N1_MAIN_OFFSET_Z_L 0x3005
143 #define EARTHQUAKE_N1_MAIN_T_AVE_H 0x3006
144 #define EARTHQUAKE_N1_MAIN_T_AVE_L 0x3007
145 #define EARTHQUAKE_N1_MAIN_SI_H 0x3008
146 #define EARTHQUAKE_N1_MAIN_SI_L 0x3009
147 #define EARTHQUAKE_N1_MAIN_PGA_H 0x300A
148 #define EARTHQUAKE_N1_MAIN_PGA_L 0x300B
155 #define EARTHQUAKE_N2_MAIN_OFFSET_X_H 0x3100
156 #define EARTHQUAKE_N2_MAIN_OFFSET_X_L 0x3101
157 #define EARTHQUAKE_N2_MAIN_OFFSET_Y_H 0x3102
158 #define EARTHQUAKE_N2_MAIN_OFFSET_Y_L 0x3103
159 #define EARTHQUAKE_N2_MAIN_OFFSET_Z_H 0x3104
160 #define EARTHQUAKE_N2_MAIN_OFFSET_Z_L 0x3105
162 #define EARTHQUAKE_N2_MAIN_T_AVE_H 0x3106
163 #define EARTHQUAKE_N2_MAIN_T_AVE_L 0x3107
164 #define EARTHQUAKE_N2_MAIN_SI_H 0x3108
165 #define EARTHQUAKE_N2_MAIN_SI_L 0x3109
166 #define EARTHQUAKE_N2_MAIN_PGA_H 0x310A
167 #define EARTHQUAKE_N2_MAIN_PGA_L 0x310B
174 #define EARTHQUAKE_N3_MAIN_OFFSET_X_H 0x3200
175 #define EARTHQUAKE_N3_MAIN_OFFSET_X_L 0x3201
176 #define EARTHQUAKE_N3_MAIN_OFFSET_Y_H 0x3202
177 #define EARTHQUAKE_N3_MAIN_OFFSET_Y_L 0x3203
178 #define EARTHQUAKE_N3_MAIN_OFFSET_Z_H 0x3204
179 #define EARTHQUAKE_N3_MAIN_OFFSET_Z_L 0x3205
181 #define EARTHQUAKE_N3_MAIN_T_AVE_H 0x3206
182 #define EARTHQUAKE_N3_MAIN_T_AVE_L 0x3207
183 #define EARTHQUAKE_N3_MAIN_SI_H 0x3208
184 #define EARTHQUAKE_N3_MAIN_SI_L 0x3209
185 #define EARTHQUAKE_N3_MAIN_PGA_H 0x320A
186 #define EARTHQUAKE_N3_MAIN_PGA_L 0x320B
193 #define EARTHQUAKE_N4_MAIN_OFFSET_X_H 0x3300
194 #define EARTHQUAKE_N4_MAIN_OFFSET_X_L 0x3301
195 #define EARTHQUAKE_N4_MAIN_OFFSET_Y_H 0x3302
196 #define EARTHQUAKE_N4_MAIN_OFFSET_Y_L 0x3303
197 #define EARTHQUAKE_N4_MAIN_OFFSET_Z_H 0x3304
198 #define EARTHQUAKE_N4_MAIN_OFFSET_Z_L 0x3305
200 #define EARTHQUAKE_N4_MAIN_T_AVE_H 0x3306
201 #define EARTHQUAKE_N4_MAIN_T_AVE_L 0x3307
202 #define EARTHQUAKE_N4_MAIN_SI_H 0x3308
203 #define EARTHQUAKE_N4_MAIN_SI_L 0x3309
204 #define EARTHQUAKE_N4_MAIN_PGA_H 0x330A
205 #define EARTHQUAKE_N4_MAIN_PGA_L 0x330B
212 #define EARTHQUAKE_N5_MAIN_OFFSET_X_H 0x3400
213 #define EARTHQUAKE_N5_MAIN_OFFSET_X_L 0x3401
214 #define EARTHQUAKE_N5_MAIN_OFFSET_Y_H 0x3402
215 #define EARTHQUAKE_N5_MAIN_OFFSET_Y_L 0x3403
216 #define EARTHQUAKE_N5_MAIN_OFFSET_Z_H 0x3404
217 #define EARTHQUAKE_N5_MAIN_OFFSET_Z_L 0x3405
219 #define EARTHQUAKE_N5_MAIN_T_AVE_H 0x3406
220 #define EARTHQUAKE_N5_MAIN_T_AVE_L 0x3407
221 #define EARTHQUAKE_N5_MAIN_SI_H 0x3408
222 #define EARTHQUAKE_N5_MAIN_SI_L 0x3409
223 #define EARTHQUAKE_N5_MAIN_PGA_H 0x340A
224 #define EARTHQUAKE_N5_MAIN_PGA_L 0x340B
231 #define EARTHQUAKE_M1_MAIN_OFFSET_X_H 0x3500
232 #define EARTHQUAKE_M1_MAIN_OFFSET_X_L 0x3501
233 #define EARTHQUAKE_M1_MAIN_OFFSET_Y_H 0x3502
234 #define EARTHQUAKE_M1_MAIN_OFFSET_Y_L 0x3503
235 #define EARTHQUAKE_M1_MAIN_OFFSET_Z_H 0x3504
236 #define EARTHQUAKE_M1_MAIN_OFFSET_Z_L 0x3505
238 #define EARTHQUAKE_M1_MAIN_T_AVE_H 0x3506
239 #define EARTHQUAKE_M1_MAIN_T_AVE_L 0x3507
240 #define EARTHQUAKE_M1_MAIN_SI_H 0x3508
241 #define EARTHQUAKE_M1_MAIN_SI_L 0x3509
242 #define EARTHQUAKE_M1_MAIN_PGA_H 0x350A
243 #define EARTHQUAKE_M1_MAIN_PGA_L 0x350B
250 #define EARTHQUAKE_M2_MAIN_OFFSET_X_H 0x3600
251 #define EARTHQUAKE_M2_MAIN_OFFSET_X_L 0x3601
252 #define EARTHQUAKE_M2_MAIN_OFFSET_Y_H 0x3602
253 #define EARTHQUAKE_M2_MAIN_OFFSET_Y_L 0x3603
254 #define EARTHQUAKE_M2_MAIN_OFFSET_Z_H 0x3604
255 #define EARTHQUAKE_M2_MAIN_OFFSET_Z_L 0x3605
257 #define EARTHQUAKE_M2_MAIN_T_AVE_H 0x3606
258 #define EARTHQUAKE_M2_MAIN_T_AVE_L 0x3607
259 #define EARTHQUAKE_M2_MAIN_SI_H 0x3608
260 #define EARTHQUAKE_M2_MAIN_SI_L 0x3609
261 #define EARTHQUAKE_M2_MAIN_PGA_H 0x360A
262 #define EARTHQUAKE_M2_MAIN_PGA_L 0x360B
269 #define EARTHQUAKE_M3_MAIN_OFFSET_X_H 0x3700
270 #define EARTHQUAKE_M3_MAIN_OFFSET_X_L 0x3701
271 #define EARTHQUAKE_M3_MAIN_OFFSET_Y_H 0x3702
272 #define EARTHQUAKE_M3_MAIN_OFFSET_Y_L 0x3703
273 #define EARTHQUAKE_M3_MAIN_OFFSET_Z_H 0x3704
274 #define EARTHQUAKE_M3_MAIN_OFFSET_Z_L 0x3705
276 #define EARTHQUAKE_M3_MAIN_T_AVE_H 0x3706
277 #define EARTHQUAKE_M3_MAIN_T_AVE_L 0x3707
278 #define EARTHQUAKE_M3_MAIN_SI_H 0x3708
279 #define EARTHQUAKE_M3_MAIN_SI_L 0x3709
280 #define EARTHQUAKE_M3_MAIN_PGA_H 0x370A
281 #define EARTHQUAKE_M3_MAIN_PGA_L 0x370B
288 #define EARTHQUAKE_M4_MAIN_OFFSET_X_H 0x3800
289 #define EARTHQUAKE_M4_MAIN_OFFSET_X_L 0x3801
290 #define EARTHQUAKE_M4_MAIN_OFFSET_Y_H 0x3802
291 #define EARTHQUAKE_M4_MAIN_OFFSET_Y_L 0x3803
292 #define EARTHQUAKE_M4_MAIN_OFFSET_Z_H 0x3804
293 #define EARTHQUAKE_M4_MAIN_OFFSET_Z_L 0x3805
295 #define EARTHQUAKE_M4_MAIN_T_AVE_H 0x3806
296 #define EARTHQUAKE_M4_MAIN_T_AVE_L 0x3807
297 #define EARTHQUAKE_M4_MAIN_SI_H 0x3808
298 #define EARTHQUAKE_M4_MAIN_SI_L 0x3809
299 #define EARTHQUAKE_M4_MAIN_PGA_H 0x380A
300 #define EARTHQUAKE_M4_MAIN_PGA_L 0x380B
307 #define EARTHQUAKE_M5_MAIN_OFFSET_X_H 0x3900
308 #define EARTHQUAKE_M5_MAIN_OFFSET_X_L 0x3901
309 #define EARTHQUAKE_M5_MAIN_OFFSET_Y_H 0x3902
310 #define EARTHQUAKE_M5_MAIN_OFFSET_Y_L 0x3903
311 #define EARTHQUAKE_M5_MAIN_OFFSET_Z_H 0x3904
312 #define EARTHQUAKE_M5_MAIN_OFFSET_Z_L 0x3905
314 #define EARTHQUAKE_M5_MAIN_T_AVE_H 0x3906
315 #define EARTHQUAKE_M5_MAIN_T_AVE_L 0x3907
316 #define EARTHQUAKE_M5_MAIN_SI_H 0x3908
317 #define EARTHQUAKE_M5_MAIN_SI_L 0x3909
318 #define EARTHQUAKE_M5_MAIN_PGA_H 0x390A
319 #define EARTHQUAKE_M5_MAIN_PGA_L 0x390B
326 #define EARTHQUAKE_OFFSET_SET_X_H 0x4000
327 #define EARTHQUAKE_OFFSET_SET_X_L 0x4001
328 #define EARTHQUAKE_OFFSET_SET_Y_H 0x4002
329 #define EARTHQUAKE_OFFSET_SET_Y_L 0x4003
330 #define EARTHQUAKE_OFFSET_SET_Z_H 0x4004
331 #define EARTHQUAKE_OFFSET_SET_Z_L 0x4005
333 #define EARTHQUAKE_OFFSET_SET_T_AVE_H 0x4006
334 #define EARTHQUAKE_OFFSET_SET_T_AVE_L 0x4007
335 #define EARTHQUAKE_OFFSET_SET_MAX_X_H 0x4008
336 #define EARTHQUAKE_OFFSET_SET_MAX_X_L 0x4009
337 #define EARTHQUAKE_OFFSET_SET_MAX_Y_H 0x400A
338 #define EARTHQUAKE_OFFSET_SET_MAX_Y_L 0x400B
339 #define EARTHQUAKE_OFFSET_SET_MAX_Z_H 0x400C
340 #define EARTHQUAKE_OFFSET_SET_MAX_Z_L 0x400D
342 #define EARTHQUAKE_OFFSET_SET_MIN_X_H 0x400E
343 #define EARTHQUAKE_OFFSET_SET_MIN_X_L 0x400F
344 #define EARTHQUAKE_OFFSET_SET_MIN_Y_H 0x4010
345 #define EARTHQUAKE_OFFSET_SET_MIN_Y_L 0x4011
346 #define EARTHQUAKE_OFFSET_SET_MIN_Z_H 0x4012
347 #define EARTHQUAKE_OFFSET_SET_MIN_Z_L 0x4013
349 #define EARTHQUAKE_OFFSET_SET_AXIS 0x4014
356 #define EARTHQUAKE_OFFSET_RECENT_X_H 0x4100
357 #define EARTHQUAKE_OFFSET_RECENT_X_L 0x4101
358 #define EARTHQUAKE_OFFSET_RECENT_Y_H 0x4102
359 #define EARTHQUAKE_OFFSET_RECENT_Y_L 0x4103
360 #define EARTHQUAKE_OFFSET_RECENT_Z_H 0x4104
361 #define EARTHQUAKE_OFFSET_RECENT_Z_L 0x4105
363 #define EARTHQUAKE_OFFSET_RECENT_T_AVE_H 0x4106
364 #define EARTHQUAKE_OFFSET_RECENT_T_AVE_L 0x4107
366 #define EARTHQUAKE_OFFSET_RECENT_MAX_X_H 0x4108
367 #define EARTHQUAKE_OFFSET_RECENT_MAX_X_L 0x4109
368 #define EARTHQUAKE_OFFSET_RECENT_MAX_Y_H 0x410A
369 #define EARTHQUAKE_OFFSET_RECENT_MAX_Y_L 0x410B
370 #define EARTHQUAKE_OFFSET_RECENT_MAX_Z_H 0x410C
371 #define EARTHQUAKE_OFFSET_RECENT_MAX_Z_L 0x410D
373 #define EARTHQUAKE_OFFSET_RECENT_MIN_X_H 0x410E
374 #define EARTHQUAKE_OFFSET_RECENT_MIN_X_L 0x410F
375 #define EARTHQUAKE_OFFSET_RECENT_MIN_Y_H 0x4110
376 #define EARTHQUAKE_OFFSET_RECENT_MIN_Y_L 0x4111
377 #define EARTHQUAKE_OFFSET_RECENT_MIN_Z_H 0x4112
378 #define EARTHQUAKE_OFFSET_RECENT_MIN_Z_L 0x4113
380 #define EARTHQUAKE_OFFSET_RECENT_STATE 0x4114
387 #define EARTHQUAKE_SELFTEST_BEFORE_X_H 0x4200
388 #define EARTHQUAKE_SELFTEST_BEFORE_X_L 0x4201
389 #define EARTHQUAKE_SELFTEST_AFTER_X_H 0x4202
390 #define EARTHQUAKE_SELFTEST_AFTER_X_L 0x4203
391 #define EARTHQUAKE_SELFTEST_BEFORE_Y_H 0x4204
392 #define EARTHQUAKE_SELFTEST_BEFORE_Y_L 0x4205
393 #define EARTHQUAKE_SELFTEST_AFTER_Y_H 0x4206
394 #define EARTHQUAKE_SELFTEST_AFTER_Y_L 0x4207
395 #define EARTHQUAKE_SELFTEST_BEFORE_Z_H 0x4208
396 #define EARTHQUAKE_SELFTEST_BEFORE_Z_L 0x4209
397 #define EARTHQUAKE_SELFTEST_AFTER_Z_H 0x420A
398 #define EARTHQUAKE_SELFTEST_AFTER_Z_L 0x420B
400 #define EARTHQUAKE_SELFTEST_T_AVE_H 0x420C
401 #define EARTHQUAKE_SELFTEST_T_AVE_L 0x420D
403 #define EARTHQUAKE_SELFTEST_ERROR 0x420E
597 #endif // _EARTHQUAKE_H_
digital_in_t int2
Definition: earthquake.h:422
void earthquake_clear_mememory(earthquake_t *ctx)
Clear Memory function.
pin_name_t int1
Definition: earthquake.h:453
pin_name_t int2
Definition: earthquake.h:452
Click configuration structure definition.
Definition: earthquake.h:442
i2c_master_t i2c
Definition: earthquake.h:431
EARTHQUAKE_RETVAL earthquake_init(earthquake_t *ctx, earthquake_cfg_t *cfg)
Initialization function.
digital_in_t int1
Definition: earthquake.h:423
void earthquake_default_cfg(earthquake_t *ctx)
Click Default Configuration function.
uint8_t i2c_address
Definition: earthquake.h:458
pin_name_t st
Definition: earthquake.h:451
uint8_t slave_address
Definition: earthquake.h:435
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:75
Click ctx object definition.
Definition: earthquake.h:418
pin_name_t scl
Definition: earthquake.h:446
uint8_t i2c_speed
Definition: earthquake.h:457
uint16_t earthquake_read_si(earthquake_t *ctx)
Read SI function.
digital_out_t st
Definition: earthquake.h:427
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:447