嵌入式用户界面是如何控制的

发布于 2024-09-15 01:42:20 字数 295 浏览 4 评论 0原文

他们如何对在嵌入式硬件上运行的用户界面的逻辑进行编码。如今,微波炉、平板电视、便携式 DVD 播放器甚至数字手表都具有复杂的用户界面。是否有工具/框架可用于消除所有脏工作,或者开发人员是否使用 IF ELSE 类型的构造。

我并不是在要求 QT 或 WxWidgets 意义上的用户界面工具包。我更感兴趣的是知道是否有框架来处理控件背后的逻辑。

if (mTemperature > maxTemperature)
    temperatureDialControl.Enabled = false;

How do they code the logic of a user interface running on embedded hardware. Microwave ovens, flat screen televisions, portable DVD players and even a digital watches these days have complex user interfaces. Are there tools / frameworks available to remove all the dirty work or are the developers using IF ELSE kind of constructs.

I'm not asking for user interface toolkits in the sense of QT or WxWidgets. I am more interested in knowing if there are frameworks to handle the logic behind the controls.

if (mTemperature > maxTemperature)
    temperatureDialControl.Enabled = false;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

那伤。 2024-09-22 01:42:20

我使用了 Quantum 的 Quantum Platform 系列框架跨越多个具有用户界面的嵌入式产品(以及那些没有用户界面的产品)。

QP 是事件驱动编程的框架(基本上所有嵌入式系统都是如此)。用户界面尤其是一个很好的匹配,因为大多数用户界面由可以定制的“小部件”组成,并且小部件通常从事件调度程序接收事件(超时、按钮按下、移动等)。这种“控制反转”在用户界面中非常典型。我在职业生涯中遇到的大多数(嵌入式)用户界面要么是事件驱动的状态机,要么应该以这种方式实现。

您具体询问了有关处理逻辑和内容的问题。控制。 QP 的优点在于它所采用的主动对象计算模型非常自然且易于使用。状态机的直接实现(平面或分层)。因此,在上面的示例中,您可能会收到一个具有新温度的“温度更新”事件,并且您的状态处理程序将执行逻辑&决定需要采取什么行动。使用框架,您可以创建控件背后的逻辑,但基础设施可以处理几乎所有其他事情。

量子平台非常灵活。也很容易看到设计(状态图)和实现/代码之间的联系(可追溯性)。最重要的是,该框架实现了所有基础设施(事件排队和分派、状态转换、垃圾收集、内存池等),因此您所要做的就是专注于您的应用程序。

我在非嵌入式平台上使用过诺基亚的 Qt,但你的问题似乎表明你已经意识到了这一点。我认为 Qt 有一个更小的“嵌入式”版本,但我从未使用过它。

I've used the Quantum Platform family of frameworks from Quantum Leaps for several embedded products with user interfaces (and those without UIs as well).

The QP is a framework for event-driven programming (which essentially all embedded systems are). User interfaces in particular are a good match, because most user interfaces consist of "widgets" which can be customized, and the widgets typically receive events (timeout, button press, movement, etc.) from an event dispatcher. This "inversion of control" is very typical with user interfaces. Most (embedded) user interfaces that I've come across in my career are either event-driven state machines, or they should have been implemented that way.

You asked specifically about handling the logic & controls. What's nice about the QP is that the active-object model of computing that it embraces lends itself to very natural & straightforward implementation of state machines (flat or hierarchical). So in your example above, you'd probably receive a "temperature update" event with a new temperature, and your state handler would perform the logic & decide what action is necessary. With a framework, you create the logic behind the controls, but the infrastructure handles almost everything else.

The Quantum Platform is pretty slick. It's also very easy to see the connection (traceability) between the design (statechart) and the implementation/code. Best of all, the framework implements all the infrastructure (event queueing & dispatching, state transitions, garbage collection, memory pools, etc..) so all you have to do is focus on your application.

I've used Nokia's Qt on non-embedded platforms, but your question seems to suggest you're already aware of it. I think there's a smaller "embeddedable" version of Qt but I've never used it.

汐鸠 2024-09-22 01:42:20

是否有工具/框架可以消除所有脏工作..?是的,有。它们被称为嵌入式操作系统和实时操作系统。通常,它们帮助处理由计时器、按钮和其他控件生成的中断,它们包含硬件抽象级别,它们包括各种通信协议栈等。因此,基本上,它们完成了所有肮脏的工作。您所需要做的就是使用 IF/ELSE 或 SWITCH 或任何您喜欢的方式处理它们提供的内容。至少谁更清楚如果mTemperature超过ma​​xTemperaturetempereDialControl.Enabled必须为false

Are there tools/frameworks to remove all the dirty work .. ? Yes, there are. They are called embedded OS'es and RTOS'es. As a rule, they help in handling interrupts generated by timers, buttons, and other controls, they contain hardware abstraction levels, they include various communication protocol stacks and etc. So, basically, they do all dirty work. All you need is to process what they provide using IF/ELSE or SWITCH or whatever you like. At least who knows better that temperatureDialControl.Enabled has to be false if mTemperature exceeds maxTemperature?

始终不够 2024-09-22 01:42:20

通过嵌入式,您可以自由地做任何您想做的事情,您不会受到操作系统或更糟糕的 API 的限制。嵌入式系统可以是事件驱动的,特别是如果电源是一个问题(电池供电),因为您本质上希望进入低功耗状态并且仅在发生事件时唤醒。但是您也可以使用无中断和中断意义上的无事件,您可以轮询所有内容,只要保证您的响应时间满足任何要求即可。

就微波用户界面而言,与计算机键盘相比微不足道,但根据系统的不同,微波用户界面可能会复杂或简单。为了成本,每个按钮都可以输入微控制器,微控制器必须轮询或获取每个按钮的中断并进行去抖动等。或者像您的计算机键盘或鼠标一样,可能有硬件和逻辑来完成所有这些操作工作,并且微控制器在某些特殊或标准总线(如串行或 spi 或其他)上发送指示事件的单个字节或数据包。现在,执行该任务的逻辑本身可能是另一个微控制器,其唯一的工作是去抖动和检测按钮按下,然后在看到状态变化时触发串行字节。轮询可能更容易,但我也可以想象使用中断来消除抖动的方法。

嵌入式的特殊之处在于您不受操作系统限制和 API 的限制,除非您强加给自己(或由客户强加)。用户界面通常比桌面程序用户界面简单得多。

With embedded you have the freedom to do whatever you want, you are not confined by the limits of an operating system or worse an API. Embedded systems can be event driven, esp if power is a concern (battery powered) because you essentially want to go to low power and only wake up for events. But you can also use no interrupts and no events in the sense of interrupts, you can poll everything so long as your response time is guaranteed to meet whatever the requirements are.

As far as microwave user interfaces, which are trivial compared that of a computer keyboard for example, can be complicated or simple depending on the system. For cost each of those buttons may be fed into a microcontroller and the microcontroller has to poll or get an interrupt for each one and do the debouncing, etc. Or like your computer keyboard or mouse for example there maybe hardware and logic that does all that work and the microcontroller is sent a single byte or packet indicating an event, on some special or standard bus like serial or spi or other. Now that logic that performs that task may itself be another microcontroller whose only job is to debounce and detect button presses and then fire out the serial byte when it sees a state change. Polling is probably easier but I can imagine ways to debounce using interrupts as well.

Embedded is only special in the sense that you are not confined by operating system limits and apis, except for those that you impose on yourself (or are imposed by the customer). The user interfaces are normally much much simpler than a desktop programs user interface.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文