mbed Weather Platform firmware http://mbed.org/users/okini3939/notebook/mbed-weather-platform-firmware/
Dependencies: EthernetNetIf SDHCFileSystem I2CLEDDisp Agentbed NTPClient_NetServices mbed BMP085 HTTPClient ConfigFile I2CLCD
Diff: conf.cpp
- Revision:
- 11:c6356e5949cd
- Parent:
- 10:848a2205aed1
- Child:
- 14:ee6cc1632166
--- a/conf.cpp Sun Feb 27 13:39:45 2011 +0000 +++ b/conf.cpp Thu Mar 17 14:13:42 2011 +0000 @@ -13,6 +13,10 @@ extern I2C i2c; extern I2CLCD *lcd; extern I2CLEDDisp *leddisp; +extern AnalogIn *aimoist; +extern InterruptIn *intcounter; + +void int_counter(); char* chop (char *s) { int i; @@ -313,7 +317,7 @@ } if (cfg.getValue("LCD_MESG", conf.lcd_mesg, sizeof(conf.lcd_mesg))) { chop(conf.lcd_mesg); - lcd = new I2CLCD(i2c, lcdtype, lcdconf); + lcd = new I2CLCD(i2c, I2CLCD_ADDR, lcdtype, lcdconf); } if (cfg.getValue("LEDDISP_MESG", conf.leddisp_mesg, sizeof(conf.leddisp_mesg))) { chop(conf.leddisp_mesg); @@ -324,6 +328,23 @@ xbee.baud(atoi(chop(buf))); } + if (cfg.getValue("INPUT", buf, sizeof(buf))) { + conf.inputtype = (enum eINPUTTYPE)atoi(chop(buf)); + } + if (cfg.getValue("INPUT", buf, sizeof(buf))) { + conf.inputtype = (enum eINPUTTYPE)atoi(chop(buf)); + } + if (conf.inputtype == INPUT_FALL) { + intcounter = new InterruptIn(p18); + intcounter->fall(&int_counter); + } else + if (conf.inputtype == INPUT_RISE) { + intcounter = new InterruptIn(p18); + intcounter->rise(&int_counter); + } else { + aimoist = new AnalogIn(p18); + } + for (i = 0; i < CF_ACTION_NUM; i ++) { sprintf(key, "ACTION[%d]", i); if (cfg.getValue(key, buf, sizeof(buf))) {