Fixed USB VID/PID
[hackover2013-badge-firmware.git] / sysinit.c
index aedf9b3..0385a21 100644 (file)
--- a/sysinit.c
+++ b/sysinit.c
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdarg.h>
 
 #include "sysinit.h"
 
 #include "core/cpu/cpu.h"
 #include "core/pmu/pmu.h"
 
 #include "sysinit.h"
 
 #include "core/cpu/cpu.h"
 #include "core/pmu/pmu.h"
-#include "core/adc/adc.h"
 
 #ifdef CFG_PRINTF_UART
   #include "core/uart/uart.h"
 
 #ifdef CFG_PRINTF_UART
   #include "core/uart/uart.h"
@@ -55,7 +55,7 @@
 #endif
 
 #ifdef CFG_CHIBI
 #endif
 
 #ifdef CFG_CHIBI
-  #include "drivers/chibi/chb.h"
+  #include "drivers/rf/chibi/chb.h"
 #endif
 
 #ifdef CFG_USBHID
 #endif
 
 #ifdef CFG_USBHID
 #endif
 
 #ifdef CFG_ST7565
 #endif
 
 #ifdef CFG_ST7565
-  #include "drivers/lcd/bitmap/st7565/st7565.h"
-  #include "drivers/lcd/smallfonts.h"
+  #include "drivers/displays/bitmap/st7565/st7565.h"
+  #include "drivers/displays/smallfonts.h"
 #endif
 
 #ifdef CFG_SSD1306
 #endif
 
 #ifdef CFG_SSD1306
-  #include "drivers/lcd/bitmap/ssd1306/ssd1306.h"
-  #include "drivers/lcd/smallfonts.h"
+  #include "drivers/displays/bitmap/ssd1306/ssd1306.h"
+  #include "drivers/displays/smallfonts.h"
 #endif
 
 #ifdef CFG_TFTLCD
 #endif
 
 #ifdef CFG_TFTLCD
-  #include "drivers/lcd/tft/lcd.h"
-  #include "drivers/lcd/tft/touchscreen.h"
-  #include "drivers/lcd/tft/drawing.h"  
+  #include "drivers/displays/tft/lcd.h"
+  #include "drivers/displays/tft/touchscreen.h"
+  #include "drivers/displays/tft/drawing.h"  
 #endif
 
 #ifdef CFG_I2CEEPROM
 #endif
 
 #ifdef CFG_I2CEEPROM
-  #include "drivers/eeprom/mcp24aa/mcp24aa.h"
-  #include "drivers/eeprom/eeprom.h"
+  #include "drivers/storage/eeprom/mcp24aa/mcp24aa.h"
+  #include "drivers/storage/eeprom/eeprom.h"
 #endif
 
 #ifdef CFG_PWM
 #endif
 
 #ifdef CFG_PWM
 
   DWORD get_fattime ()
   {
 
   DWORD get_fattime ()
   {
-    // ToDo!
-    return 0;
+    DWORD tmr = 0;
+
+    // tmr =  (((DWORD)rtcYear - 80) << 25)
+       //      | ((DWORD)rtcMon << 21)
+    //      | ((DWORD)rtcMday << 16)
+    //      | (WORD)(rtcHour << 11)
+    //      | (WORD)(rtcMin << 5)
+    //      | (WORD)(rtcSec >> 1);
+
+    return tmr;
   }
 #endif
 
   }
 #endif
 
@@ -299,3 +307,61 @@ int puts(const char * str)
 
   return 0;
 }
 
   return 0;
 }
+
+// Override printf here if we're using Crossworks for ARM
+// so that we can still use the custom libc libraries.
+// For Codelite and compiling from the makefile (Yagarto, etc.)
+// this is done in /core/libc
+
+#ifdef __CROSSWORKS_ARM
+
+/**************************************************************************/
+/*! 
+    @brief  Outputs a formatted string on the DBGU stream. Format arguments
+            are given in a va_list instance.
+
+    @param[in]  pFormat
+                Format string
+    @param[in]  ap
+                Argument list
+*/
+/**************************************************************************/
+signed int vprintf(const char *pFormat, va_list ap)
+{
+  char pStr[CFG_PRINTF_MAXSTRINGSIZE];
+  char pError[] = "stdio.c: increase CFG_PRINTF_MAXSTRINGSIZE\r\n";
+  
+  // Write formatted string in buffer
+  if (vsprintf(pStr, pFormat, ap) >= CFG_PRINTF_MAXSTRINGSIZE) {
+    
+    puts(pError);
+    while (1); // Increase CFG_PRINTF_MAXSTRINGSIZE
+  }
+  
+  // Display string
+  return puts(pStr);
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Outputs a formatted string on the DBGU stream, using a 
+            variable number of arguments
+
+    @param[in]  pFormat
+                Format string
+*/
+/**************************************************************************/
+signed int printf(const char *pFormat, ...)
+{
+    va_list ap;
+    signed int result;
+
+    // Forward call to vprintf
+    va_start(ap, pFormat);
+    result = vprintf(pFormat, ap);
+    va_end(ap);
+
+    return result;
+}
+
+#endif
This page took 0.030852 seconds and 4 git commands to generate.