#include <stdio.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "esp_system.h"
#include "esp_spi_flash.h"
#include "esp_log.h"
#include "driver/timer.h"
#define TIMER_DIVIDER 16
#define TIMER_SCALE (TIMER_BASE_CLK / TIMER_DIVIDER/ 1000) //分频
#define TIMER_INTERVAL0_SEC (1) //计数值,如果为1,则1ms进入中断;如果为10,则10ms进入中断
#define TEST_WITH_RELOAD 1
typedef struct {
uint64_t timer_minute_count;
uint64_t timer_second_count;
} timer_event_t;
timer_event_t g_timer_event;
xQueueHandle timer_queue;
unsigned int timer_counter = 0;
void IRAM_ATTR timer_group0_isr(void *para) //中断函数
{
timer_spinlock_take(TIMER_GROUP_0);
int timer_idx = (int) para;
// /* Prepare basic event data
// that will be then sent back to the main program task */
timer_counter++;
timer_event_t evt;
xQueueSendFromISR(timer_queue, &evt, NULL); //每次进入中断都会向设置
ESP32学习笔记:FreeRTOS中的消息队列
最新推荐文章于 2025-07-02 10:27:05 发布
实战派 ESP32-S3,双模无线开发板
ESP32-S3 原生支持 ESP-IDF,WiFi + 蓝牙一次搞定
实战派 ESP32-S3,双模无线开发板
ESP32-S3 原生支持 ESP-IDF,WiFi + 蓝牙一次搞定


4674

被折叠的 条评论
为什么被折叠?



