2019-12-31 15:56:23 -05:00

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(&amp;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 &quot;qpcpp.hpp&quot;
#include &lt;iostream&gt;
#include &lt;stdlib.h&gt; // for exit()
using namespace std;
using namespace QP;
enum { BSP_TICKS_PER_SEC = 100 };
void BSP_ledOff(void) {
cout &lt;&lt; &quot;LED OFF&quot; &lt;&lt; endl;
}
void BSP_ledOn(void) {
cout &lt;&lt; &quot;LED ON&quot; &lt;&lt; endl;
}
extern &quot;C&quot; void Q_onAssert(char const * const module, int loc) {
cout &lt;&lt; &quot;Assertion failed in &quot; &lt;&lt; module &lt;&lt; ':' &lt;&lt; loc &lt;&lt; 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 = &amp;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-&gt;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>