Version one of final code
Dependencies: ARCH_GPRS_V2_HW Blinker GPRSInterface HTTPClient_GPRS SDFileSystem USBDevice mbed RTC_WorkingLibrary
Fork of finalV1 by
SLEEP/ARCH_GPRS_Sleep.h@0:a2a4d0d432b3, 2015-04-16 (annotated)
- Committer:
- mbotkinl
- Date:
- Thu Apr 16 19:46:40 2015 +0000
- Revision:
- 0:a2a4d0d432b3
Code from Micah and Z
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbotkinl | 0:a2a4d0d432b3 | 1 | #ifndef __ARCH_GPRS_SLEEP_H__ |
mbotkinl | 0:a2a4d0d432b3 | 2 | #define __ARCH_GPRS_SLEEP_H__ |
mbotkinl | 0:a2a4d0d432b3 | 3 | |
mbotkinl | 0:a2a4d0d432b3 | 4 | |
mbotkinl | 0:a2a4d0d432b3 | 5 | #define WDTCLK_SRC_IRC_OSC 0 |
mbotkinl | 0:a2a4d0d432b3 | 6 | #define WDTCLK_SRC_WDT_OSC 1 |
mbotkinl | 0:a2a4d0d432b3 | 7 | |
mbotkinl | 0:a2a4d0d432b3 | 8 | #define WDEN (0x1<<0) |
mbotkinl | 0:a2a4d0d432b3 | 9 | #define WDRESET (0x1<<1) |
mbotkinl | 0:a2a4d0d432b3 | 10 | #define WDTOF (0x1<<2) |
mbotkinl | 0:a2a4d0d432b3 | 11 | #define WDINT (0x1<<3) |
mbotkinl | 0:a2a4d0d432b3 | 12 | #define WDPROTECT (0x1<<4) |
mbotkinl | 0:a2a4d0d432b3 | 13 | #define WDLOCKCLK (0x1<<5) |
mbotkinl | 0:a2a4d0d432b3 | 14 | |
mbotkinl | 0:a2a4d0d432b3 | 15 | #define WDT_FEED_VALUE 0x003FFFFF |
mbotkinl | 0:a2a4d0d432b3 | 16 | |
mbotkinl | 0:a2a4d0d432b3 | 17 | #define WINDOW_MODE 0 |
mbotkinl | 0:a2a4d0d432b3 | 18 | #define PROTECT_MODE 0 |
mbotkinl | 0:a2a4d0d432b3 | 19 | #define WATCHDOG_RESET 1 |
mbotkinl | 0:a2a4d0d432b3 | 20 | #define WDLOCK_MODE 0 |
mbotkinl | 0:a2a4d0d432b3 | 21 | #define LOCKCLK_MODE 0 |
mbotkinl | 0:a2a4d0d432b3 | 22 | |
mbotkinl | 0:a2a4d0d432b3 | 23 | #define MODE_SLEEP 0 |
mbotkinl | 0:a2a4d0d432b3 | 24 | #define MODE_WORKING 1 |
mbotkinl | 0:a2a4d0d432b3 | 25 | |
mbotkinl | 0:a2a4d0d432b3 | 26 | class Stalker3_0_sleep{ |
mbotkinl | 0:a2a4d0d432b3 | 27 | |
mbotkinl | 0:a2a4d0d432b3 | 28 | public: |
mbotkinl | 0:a2a4d0d432b3 | 29 | |
mbotkinl | 0:a2a4d0d432b3 | 30 | int workMode; // working mode, sleep or working |
mbotkinl | 0:a2a4d0d432b3 | 31 | |
mbotkinl | 0:a2a4d0d432b3 | 32 | public: |
mbotkinl | 0:a2a4d0d432b3 | 33 | |
mbotkinl | 0:a2a4d0d432b3 | 34 | void gotoSleep(); // goto sleep mode, untill wdt interrupt |
mbotkinl | 0:a2a4d0d432b3 | 35 | void wdtClkSetup(unsigned long clksrc); |
mbotkinl | 0:a2a4d0d432b3 | 36 | |
mbotkinl | 0:a2a4d0d432b3 | 37 | public: |
mbotkinl | 0:a2a4d0d432b3 | 38 | |
mbotkinl | 0:a2a4d0d432b3 | 39 | void init(); |
mbotkinl | 0:a2a4d0d432b3 | 40 | |
mbotkinl | 0:a2a4d0d432b3 | 41 | void sleep(long ts); // sleep for ts (s) |
mbotkinl | 0:a2a4d0d432b3 | 42 | void wakeUp(); // wake up from sleep |
mbotkinl | 0:a2a4d0d432b3 | 43 | void feed(); // watch dog feed |
mbotkinl | 0:a2a4d0d432b3 | 44 | void wdtInit(long tc); // init wdt |
mbotkinl | 0:a2a4d0d432b3 | 45 | }; |
mbotkinl | 0:a2a4d0d432b3 | 46 | |
mbotkinl | 0:a2a4d0d432b3 | 47 | extern Stalker3_0_sleep wdt_sleep; |
mbotkinl | 0:a2a4d0d432b3 | 48 | #endif |