minimizing power on C027
Dependencies: C027_Support mbed
Fork of PowerControl by
main.cpp@1:21401fc44382, 2015-05-27 (annotated)
- Committer:
- coyotebush
- Date:
- Wed May 27 05:59:21 2015 +0000
- Revision:
- 1:21401fc44382
- Parent:
- 0:9bd5f1bdb845
Test C027 features
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
no2chem | 0:9bd5f1bdb845 | 1 | #include "mbed.h" |
no2chem | 0:9bd5f1bdb845 | 2 | #include "PowerControl/PowerControl.h" |
no2chem | 0:9bd5f1bdb845 | 3 | #include "PowerControl/EthernetPowerControl.h" |
coyotebush | 1:21401fc44382 | 4 | #include "MDM.h" |
coyotebush | 1:21401fc44382 | 5 | #include "GPS.h" |
coyotebush | 1:21401fc44382 | 6 | |
coyotebush | 1:21401fc44382 | 7 | DigitalOut led(LED); |
coyotebush | 1:21401fc44382 | 8 | void hello() { |
coyotebush | 1:21401fc44382 | 9 | led = !led; |
coyotebush | 1:21401fc44382 | 10 | } |
no2chem | 0:9bd5f1bdb845 | 11 | |
no2chem | 0:9bd5f1bdb845 | 12 | int main() { |
coyotebush | 1:21401fc44382 | 13 | printf("Starting\r\n"); |
coyotebush | 1:21401fc44382 | 14 | wait(5); |
coyotebush | 1:21401fc44382 | 15 | printf("Modem on\r\n"); |
coyotebush | 1:21401fc44382 | 16 | MDMSerial mdm; |
coyotebush | 1:21401fc44382 | 17 | wait(5); |
coyotebush | 1:21401fc44382 | 18 | printf("GPS on\r\n"); |
coyotebush | 1:21401fc44382 | 19 | GPSI2C gps; |
coyotebush | 1:21401fc44382 | 20 | wait(5); |
coyotebush | 1:21401fc44382 | 21 | printf("PHY off\r\n"); |
coyotebush | 1:21401fc44382 | 22 | PHY_PowerDown(); |
coyotebush | 1:21401fc44382 | 23 | wait(5); |
coyotebush | 1:21401fc44382 | 24 | printf("Modem off\r\n"); |
coyotebush | 1:21401fc44382 | 25 | mdm.powerOff(); |
coyotebush | 1:21401fc44382 | 26 | wait(5); |
coyotebush | 1:21401fc44382 | 27 | printf("GPS off\r\n"); |
coyotebush | 1:21401fc44382 | 28 | gps.powerOff(); |
coyotebush | 1:21401fc44382 | 29 | printf("Sleeping\r\n"); |
coyotebush | 1:21401fc44382 | 30 | Timeout t; |
coyotebush | 1:21401fc44382 | 31 | t.attach(&hello, 5.0f); |
coyotebush | 1:21401fc44382 | 32 | Sleep(); |
coyotebush | 1:21401fc44382 | 33 | printf("Woke up\r\n"); |
coyotebush | 1:21401fc44382 | 34 | while (true); |
no2chem | 0:9bd5f1bdb845 | 35 | } |