Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MPU9250_SPI SDFileSystem XBeeLib
Diff: event.cpp
- Revision:
- 26:4bc56ce08d15
- Parent:
- 25:86137c182a17
- Child:
- 27:c4b2ce6fa5b8
--- a/event.cpp Fri Oct 27 23:49:44 2017 +0000
+++ b/event.cpp Wed Nov 08 10:59:01 2017 +0000
@@ -7,82 +7,42 @@
* Date: 12-Oct-2017
* Version: V0.1
*/
-
-#include "event.h"
-
-void CheckInputBuffer(void)
-{
- // Check for Received Frames
- XBee.process_rx_frames();
-}
-
-void ReadIMUData(void)
-{
- imu.read_acc();
-
- //PC.printf("Time: %d ms:\t%d,%10.3f,%10.3f,%10.3f\n",
- fprintf(fp, "Time: %d us:\t%d,%10.3f,%10.3f,%10.3f\n",
- time_stamp.read_us(),
- micro.read_u16(),
- imu.accelerometer_data[0],
- imu.accelerometer_data[1],
- imu.accelerometer_data[2]);
-}
-
-void ReadMicroData(void)
-{
- // Reading the analog input (Microphone)
- // array = micro.read_u16();
-}
-
-/*
-void print_stinrg(char c = '*') {
- pc.putc(c);
-}
-*/
+//-----------------------------------------------------------------
-/*
-void print_event(void const *argv, int i) {
- pc.printf("%d ",i);
- pc.printf((const char*)argv);
- pc.printf("\r\n");
-}
-*/
-
-/*
-void blink_event(DigitalOut pin){
- pin = 1;
- }
-*/
+//-----------------------------------------------------------------
+// Includes
+#include "event.h"
+//-----------------------------------------------------------------
-/*
-void readIMU(){
- //imu.resetMPU9250();
- PC.printf("%d\r\r ", time_stamp.read());
-}*/
-
-/*void gayEvent(){
- PC.printf("Is Michi schwul? (1 - true, 0 - false): ");
- PC.printf("%d", 1);
- PC.printf("\r\n");
-}*/
-/*
-void print_event(void const *argv, int i)
+//-----------------------------------------------------------------
+void ReceiveXBee(void)
{
- pc.printf("%d ",i);
- pc.printf((const char*)argv);
- pc.printf("\r\n");
+ XBee.process_rx_frames(); // Check for Received Frames
}
//-----------------------------------------------------------------
-*/
-//-----------------------------------------------------------------
-/*void blink_event(DigitalOut pin){
- pin = !pin;
-}*/
-//-----------------------------------------------------------------
//-----------------------------------------------------------------
-/*void println_event(){
- pc.printf("Arroz, feijao e batata\r\n");
-}*/
+void ReadIMU(void)
+{
+ Time_Data = TimeStamp.read_ms(); // Read TimeStamp Data
+
+ if (Time_Data <= Requested_Time * 1000) { // Check Time Elapsed
+ imu.read_all();
+
+ Data_Storage_MIC[writePointer_MIC++] = micro.read_u16(); // Store Microphone Data
+ Data_Storage[writePointer++] = (int)(1000*imu.accelerometer_data[2]); // Store Z-Axis Accelerometer Data
+ Data_Storage[writePointer++] = (int)(1000*imu.accelerometer_data[1]); // Store Y-Axis Accelerometer Data
+ Data_Storage[writePointer++] = (int)(1000*imu.accelerometer_data[0]); // Store X-Axis Accelerometer Data
+ Data_Storage[writePointer++] = Time_Data; // Store Time Data
+ } else {
+ Ticker_IMU.detach(); // Detach Timer to Stop "ReadIMU"
+ TimeStamp.stop(); // Stop TimeStamp
+
+ ReadIMU_Flag = 1;
+ PC.printf(" Done!\n");
+ PC.printf("Writing SD-Card ...");
+ }
+}
+//-----------------------------------------------------------------
+
//-----------------------------------------------------------------
\ No newline at end of file

