-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.c
91 lines (70 loc) · 1.67 KB
/
code.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include "ee.h"
#include "stm32f4xx.h"
#include "stm32f4_discovery.h"
#include "stm32f4_discovery_lcd.h"
#include "lcd_log.h"
#include <stdio.h>
#include "Widget.h"
#include "WidgetConfig.h"
#include "Touch.h"
#include "STMPE811QTR.h"
#include "app.h"
/*
* SysTick ISR2
*/
ISR2(systick_handler)
{
/* count the interrupts, waking up expired alarms */
CounterTick(myCounter);
}
TASK(TaskOUT)
{
app();
}
TASK(TaskLCDTouch) {
unsigned int px, py;
TPoint p;
if(GetTouch_SC_Async(&px, &py)) {
p.x = px;
p.y = py;
OnTouch(weather_ui, &p);
}
}
int main(void)
{
/*
* Setup the microcontroller system.
* Initialize the Embedded Flash Interface, the PLL and update the
* SystemFrequency variable.
* For default settings look at:
* pkg/mcu/st_stm32_stm32f4xx/src/system_stm32f4xx.c
*/
SystemInit();
/*Initialize Erika related stuffs*/
EE_system_init();
/*Initialize systick */
EE_systick_set_period(MILLISECONDS_TO_TICKS(1, SystemCoreClock));
EE_systick_enable_int();
EE_systick_start();
/* Init Touchscreen */
IOE_Config();
// InitTouch(-0.096, 0.0650, -367, 15);
// InitTouch(-0.096, 0.0650, -327, 15);
InitTouch(-0.1, 0.0650, -327, 15);
/*Initialize the LCD*/
STM32f4_Discovery_LCD_Init();
LCD_Clear(APP_BACKGROUND_COLOR);
LCD_SetColors(APP_BACKGROUND_COLOR, APP_BACKGROUND_COLOR);
UI_DrawFixElements();
// DrawInit(weather_ui);
// DrawFixWidgets();
LCD_SetFont(&Font8x12);
app_init();
/* Program cyclic alarms which will fire after an initial offset,
* and after that periodically
* */
SetRelAlarm(AlarmOUT, 1, 10);
SetRelAlarm(AlarmTaskLCDTouch, 7, 20);
/* Forever loop: background activities (if any) should go here */
for (;;);
}