Ver código fonte

Add printf for IAR

TelenkovDmitry 7 anos atrás
pai
commit
465be43d11
3 arquivos alterados com 16 adições e 5 exclusões
  1. 1 1
      modules/settings_api.c
  2. 11 0
      peripheral_modules/src/usart.c
  3. 4 4
      user/main.h

+ 1 - 1
modules/settings_api.c

@@ -32,7 +32,7 @@
 #include "tinystdio.h"
 #endif
 
-#define DBG if(0)
+//#define DBG if(0)
 
 #if defined ( __ICCARM__ )
 #define DEVICE_MAC "00-00-00-00-00-03"

+ 11 - 0
peripheral_modules/src/usart.c

@@ -26,6 +26,17 @@
 #include "tinystdio.h"
 #endif
 
+#ifdef __ICCARM__
+  #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)    
+#endif  
+
+PUTCHAR_PROTOTYPE   
+{   
+  USART_SendData(USER_USART, (u8) ch);   
+  while(USART_GetFlagStatus(USER_USART, USART_FLAG_TXE) == RESET) {}   
+  return ch;   
+}   
+
 #ifdef BT6702_SERVICE
 #define UPS_RBUF_SIZE 1024
 #else

+ 4 - 4
user/main.h

@@ -58,13 +58,13 @@
 #define __packed		__attribute__(( packed ))
 #endif
    
-//#define DEBUG
+#define DEBUG
 
-/*#ifdef DEBUG
+#ifdef DEBUG
 #define DBG
-#else*/
+#else
 #define DBG if (0)
-//#endif
+#endif
 
    
 /* Exported macro ------------------------------------------------------------*/