sync(template): 回合 capsule_mb 通用驱动修复

- uart_ring_buffer: PRIMASK 位检查从 ==0 改为 &0x1 修正
- i2c: 新增 i2c_read_raw() 无子地址读函数
- 全局: volatile 统一替换为 __IO (CMSIS 风格)
This commit is contained in:
2026-06-30 11:03:22 +08:00
parent 03810e9cad
commit bfa311b70f
5 changed files with 181 additions and 14 deletions
+4 -4
View File
@@ -12,7 +12,7 @@
#include "gd32e23x.h"
#include "systick.h"
volatile static uint32_t delay_count = 0;
static __IO uint32_t delay_count = 0;
/**
* ************************************************************************
@@ -47,7 +47,7 @@ void delay_10us(uint32_t count)
uint32_t loops_per_10us = SystemCoreClock / 1700000; // 粗略估计,每10微秒的循环次数
for(uint32_t i = 0; i < count; i++) {
for(volatile uint32_t j = 0; j < loops_per_10us; j++);
for(__IO uint32_t j = 0; j < loops_per_10us; j++);
}
}
@@ -95,7 +95,7 @@ void delay_decrement(void)
// uint32_t loops_per_ms = SystemCoreClock / 14000; // 粗略估计
// for(uint32_t i = 0; i < count; i++) {
// for(volatile uint32_t j = 0; j < loops_per_ms; j++);
// for(__IO uint32_t j = 0; j < loops_per_ms; j++);
// }
// }
@@ -113,6 +113,6 @@ void delay_decrement(void)
// uint32_t loops_per_us = SystemCoreClock / 22000000; // 粗略估计,每微秒的循环次数
// for(uint32_t i = 0; i < count; i++) {
// for(volatile uint32_t j = 0; j < loops_per_us; j++);
// for(__IO uint32_t j = 0; j < loops_per_us; j++);
// }
// }