Blame view

main.c 871 Bytes
e583b6a9   henyxia   First version
1
  #include <stdio.h>
cdaa873f   henyxia   Log fixed
2
  #include <pthread.h>
ae25085d   henyxia   Output function done
3
  #include "printx.h"
ea1218f1   henyxia   UI finished
4
  #include "ui.h"
3bdc9daf   henyxia   NFC Added
5
  #include "nfc.h"
d4d5bb6d   henyxia   Bus working
6
  #include "bus.h"
e583b6a9   henyxia   First version
7
  
cdaa873f   henyxia   Log fixed
8
9
  #include <unistd.h>
  
e583b6a9   henyxia   First version
10
11
  int main(void)
  {
19082eeb   henyxia   UI design not wor...
12
  	int ret;
d4d5bb6d   henyxia   Bus working
13
  	pthread_t tUI, tNFC, tBUS;//tHVC
ea1218f1   henyxia   UI finished
14
15
16
17
18
19
  	initUILog();
  	if(!initLog())
  	{
  		printf("Log creation failed\n");
  		return 1;
  	}
297a72df   henyxia   Added sender
20
21
  	printx(INFO, MAIN, "Tweekd starting\n");
  	printx(DEBUG, MAIN, "Creating processes\n");
ea1218f1   henyxia   UI finished
22
  	displayUI();
19082eeb   henyxia   UI design not wor...
23
  	ret = pthread_create(&tUI, NULL, drawUI, NULL);
297a72df   henyxia   Added sender
24
25
  	printx(DEBUG, MAIN, "UI Started ID %08x ret %d\n", tUI, ret);
  	printx(INFO, MAIN, "Initializing NFC");
3bdc9daf   henyxia   NFC Added
26
27
28
29
30
31
  	if(!initNFC())
  	{
  		printx(ERROR, MAIN, "Unable to start the NFC interface\n");
  		return 2;
  	}
  	pthread_create(&tNFC, NULL, processNFC, NULL);
d4d5bb6d   henyxia   Bus working
32
33
34
35
36
37
  	if(!initBus())
  	{
  		printx(ERROR, MAIN, "Unable to start the BUS interface\n");
  		return 3;
  	}
  	pthread_create(&tBUS, NULL, processBus, NULL);
cdaa873f   henyxia   Log fixed
38
  	pthread_join(tUI, NULL);
ae25085d   henyxia   Output function done
39
  	closeLog();
e583b6a9   henyxia   First version
40
41
  	return 0;
  }