mirror of
https://github.com/espressif/esp-idf.git
synced 2026-05-04 11:55:21 +02:00
implement esp_deep_sleep, fix build issues
This commit is contained in:
@@ -16,25 +16,8 @@
|
||||
#include "rom/ets_sys.h"
|
||||
#include "rom/uart.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
typedef enum{
|
||||
XTAL_40M = 40,
|
||||
XTAL_26M = 26,
|
||||
XTAL_24M = 24,
|
||||
XTAL_AUTO = 0
|
||||
} xtal_freq_t;
|
||||
|
||||
typedef enum{
|
||||
CPU_80M = 1,
|
||||
CPU_160M = 2,
|
||||
CPU_240M = 3,
|
||||
} cpu_freq_t;
|
||||
|
||||
extern void phy_get_romfunc_addr();
|
||||
|
||||
// TODO: these functions need to be moved from librtc to ESP-IDF
|
||||
extern void rtc_init_lite();
|
||||
extern void rtc_set_cpu_freq(xtal_freq_t xtal_freq, cpu_freq_t cpu_freq);
|
||||
#include "phy.h"
|
||||
#include "rtc.h"
|
||||
|
||||
/*
|
||||
* This function is not exposed as an API at this point,
|
||||
@@ -52,7 +35,7 @@ void esp_set_cpu_freq(void)
|
||||
// wait uart tx finish, otherwise some uart output will be lost
|
||||
uart_tx_wait_idle(0);
|
||||
|
||||
rtc_init_lite();
|
||||
rtc_init_lite(XTAL_AUTO);
|
||||
cpu_freq_t freq = CPU_80M;
|
||||
switch(freq_mhz) {
|
||||
case 240:
|
||||
@@ -73,7 +56,7 @@ void esp_set_cpu_freq(void)
|
||||
// wait uart tx finish, otherwise some uart output will be lost
|
||||
uart_tx_wait_idle(0);
|
||||
|
||||
rtc_set_cpu_freq(XTAL_AUTO, freq);
|
||||
rtc_set_cpu_freq(freq);
|
||||
ets_update_cpu_frequency(freq_mhz);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user