⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kbdmgr.c

📁 state machine working with rtos
💻 C
字号:
/****************************************************************************** Product: QDPP example* Version: Compatible with QF/C 3.1.yy* Updated: Dec 18, 2005** Copyright (C) 2002-2005 Quantum Leaps, LLC. All rights reserved.** This example is part of the Quantum Leaps QP/C software, and may be* distributed and modified under the terms of the GNU General Public License* version 2 (GPL) as published by the Free Software Foundation and appearing* in the file GPL.TXT included in the packaging of this file. Please note* that GPL Section 2[b] requires that all works based on this software must* also be made publicly available under the terms of the GPL ("Copyleft").** Alternatively, this software may be distributed and modified in conjunction* with a valid QP/C Quantum Leaps commercial license. Quantum Leaps* commercial licenses are designed for users who want to retain proprietary* status of their code. The users who license this software under one of* Quantum Leaps commercial licenses do not use this software under the GPL* and therefore are not subject to any of its terms.** Contact information:* Quantum Leaps Web site:  http://www.quantum-leaps.com* Quantum Leaps licensing: http://www.quantum-leaps.com/licensing* Quantum Leaps products:  http://www.quantum-leaps.com/products* e-mail:                  sales@quantum-leaps.com*****************************************************************************/#include "qf_port.h"#include "qdpp.h"#include "qassert.h"Q_DEFINE_THIS_FILEtypedef struct KbdMgrTag KbdMgr;struct KbdMgrTag {                                      /* keyboard manager */    QActive super_;                                /* inherits from QActive */};void KbdMgr_ctor(KbdMgr *me);static void KbdMgr_initial(KbdMgr *me, QEvent const *e);static QSTATE KbdMgr_active(KbdMgr *me, QEvent const *e);/*..........................................................................*/void kbdMgrStart(uint8_t prio,                 QEvent const *qSto[], uint32_t qLen,                 void *stkSto, uint32_t stkSize){    static KbdMgr k;    KbdMgr_ctor(&k);                                  /* explicit Ctor call */    QActive_start((QActive *)&k, prio,                  qSto, qLen, stkSto, stkSize,                  (QEvent *)0);                  /* no initialization event */}/*..........................................................................*/void KbdMgr_ctor(KbdMgr *me) {    QActive_ctor_(&me->super_, (QState)&KbdMgr_initial);}/*..........................................................................*/void KbdMgr_initial(KbdMgr *me, QEvent const *e) {    (void)e;                               /* suppress the compiler warning */    QActive_subscribe_((QActive *)me, KBD_SIG);    Q_INIT(&KbdMgr_active);}/*..........................................................................*/QSTATE KbdMgr_active(KbdMgr *me, QEvent const *e) {    (void)me;                             /* eliminate the compiler warning */    switch (e->sig) {        case KBD_SIG: {            busyDelay();            displayKey(((KbdEvt const *)e)->key);            if (((KbdEvt const *)e)->key == (uint8_t)0x81) {                QF_publish(Q_NEW(QEvent, TERMINATE_SIG));            }            return 0;        }    }    return (QSTATE)&QHsm_top;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -