rtc example with tm1637 driver
[cortex-from-scratch] / main.c
diff --git a/main.c b/main.c
index 35b718e..da28711 100644 (file)
--- a/main.c
+++ b/main.c
@@ -5,6 +5,8 @@
  * Initial version 
  * 
  * $DESCRIPTION$
+ * Main intialize basic components of the boards
+ * and jumps to a terminal
  *
  * */
 
 #include <sys/robsys.h> 
 #include <sys/mmap.h>
 
+#include <lib/regfunc.h>
+#include <lib/stdio.h>
+#include <lib/tinyprintf.h>
+
 #include <drivers/uart.h>
+#include <drivers/led.h>
+#include <drivers/tm1637.h>
+#include <drivers/at24c.h>
+#include <drivers/tsensor.h>
+
+//void sleep() {
+//
+//     __asm__ __volatile__("wfe");
+//
+//}
 
 void main()
 {
+       clock_init();
        ivt_init();
        uart_init();
+//     cputs("ROBSYS LOADING...\n");
+       //systick_init();
+//     tsensor_output(0xFFFF, 0x7FFF);
 
-       systick_init();
+       init_printf(NULL, putc);
+       // SPEED_TEST
+/*     cputs("START TEST (8MHz) \n");
+       int a;
+       for (int i = 0; i < 20000000; i++) {
+               a + 2;  
+       }
+       a = 0;
+       cputs("END TEST\n");
        
+       //! 
+       clock_init();
+
+       cputs("START TEST (??MHz) \n");
+       for (int i = 0; i < 20000000; i++) {
+               a + 2;  
+       }
+       cputs("END TEST\n"); */
        sysinfo();
 
-       extern void stub();
+
+//     tsensor_input(5000);
+//     run();
+
+       led_init();
+//     eeprom_at24c_init();
+//     eeprom_test();
+       tm1637_init();
+
+       rtc_init();
+
+
+       //uint32_t test = hextoreg("12345678");
+               
+//     cputs(regtohex(test));
+
+       //extern void stub();
        //stub();
        //__asm__ __volatile__ ("ldc p1, cr1, r0");
 
+/*     while(1) {
+               int r;
+               for (int i = 0; i < 50000; i++) {
+                       r = 0;  
+               }
+               led_on();
+               for (int i = 0; i < 50000; i++) {
+                       r = 0;  
+               }
+               led_off();
+       } */
        terminal();
 
        for(;;) {