You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
150 lines
5.1 KiB
XML
150 lines
5.1 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<model version="5.3.0" links="0">
|
|
<framework name="qpc"/>
|
|
<package name="AO_ptrs" stereotype="0x00">
|
|
<attribute name="AO_Blinky1" type="QActive * const" visibility="0x00" properties="0x00">
|
|
<code>= &Blinky1_inst.super;</code>
|
|
</attribute>
|
|
<attribute name="AO_Blinky2" type="QActive * const" visibility="0x00" properties="0x00">
|
|
<code>= &Blinky2_inst.super;</code>
|
|
</attribute>
|
|
</package>
|
|
<package name="AOs" stereotype="0x00">
|
|
<class name="BlinkPatternEvt" superclass="qpc::QEvt">
|
|
<documentation>event for blink-pattern</documentation>
|
|
<attribute name="ticks" type="uint8_t" visibility="0x00" properties="0x00"/>
|
|
<attribute name="iter" type="uint32_t" visibility="0x00" properties="0x00"/>
|
|
</class>
|
|
<class name="Blinky1" superclass="qpc::QActive">
|
|
<attribute name="te" type="QTimeEvt" visibility="0x02" properties="0x00"/>
|
|
<attribute name="iter" type="uint32_t" visibility="0x00" properties="0x00"/>
|
|
<attribute name="inst" type="Blinky1" visibility="0x00" properties="0x01"/>
|
|
<operation name="ctor" type="void" visibility="0x00" properties="0x00">
|
|
<code>QActive_ctor(&me->super, Q_STATE_CAST(&Blinky1_initial));
|
|
QTimeEvt_ctorX(&me->te, &me->super, TIMEOUT_SIG, 0U);</code>
|
|
</operation>
|
|
<statechart properties="0x01">
|
|
<initial target="../1">
|
|
<action>QTimeEvt_armX(&me->te, 2U, 2U);
|
|
me->iter = 1500U;</action>
|
|
<initial_glyph conn="3,2,5,1,35,6,-2">
|
|
<action box="0,-2,34,4"/>
|
|
</initial_glyph>
|
|
</initial>
|
|
<state name="active">
|
|
<tran trig="BLINK_PATTERN">
|
|
<action>QTimeEvt_disarm(&me->te);
|
|
QTimeEvt_armX(&me->te, ((BlinkPatternEvt const *)e)->ticks,
|
|
((BlinkPatternEvt const *)e)->ticks);
|
|
me->iter = ((BlinkPatternEvt const *)e)->iter;</action>
|
|
<tran_glyph conn="2,14,3,-1,30">
|
|
<action box="0,-2,47,11"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<tran trig="TIMEOUT">
|
|
<action>for (uint32_t volatile i = me->iter; i != 0U; --i) {
|
|
BSP_ledGreenOn();
|
|
BSP_ledGreenOff();
|
|
}</action>
|
|
<tran_glyph conn="2,26,3,-1,31">
|
|
<action box="0,-2,33,12"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<state_glyph node="2,6,34,30"/>
|
|
</state>
|
|
<state_diagram size="40,41"/>
|
|
</statechart>
|
|
</class>
|
|
<class name="Blinky2" superclass="qpc::QActive">
|
|
<attribute name="inst" type="Blinky2" visibility="0x00" properties="0x01"/>
|
|
<attribute name="seq" type="uint8_t" visibility="0x00" properties="0x00"/>
|
|
<operation name="ctor" type="void" visibility="0x00" properties="0x00">
|
|
<code>QActive_ctor(&me->super, Q_STATE_CAST(&Blinky2_initial));</code>
|
|
</operation>
|
|
<statechart properties="0x01">
|
|
<initial target="../1">
|
|
<action>me->seq = 0U;</action>
|
|
<initial_glyph conn="3,2,5,1,39,6,-2">
|
|
<action box="1,0,12,2"/>
|
|
</initial_glyph>
|
|
</initial>
|
|
<state name="active">
|
|
<tran trig="BUTTON_PRESS">
|
|
<action>enum { N_SEQ = 2 };
|
|
static uint8_t const n_ticks[N_SEQ] = { 2U, 1U };
|
|
static uint32_t const n_iter[N_SEQ] = { 1500U, 750U };
|
|
|
|
/* advance and wrap-around the sequence counter */
|
|
me->seq = (me->seq + 1U) % N_SEQ;
|
|
|
|
BlinkPatternEvt *bpe = Q_NEW(BlinkPatternEvt,
|
|
BLINK_PATTERN_SIG);
|
|
bpe->ticks = n_ticks[me->seq];
|
|
for (uint32_t volatile i = 1500U; i != 0U; --i) {
|
|
BSP_ledBlueOn();
|
|
BSP_ledBlueOff();
|
|
}
|
|
bpe->iter = n_iter[me->seq];
|
|
QACTIVE_POST(AO_Blinky1, &bpe->super, 0U);
|
|
|
|
for (uint32_t volatile i = 2*1500U; i != 0U; --i) {
|
|
BSP_ledBlueOn();
|
|
BSP_ledBlueOff();
|
|
}</action>
|
|
<tran_glyph conn="2,12,3,-1,32">
|
|
<action box="0,-2,39,44"/>
|
|
</tran_glyph>
|
|
</tran>
|
|
<state_glyph node="2,6,38,50"/>
|
|
</state>
|
|
<state_diagram size="44,60"/>
|
|
</statechart>
|
|
</class>
|
|
</package>
|
|
<directory name=".">
|
|
<file name="main_qm.c">
|
|
<text>#include "qpc.h"
|
|
#include "bsp.h"
|
|
|
|
Q_DEFINE_THIS_FILE
|
|
|
|
$declare ${AOs}
|
|
|
|
static QEvt const *blinky1_queue[10];
|
|
static QEvt const *blinky2_queue[10];
|
|
static BlinkPatternEvt evtPool[10];
|
|
|
|
int main() {
|
|
BSP_init();
|
|
QF_init();
|
|
|
|
/* initialize the event pools... */
|
|
QF_poolInit(evtPool, sizeof(evtPool), sizeof(evtPool[0]));
|
|
|
|
/* initialize and start Blinky1 AO */
|
|
Blinky1_ctor(&Blinky1_inst);
|
|
QACTIVE_START(&Blinky1_inst,
|
|
5U, /* priority */
|
|
blinky1_queue, Q_DIM(blinky1_queue), /* event queue */
|
|
(void *)0, 0, /* stack memory, stack size (not used) */
|
|
(void *)0); /* extra parameter (not used) */
|
|
|
|
/* initialize and start Blinky2 AO */
|
|
Blinky2_ctor(&Blinky2_inst);
|
|
QACTIVE_START(&Blinky2_inst,
|
|
2U, /* priority */
|
|
blinky2_queue, Q_DIM(blinky2_queue), /* event queue */
|
|
(void *)0, 0, /* stack memory, stack size (not used) */
|
|
(void *)0); /* extra parameter (not used) */
|
|
|
|
/* transfer control to the RTOS to run the threads */
|
|
return QF_run();
|
|
}
|
|
|
|
/*=======================================================================*/
|
|
$define ${AO_ptrs}
|
|
$define ${AOs}</text>
|
|
</file>
|
|
</directory>
|
|
</model>
|