Lizzy project

Dependencies:   aconno_I2C Lis2dh12 adc52832_common aconno_SEGGER_RTT

Committer:
dbartolovic
Date:
Thu Sep 20 07:34:35 2018 +0000
Branch:
testing-ignore
Revision:
24:7539258b015c
Not a branch to be ignored, added proj_config, changed logic.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dbartolovic 24:7539258b015c 1
dbartolovic 24:7539258b015c 2 #include "mbed.h"
dbartolovic 24:7539258b015c 3 #include "Lis2dh12.h"
dbartolovic 24:7539258b015c 4 #include "Lis2dh12_regs.h"
dbartolovic 24:7539258b015c 5 #include "bspAcc.h"
dbartolovic 24:7539258b015c 6 #include "main.h"
dbartolovic 24:7539258b015c 7
dbartolovic 24:7539258b015c 8
dbartolovic 24:7539258b015c 9 extern DigitalOut AccVcc;
dbartolovic 24:7539258b015c 10
dbartolovic 24:7539258b015c 11 extern Lis2dh12 mems;
dbartolovic 24:7539258b015c 12
dbartolovic 24:7539258b015c 13 extern InterruptIn INT1;
dbartolovic 24:7539258b015c 14
dbartolovic 24:7539258b015c 15 void init_acc()
dbartolovic 24:7539258b015c 16 {
dbartolovic 24:7539258b015c 17 INT1.disable_irq();
dbartolovic 24:7539258b015c 18 //__disable_irq();
dbartolovic 24:7539258b015c 19
dbartolovic 24:7539258b015c 20 AccVcc = 1;
dbartolovic 24:7539258b015c 21
dbartolovic 24:7539258b015c 22 wait_ms(POWER_UP_DELAY_MS);
dbartolovic 24:7539258b015c 23
dbartolovic 24:7539258b015c 24 //__enable_irq();
dbartolovic 24:7539258b015c 25
dbartolovic 24:7539258b015c 26 mems.setMode(LOW_POWER);
dbartolovic 24:7539258b015c 27 //mems.setMode(HIGH_RES);
dbartolovic 24:7539258b015c 28 mems.enableAxes(X_axis);
dbartolovic 24:7539258b015c 29 mems.enableAxes(Y_axis);
dbartolovic 24:7539258b015c 30 mems.enableAxes(Z_axis);
dbartolovic 24:7539258b015c 31 mems.setODR(ACC_ODR_MODE);
dbartolovic 24:7539258b015c 32 //mems.setScale(_16g);
dbartolovic 24:7539258b015c 33 mems.setScale(_8g);
dbartolovic 24:7539258b015c 34 mems.int1Setup(0x40); // IntActivity 1 driven to INT1 pad
dbartolovic 24:7539258b015c 35 mems.int1Latch(0x01); // Enable int1 latch
dbartolovic 24:7539258b015c 36 mems.int1Threshold(INT1_THRESHOLD);
dbartolovic 24:7539258b015c 37 mems.int1Duration(INT1_DUR);
dbartolovic 24:7539258b015c 38 mems.int1Config(0x2A); // Enable XHigh, YHigh and ZHigh
dbartolovic 24:7539258b015c 39
dbartolovic 24:7539258b015c 40 //__enable_irq();
dbartolovic 24:7539258b015c 41 INT1.enable_irq();
dbartolovic 24:7539258b015c 42 }