debug output for cdc example

This commit is contained in:
schneider 2011-07-17 10:53:52 +02:00
parent 2e338dff8a
commit 1710ad8b07
1 changed files with 14 additions and 1 deletions

View File

@ -4,6 +4,11 @@
#include "core/usbcdc/usbhw.h" #include "core/usbcdc/usbhw.h"
#include "core/usbcdc/cdcuser.h" #include "core/usbcdc/cdcuser.h"
#include "core/usbcdc/cdc_buf.h" #include "core/usbcdc/cdc_buf.h"
#include <sysinit.h>
#include "basic/basic.h"
#include "lcd/render.h"
#include "lcd/allfonts.h"
volatile unsigned int lastTick; volatile unsigned int lastTick;
int puts(const char * str) int puts(const char * str)
@ -36,18 +41,24 @@ int puts(const char * str)
void main_cdc(void) void main_cdc(void)
{ {
int dx = 0;
//lastTick = systickGetTicks(); // Used to control output/printf timing //lastTick = systickGetTicks(); // Used to control output/printf timing
lcdPrintln("Init USB"); lcdRefresh();
CDC_Init(); // Initialise VCOM CDC_Init(); // Initialise VCOM
USB_Init(); // USB Initialization USB_Init(); // USB Initialization
USB_Connect(TRUE); // USB Connect USB_Connect(TRUE); // USB Connect
// Wait until USB is configured or timeout occurs // Wait until USB is configured or timeout occurs
uint32_t usbTimeout = 0; uint32_t usbTimeout = 0;
while ( usbTimeout < CFG_USBCDC_INITTIMEOUT / 10 ) while ( usbTimeout < CFG_USBCDC_INITTIMEOUT / 10 )
{ {
if (USB_Configuration) break; if (USB_Configuration) break;
delayms(10); // Wait 10ms delayms(10); // Wait 10ms
usbTimeout++; usbTimeout++;
} }
lcdPrintln("Done"); lcdRefresh();
uint8_t buf[2] = {0,0}; uint8_t buf[2] = {0,0};
int l; int l;
while(1){ while(1){
@ -56,6 +67,8 @@ void main_cdc(void)
l = 1; l = 1;
CDC_RdOutBuf (buf, &l); CDC_RdOutBuf (buf, &l);
puts(buf); puts(buf);
dx=DoString(dx,0,buf);
lcdDisplay(0);
} }
//puts("hello world\r\n"); //puts("hello world\r\n");
//delayms(1); //delayms(1);