pretty print EEPROM
[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 intialize basic components of the boards
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
30 //void sleep() {
31 //
32 //      __asm__ __volatile__("wfe");
33 //
34 //}
35
36 void main()
37 {
38         clock_init();
39         ivt_init();
40         uart_init();
41 //      cputs("ROBSYS LOADING...\n");
42         //systick_init();
43 //      tsensor_output(0xFFFF, 0x7FFF);
44
45         init_printf(NULL, putc);
46         // SPEED_TEST
47 /*      cputs("START TEST (8MHz) \n");
48         int a;
49         for (int i = 0; i < 20000000; i++) {
50                 a + 2;  
51         }
52         a = 0;
53         cputs("END TEST\n");
54         
55         //! 
56         clock_init();
57
58         cputs("START TEST (??MHz) \n");
59         for (int i = 0; i < 20000000; i++) {
60                 a + 2;  
61         }
62         cputs("END TEST\n"); */
63         sysinfo();
64
65
66 //      tsensor_input(5000);
67 //      run();
68
69         led_init();
70         eeprom_at24c_init();
71         eeprom_test();
72 //      rtc_init();
73
74 //      tm1637_init();
75 //      tm1637_start();
76
77         //uint32_t test = hextoreg("12345678");
78                 
79 //      cputs(regtohex(test));
80
81         //extern void stub();
82         //stub();
83         //__asm__ __volatile__ ("ldc p1, cr1, r0");
84
85 /*      while(1) {
86                 int r;
87                 for (int i = 0; i < 50000; i++) {
88                         r = 0;  
89                 }
90                 led_on();
91                 for (int i = 0; i < 50000; i++) {
92                         r = 0;  
93                 }
94                 led_off();
95         } */
96         terminal();
97
98         for(;;) {
99
100         }
101 }