⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main_cdc.c

📁 USB 通信,使用的是Freescale公司的CMX协议栈
💻 C
字号:
/****************************************************************************
 *
 *            Copyright (c) 2006 by CMX Systems, Inc.
 *
 * This software is copyrighted by and is the sole property of
 * CMX.  All rights, title, ownership, or other interests
 * in the software remain the property of CMX.  This
 * software may only be used in accordance with the corresponding
 * license agreement.  Any unauthorized use, duplication, transmission,
 * distribution, or disclosure of this software is expressly forbidden.
 *
 * This Copyright notice may not be removed or modified without prior
 * written consent of CMX.
 *
 * CMX reserves the right to modify this software without notice.
 *
 * CMX Systems, Inc.
 * 12276 San Jose Blvd. #511
 * Jacksonville, FL 32223
 * USA
 *
 * Tel:  (904) 880-1840
 * Fax:  (904) 880-1632
 * http: www.cmx.com
 * email: cmx@cmx.com
 *
 ***************************************************************************/
#include "mcf5222x_reg.h"
#include "usb.h"
#include "target.h"
#include "usb_cdc.h"
#include "uart.h"

int main()
{
  hw_init();
  uart_init(9600, 1, 'n', 8); 
  /* USB irq is level 2, priority = 2. */
  usb_init((2<<3) | 2, 0);
  /* UART irq is level 3, priority = 3. (UART needs higher 
     priority. */
  uart_putch(0x56);
  cdc_init();  
  while(1)
  {
    /*if (cdc_line_coding_changed())
    {
       line_coding_t l;
       hcc_u8 parity[]="noe";
       cdc_get_line_coding(&l);       
       uart_init(l.bps, l.nstp, parity[l.parity], l.ndata);
    }*/
    if (cdc_input_ready())
    {
      //char c;
      //c=cdc_getch(); 
      //uart_putch(c);
      //cdc_putch(c);
    }
    
    /*if (uart_input_ready())
    {
      hcc_u8 c=uart_getch();
      cdc_putch(c);
    } */
  }
  return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -