当前位置: 首页 > news >正文

TouchGFX之调试

DebugPrinter类是一种在显示屏上打印调试消息的简单方法,无需向屏幕添加控件。

在使用DebugPrinter之前,需要分配一个实例并将其传递给Application类,且DebugPrinter实例必须兼容所使用的LCD类。 该表列出了DebugPrinter类名称:

LCD 类DebugPrinter类
LCD1bppLCD1DebugPrinter
LCD2bppLCD2DebugPrinter
LCD4bppLCD4DebugPrinter
LCD8bpp_ARGB2222LCD8ARGB2222DebugPrinter
LCD8bpp_ABGR2222LCD8ABGR2222DebugPrinter
LCD8bpp_RGBA2222LCD8RGBA2222DebugPrinter
LCD8bpp_BGRA2222LCD8BGRA2222DebugPrinter
LCD16bppLCD16DebugPrinter
LCD16bppSerialFlashLCD16DebugPrinter
LCD24bppLCD24DebugPrinter
LCD32bppLCD32DebugPrinter

 

例如,这可以在FrontendApplication的构造函数中实现。

#include <gui/common/FrontendApplication.hpp>
#include <touchgfx/lcd/LCD16DebugPrinter.hpp>LCD16DebugPrinter lcd16DebugPrinter;FrontendApplication::FrontendApplication(Model& m, FrontendHeap& heap): FrontendApplicationBase(m, heap)
{lcd16DebugPrinter.setPosition(0, 0, 240, 40);lcd16DebugPrinter.setScale(3);lcd16DebugPrinter.setColor(0x00); //blackApplication::setDebugPrinter(&lcd16DebugPrinter);
}

此时,我们已经将DebugPrinter配置为左上角240 x 40像素写入。 现在可以编写程序打印字符串:

#ifndef SCREENVIEW_HPP
#define SCREENVIEW_HPP#include <gui_generated/screen_screen/screenViewBase.hpp>
#include <gui/screen_screen/screenPresenter.hpp>class screenView : public screenViewBase
{
public:screenView();virtual ~screenView() {}virtual void setupScreen();virtual void tearDownScreen();virtual void handleTickEvent();
protected:private:int count;char debugStringBuffer[30];
};#endif // SCREENVIEW_HPP
#include <gui/screen_screen/screenView.hpp>
#include <stdio.h>screenView::screenView()
{count = 0;
}void screenView::setupScreen()
{screenViewBase::setupScreen();
}void screenView::tearDownScreen()
{screenViewBase::tearDownScreen();
}void screenView::handleTickEvent()
{count++;snprintf(debugStringBuffer, sizeof(debugStringBuffer), "tick: %d", count);Application::getDebugPrinter()->setString(debugStringBuffer);Application::invalidateDebugRegion();	
}

其实不必在应用程序中多次调用DebugPrinter::setString。 只需要更改缓存区的内容,但是请调用invalidateDebugRegion,这将使DebugPrinter绘制新内容。 

 

http://www.lryc.cn/news/142721.html

相关文章:

  • C# winform加载yolov8模型测试(附例程)
  • 浙大陈越何钦铭数据结构07-图6 旅游规划
  • VUE笔记(七)项目登录
  • 大语言模型之六- LLM之企业私有化部署
  • Python3 列表
  • OpenCV基础知识(8)— 图形检测
  • Java虚拟机
  • c++学习 之 函数重载注意事项
  • 2023-08-27 LeetCode每日一题(合并区间)
  • C#,数值计算——调适数值积分法(adaptive quadrature)的计算方法与源程序
  • 微信小程序发布迭代版本后如何提示用户强制更新新版本
  • 星际争霸之小霸王之小蜜蜂(七)--消失的子弹
  • Hadoop入门机安装hadoop
  • cookie技术介绍
  • 网络摄像头:SparkoCam Crack
  • 【缓存设计】记一种不错的缓存设计思路
  • 微信小程序大学校园二手教材与书籍拍卖系统设计与实现
  • 涛然自得周刊(第06期):韩版苏东坡的突围
  • DOCKER 部署 webman项目
  • LLMs:LangChain-Chatchat(一款可实现本地知识库问答应用)的简介、安装、使用方法之详细攻略
  • Qt 解析XML文件 QXmlStreamReader
  • 图像线段检测几种方法
  • 【Vue2.0源码学习】生命周期篇-初始化阶段(initEvents)
  • SQL高级知识点
  • 【安全】原型链污染 - Code-Breaking 2018 Thejs
  • 【架构】探索计算机处理器的世界:ARM和x86架构解析及指令集
  • SpringBoot权限认证
  • OpenGL-入门-BMP像素图glReadPixels
  • 同源策略以及SpringBoot的常见跨域配置
  • 基于jeecg-boot的flowable流程跳转功能实现