mangue baja 1st working logger on stm32
Dependencies: LSM6DS3 DebouncedInterrupt
Diff: main.cpp
- Revision:
- 5:122b9fd3df1a
- Parent:
- 3:15d63b793f7b
--- a/main.cpp Fri Jan 10 11:27:43 2020 +0000 +++ b/main.cpp Wed Sep 21 21:23:51 2022 +0000 @@ -17,6 +17,7 @@ #include "SDBlockDevice.h" #include "FATFileSystem.h" #include "LSM6DS3.h" +#include "DebouncedInterrupt.h" #define BUFFER_SIZE 200 // Acquisition buffer #define SAVE_WHEN 50 // Number of packets to save (fail safe) @@ -32,10 +33,11 @@ FATFileSystem fileSystem("sd"); DigitalOut warning(PA_15); // When device is ready, led is permanently OFF DigitalOut logging(PA_12); // When data is beign acquired, led is ON -InterruptIn start(PB_4,PullUp); // Press button to start/stop acquisition +//InterruptIn start(PB_4,PullUp); // Press button to start/stop acquisition +DebouncedInterrupt start(PB_4); InterruptIn freq_chan1(PB_5,PullUp); // Frequency channel 1 InterruptIn freq_chan2(PB_6,PullUp); // Frequency channel 2 -AnalogIn pot0(PA_5), +AnalogIn pot0(PB_1), pot1(PB_0), pot2(PA_7); @@ -127,7 +129,8 @@ pc.printf("\r\nDebug 4\r\n"); pc.printf("\r\nNum_files = %d\r\n", num_files); - start.fall(&toggle_logging); // Attach start button ISR + //start.fall(&toggle_logging); // Attach start button ISR + start.attach(&toggle_logging, IRQ_FALL, 500, true); while(!running) // Wait button press { @@ -222,9 +225,12 @@ } } - /* Software debounce for start button */ + /* Software debounce for start button if((t.read_ms() > 10) && (t.read_ms() < 1000)) + { + start.fall(toggle_logging); + }*/ } /* Reset device if start button is pressed while logging */ @@ -267,5 +273,5 @@ void toggle_logging() { running = !running; - start.fall(NULL); + //start.fall(NULL); }