4712f7ab93c3e675376232b5d17f5380f884ed0b
[cortex-from-scratch] / main.c
1 /* (CC-BY-NC-SA) ROBIN KRENS - ROBIN @ ROBINKRENS.NL
2  * 
3  * $LOG$
4  * 2019/7/20 - ROBIN KRENS      
5  * Initial version 
6  * 
7  * $DESCRIPTION$
8  * Main initialize basic components of the board
9  * and jumps to a terminal
10  *
11  * */
12
13 #include <stdbool.h>
14 #include <stddef.h>
15 #include <stdint.h>
16
17 #include <sys/robsys.h> 
18 #include <sys/mmap.h>
19
20 #include <lib/regfunc.h>
21 #include <lib/stdio.h>
22 #include <lib/tinyprintf.h>
23
24 #include <drivers/uart.h>
25 #include <drivers/led.h>
26 //#include <drivers/tm1637.h>
27 //#include <drivers/at24c.h>
28 //#include <drivers/tsensor.h>
29 //#include <drivers/mk450_joystick.h>
30 #include <drivers/st7735s.h>
31
32 void main()
33 {
34
35         /* Initialize the clock system, */
36         clock_init();
37
38         /* Setup the interrupt vector table */
39         ivt_init();
40
41         /* Initialze basic input and output over serial */
42         uart_init();
43
44         /* TFT screen */
45         tft_init();
46         
47         /* Cortex M* integrated systick, can be replaced
48          * by the more accurate RTC.
49         systick_init();
50         */
51         
52
53         /* Set up a very small libc library */
54         init_printf(NULL, putc);
55
56         /* Display some basic info at startup */
57         sysinfo();
58
59         /* On board LEDs*/
60         led_init();
61
62         /* Real time clock */
63         rtc_init();
64         
65         /* Eeprom Driver
66         eeprom_at24c_init();
67         eeprom_test();
68         */
69         
70         /* LED Segment Driver */
71         //tm1637_init();
72
73         /* ASM Blocking routine */
74         //for (int i = 0; i < 1000; i++)
75         //      _block(10000);
76
77         /* TEMP SENSOR 
78         tsensor_printid();
79         uint16_t temp = tsensor_get_temp();
80         printf("Current temperature: %d °C\n", temp); */
81
82         /* ADC Joystick module */
83         // mk450_init();        
84
85
86         /* Start up terminal */
87         terminal();
88         
89         /* Should not be here, endless loop */
90         for(;;) {
91
92         }
93 }