-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathusbtask.cpp
More file actions
72 lines (60 loc) · 1.97 KB
/
usbtask.cpp
File metadata and controls
72 lines (60 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//////////////////////////////////////////////////////////////////////////////
// Model: fsa_eos.qm
// File: ./usbtask.cpp
//
// This file has been generated automatically by QP Modeler (QM).
// DO NOT EDIT THIS FILE MANUALLY.
//
// Please visit www.state-machine.com/qm for more information.
//////////////////////////////////////////////////////////////////////////////
#include "Usb.h"
#include "qp_port.h"
#include "bsp.h"
#include "fsa.h"
Q_DEFINE_THIS_FILE
// mult.reconnect - /2 rare
//
#define USB_TICK_TIME BSP_TICKS_PER_SEC/5 //Usb.Task() tick time
//Usbtask Class
// $(AOs::Usbtask) ...........................................................
/// AO to run USB Task. To be moved somewhere else.
class Usbtask : public QActive {
private:
QTimeEvt usb_tick;
public:
Usbtask() : QActive((QStateHandler)&Usbtask::initial), usb_tick(USB_TICK_SIG) {
}
protected:
static QState initial(Usbtask *me, QEvent const *e);
static QState usb_task(Usbtask *me, QEvent const *e);
};
//Local objects
static Usbtask l_usbtask;
//Global objects
QActive * const AO_Usbtask = &l_usbtask;
//Lights class definition
// $(AOs::Usbtask) ...........................................................
// $(AOs::Usbtask::Statechart) ...............................................
// @(/2/3/2/0)
QState Usbtask::initial(Usbtask *me, QEvent const *e) {
me->usb_tick.postIn(me, USB_TICK_TIME);
return Q_TRAN(&Usbtask::usb_task);
}
// $(AOs::Usbtask::Statechart::usb_task) .....................................
QState Usbtask::usb_task(Usbtask *me, QEvent const *e) {
switch (e->sig) {
// @(/2/3/2/1)
case Q_ENTRY_SIG: {
//Notify(PSTR("AO_UT Entry\r\n"));
return Q_HANDLED();
}
// @(/2/3/2/1/0)
case USB_TICK_SIG: {
//Notify(PSTR("AO_UT USB_TICK_SIG\r\n"));
O_usb->Task();
me->usb_tick.postIn(me, USB_TICK_TIME);
return Q_HANDLED();
}
}
return Q_SUPER(&QHsm::top);
}