mbed Weather Platform firmware http://mbed.org/users/okini3939/notebook/mbed-weather-platform-firmware/

Dependencies:   ChaNFSSD EthernetNetIf I2CLEDDisp Agentbed ChaNFSUSB ILinterpreter mbed BMP085 WeatherMeters ConfigFile ChaNFS I2CLCD

Revision:
1:6c7141895545
Parent:
0:bdb53686c194
Child:
2:a3e5edf84f74
--- a/file.cpp	Mon Jul 04 15:16:45 2011 +0000
+++ b/file.cpp	Sun Jul 10 15:36:46 2011 +0000
@@ -1,3 +1,13 @@
+/*
+ * Weather Station - mbed Weather Platform
+ * Copyright (c) 2011 Hiroshi Suga
+ * Released under the MIT License: http://mbed.org/license/mit
+ */
+
+/** @file
+ * @brief Weather Station
+ */
+
 #include "mbed.h"
 #include "weather.h"
 #include "SDHCFileSystem.h"
@@ -7,7 +17,7 @@
 static SDFileSystem sd(p5, p6, p7, p8, "sd");
 static LocalFileSystem *local;
 static MSCFileSystem *usb;
-static DigitalIn sd_cd(p21);
+static DigitalIn sd_ins(p27);
 ConfigFile cfg;
 static char filename[30] = "";
 
@@ -15,6 +25,9 @@
     FILE *fp;
 
     if (filename[0] == 0) return 0;
+#ifdef USE_SD_INS
+    if (sd_ins != 0) return -1;
+#endif
 
     LED_FILE_ON;
     fp = fopen(filename, "a");
@@ -34,6 +47,7 @@
     char buf[128], buf2[10] = "";
     FILE *fp;
 
+
     if (cfg.getValue("FILE", buf, sizeof(buf))) {
 
         if (strncmp(buf, "SD", 2) == 0) {
@@ -73,9 +87,17 @@
 
 int init_conf () {
 
+#ifdef USE_SD_INS
+    sd_ins.mode(PullUp);
+#endif
+
     // load config
     LED_FILE_ON;
+#ifdef USE_SD_INS
+    if (sd_ins == 0 && cfg.read("/sd/" CONFIG_FILE)) {
+#else
     if (cfg.read("/sd/" CONFIG_FILE)) {
+#endif
         // from sd
         
         LED_FILE_OFF;