initial commit
This commit is contained in:
13
main/CMakeLists.txt
Normal file
13
main/CMakeLists.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
set(srcs "src/main.cpp")
|
||||
#list(APPEND srcs "src/function/touch_graph.cpp")
|
||||
#list(APPEND srcs "src/function/server_clock.cpp")
|
||||
#list(APPEND srcs "src/connection/connect.cpp")
|
||||
#list(APPEND srcs "src/function/sd_rw.cpp")
|
||||
|
||||
idf_component_register(
|
||||
SRCS ${srcs}
|
||||
#INCLUDE_DIRS "include" "include/function"
|
||||
#REQUIRES "driver" "ssd1306" "esp_wifi" "nvs_flash" "esp-tls" "esp_http_client" "json" "sdmmc" "vfs"
|
||||
)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE -std=gnu++11)
|
||||
40
main/src/main.cpp
Normal file
40
main/src/main.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "driver/timer.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
static void IRAM_ATTR timer_g0_t0_isr(void *arg) {
|
||||
|
||||
timer_group_clr_intr_status_in_isr(TIMER_GROUP_0, TIMER_0);
|
||||
|
||||
timer_group_enable_alarm_in_isr(TIMER_GROUP_0, TIMER_0);
|
||||
|
||||
esp_rom_printf("Hello From ISR 20sec\n");
|
||||
}
|
||||
|
||||
extern "C" void app_main() {
|
||||
|
||||
timer_config_t config = {
|
||||
.alarm_en = TIMER_ALARM_EN,
|
||||
.counter_en = TIMER_PAUSE,
|
||||
.counter_dir = TIMER_COUNT_UP,
|
||||
.auto_reload = TIMER_AUTORELOAD_EN,
|
||||
.divider = 80,
|
||||
};
|
||||
|
||||
const unsigned long long interval_sec = 10;
|
||||
|
||||
timer_init(TIMER_GROUP_0, TIMER_0, &config);
|
||||
|
||||
timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0x00000000ULL);
|
||||
timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, interval_sec * 1000000ULL);
|
||||
|
||||
timer_enable_intr(TIMER_GROUP_0, TIMER_0);
|
||||
|
||||
timer_isr_register(TIMER_GROUP_0, TIMER_0, timer_g0_t0_isr, NULL, ESP_INTR_FLAG_IRAM, NULL);
|
||||
|
||||
timer_start(TIMER_GROUP_0, TIMER_0);
|
||||
|
||||
while (true) { vTaskDelay(pdMS_TO_TICKS(10000)); }
|
||||
}
|
||||
Reference in New Issue
Block a user