CaryCoders
/
demo_SX1276_standalone
standalone sx1276 demo program
Fork of SX1276_GPS by
main.cpp@21:c44cfd3259c0, 2014-09-02 (annotated)
- Committer:
- vtraveller
- Date:
- Tue Sep 02 07:12:23 2014 +0000
- Revision:
- 21:c44cfd3259c0
- Parent:
- 20:93c70a1869ee
- Child:
- 22:dd8197db4478
Changed to using a shared I2C object
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wim | 0:88d87b1c1f8b | 1 | #include "mbed.h" |
vtraveller | 13:9641bc42db92 | 2 | |
vtraveller | 4:d70e37f6c6bd | 3 | #include "Adafruit_RGBLCDShield.h" |
vtraveller | 10:3fcab08717fc | 4 | #include "RTclock.h" |
vtraveller | 10:3fcab08717fc | 5 | |
vtraveller | 10:3fcab08717fc | 6 | #include "DateModule.h" |
vtraveller | 10:3fcab08717fc | 7 | #include "TempModule.h" |
vtraveller | 10:3fcab08717fc | 8 | #include "TimeModule.h" |
vtraveller | 10:3fcab08717fc | 9 | #include "TitleModule.h" |
vtraveller | 17:731a47339cb8 | 10 | #include "SyncModule.h" |
wim | 0:88d87b1c1f8b | 11 | |
vtraveller | 13:9641bc42db92 | 12 | #include "MenuManager.h" |
vtraveller | 10:3fcab08717fc | 13 | |
vtraveller | 13:9641bc42db92 | 14 | //Serial cPC(SERIAL_TX, SERIAL_RX); |
vtraveller | 3:ed09f95739df | 15 | |
vtraveller | 3:ed09f95739df | 16 | int main() |
vtraveller | 21:c44cfd3259c0 | 17 | { |
vtraveller | 21:c44cfd3259c0 | 18 | // Share the I2C across multiple devices |
vtraveller | 21:c44cfd3259c0 | 19 | I2C cI2C(I2C_SDA, I2C_SCL); // D3, D6 |
vtraveller | 21:c44cfd3259c0 | 20 | cI2C.frequency(400000); // I2C can handle two different frequencies - switch to high speed if asked |
vtraveller | 21:c44cfd3259c0 | 21 | |
vtraveller | 21:c44cfd3259c0 | 22 | MCP23017 cMCP23017(cI2C, 0x40); |
vtraveller | 21:c44cfd3259c0 | 23 | //MCP23017 cMCP23017(cI2C, 0x4E, true); |
vtraveller | 17:731a47339cb8 | 24 | |
vtraveller | 20:93c70a1869ee | 25 | Adafruit_RGBLCDShield cLCD(cMCP23017); |
vtraveller | 20:93c70a1869ee | 26 | //Adafruit_RGBLCDShield cLCD(cMCP23017,1<<0,1<<1, 1<< 2, 1<<4, 1<<5, 1<<6, 1<<7); |
vtraveller | 20:93c70a1869ee | 27 | |
vtraveller | 21:c44cfd3259c0 | 28 | RTclock cClock(cI2C, RTclock::eDS3231); |
vtraveller | 13:9641bc42db92 | 29 | |
vtraveller | 13:9641bc42db92 | 30 | // Spin up RTC |
vtraveller | 19:72c02acb601d | 31 | cClock.mapTime(); |
vtraveller | 17:731a47339cb8 | 32 | |
vtraveller | 10:3fcab08717fc | 33 | // Set up display modules |
vtraveller | 10:3fcab08717fc | 34 | Module * aModules[] = |
vtraveller | 10:3fcab08717fc | 35 | { |
vtraveller | 21:c44cfd3259c0 | 36 | new TempModule(cLCD,cI2C,0x18), |
vtraveller | 17:731a47339cb8 | 37 | new TimeModule(cLCD,cClock), |
vtraveller | 20:93c70a1869ee | 38 | new DateModule(cLCD,cClock), |
vtraveller | 19:72c02acb601d | 39 | new SyncModule(cLCD,cClock), |
vtraveller | 20:93c70a1869ee | 40 | new TitleModule(cLCD), |
vtraveller | 10:3fcab08717fc | 41 | }; |
vtraveller | 10:3fcab08717fc | 42 | |
vtraveller | 13:9641bc42db92 | 43 | // Set up the menu manager |
vtraveller | 20:93c70a1869ee | 44 | MenuManager cMenuManager(aModules,_countof(aModules),cLCD,16,2); |
vtraveller | 20:93c70a1869ee | 45 | //MenuManager cMenuManager(aModules,_countof(aModules),cLCD,20,4); |
vtraveller | 13:9641bc42db92 | 46 | |
vtraveller | 13:9641bc42db92 | 47 | // Start menu manager loop |
vtraveller | 13:9641bc42db92 | 48 | cMenuManager.loop(); |
wim | 0:88d87b1c1f8b | 49 | } |