真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

STM32的停機(jī)模式與喚醒

主函數(shù)內(nèi)容:
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_DMA_Init();
MX_ADC_Init();
MX_LPUART1_UART_Init();
MX_USART1_UART_Init();
MX_RTC_Init();
WorkFinished=0;//工作沒有完成
while(1)
{
LED1_ON; LED2_ON; LED3_ON;HAL_Delay (500);
printf ("Before Stop \r\n");
if(WorkFinished){
HAL_PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);//進(jìn)入停止模式
}
LED1_OFF; LED2_OFF; LED3_OFF;
printf ("After Stop \r\n");
}

深澤網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián)公司,深澤網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為深澤上千多家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢,請找那個(gè)售后服務(wù)好的深澤做網(wǎng)站的公司定做!

//用于停機(jī)模式的聲明
#define PWR_Regulator_LowPower ((uint32_t)0x00000001)
#define PWR_STOPEntry_WFI ((uint8_t)0x01)

//系統(tǒng)的停機(jī)函數(shù)
void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry)
{
uint32_t tmpreg = 0U;
/ Check the parameters /
assert_param(IS_PWR_REGULATOR(Regulator));
assert_param(IS_PWR_STOP_ENTRY(STOPEntry));
/ Select the regulator state in Stop mode ---------------------------------/
tmpreg = PWR->CR;
/ Clear PDDS and LPDS bits /
CLEAR_BIT(tmpreg, (PWR_CR_PDDS | PWR_CR_LPSDSR));
/ Set LPSDSR bit according to PWR_Regulator value /
SET_BIT(tmpreg, Regulator);
/ Store the new value /
PWR->CR = tmpreg;
/ Set SLEEPDEEP bit of Cortex System Control Register /
SET_BIT(SCB->SCR, SCB_SCR_SLEEPDEEP_Msk);
/ Select Stop mode entry --------------------------------------------------/
if(STOPEntry == PWR_STOPENTRY_WFI)
{
/ Request Wait For Interrupt /
WFI();
}
else
{
/ Request Wait For Event /
SEV();
WFE();
WFE();
}
/ Reset SLEEPDEEP bit of Cortex System Control Register /
CLEAR_BIT(SCB->SCR, SCB_SCR_SLEEPDEEP_Msk);
}

void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
WorkFinished=~WorkFinished;
SystemClock_Config();
printf ("Callback \r\n"); //外設(shè)中斷 打印
}

程序正常啟動(dòng)后三個(gè)燈閃爍(PB12|PB13|PB14),按鍵后進(jìn)入停機(jī)模式,再按鍵程序繼續(xù)執(zhí)行,再按鍵停機(jī)。
停機(jī)模式下耗電:148uA。


文章題目:STM32的停機(jī)模式與喚醒
鏈接分享:http://weahome.cn/article/jocsch.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部