mirror of
https://github.com/QuantumLeaps/qpcpp.git
synced 2025-01-14 05:42:57 +08:00
114 lines
3.2 KiB
XML
114 lines
3.2 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<model version="4.6.0" links="1">
|
|
<!--${qpcpp}-->
|
|
<framework name="qpcpp"/>
|
|
<!--${AOs}-->
|
|
<package name="AOs" stereotype="0x02">
|
|
<!--${AOs::Blinky}-->
|
|
<class name="Blinky" superclass="qpcpp::QActive">
|
|
<!--${AOs::Blinky::m_timeEvt}-->
|
|
<attribute name="m_timeEvt" type="QP::QTimeEvt" visibility="0x02" properties="0x00"/>
|
|
<!--${AOs::Blinky::Blinky}-->
|
|
<operation name="Blinky" type="" visibility="0x00" properties="0x00">
|
|
<code>: QActive(Q_STATE_CAST(&Blinky::initial)),
|
|
m_timeEvt(this, TIMEOUT_SIG, 0U)</code>
|
|
</operation>
|
|
<!--${AOs::Blinky::SM}-->
|
|
<statechart properties="0x02">
|
|
<!--${AOs::Blinky::SM::initial}-->
|
|
<initial target="../1">
|
|
<action>m_timeEvt.armX(BSP_TICKS_PER_SEC/2, BSP_TICKS_PER_SEC/2);
|
|
(void)e; // unused parameter</action>
|
|
<initial_glyph conn="2,2,5,1,20,8,-4">
|
|
<action box="0,-2,32,6"/>
|
|
</initial_glyph>
|
|
</initial>
|
|
<!--${AOs::Blinky::SM::off}-->
|
|
<state name="off">
|
|
<entry>BSP_ledOff();</entry>
|
|
<!--${AOs::Blinky::SM::off::TIMEOUT}-->
|
|
<tran trig="TIMEOUT" target="../../2">
|
|
<tran_glyph conn="2,16,3,1,18,8,-2">
|
|
<action box="0,-2,8,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<state_glyph node="2,8,16,10">
|
|
<entry box="1,2,12,4"/>
|
|
</state_glyph>
|
|
</state>
|
|
<!--${AOs::Blinky::SM::on}-->
|
|
<state name="on">
|
|
<entry>BSP_ledOn();</entry>
|
|
<!--${AOs::Blinky::SM::on::TIMEOUT}-->
|
|
<tran trig="TIMEOUT" target="../../1">
|
|
<tran_glyph conn="2,30,3,1,20,-17,-4">
|
|
<action box="0,-2,8,2"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<state_glyph node="2,22,16,10">
|
|
<entry box="1,2,12,4"/>
|
|
</state_glyph>
|
|
</state>
|
|
<state_diagram size="34,34"/>
|
|
</statechart>
|
|
</class>
|
|
</package>
|
|
<!--${.}-->
|
|
<directory name=".">
|
|
<!--${.::blinky.cpp}-->
|
|
<file name="blinky.cpp">
|
|
<text>#include "qpcpp.hpp"
|
|
#include <iostream>
|
|
#include <stdlib.h> // for exit()
|
|
|
|
using namespace std;
|
|
using namespace QP;
|
|
|
|
enum { BSP_TICKS_PER_SEC = 100 };
|
|
|
|
void BSP_ledOff(void) {
|
|
cout << "LED OFF" << endl;
|
|
}
|
|
void BSP_ledOn(void) {
|
|
cout << "LED ON" << endl;
|
|
}
|
|
extern "C" void Q_onAssert(char const * const module, int loc) {
|
|
cout << "Assertion failed in " << module << ':' << loc << endl;
|
|
exit(-1);
|
|
}
|
|
void QF::onStartup(void) {}
|
|
void QF::onCleanup(void) {}
|
|
void QP::QF_onClockTick(void) {
|
|
QF::TICK_X(0U, (void *)0); // perform the QF clock tick processing
|
|
}
|
|
|
|
enum BlinkySignals {
|
|
TIMEOUT_SIG = Q_USER_SIG,
|
|
MAX_SIG
|
|
};
|
|
|
|
//=============== ask QM to declare the Blinky class ==================
|
|
$declare${AOs::Blinky}
|
|
|
|
static Blinky l_blinky;
|
|
QActive * const AO_Blinky = &l_blinky;
|
|
|
|
int main() {
|
|
// statically allocate event queue buffer for the Blinky AO
|
|
static QEvt const *blinky_queueSto[10];
|
|
|
|
QF::init(); // initialize the framework
|
|
AO_Blinky->start(1U, // priority
|
|
blinky_queueSto, Q_DIM(blinky_queueSto),
|
|
(void *)0, 0U); // no stack
|
|
return QF::run(); // run the QF application
|
|
}
|
|
|
|
//================ ask QM to define the Blinky class ==================
|
|
$define${AOs::Blinky}
|
|
|
|
</text>
|
|
</file>
|
|
</directory>
|
|
</model>
|