深圳的网站建设公司价格,产品营销网站建设,山东省住房和城乡建设厅注册中心,注销网站备案申请表DebugPrinter类是一种在显示屏上打印调试消息的简单方法#xff0c;无需向屏幕添加控件。 在使用DebugPrinter之前#xff0c;需要分配一个实例并将其传递给Application类#xff0c;且DebugPrinter实例必须兼容所使用的LCD类。 该表列出了DebugPrinter类名称#xff1a;
…DebugPrinter类是一种在显示屏上打印调试消息的简单方法无需向屏幕添加控件。 在使用DebugPrinter之前需要分配一个实例并将其传递给Application类且DebugPrinter实例必须兼容所使用的LCD类。 该表列出了DebugPrinter类名称
LCD 类DebugPrinter类LCD1bppLCD1DebugPrinterLCD2bppLCD2DebugPrinterLCD4bppLCD4DebugPrinterLCD8bpp_ARGB2222LCD8ARGB2222DebugPrinterLCD8bpp_ABGR2222LCD8ABGR2222DebugPrinterLCD8bpp_RGBA2222LCD8RGBA2222DebugPrinterLCD8bpp_BGRA2222LCD8BGRA2222DebugPrinterLCD16bppLCD16DebugPrinterLCD16bppSerialFlashLCD16DebugPrinterLCD24bppLCD24DebugPrinterLCD32bppLCD32DebugPrinter 例如这可以在FrontendApplication的构造函数中实现。
#include gui/common/FrontendApplication.hpp
#include touchgfx/lcd/LCD16DebugPrinter.hppLCD16DebugPrinter 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.hppclass 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.hscreenView::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绘制新内容。