main.c
1.1 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
#include <stdio.h>
#include <pthread.h>
#include "printx.h"
#include "ui.h"
#include "nfc.h"
#include "bus.h"
#include "hvc.h"
#include "heat.h"
#include <unistd.h>
int main(void)
{
int ret;
pthread_t tUI;
pthread_t tNFC;
pthread_t tBUS;
pthread_t tHVC;
initUILog();
if(!initLog())
{
printf("Log creation failed\n");
return 1;
}
printx(INFO, MAIN, "Tweekd starting\n");
printx(DEBUG, MAIN, "Creating processes\n");
ret = pthread_create(&tUI, NULL, drawUI, NULL);
printx(DEBUG, MAIN, "UI Started ID %08x ret %d\n", tUI, ret);
printx(INFO, MAIN, "Initializing NFC\n");
if(!initNFC())
{
printx(ERROR, MAIN, "Unable to start the NFC interface\n");
return 2;
}
pthread_create(&tNFC, NULL, processNFC, NULL);
if(!initBus())
{
printx(ERROR, MAIN, "Unable to start the BUS interface\n");
return 3;
}
pthread_create(&tBUS, NULL, processBus, NULL);
if(!initHVC())
{
printx(ERROR, MAIN, "Unable to start the HVC interface\n");
return 4;
}
pthread_create(&tHVC, NULL, processHVC, NULL);
initProcessHeat();
setPumpOn();
processHeat(NULL);
pthread_join(tUI, NULL);
closeLog();
return 0;
}