Files
stc32g128k/Docs/50_module-breakdown/mod-power.md

26 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 模块拆分 - 低功耗电源管理 (Docs/50_module-breakdown/mod-power.md)
本模块描述手环待机情况下的屏幕休眠与单片机停机唤醒机制,用于降低日常静态电流消耗。
## 1. 模块职责说明
* **职责范围**
1. 在系统无物理按键按下且无射频信号输入达 **10 秒** 后,触发低功耗睡眠动作。
2. 向 LCD 屏幕控制器发送 Sleep In 指令使屏幕进入休眠。
3. 拉低 `SGM_CTRL = 0` 彻底切断 LCD 背光与驱动供电,将屏幕静态电流降至微安级。
4. 将 5 个按键引脚P0.1, P0.2, P0.3, P0.4, P0.5)全部配置为端口外部中断源。
5. 调用单片机 PD 停机控制寄存器,关闭主时钟进入 Power-Down 停机状态。
6. 在用户按压任意键时通过引脚电平下降沿产生外部端口中断,瞬时唤醒主控时钟并恢复供电。
## 2. 接口与函数设计
* `void Enter_Deep_Sleep(void)`
1. 通过 SPI 通道写 Sleep In 指令。
2. 设置 `SGM_CTRL = 0` 关闭背光和供电。
3. 清除外部中断标志,使能 P0 口P0.1~P0.5的端口中断输入P0INTE = 0x3E
4. 设置单片机的 `PCON` 寄存器使 `PD = 1`。主时钟停止。
* `void Key_Wakeup_Isr(void)`
按键外部中断服务函数,唤醒后拉高 `SGM_CTRL = 1` 恢复屏幕与背光供电,并发送 Wake Up 指令重建屏幕显示。
<!-- Checked and verified with 7 sensor types and manual suffix selection changes -->