Using DHT11 sensor, sdWrite, wdt. Need to sleep more then this.

Dependencies:   DHT GPRSInterface HTTPClient_GPRS SDFileSystem USBDevice mbed

Committer:
seedteam20
Date:
Wed Apr 01 16:16:13 2015 +0000
Revision:
0:b6b64c1e74bb
Using DHT11 sensor and wdt. Not fully going to sleep.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
seedteam20 0:b6b64c1e74bb 1 #ifndef __ARCH_GPRS_SLEEP_H__
seedteam20 0:b6b64c1e74bb 2 #define __ARCH_GPRS_SLEEP_H__
seedteam20 0:b6b64c1e74bb 3
seedteam20 0:b6b64c1e74bb 4
seedteam20 0:b6b64c1e74bb 5 #define WDTCLK_SRC_IRC_OSC 0
seedteam20 0:b6b64c1e74bb 6 #define WDTCLK_SRC_WDT_OSC 1
seedteam20 0:b6b64c1e74bb 7
seedteam20 0:b6b64c1e74bb 8 #define WDEN (0x1<<0)
seedteam20 0:b6b64c1e74bb 9 #define WDRESET (0x1<<1)
seedteam20 0:b6b64c1e74bb 10 #define WDTOF (0x1<<2)
seedteam20 0:b6b64c1e74bb 11 #define WDINT (0x1<<3)
seedteam20 0:b6b64c1e74bb 12 #define WDPROTECT (0x1<<4)
seedteam20 0:b6b64c1e74bb 13 #define WDLOCKCLK (0x1<<5)
seedteam20 0:b6b64c1e74bb 14
seedteam20 0:b6b64c1e74bb 15 #define WDT_FEED_VALUE 0x003FFFFF
seedteam20 0:b6b64c1e74bb 16
seedteam20 0:b6b64c1e74bb 17 #define WINDOW_MODE 0
seedteam20 0:b6b64c1e74bb 18 #define PROTECT_MODE 0
seedteam20 0:b6b64c1e74bb 19 #define WATCHDOG_RESET 1
seedteam20 0:b6b64c1e74bb 20 #define WDLOCK_MODE 0
seedteam20 0:b6b64c1e74bb 21 #define LOCKCLK_MODE 0
seedteam20 0:b6b64c1e74bb 22
seedteam20 0:b6b64c1e74bb 23 #define MODE_SLEEP 0
seedteam20 0:b6b64c1e74bb 24 #define MODE_WORKING 1
seedteam20 0:b6b64c1e74bb 25
seedteam20 0:b6b64c1e74bb 26 class Stalker3_0_sleep{
seedteam20 0:b6b64c1e74bb 27
seedteam20 0:b6b64c1e74bb 28 public:
seedteam20 0:b6b64c1e74bb 29
seedteam20 0:b6b64c1e74bb 30 int workMode; // working mode, sleep or working
seedteam20 0:b6b64c1e74bb 31
seedteam20 0:b6b64c1e74bb 32 public:
seedteam20 0:b6b64c1e74bb 33
seedteam20 0:b6b64c1e74bb 34 void gotoSleep(); // goto sleep mode, untill wdt interrupt
seedteam20 0:b6b64c1e74bb 35 void wdtClkSetup(unsigned long clksrc);
seedteam20 0:b6b64c1e74bb 36
seedteam20 0:b6b64c1e74bb 37 public:
seedteam20 0:b6b64c1e74bb 38
seedteam20 0:b6b64c1e74bb 39 void init();
seedteam20 0:b6b64c1e74bb 40
seedteam20 0:b6b64c1e74bb 41 void sleep(long ts); // sleep for ts (s)
seedteam20 0:b6b64c1e74bb 42 void wakeUp(); // wake up from sleep
seedteam20 0:b6b64c1e74bb 43 void feed(); // watch dog feed
seedteam20 0:b6b64c1e74bb 44 void wdtInit(long tc); // init wdt
seedteam20 0:b6b64c1e74bb 45 };
seedteam20 0:b6b64c1e74bb 46
seedteam20 0:b6b64c1e74bb 47 extern Stalker3_0_sleep wdt_sleep;
seedteam20 0:b6b64c1e74bb 48 #endif