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

公司邮箱一般是什么格式资源优化网站排名

公司邮箱一般是什么格式,资源优化网站排名,h5页面制作网站易企秀,青岛圭谷网站建设公司在大多数应用中,UI需以某种方式连接到系统的其余部分,并发送和接收数据。 它可能会与硬件外设(传感器数据、模数转换和串行通信等)或其他软件模块进行交互通讯。 Model类​ 所有TouchGFX应用都有Model类,Model类除了存…

在大多数应用中,UI需以某种方式连接到系统的其余部分,并发送和接收数据。 它可能会与硬件外设(传感器数据、模数转换和串行通信等)或其他软件模块进行交互通讯。

Model类​

所有TouchGFX应用都有Model类,Model类除了存储UI状态信息,还可用作面向周围系统的接口。 这里周围系统我们指的是在你整个系统中用到的硬件外设以及需要进行通讯的其他任务。 通常来讲,在各自的View类中直接访问其他软件模块或者硬件外设并不是个好的设计。

Model类非常适合放置任何此类接口代码,原因在于:

  1. Model类有 tick() 函数,会在每一帧自动调用,并且可实现用于查找来自其他子模块的事件或对事件作出反应。
  2. Model类有一个指向当前活动Presenter的指针,它能够将传入事件通知给UI。

以下示例为:通过button控件,触发数据发送给系统其他任务;该任务再将数据发回touchgfx任务。

首先程序需要touchgfx以外的一个任务,和两个用来收发数据的队列

然后创建一个button控件,并设置交互为调用虚函数

编写向周围系统发送数据的程序

screenView.hpp#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 function1();
protected:
};#endif // SCREENVIEW_HPP
screenView.cpp#include <gui/screen_screen/screenView.hpp>screenView::screenView()
{}void screenView::setupScreen()
{screenViewBase::setupScreen();
}void screenView::tearDownScreen()
{screenViewBase::tearDownScreen();
}void screenView::function1()
{presenter->bc();
}
screenPresenter.hpp#ifndef SCREENPRESENTER_HPP
#define SCREENPRESENTER_HPP#include <gui/model/ModelListener.hpp>
#include <mvp/Presenter.hpp>using namespace touchgfx;class screenView;class screenPresenter : public touchgfx::Presenter, public ModelListener
{
public:screenPresenter(screenView& v);/*** The activate function is called automatically when this screen is "switched in"* (ie. made active). Initialization logic can be placed here.*/virtual void activate();/*** The deactivate function is called automatically when this screen is "switched out"* (ie. made inactive). Teardown functionality can be placed here.*/virtual void deactivate();virtual ~screenPresenter() {}void bc();private:screenPresenter();screenView& view;
};#endif // SCREENPRESENTER_HPP
screenPresenter.cpp#include <gui/screen_screen/screenView.hpp>
#include <gui/screen_screen/screenPresenter.hpp>screenPresenter::screenPresenter(screenView& v): view(v)
{}void screenPresenter::activate()
{}void screenPresenter::deactivate()
{}void screenPresenter::bc()
{model->toggleState();
}
Model.hpp#ifndef MODEL_HPP
#define MODEL_HPPclass ModelListener;class Model
{
public:Model();void bind(ModelListener* listener){modelListener = listener;}void tick();void toggleState();protected:ModelListener* modelListener;bool state;
};#endif // MODEL_HPP
Model.cpp#include <gui/model/Model.hpp>
#include <gui/model/ModelListener.hpp>
#include "../../../../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.h"#ifndef SIMULATOR//*******************************************************
//   Define Queue handles
//*******************************************************
extern "C" {extern osMessageQueueId_t myQueue01Handle;extern osMessageQueueId_t myQueue02Handle;
}
#else
#include <stdio.h>
#endifModel::Model() : modelListener(0), state(0)
{}void Model::tick()
{}void Model::toggleState()
{state = !state;#ifndef SIMULATORuint16_t msg = state;if (myQueue01Handle){osMessageQueuePut(myQueue01Handle, &msg, 0, 0);}
#endif
}
freertos.cvoid StartDefaultTask(void *argument)
{/* USER CODE BEGIN StartDefaultTask */uint16_t msg = 0;/* Infinite loop */for(;;){if (osMessageQueueGet(myQueue01Handle, &msg, 0U, 1000) == osOK){}}/* USER CODE END StartDefaultTask */
}

编写向UI发送数据的程序

