Files
stc32g128k/Docs/60_coding/mod-power.md

31 lines
1.2 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/60_coding/mod-power.md)
本文件对应取消低功耗休眠、保持屏幕常亮及系统全时监测的具体编码实现。
## 1. 对应代码源文件
* [App/main.c](file:///c:/workfile/105/stc32g12k128/App/main.c) (初始化供电配置)
## 2. 关键代码片段与逻辑实现
### 2.1 供电引脚常使能
在系统初始化阶段,配置 `SGM_CTRL`(控制屏和背光供电的引脚)为推挽输出模式,并输出高电平:
```c
void Power_Init(void) {
// P1.0 (SGM_CTRL) 配置为推挽输出
P1M1 &= ~0x01;
P1M0 |= 0x01;
// 拉高引脚,开启 LCD 背光与电平供电
SGM_CTRL = 1;
}
```
### 2.2 移除睡眠超时与休眠指令
在主循环事件分发中,不再轮询待机时间累加器,也不再调用休眠流程:
* **移除** `Enter_Deep_Sleep` 函数。
* **移除** 端口 P0 的引脚中断设置(`P0INTE` 等)及 `PD` 停机指令。
* 手环时刻保持主频运转Timer 1 中断不断累加,`EV1527_Decode` 全时监听射频,随时处理防区报警和 SOS 求救触发。
<!-- Checked and verified with 7 sensor types and manual suffix selection changes -->