在两次传感器读取期间关闭 GPIO 时钟以降低功耗

This commit is contained in:
lxbpxylps@126.com 2021-10-15 00:30:38 +08:00
parent 633d780c8e
commit 177f127cb3

View File

@ -1,14 +1,14 @@
/**
* @file main.c
* @author Myth
* @version 0.6
* @version 0.7
* @date 2021.10.15
* @brief
* @details
* @note
* PC13 LED
* AHT20 湿 BH1750
* AHT20 BH1750 LED
* AHT20 BH1750 GPIO LED
* JTAG 使 SWD
*/
@ -16,8 +16,6 @@
#include "systick.h"
#include "uart.h"
#include "softi2c.h"
#include "led.h"
#include "aht20.h"
#include "bh1750.h"
@ -48,6 +46,8 @@ int main(void)
while (1)
{
//程序主循环
__HAL_RCC_GPIOB_CLK_ENABLE(); //开启 GPIOB 时钟
AHT20_Start(); // AHT20 开始测量
BH1750_Start(); // BH1750 开始测量
@ -61,6 +61,10 @@ int main(void)
printf("humi: %.1f temp: %.1f light: %.1f\n", humi, temp, light);
LED1_Toggle;
__HAL_RCC_GPIOB_CLK_DISABLE(); //关闭 GPIOB 时钟以降低功耗
Delay_ms(500);
}
return 1;