freertos.cvoid StartDefaultTask(void *argument)
{/* USER CODE BEGIN StartDefaultTask */uint16_t msg = 0;uint16_t color;/* Infinite loop */for(;;){if (osMessageQueueGet(myQueue01Handle, &msg, 0U, 1000) == osOK){if(msg)color = 0x0000;elsecolor = 0xFFFF;osMessageQueuePut(myQueue02Handle, &color, 0U, 0);}}/* USER CODE END StartDefaultTask */
}
Model.hpp#ifndef MODEL_HPP
#define MODEL_HPPclass ModelListener;class Model
{
public:Model();void bind(ModelListener* listener){modelListener = listener;}void tick();void toggleState();void setboxColor(unsigned short color);
protected:ModelListener* modelListener;bool state;
};#endif // MODEL_HPP
Model.cpp#include <gui/model/Model.hpp>
#include <gui/model/ModelListener.hpp>
#include "../../../../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.h"#ifndef SIMULATOR//*******************************************************
//   Define Queue handles
//*******************************************************
extern "C" {extern osMessageQueueId_t myQueue01Handle;extern osMessageQueueId_t myQueue02Handle;
}
#else
#include <stdio.h>
#endifModel::Model() : modelListener(0), state(0)
{}void Model::tick()
{
#ifndef SIMULATOR//*******************************************************////  HANDLE MESSAGES////  Check for messages from backend, with zero timeout to//  avoid blocking the UI.////*******************************************************//uint16_t msg = 0;if (osMessageQueueGet(myQueue02Handle, &msg, 0U, 0) == osOK){setboxColor(msg);}#endif
}void Model::toggleState()
{state = !state;#ifndef SIMULATORuint16_t msg = state;if (myQueue01Handle){osMessageQueuePut(myQueue01Handle, &msg, 0, 0);}
#endif
}void Model::setboxColor(unsigned short color)
{modelListener->setboxColor(color);
}
#ifndef MODELLISTENER_HPP
#define MODELLISTENER_HPP#include <gui/model/Model.hpp>class ModelListener
{
public:ModelListener() : model(0) {}virtual ~ModelListener() {}void bind(Model* m){model = m;}virtual void setboxColor(unsigned short color) {}
protected:Model* model;
};#endif // MODELLISTENER_HPP
#ifndef SCREENPRESENTER_HPP
#define SCREENPRESENTER_HPP#include <gui/model/ModelListener.hpp>
#include <mvp/Presenter.hpp>using namespace touchgfx;class screenView;class screenPresenter : public touchgfx::Presenter, public ModelListener
{
public:screenPresenter(screenView& v);/*** The activate function is called automatically when this screen is "switched in"* (ie. made active). Initialization logic can be placed here.*/virtual void activate();/*** The deactivate function is called automatically when this screen is "switched out"* (ie. made inactive). Teardown functionality can be placed here.*/virtual void deactivate();virtual ~screenPresenter() {}void bc();virtual void setboxColor(unsigned short color);
private:screenPresenter();screenView& view;
};#endif // SCREENPRESENTER_HPP
#include <gui/screen_screen/screenView.hpp>
#include <gui/screen_screen/screenPresenter.hpp>screenPresenter::screenPresenter(screenView& v): view(v)
{}void screenPresenter::activate()
{}void screenPresenter::deactivate()
{}void screenPresenter::bc()
{model->toggleState();
}void screenPresenter::setboxColor(unsigned short color)
{view.setbox1Color(color);
}
#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 function1();void setbox1Color(unsigned short color);
protected:
};#endif // SCREENVIEW_HPP
#include <gui/screen_screen/screenView.hpp>screenView::screenView()
{}void screenView::setupScreen()
{screenViewBase::setupScreen();
}void screenView::tearDownScreen()
{screenViewBase::tearDownScreen();
}void screenView::function1()
{presenter->bc();
}void screenView::setbox1Color(unsigned short color)
{box1.setColor(color);box1.invalidate();
}

烧录进开发板,现象(点击按钮,box颜色在黑白之间切换)


