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:
- 10:848a2205aed1
- Parent:
- 9:8c63e4f3edab
- Child:
- 11:c6356e5949cd
--- a/conf.cpp Tue Feb 22 14:40:11 2011 +0000 +++ b/conf.cpp Sun Feb 27 13:39:45 2011 +0000 @@ -4,10 +4,15 @@ #include "mbed.h" #include "conf.h" #include "ConfigFile.h" +#include "I2CLEDDisp.h" +#include "I2CLCD.h" -extern struct Serial xbee; -extern struct Config conf; +extern Serial xbee; +extern Config conf; extern float pres, temp, humi, light, anemo, vane, rain, uv, moist, temp2; +extern I2C i2c; +extern I2CLCD *lcd; +extern I2CLEDDisp *leddisp; char* chop (char *s) { int i; @@ -220,7 +225,9 @@ ConfigFile cfg; char buf[80], key[20]; int ip0, ip1, ip2, ip3; - + enum I2CLCDType lcdtype = LCD16x2; + enum I2CLCDConfig lcdconf = LCDCFG_3V; + conf.ipaddr = IpAddr(0, 0, 0, 0); conf.netmask = IpAddr(255, 255, 255, 0); conf.gateway = IpAddr(0, 0, 0, 0); @@ -237,6 +244,8 @@ conf.stations_id[0] = 0; conf.stations_pin[0] = 0; conf.snmp_commname[0] = 0; + conf.leddisp_mesg[0] = 0; + conf.lcd_mesg[0] = 0; if (! cfg.read(file)) { return -1; @@ -296,6 +305,21 @@ cfg.getValue("SNMP_COMMNAME", conf.snmp_commname, sizeof(conf.snmp_commname)); chop(conf.snmp_commname); + if (cfg.getValue("LCD_TYPE", buf, sizeof(buf))) { + lcdtype = (enum I2CLCDType)atoi(chop(buf)); + } + if (cfg.getValue("LCD_CONF", buf, sizeof(buf))) { + lcdconf = (enum I2CLCDConfig)atoi(chop(buf)); + } + if (cfg.getValue("LCD_MESG", conf.lcd_mesg, sizeof(conf.lcd_mesg))) { + chop(conf.lcd_mesg); + lcd = new I2CLCD(i2c, lcdtype, lcdconf); + } + if (cfg.getValue("LEDDISP_MESG", conf.leddisp_mesg, sizeof(conf.leddisp_mesg))) { + chop(conf.leddisp_mesg); + leddisp = new I2CLEDDisp(i2c); + } + if (cfg.getValue("XBEE", buf, sizeof(buf))) { xbee.baud(atoi(chop(buf))); }