|
|||||||||||
| 技術(shù)交流 | 電路欣賞 | 工控天地 | 數(shù)字廣電 | 通信技術(shù) | 電源技術(shù) | 測控之家 | EMC技術(shù) | ARM技術(shù) | EDA技術(shù) | PCB技術(shù) | 嵌入式系統(tǒng) 驅(qū)動編程 | 集成電路 | 器件替換 | 模擬技術(shù) | 新手園地 | 單 片 機 | DSP技術(shù) | MCU技術(shù) | IC 設(shè)計 | IC 產(chǎn)業(yè) | CAN-bus/DeviceNe |
c語言 |
| 作者:jpj1234 欄目:嵌入式系統(tǒng) |
void usb_idle( void ) { #if 1 if ( !timer1 ) { //Determine if USB idle timer expired, if so we need to send the last //STANDARD USB report again USB_LoadEP( USB_REMOTE_ENDPOINT,( UINT8 * ) report_packet,sizeof( APP_TX_PACKET ) ); //Reset delay counter to HID idle timeout VALUE timer1 = 5; #endif #if 0 if ( !timer1 ) { if ( remote_get_report( report_packet ) ) { // ONLY send KEYBOARD report if USB DEVICE is configured if ( USB_bGetConfiguration() ) { //break; #if 1 // if (!data_valid_flag) { if (!yilou_break) { USB_LoadEP( USB_REMOTE_ENDPOINT, ( UINT8 * ) report_packet, sizeof( APP_TX_PACKET ) ); yilou_break=TRUE; } else { init_remote_report(); USB_LoadEP( USB_REMOTE_ENDPOINT, ( UINT8 * ) report_packet, sizeof( APP_TX_PACKET ) ); yilou_break=FALSE; } #endif } } } //Reset delay counter to HID idle timeout VALUE timer1 = 5; // random NUMBER choosen that will satisfy a 8 ms polling interval } #endif //return; } } 這里的 #if 1 #endif #if 0 #endif 是怎么回事,編譯器是會怎么編譯? |
| 2樓: | >>參與討論 |
| 作者: 平常人 于 2006/11/27 9:52:00 發(fā)布:
#if 1部分進入編譯;#if 0部分不進入編譯 |
|
| 3樓: | >>參與討論 |
| 作者: xinzha 于 2006/11/27 10:25:00 發(fā)布:
除非必要,不要在程序中加入過多#if 1和 #if 0 #if 0 到相應(yīng)的#endif之間的語句,編譯程序不進行編譯。 這樣會把你的程序搞得可讀性很差,不是一個好習(xí)慣。 |
|
| 4樓: | >>參與討論 |
| 作者: jpj1234 于 2006/11/27 10:27:00 發(fā)布:
thank you。! |
|
|
|
| 免費注冊為維庫電子開發(fā)網(wǎng)會員,參與電子工程師社區(qū)討論,點此進入 |
Copyright © 1998-2006 m.58mhw.cn 浙ICP證030469號 |