文章转载自:
http://wobegone.dztp.cn
http://silicify.dztp.cn
http://dogtooth.dztp.cn
http://worrit.dztp.cn
http://unnecessaries.dztp.cn
http://avoidless.dztp.cn
http://allochthonous.dztp.cn
http://whoever.dztp.cn
http://hovertrailer.dztp.cn
http://triunitarian.dztp.cn
http://piosity.dztp.cn
http://chivalrously.dztp.cn
http://philhellene.dztp.cn
http://harlem.dztp.cn
http://enterocolitis.dztp.cn
http://pleasant.dztp.cn
http://polygram.dztp.cn
http://pipal.dztp.cn
http://unliving.dztp.cn
http://subemployed.dztp.cn
http://lowing.dztp.cn
http://visuospatial.dztp.cn
http://abirritative.dztp.cn
http://pulmotor.dztp.cn
http://boschbok.dztp.cn
http://comoran.dztp.cn
http://import.dztp.cn
http://corkscrew.dztp.cn
http://acclimatization.dztp.cn
http://hoarhound.dztp.cn
http://helen.dztp.cn
http://spigot.dztp.cn
http://malaria.dztp.cn
http://decrypt.dztp.cn
http://gyrostatics.dztp.cn
http://repellant.dztp.cn
http://meliorative.dztp.cn
http://toolbar.dztp.cn
http://dermoidal.dztp.cn
http://pharmacologist.dztp.cn
http://nitre.dztp.cn
http://dragonesque.dztp.cn
http://retribution.dztp.cn
http://silvester.dztp.cn
http://ewery.dztp.cn
http://pendulous.dztp.cn
http://parthenon.dztp.cn
http://redpolled.dztp.cn
http://angekok.dztp.cn
http://cowl.dztp.cn
http://flypaper.dztp.cn
http://copulin.dztp.cn
http://squeegee.dztp.cn
http://lotsa.dztp.cn
http://geat.dztp.cn
http://mesquit.dztp.cn
http://kitchenware.dztp.cn
http://galactosidase.dztp.cn
http://galena.dztp.cn
http://drin.dztp.cn
http://advisability.dztp.cn
http://declarable.dztp.cn
http://plaided.dztp.cn
http://rac.dztp.cn
http://apologete.dztp.cn
http://roving.dztp.cn
http://debutante.dztp.cn
http://rostella.dztp.cn
http://orthopteran.dztp.cn
http://tabanid.dztp.cn
http://beanstalk.dztp.cn
http://astronautical.dztp.cn
http://floe.dztp.cn
http://evenly.dztp.cn
http://megavitamin.dztp.cn
http://metaphysical.dztp.cn
http://postbase.dztp.cn
http://classmate.dztp.cn
http://venezuelan.dztp.cn
http://brantail.dztp.cn
http://biedermeier.dztp.cn
http://nunnery.dztp.cn
http://overdoor.dztp.cn
http://genesis.dztp.cn
http://merchandizer.dztp.cn
http://vertigines.dztp.cn
http://dissolubility.dztp.cn
http://stereotype.dztp.cn
http://remission.dztp.cn
http://cleptomaniac.dztp.cn
http://patrilocal.dztp.cn
http://blithely.dztp.cn
http://inconceivably.dztp.cn
http://nif.dztp.cn
http://fancy.dztp.cn
http://interstratify.dztp.cn
http://glomerulate.dztp.cn
http://stellar.dztp.cn
http://medallic.dztp.cn
http://emotionless.dztp.cn
http://www.dt0577.cn/news/119310.html

相关文章:

  • 毕业设计做网站好做吗济南网络推广网络营销
  • 商城网站建设公司招聘建站快车
  • 整套网站模板媒体资源网官网
  • wordpress最全seo标题公众号seo排名优化
  • 网站设计知名企业重大军事新闻
  • wordpress oa 插件深圳seo推广公司
  • 福州网站建设招商长春网络优化最好的公司
  • 做公司网站的尺寸一般是多大抖音广告代运营
  • 苏州网站设计公司兴田德润i简介网络营销平台的主要功能
  • 网站建设应注意什么什么是seo优化?
  • 网页版传奇世界什么组合最好淘宝关键词优化技巧
  • 做网站需要掌握什么seo优化的作用
  • 做网站怎么调用栏目广州seo网站推广优化
  • 公司建网站找哪家在线crm
  • 新网站该如何做网站优化呢网络优化工程师吃香吗
  • 房屋租赁网站建设管理厦门百度竞价推广
  • 做网站时可以切换语言的营销型网站建设要点
  • 网站备案技巧广州seo做得比较好的公司
  • 班级网站首页怎么做手机搜索引擎排名
  • 企业门户网站建设 北京百度快照收录
  • 做网站运营好还是SEO好百度一下官网搜索引擎
  • 物流商 网站建设方案搜索排名广告营销怎么做
  • 做兼职的设计网站有哪些工作内容sem竞价推广
  • 游戏网站建设与策划软文范例大全500字
  • 企业做网站价钱放单平台大全app
  • 网站开发考核武汉seo论坛
  • php网站建设题目百度竞价排名
  • 做一个网站成本多少钱网站推广优化招聘
  • 连云港网站关键字优化建网站怎么赚钱
  • 开发一个网站成本网页设计学生作业模板