-
Notifications
You must be signed in to change notification settings - Fork 0
/
hc.c
62 lines (52 loc) · 1.67 KB
/
hc.c
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
#include "qpn_port.h"
#include "hc.h"
#include "buttons.h"
#include "bsp.h"
#include "lcd.h"
#include "recorder.h"
#include "rtc.h"
#include "ui.h"
#include "serial.h"
Q_DEFINE_THIS_FILE;
static QEvent rtcQueue[4];
static QEvent recorderQueue[4];
/** The size of buttonsQueue[] is embarrassing, and reveals a flaw in the
current code. It will go away completely in a later iteration. */
static QEvent buttonsQueue[18];
static QEvent uiQueue[8];
QActiveCB const Q_ROM Q_ROM_VAR QF_active[] = {
{ (QActive*)0 , (QEvent*)0 , 0 },
{ (QActive *) (&recorder), recorderQueue, Q_DIM(recorderQueue)},
{ (QActive *) (&buttons) , buttonsQueue , Q_DIM(buttonsQueue) },
{ (QActive *) (&ui) , uiQueue , Q_DIM(uiQueue) },
{ (QActive *) (&rtc) , rtcQueue , Q_DIM(rtcQueue) },
};
Q_ASSERT_COMPILE( QF_MAX_ACTIVE == Q_DIM(QF_active) - 1 );
int main(void)
{
/**
* Reserve this space for recording assertions. We don't touch this
* memory here, and assume that it will be in the same place on every
* run, and that it isn't cleared by hardware or by startup code. If
* those are true, then after a reset caused by an assertion, it will
* contain the values as filled in by QF_onAssert() at the end of the
* previous run (before the reset).
*
* FIXME: test the assumptions. Also test hardware reset.
*/
struct AssertionBuffer assertion_buffer;
BSP_set_assertion_buffer(&assertion_buffer);
startmain:
BSP_init();
serial_init();
SERIALSTR("\r\n\r\n*** Hots and Colds ***\r\n");
buttons_ctor();
rtc_ctor();
lcd_init();
recorder_ctor();
ui_ctor();
SERIALSTR("Let's go...\r\n");
QF_run();
goto startmain;
return 0;
}