全球最实用的IT互联网信息网站!

AI人工智能P2P分享&下载搜索网页发布信息网站地图

当前位置:诺佳网 > 电子/半导体 > 测量仪表 >

PSoC™ 62温湿采集功耗测试

时间:2023-06-07 17:23

人气:

作者:admin

标签: PSoC  采集  功耗      温湿 

导读:创建epaper文件夹并加入下图所示的spi驱动、墨水屏显示、绘画、字库等...

在这篇文章中我们展示如何采集温湿度计,今天向大家介绍采集温度后显示于墨水屏。并实现深度休眠模式,同时展示工作、休眠的电流检测

1、增加墨水屏显示:

创建epaper文件夹并加入下图所示的spi驱动、墨水屏显示、绘画、字库等:

1.jpg

2、main.c的实现:

#include

#include

#include "sensor_renesas_hs300x.h"

#include "drv_gpio.h"

#include

#include "Display_EPD_w21.h"

#include "Display_EPD_W21_spi.h"

#include "fonts.h"

#include "GUI_Paint.h"

#define LED_PIN GET_PIN(0, 0)

#define USE_SECONDS_FOR_ALARM 10

#define LONG_GLITCH_DELAY_MS 100u /* in ms */

#define RTC_INTERRUPT_PRIORITY 3u

void set_rtc_alarm_date_time(void);

cyhal_rtc_t rtc_obj;

unsigned char BlackImage[4736];//Define canvas space

extern struct hs300x_device temp_humi_dev;

int main(void)

{

cy_rslt_t result;

float temp, humi;

uint8_t show_str[20] = {0};

EPD_GPIO_Init(); //EPD GPIO initialization

__enable_irq();

rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT);

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 (;;)

{

/* Go to deep sleep */

cyhal_syspm_deepsleep();

set_rtc_alarm_date_time();

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!!!

}

}

实现的效果:

上传开发板以后工作电流为19MA,休眠电流为450uA左右。

温馨提示:以上内容整理于网络,仅供参考,如果对您有帮助,留下您的阅读感言吧!
相关阅读
本类排行
相关标签
本类推荐

CPU | 内存 | 硬盘 | 显卡 | 显示器 | 主板 | 电源 | 键鼠 | 网站地图

Copyright © 2025-2035 诺佳网 版权所有 备案号:赣ICP备2025066733号
本站资料均来源互联网收集整理,作品版权归作者所有,如果侵犯了您的版权,请跟我们联系。

关注微信