主要区别在于初始化和调用的CDC函数不同,看下面的代码。
int main (void){sysclk_init();board_init();// Initialize interrupt vector table support.irq_initialize_vectors();// Enable interruptscpu_irq_enable();udc_start();delay_init();uint8_t ch = '>';// Insert application code here, after the board has been initialized.while (true) {if(udi_cdc_is_rx_ready()){ch = udi_cdc_getc();LED_Toggle(LED0_GPIO);}udi_cdc_putc(ch);LED_Toggle(LED2_GPIO);delay_ms(200);}}