Implement low power RF wake-up and filter mechanism
This commit is contained in:
@@ -9,19 +9,8 @@
|
||||
## 2. 关键代码片段与逻辑实现
|
||||
|
||||
### 2.1 供电引脚初始化
|
||||
系统初始化时,配置 `SHUT`(控制 SGM3833 供电的引脚 `P2.2`)为推挽输出,并拉高以开启屏幕供电:
|
||||
```c
|
||||
sbit SHUT = P2^2; // Pin 23
|
||||
|
||||
void Power_Init(void) {
|
||||
// P2.2 (SHUT) 配置为推挽输出
|
||||
P2M1 &= ~(1 << 2);
|
||||
P2M0 |= (1 << 2);
|
||||
|
||||
// 拉高引脚,开启 SGM3833 负压供电
|
||||
SHUT = 1;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### 2.2 进入低功耗睡眠 (Enter_Low_Power_Sleep)
|
||||
在 10 秒无按键操作发生后,关闭屏幕显示,断电,配置中断,并进入 Power-Down 挂起状态:
|
||||
@@ -31,7 +20,7 @@ void Enter_Low_Power_Sleep(void) {
|
||||
LCD_WriteCmd(0x10);
|
||||
|
||||
// 2. 切断 SGM3833 电源,停止输出负压
|
||||
SHUT = 0;
|
||||
|
||||
|
||||
// 3. 配置引脚中断 (P0.1, P0.2, P0.3, P2.6) 允许唤醒
|
||||
// 允许 P0 / P2 端口中断以供按键唤醒
|
||||
@@ -56,12 +45,12 @@ void Port0_Isr(void) interrupt 37 {
|
||||
P0INTF = 0x00; // 清除 P0 中断标志
|
||||
Wakeup_Restore();
|
||||
}
|
||||
|
||||
//周期嗅探模式来接收信号源
|
||||
void Wakeup_Restore(void) {
|
||||
if (SHUT == 1) return; // 已经在工作状态,直接返回
|
||||
if // 已经在工作状态,直接返回
|
||||
|
||||
// 1. 拉高 SHUT 重新使能 SGM3833 供电
|
||||
SHUT = 1;
|
||||
// 重新使能 SGM3833 供电
|
||||
|
||||
|
||||
// 2. 延时约 50ms 等待升压/负压输出稳定
|
||||
Delay50ms();
|
||||
|
||||
Reference in New Issue
Block a user