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

📄 kbdmgr.c

📁 量子编程源代码 量子编程源代码
💻 C
字号:
/****************************************************************************** Product: QDPP example* Last Updated for Version: 3.1.06* Date of the Last Update:  May 06, 2006**                    Q u a n t u m     L e a P s*                    ---------------------------*                    innovating embedded systems** Copyright (c) 2002-2006 Quantum Leaps, LLC. All rights reserved.** Internet: www.quantum-leaps.com     Licensing: sales@quantum-leaps.com** This Software is protected by the United States copyright laws and* international treaties. Distribution of products containing this Software* or based upon this Software (Derivative Works) requires a valid Quantum* Leaps Distribution License. Any other distribution, in source or binary* format is illegal.*****************************************************************************/#include "qf_port.h"#include "qs_port.h"#include "qdpp.h"#include "qassert.h"Q_DEFINE_THIS_FILE/* local types -------------------------------------------------------------*/typedef 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);/* local objects -----------------------------------------------------------*/static KbdMgr l_kbdMgr;/*..........................................................................*/void kbdMgrStart(uint8_t prio,                 QEvent const *qSto[], uint32_t qLen,                 void *stkSto, uint32_t stkSize){    KbdMgr_ctor(&l_kbdMgr);                           /* explicit Ctor call */    QActive_start((QActive *)&l_kbdMgr, 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 */    QS_OBJ_DICTIONARY(&l_kbdMgr);    QS_FUN_DICTIONARY(&KbdMgr_initial);    QS_FUN_DICTIONARY(&KbdMgr_active);    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: {            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 + -