54 lines
1.0 KiB
C
54 lines
1.0 KiB
C
|
#include "stm32f10x.h" // Device header
|
||
|
#include "Delay.h"
|
||
|
#include "Timer.h"
|
||
|
#include "Encoder.h"
|
||
|
#include "Key.h"
|
||
|
#include "OLED.h"
|
||
|
#include "Menu.h"
|
||
|
|
||
|
int Power_Off(void); // 关机
|
||
|
uint8_t data;
|
||
|
int16_t Num;
|
||
|
uint8_t flag = 1;
|
||
|
int main(void)
|
||
|
{
|
||
|
|
||
|
OLED_Init();
|
||
|
Encoder_Init();
|
||
|
|
||
|
OLED_ShowChinese(0, 25,"实现");
|
||
|
OLED_ShowString(35, 25,"3.8V",OLED_8X16);
|
||
|
OLED_ShowChinese(80,25,"电压值");
|
||
|
|
||
|
|
||
|
|
||
|
while (1)
|
||
|
{
|
||
|
|
||
|
OLED_Update(); //更新显示,清屏,防止初始化后未显示内容时花屏
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int Power_Off(void) // 关机
|
||
|
{
|
||
|
/*关闭外设区*******/
|
||
|
OLED_Clear();
|
||
|
OLED_Update();
|
||
|
/*******关闭外设区*/
|
||
|
|
||
|
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); // Enables or disables the Low Speed APB (APB1) peripheral clock.
|
||
|
PWR_WakeUpPinCmd(ENABLE);
|
||
|
|
||
|
PWR_EnterSTOPMode(PWR_Regulator_ON, PWR_STOPEntry_WFI); // SIOP模式
|
||
|
SystemInit();
|
||
|
|
||
|
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, DISABLE); // Enables or disables the Low Speed APB (APB1) peripheral clock.
|
||
|
PWR_WakeUpPinCmd(DISABLE);
|
||
|
|
||
|
// Key_Reset_All();
|
||
|
// Key_Reset_All();
|
||
|
|
||
|
return 1;
|
||
|
}
|
||
|
|