A collection of Analog Devices drivers for the mbed platform
For additional information check out the mbed page of the Analog Devices wiki: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
Diff: examples/drvdiag/driver_wrapper/adxl362_diag.cpp
- Revision:
- 21:a8023e5e97be
- Parent:
- 19:fb92949e59c9
--- a/examples/drvdiag/driver_wrapper/adxl362_diag.cpp Tue May 17 15:15:19 2016 +0300 +++ b/examples/drvdiag/driver_wrapper/adxl362_diag.cpp Tue May 17 18:15:28 2016 +0300 @@ -136,6 +136,38 @@ pc.printf("fifo scan - %x ", data); } +void ADXL362_Diag::intinit(void) +{ + + dut.reset(); + pc.printf("adxl362 reset\r\n"); + wait_ms(500); + dut.set_activity_threshold(ACT_VAL); + dut.set_activity_time(ACT_TIMER / 10); + + dut.set_inactivity_threshold(INACT_VAL); + dut.set_inactivity_time(INACT_TIMER); + dut.set_act_inact_ctl_reg(0x3f); + + pc.printf("adxl362 set activity/inactivity\r\n"); + + dut.disable_interrupt1(); + dut.set_interrupt1_pin(D2, 0x40, &rising_adxl362, &falling_adxl362); + + awake = true; + + pc.printf("adxl362 set interrupt\r\n"); + dut.enable_interrupt1(); + dut.set_mode(ADXL362::MEASUREMENT); + pc.printf("adxl362 measurement started\r\n"); +} + +void ADXL362_Diag::checkawake(void) +{ + if(awake) pc.printf("awaken"); + else pc.printf("asleep"); +} + void rising_adxl362() { awake = true;