英飞凌PSoC62是一款Cortex-M0+与Cortex-M4的双内核MCU,其有着非常优秀的超低功耗性能。
以上三款都具休有超过功耗性能
void set_rtc_alarm_date_time(void)
{
cy_rslt_t result;
/* Print the RTC alarm time by UART */
//LOG_D("RTC alarm will be generated after 10 seconds
");
/* Set the RTC alarm for the specified number of seconds in the future by editing the macro(USE_SECONDS_FOR_ALARM) */
result = cyhal_rtc_set_alarm_by_seconds(&rtc_obj, USE_SECONDS_FOR_ALARM);
if (result != CY_RSLT_SUCCESS)
{
rt_kprintf("RTC alarm err
");
}
}
5、主程序代码:
int main(void)
{
cy_rslt_t result;
float temp, humi;
uint8_t show_str[20] = {0};
EPD_GPIO_Init(); //EPD GPIO initialization
//Cy_SysDisableCM4();
__enable_irq();
rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT);
// rt_thread_mdelay(500);
Paint_NewImage(BlackImage, 128, 296, 270, WHITE); //Set screen size and display orientation
Paint_SelectImage(BlackImage);//Set the virtual canvas data storage location
Paint_NewImage(BlackImage, EPD_WIDTH, EPD_HEIGHT, 270, WHITE); //Set screen size and display orientation
Paint_SelectImage(BlackImage);//Set the virtual canvas data storage location
EPD_DeepSleep();
/* Initialize RTC */
cyhal_rtc_enable_event(&rtc_obj, CYHAL_RTC_ALARM, RTC_INTERRUPT_PRIORITY, true);
set_rtc_alarm_date_time();
for (;;)
{
// cyhal_system_delay_ms(LONG_GLITCH_DELAY_MS);
/* Set MYPIN_0_NUM to Analog HI-Z for low power using HAL APIs. */
// /* Go to deep sleep */
cyhal_syspm_deepsleep();
set_rtc_alarm_date_time();
// rt_kprintf("Wack from sleep!
");
hs300x_read_data(&temp_humi_dev, &humi, &temp);
EPD_HW_Init(); //Electronic paper initialization
EPD_HW_Init_GUI(); //EPD init GUI
Paint_Clear(WHITE);
sprintf(show_str,"温度%02d.%02d℃",(int)temp, (int)(temp*100)%100);
Paint_DrawString_CN(40,0,show_str, &Font24CN, WHITE, BLACK);
sprintf(show_str,"湿度%02d.%02d%%",(int)humi, (int)(humi*100)%100);
Paint_DrawString_CN(40,40,show_str, &Font24CN, WHITE, BLACK);
EPD_Display(BlackImage); //display image
EPD_DeepSleep();//EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!!
}
}
经调试休眠模式下,整体的待机电流低到450uA:
工作电流为19mA:
目前待机电流基本上达到电池供电的效果,后期再加上NB-IoT的数据传输模式。
全部0条评论
快来发表一下你的评论吧 !