-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The program is a simple loop: Read VDD, sleep for 5 second.
- Loading branch information
Showing
5 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ROOT = ../.. | ||
|
||
#FLASH_SIZE=512 | ||
#OTA=0 | ||
|
||
include $(ROOT)/Makefile.common |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
To read VDD | ||
------------------- | ||
|
||
The 107th byte in esp_init_data_default.bin (0~127byte) is named as "vdd33_const" , when TOUT pin is suspended vdd33_const must be set as 0xFF, that is 255. | ||
|
||
Should change byte 107th of esp_init_data_default.bin to run this program. | ||
|
||
With vi: | ||
:%!xxd | ||
[edit] | ||
:%!xxd -r | ||
:wq | ||
|
||
To wakeup from deep sleep | ||
------------------ | ||
|
||
Connect GPIO16 to Reset pin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#ifndef _USER_CONFIG_H_ | ||
#define _USER_CONFIG_H_ | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "ets_sys.h" | ||
#include "os_type.h" | ||
#include "osapi.h" | ||
#include "user_config.h" | ||
#include "user_interface.h" | ||
|
||
#include "driver/uart.h" | ||
|
||
#define INFO(...) os_printf(__VA_ARGS__) | ||
#define __SET__DEEP_SLEEP__WAKEUP_NO_RF__ system_deep_sleep_set_option(4) | ||
#define __SET__DEEP_SLEEP__WAKEUP_NORMAL__ system_deep_sleep_set_option(1) | ||
|
||
static ETSTimer report_timer; | ||
|
||
void ICACHE_FLASH_ATTR | ||
read_vdcc() | ||
{ | ||
uint16_t vdd33 = system_get_vdd33(); | ||
uint16_t vdd = vdd33*100/1024; | ||
INFO("VDD = %d.%d\n", vdd/100, vdd%100); | ||
} | ||
|
||
//Init function | ||
void ICACHE_FLASH_ATTR | ||
user_init() | ||
{ | ||
// UART setup | ||
uart_init(BIT_RATE_115200, BIT_RATE_115200); | ||
os_delay_us(2000000); // 1 sec | ||
|
||
read_vdcc(); | ||
__SET__DEEP_SLEEP__WAKEUP_NORMAL__; | ||
system_deep_sleep(5000000); | ||
} | ||
|