|
| 1 | +/* |
| 2 | + Esp.h - ESP8266-specific APIs |
| 3 | + Copyright (c) 2015 Ivan Grokhotkov. All rights reserved. |
| 4 | + This file is part of the esp8266 core for Arduino environment. |
| 5 | + |
| 6 | + This library is free software; you can redistribute it and/or |
| 7 | + modify it under the terms of the GNU Lesser General Public |
| 8 | + License as published by the Free Software Foundation; either |
| 9 | + version 2.1 of the License, or (at your option) any later version. |
| 10 | +
|
| 11 | + This library is distributed in the hope that it will be useful, |
| 12 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | + Lesser General Public License for more details. |
| 15 | +
|
| 16 | + You should have received a copy of the GNU Lesser General Public |
| 17 | + License along with this library; if not, write to the Free Software |
| 18 | + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | + */ |
| 20 | + |
| 21 | +#ifndef ESP_H |
| 22 | +#define ESP_H |
| 23 | + |
| 24 | + |
| 25 | +enum WakeMode { |
| 26 | + WAKE_RF_DEFAULT = 0, // RF_CAL or not after deep-sleep wake up, depends on init data byte 108. |
| 27 | + WAKE_RFCAL = 1, // RF_CAL after deep-sleep wake up, there will be large current. |
| 28 | + WAKE_NO_RFCAL = 2, // no RF_CAL after deep-sleep wake up, there will only be small current. |
| 29 | + WAKE_RF_DISABLED = 4 // disable RF after deep-sleep wake up, just like modem sleep, there will be the smallest current. |
| 30 | +}; |
| 31 | + |
| 32 | +class EspClass { |
| 33 | + public: |
| 34 | + EspClass(); |
| 35 | + |
| 36 | + void wdtEnable(int timeout_ms = 0); |
| 37 | + // TODO: figure out how to set WDT timeout |
| 38 | + void wdtDisable(); |
| 39 | + void wdtFeed(); |
| 40 | + |
| 41 | + void deepSleep(uint32_t time_us, WakeMode mode = WAKE_RF_DEFAULT); |
| 42 | +}; |
| 43 | + |
| 44 | +extern EspClass ESP; |
| 45 | + |
| 46 | +#endif //ESP_H |
0 commit comments