void BlinkUSBStatus(void) { static WORD led_count = 0; if (led_count == 0) led_count = 10000U; led_count--; #define mLED_Both_Off() \ { \ mLED_1_Off(); \ mLED_2_Off(); \ } #define mLED_Both_On() \ { \ mLED_1_On(); \ mLED_2_On(); \ } #define mLED_Only_1_On() \ { \ mLED_1_On(); \ mLED_2_Off(); \ } #define mLED_Only_2_On() \ { \ mLED_1_Off(); \ mLED_2_On(); \ } if (USBSuspendControl == 1) { if (led_count == 0) { mLED_1_Toggle(); if (mGetLED_1()) { mLED_2_On(); } else { mLED_2_Off(); } } } else { if (USBDeviceState == DETACHED_STATE) { mLED_Both_Off(); } else if (USBDeviceState == ATTACHED_STATE) { mLED_Both_On(); } else if (USBDeviceState == POWERED_STATE) { mLED_Only_1_On(); } else if (USBDeviceState == DEFAULT_STATE) { mLED_Only_2_On(); } else if (USBDeviceState == ADDRESS_STATE) { if (led_count == 0) { mLED_1_Toggle(); mLED_2_Off(); } } else if (USBDeviceState == CONFIGURED_STATE) { if (led_count < 100) { mLED_Both_On(); } else { mLED_Both_Off(); } } } }
/******************************************************************** * Function: void BlinkUSBStatus(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: BlinkUSBStatus turns on and off LEDs * corresponding to the USB device state. * * Note: mLED macros can be found in HardwareProfile.h * USBDeviceState is declared and updated in * usb_device.c. *******************************************************************/ void BlinkUSBStatus(void) { static WORD led_count=0; if(led_count == 0)led_count = 10000U; led_count--; #define mLED_Both_Off() {mLED_1_Off();mLED_2_Off();} #define mLED_Both_On() {mLED_1_On();mLED_2_On();} #define mLED_Only_1_On() {mLED_1_On();mLED_2_Off();} #define mLED_Only_2_On() {mLED_1_Off();mLED_2_On();} if(USBSuspendControl == 1) { if(led_count==0) { mLED_1_Toggle(); mLED_2 = mLED_1; // Both blink at the same time }//end if } else { if(USBDeviceState == DETACHED_STATE) { mLED_Both_Off(); } else if(USBDeviceState == ATTACHED_STATE) { mLED_Both_On(); } else if(USBDeviceState == POWERED_STATE) { mLED_Only_1_On(); } else if(USBDeviceState == DEFAULT_STATE) { mLED_Only_2_On(); } else if(USBDeviceState == ADDRESS_STATE) { if(led_count == 0) { mLED_1_Toggle(); mLED_2_Off(); }//end if } else if(USBDeviceState == CONFIGURED_STATE) { if(led_count==0) { mLED_1_Toggle(); mLED_2 = !mLED_1; // Alternate blink }//end if }//end if(...) }//end if(UCONbits.SUSPND...) }//end BlinkUSBStatus
// *--------------------------------------------------------------------------------* void BlinkUSBStatus(void){ static WORD led_count=0; if(led_count == 0)led_count = 50000U; led_count--; #define mLED_Both_Off() {LED1_OFF();LED2_OFF();} #define mLED_Both_On() {LED1_ON();LED2_ON();} #define mLED_Only_1_On() {LED1_ON();LED2_OFF();} #define mLED_Only_2_On() {LED1_OFF();LED2_ON();} if(USBSuspendControl == 1){ if(led_count==0){ LED1_TOGGLE(); if(LED1_READ()){ LED2_ON(); }else{ LED2_OFF(); } } }else{ if(USBDeviceState == DETACHED_STATE){ mLED_Both_Off(); }else if(USBDeviceState == ATTACHED_STATE){ mLED_Both_On(); }else if(USBDeviceState == POWERED_STATE){ mLED_Only_1_On(); }else if(USBDeviceState == DEFAULT_STATE){ mLED_Only_2_On(); }else if(USBDeviceState == ADDRESS_STATE){ if(led_count == 0){ LED1_TOGGLE(); LED2_OFF(); } }else if(USBDeviceState == CONFIGURED_STATE){ if(led_count==0){ LED1_TOGGLE(); if(LED1_READ()){ LED2_OFF(); }else{ LED2_ON(); } } } } }
void usb_tty_status(void) { static WORD led_count = 0; if (led_count == 0)led_count = 4U; led_count--; // verifica UCONbits.SUSPND if (USBSuspendControl == 1) { if (led_count == 0) { mLED_1_Toggle(); if (mGetLED_1()) { mLED_2_On(); } else { mLED_2_Off(); } } } else { if (USBDeviceState == DETACHED_STATE) { mLED_Both_Off(); } else if (USBDeviceState == ATTACHED_STATE) { mLED_Both_On(); } else if (USBDeviceState == POWERED_STATE) { mLED_Only_1_On(); } else if (USBDeviceState == DEFAULT_STATE) { mLED_Only_2_On(); } else if (USBDeviceState == ADDRESS_STATE) { if (led_count == 0) { mLED_1_Toggle(); mLED_2_Off(); } } else if (USBDeviceState == CONFIGURED_STATE) { if (led_count == 0) { mLED_1_Toggle(); if (mGetLED_1()) { mLED_2_Off(); } else { mLED_2_On(); } } } } }
void USB_blinkStatus(void) { static WORD led_count = 0; if (led_count == 0)led_count = 2000U; // Ajustado para USB low speed led_count--; if (USBSuspendControl == 1) { if (led_count == 0) { mLED_1_Toggle(); if (mGetLED_1()) { mLED_2_On(); } else { mLED_2_Off(); } }//end if } else { if (USBDeviceState == DETACHED_STATE) { mLED_Both_Off(); } else if (USBDeviceState == ATTACHED_STATE) { mLED_Both_On(); } else if (USBDeviceState == POWERED_STATE) { mLED_Only_1_On(); } else if (USBDeviceState == DEFAULT_STATE) { mLED_Only_2_On(); } else if (USBDeviceState == ADDRESS_STATE) { if (led_count == 0) { mLED_1_Toggle(); mLED_2_Off(); }//end if } else if (USBDeviceState == CONFIGURED_STATE) { if (led_count == 0) { mLED_1_Toggle(); if (mGetLED_1()) { mLED_2_Off(); } else { mLED_2_On(); } }//end if }//end if(...) }//end if(UCONbits.SUSPND...) }//end BlinkUSBStatus
/****************************************************************************** * Function: void BlinkUSBStatus(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: BlinkUSBStatus turns on and off LEDs corresponding to * the USB device state. * * Note: mLED macros can be found in io_cfg.h * usb_device_state is declared in usbmmap.c and is modified * in usbdrv.c, usbctrltrf.c, and usb9.c *****************************************************************************/ void BlinkUSBStatus(void) { if(led_count == 0)led_count = 10000U; led_count--; #define mLED_Both_Off() {mLED_1_Off();mLED_2_Off();} #define mLED_Both_On() {mLED_1_On();mLED_2_On();} #define mLED_Only_1_On() {mLED_1_On();mLED_2_Off();} #define mLED_Only_2_On() {mLED_1_Off();mLED_2_On();} if(usb_device_state < CONFIGURED_STATE) mLED_Only_1_On(); if(usb_device_state == CONFIGURED_STATE) { if(led_count==0) { mLED_1_Toggle(); mLED_2 = !mLED_1; // Alternate blink }//end if }//end if(...) }//end BlinkUSBStatus
/******************************************************************** * Function: void BlinkUSBStatus(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: BlinkUSBStatus turns on and off LEDs * corresponding to the USB device state. * * Note: mLED macros can be found in HardwareProfile.h * USBDeviceState is declared and updated in * usb_device.c. *******************************************************************/ void BlinkUSBStatus(void) { static WORD led_count=0; char a=0; if(led_count == 0)led_count = 10000U; led_count--; #define mLED_Both_Off() {mLED_1_Off();mLED_2_Off();} #define mLED_Both_On() {mLED_1_On();mLED_2_On();} #define mLED_Only_1_On() {mLED_1_On();mLED_2_Off();} #define mLED_Only_2_On() {mLED_1_Off();mLED_2_On();} a = is_clear(); if(a=1) { mLED_3_On(); } else { mLED_3_Off(); } if(USBSuspendControl == 1) { if(led_count==0) { mLED_1_Toggle(); if(mGetLED_1()) { mLED_2_On(); } else { mLED_2_Off(); } }//end if } else { if(USBDeviceState == DETACHED_STATE) { mLED_Both_Off(); } else if(USBDeviceState == ATTACHED_STATE) { mLED_Both_On(); } else if(USBDeviceState == POWERED_STATE) { mLED_Only_1_On(); } else if(USBDeviceState == DEFAULT_STATE) { mLED_Only_2_On(); } else if(USBDeviceState == ADDRESS_STATE) { if(led_count == 0) { mLED_1_Toggle(); mLED_2_Off(); }//end if } else if(USBDeviceState == CONFIGURED_STATE) { if(led_count==0) { mLED_1_Toggle(); if(mGetLED_1()) { mLED_2_Off(); } else { mLED_2_On(); } }//end if }//end if(...) }//end if(UCONbits.SUSPND...) }//end BlinkUSBStatus