st7735s: signs of life
[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         /* Cortex M* integrated systick, can be replaced
45          * by the more accurate RTC.
46         systick_init();
47         */
48         
49
50         /* Set up a very small libc library */
51         init_printf(NULL, putc);
52
53         /* Display some basic info at startup */
54         sysinfo();
55
56         /* On board LEDs*/
57         led_init();
58
59         /* Real time clock */
60         rtc_init();
61
62         /* Eeprom Driver
63         eeprom_at24c_init();
64         eeprom_test();
65         */
66         
67         /* LED Segment Driver */
68         //tm1637_init();
69
70         /* ASM Blocking routine */
71         //for (int i = 0; i < 1000; i++)
72         //      _block(10000);
73
74         /* TEMP SENSOR 
75         tsensor_printid();
76         uint16_t temp = tsensor_get_temp();
77         printf("Current temperature: %d °C\n", temp); */
78
79         /* ADC Joystick module */
80         // mk450_init();        
81
82         /* TFT screen */
83         tft_init();
84
85         /* Start up terminal */
86         terminal();
87         
88         /* Should not be here, endless loop */
89         for(;;) {
90
91         }
92 }