diff --git a/include/espressif/esp_system.h b/include/espressif/esp_system.h index e37263e..155489e 100644 --- a/include/espressif/esp_system.h +++ b/include/espressif/esp_system.h @@ -42,6 +42,7 @@ enum sdk_sleep_type sdk_wifi_get_sleep_type(enum sdk_sleep_type); void sdk_system_restore(void); void sdk_system_restart(void); +bool sdk_system_deep_sleep_set_option(uint8_t option); void sdk_system_deep_sleep(uint32_t time_in_us); uint32_t sdk_system_get_time(void); @@ -57,6 +58,32 @@ bool sdk_system_rtc_mem_read(uint8_t src, void *dst, uint16_t n); bool sdk_system_rtc_mem_write(uint8_t dst, const void *src, uint16_t n); void sdk_system_uart_swap(void); +void sdk_system_uart_de_swap(void); + +#define SYS_CPU_80MHZ 80 +#define SYS_CPU_160MHZ 160 +/* + Set CPU frequency in MHz. All peripheral devices are clocked by independent + system bus, and CPU frequency change will not affect them. + */ +bool sdk_system_update_cpu_freq(uint8_t freq); +uint8_t sdk_system_get_cpu_freq(void); + +/* + Measure voltage on the TOUT pin, 1V max. Returns 10 bits ADC value (1/1024V). + Voltage range 0 .. 1.0V. RF must be enabled. + Example: + printf ("ADC voltage %.3f", 1.0 / 1024 * sdk_system_adc_read()); + */ +uint16_t sdk_system_adc_read(void); +/* + Measure power voltage. Returns 10 bits ADC value (1/1024V). + TOUT pin must be floating and RF must be enabled. + Example: + printf ("Power voltage %.3f", 1.0 / 1024 * sdk_system_get_vdd33()); + */ +uint16_t sdk_system_get_vdd33(void); + #ifdef __cplusplus }