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: Adafruit_GFX_128x64 DS3231 PinDetect SDFileSystem USBDevice mbed RealtimeMath MODSERIAL
Revision 20:294eaeaf2ebb, committed 2014-06-05
- Comitter:
- ellingjp
- Date:
- Thu Jun 05 20:06:41 2014 +0000
- Parent:
- 19:4f4f7bc4a3fb
- Child:
- 22:9350752f5414
- Commit message:
- Couple bug fixes;
Changed in this revision
--- a/log_data.cpp Thu Jun 05 19:23:53 2014 +0000
+++ b/log_data.cpp Thu Jun 05 20:06:41 2014 +0000
@@ -15,13 +15,9 @@
FILE *peakFile;
/* Returns true if logging was successfully initialized, false otherwise */
-bool log_init(char* timestamp) {
-// char dataLog[33] = "/sd/00-00-0000 00:00:00 data.log";
-// if(true) // TODO: checkIf RTC is initialized properly
-// {
-// strncpy(&dataLog[4],timestamp,19);
-// }
- sd.disk_initialize();
+bool log_init() {
+ PC_PRINTLN("Initializing logging...");
+
accelFile = fopen(ACCEL_LOG, "w");
if (accelFile == NULL) {
PC_PRINTLNF("SD card initialization error: Failed to open %s", ACCEL_LOG);
--- a/log_data.h Thu Jun 05 19:23:53 2014 +0000 +++ b/log_data.h Thu Jun 05 20:06:41 2014 +0000 @@ -6,7 +6,7 @@ #define SPLIT_LOG "/sd/splits.log" #define PEAK_LOG "/sd/peaks.log" -bool log_init(char* timestamp); +bool log_init(); bool log_data(VectorInt16 *data); bool log_data(int split); bool log_close();
--- a/main.cpp Thu Jun 05 19:23:53 2014 +0000
+++ b/main.cpp Thu Jun 05 20:06:41 2014 +0000
@@ -11,7 +11,7 @@
#include "SystemTime.h"
#include "sync.h"
#include "pins.h"
-#include "DS3231.h"
+//#include "DS3231.h"
// Capture button stuff
#define PIN_DETECT_SAMPLE_PERIOD_uS 20000 // 20 ms sample period
@@ -23,7 +23,7 @@
Adafruit_SSD1306 oled(spi0, P0_11, P0_12, P0_13); // DC, RST, CS
#endif
-DS3231 rtc(I2C_SDA, I2C_SCL);
+// DS3231 rtc(I2C_SDA, I2C_SCL);
// Mode button
PinDetect captureButton(P0_16, PullUp);
@@ -80,7 +80,7 @@
} else if (State == CAPTURE) {
OLED_PRINTP("Starting capture...", 0, 0);
OLED_PRINTP("Init SD card...", 0, 10);
- log_init(rtc.getTimestamp());
+ log_init();
OLED_PRINTP("Init peak detect...", 0, 10);
process_init();
OLED_PRINTP("Init data receipt...", 0, 10);
@@ -103,7 +103,7 @@
OLED_PRINTPF("%1d", min, 0, 40);
OLED_PRINTPF("%02d", sec, 5, 40);
- oled.drawPixel(14, 44, 0x1);
+ OLED_DRAWPIXEL(14, 44, 0x1);
OLED_PRINTPF("%02d", hund, 15, 40);
log_data(split);
}
--- a/main.h Thu Jun 05 19:23:53 2014 +0000
+++ b/main.h Thu Jun 05 20:06:41 2014 +0000
@@ -1,11 +1,13 @@
#define SYNC_HOLD_TIME_MS 1000
#define DEBOUNCE_TIME_MS 200
-//#define USE_OLED
+#define USE_OLED
#ifdef USE_OLED
#define OLED_SETCURS(xpos,ypos) oled.setCursor(xpos,ypos);
#define OLED_CLEAR() oled.clearDisplay();
+ #define OLED_DRAWPIXEL(x,y,color) oled.drawPixel(x, y, color);
+
#define OLED_PRINT(x) oled.printf("%s", x); oled.display();
#define OLED_PRINTF(x,y) oled.printf(x, y); oled.display();
#define OLED_PRINTLN(x) oled.printf("%s\r\n", x); oled.display();
@@ -24,6 +26,8 @@
#define OLED_SETCURS(xpos,ypos)
#define OLED_CLEAR()
+ #define OLED_DRAWPIXEL(x, y, color)
+
#define OLED_PRINT(x)
#define OLED_PRINTF(x,y)
#define OLED_PRINTLN(x)
--- a/receive_data.cpp Thu Jun 05 19:23:53 2014 +0000
+++ b/receive_data.cpp Thu Jun 05 20:06:41 2014 +0000
@@ -95,4 +95,6 @@
DIE(DMP_ERROR_RATE);
return false;
}
+
+ PC_PRINTLN("Receive init success, capturing data...");
}
\ No newline at end of file