예제 #1
0
파일: main.c 프로젝트: NissankaW/Mariokart3
//------------------------------------------------------------------------------
/// Invoked when the USB device gets suspended. By default, turns off all LEDs.
//------------------------------------------------------------------------------
void USBDCallbacks_Suspended(void)
{
    // Turn off LEDs
    LED_Clear(USBD_LEDPOWER);
    LED_Clear(USBD_LEDUSB);
    USBState = STATE_SUSPEND;
}
예제 #2
0
//------------------------------------------------------------------------------
/// Invoked when the USB device gets suspended. By default, turns off all LEDs.
//------------------------------------------------------------------------------
void USBDCallbacks_Suspended(void)
{
    // Turn off LEDs
    LED_Clear(USBD_LEDPOWER);
    LED_Clear(USBD_LEDUSB);
    if (USBD_GetState() >= USBD_STATE_CONFIGURED)
        USBState = STATE_SUSPEND;
}
예제 #3
0
//------------------------------------------------------------------------------
/// Invoked when the USB device leaves the Suspended state. By default,
/// configures the LEDs.
//------------------------------------------------------------------------------
void USBDCallbacks_Resumed(void)
{
    // Initialize LEDs
    //LED_Configure(USBD_LEDPOWER); //moved to USB_Init()
    //LED_Configure(USBD_LEDUSB);
   LED_Set(USBD_LEDPOWER);    
   LED_Clear(USBD_LEDUSB);
}
예제 #4
0
파일: main.c 프로젝트: NissankaW/Mariokart3
//------------------------------------------------------------------------------
//         Callbacks re-implementation
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// Invoked when the USB device leaves the Suspended state. By default,
/// configures the LEDs.
//------------------------------------------------------------------------------
void USBDCallbacks_Resumed(void)
{
    // Initialize LEDs
    LED_Configure(USBD_LEDPOWER);
    LED_Set(USBD_LEDPOWER);
    LED_Configure(USBD_LEDUSB);
    LED_Clear(USBD_LEDUSB);
    USBState = STATE_RESUME;
}
예제 #5
0
void USBDDriverCallbacks_InterfaceSettingChanged(unsigned char interface,
						 unsigned char setting)
{
	if ((interface == AUDDLoopRecDriverDescriptors_STREAMING)
	    && (setting == 0))
		LED_Clear(USBD_LEDOTHER);
	else
		LED_Set(USBD_LEDOTHER);
}
예제 #6
0
파일: main.c 프로젝트: gstroe/Arm
/**
 *  Invoked when an audio streaming interface setting changed. Actually control
 *  streaming rate.
 *  \param mic         1 to indicate microphone mute changed.
 *  \param newSetting  New stream (interface) setting.
 */
void AUDDFunction_StreamSettingChanged(uint8_t mic, uint8_t newSetting)
{
	mic = mic; /* dummy */

	if (newSetting) {
		LED_Set(USBD_LEDOTHER);
		//XDMAD_StopTransfer(&dmad, sscDmaTxChannel);
		numBuffersToSend = 0;
	} else LED_Clear(USBD_LEDOTHER);
}
예제 #7
0
파일: ui.c 프로젝트: gstroe/Arm
void ui_usb_connection_event(USBH_device_t *dev, bool b_present)
{
	UNUSED(dev);

	if (b_present)
		LED_Set(LED_YELLOW0);
	else {
		LED_Clear(LED_YELLOW0);
		ui_enum_status = UHC_ENUM_DISCONNECT;
	}
}
예제 #8
0
void USBDDriverCallbacks_InterfaceSettingChanged(unsigned char interface,
						 unsigned char setting)
{
	printf("USB_IF_CHANGED(%u, %u)\n\r", interface, setting);

	if ((interface == AUDDLoopRecDriverDescriptors_STREAMINGIN)
	    && (setting == 0))
		LED_Clear(USBD_LEDOTHER);
	else
		LED_Set(USBD_LEDOTHER);
}
예제 #9
0
파일: LEDs.c 프로젝트: HclX/freertos
void vParTestSetLED( UBaseType_t uxLED, BaseType_t xValue )
{
    if( xValue == pdTRUE )
    {
        LED_Set( uxLED );
    }
    else
    {
        LED_Clear( uxLED );
    }
}
예제 #10
0
//-----------------------------------------------------------------------------
/// Invoked whenever the active setting of an interface is changed by the
/// host. Changes the status of the third LED accordingly.
/// \param interface Interface number.
/// \param setting Newly active setting.
//-----------------------------------------------------------------------------
void AUDDFunctionCallbacks_InterfaceSettingChanged(unsigned char interface,
                                                   unsigned char setting)
{
    if ((interface == AUDD_Descriptors_STREAMING) && (setting == 0)) {

        LED_Clear(USBD_LEDOTHER);
    }
    else {

        LED_Set(USBD_LEDOTHER);
    }
}
예제 #11
0
파일: ParTest.c 프로젝트: ammarkham/moos
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
{
	if( uxLED < partstNUM_LEDS )
	{
		if( xValue == 0 )
		{
			LED_Clear( uxLED );
		}
		else
		{
			LED_Set( uxLED );
		}
	}
}
예제 #12
0
파일: main.c 프로젝트: gstroe/Arm
/**
 * Invoked when the status of the keyboard LEDs changes. Turns the num. lock
 * LED on or off.
 * \param numLockStatus Indicates the current status of the num. lock key.
 * \param capsLockStatus Indicates the current status of the caps lock key.
 * \param scrollLockStatus Indicates the current status of the scroll lock key
 */
void HIDDKeyboardCallbacks_LedsChanged(
	uint8_t numLockStatus,
	uint8_t capsLockStatus,
	uint8_t scrollLockStatus)
{
	capsLockStatus = capsLockStatus; /* dummy */
	scrollLockStatus = scrollLockStatus; /* dummy */

	/* Num. lock */
	if (numLockStatus)
		LED_Set(LED_NUMLOCK);
	else
		LED_Clear(LED_NUMLOCK);
}
예제 #13
0
파일: main.c 프로젝트: 12019/at91work
//-----------------------------------------------------------------------------
/// Invoked when the status of the keyboard LEDs changes. Turns the num. lock
/// LED on or off.
/// \param numLockStatus Indicates the current status of the num. lock key.
/// \param capsLockStatus Indicates the current status of the caps lock key.
/// \param scrollLockStatus Indicates the current status of the scroll lock key
//-----------------------------------------------------------------------------
void HIDDKeyboardCallbacks_LedsChanged(
    unsigned char numLockStatus,
    unsigned char capsLockStatus,
    unsigned char scrollLockStatus)
{
    // Num. lock
    if (numLockStatus) {

        LED_Set(LED_NUMLOCK);
    }
    else {

        LED_Clear(LED_NUMLOCK);
    }
}
예제 #14
0
파일: main.c 프로젝트: cxjlante/at91sam3s
/**
 * Invoked when the status of the keyboard LEDs changes. Turns the num. lock
 * LED on or off.
 * \param numLockStatus Indicates the current status of the num. lock key.
 * \param capsLockStatus Indicates the current status of the caps lock key.
 * \param scrollLockStatus Indicates the current status of the scroll lock key
 */
void HIDDKeyboardCallbacks_LedsChanged(
    uint8_t numLockStatus,
    uint8_t capsLockStatus,
    uint8_t scrollLockStatus)
{
    /* Num. lock */
    if (numLockStatus) {

        LED_Set(LED_NUMLOCK);
    }
    else {

        LED_Clear(LED_NUMLOCK);
    }
}
예제 #15
0
/*---------------------------------------------------------------------------*/
void
leds_arch_set(unsigned char leds)
{
	if( leds & LEDS_GREEN ) {
		LED_Set(0);
	}
	else {
		LED_Clear(0);
	}

	if( leds & LEDS_YELLOW ) {
		LED_Set(1);
	}
	else {
		LED_Clear(1);
	}

	if( leds & LEDS_RED ) {
		LED_Set(2);
	}
	else {
		LED_Clear(2);
	}
}
예제 #16
0
/*
*********************************************************************************************************
*                                    App_TaskUART_Rx()
*
* Description : Process UART Receive related process between Audio Bridge and PC, Audio Bridge and Ruler.
*               Fetch data from PC in UART receive buffer, check data sanity in DL layer 
*
* Argument(s) : p_arg   Argument passed to 'App_TaskUART_Rx()' by 'OSTaskCreate()'.
*
* Return(s)   : none.
*
* Note(s)     : (1) The first line of code is used to prevent a compiler warning because 'p_arg' is not
*                   used.  The compiler should not generate any code for this statement.
*********************************************************************************************************
*/
void App_TaskUART_Rx( void *p_arg )
{     
    (void)p_arg; 
    
    CPU_INT08U       temp ;	
    CPU_INT08U       counter ;	
    CPU_INT08U       idle_counter ;	    
    CMDREAD          CMD_Read_PC ;
    CMDREAD          CMD_Read_Ruler ;
    
    Init_CMD_Read( &CMD_Read_PC, EVENT_MsgQ_PCUART2Noah ) ;
    Init_CMD_Read( &CMD_Read_Ruler, EVENT_MsgQ_RulerUART2Noah ) ;
    idle_counter = 0;
    
    while (DEF_TRUE) {               
   
        counter = Queue_NData( (void*) pUART_Rece_Buf[PC_UART] ) ;  
        //APP_TRACE_DBG((" %4d ",counter)) ;  
        if( counter ) {
            idle_counter = 0 ;
        } else {            
            if( idle_counter++ >= 100 ) { // 100*5ms = 500ms
                Global_Idle_Ready = 1 ;                
                idle_counter = 0 ;
                LED_Clear(LED_DS2); //mute communication LED when >500ms free
            }   
        }
        
        while( counter-- ) {              
            Queue_Read( &temp, pUART_Rece_Buf[PC_UART] );            
            Noah_CMD_Read( &CMD_Read_PC, temp ) ;
            
	}           
        
        counter = Queue_NData( (void*) pUART_Rece_Buf[RULER_UART] ) ;          
        while( counter-- ) {              
            Queue_Read( &temp, pUART_Rece_Buf[RULER_UART] );            
            Noah_CMD_Read( &CMD_Read_Ruler, temp ) ;
            
	} 
                
        OSTimeDly(5); // note : UART1_RECE_QUEUE_LENGTH = 1024B; 115200/10/1000 =  11.52;
  
                    
    }
    
}
예제 #17
0
파일: ui.c 프로젝트: gstroe/Arm
void ui_usb_sof_event(void)
{
	bool b_btn_state;
	static bool btn_suspend_and_remotewakeup = false;
	static uint16_t counter_sof = 0;

	if (ui_enum_status == UHC_ENUM_SUCCESS) {
		/* Display device enumerated and in active mode */
		if (++counter_sof > ui_device_speed_blink) {
			counter_sof = 0;
			LED_Toggle(LED_YELLOW0);
		}

		/* Scan button to enter in suspend mode and remote wakeup */
		/*b_btn_state = (!gpio_pin_is_high(GPIO_PUSH_BUTTON_1)) ?
		        true : false;*/
		b_btn_state = true;

		if (b_btn_state != btn_suspend_and_remotewakeup) {
			/* Button have changed */
			btn_suspend_and_remotewakeup = b_btn_state;

			if (b_btn_state) {
				/* Button has been pressed */
				ui_enable_asynchronous_interrupt();
				USBH_suspend(true);
				return;
			}
		}

		/* Power on a LED when the mouse move */
		if (!ui_x && !ui_y && !ui_scroll) {
#if 2 == LED_NUM
			LED_Clear(LED_YELLOW1);
#endif
		} else {
			ui_x = ui_y = ui_scroll = 0;
#if 2 == LED_NUM
			LED_Set(LED_YELLOW1);
#endif
		}
	}
}
예제 #18
0
파일: ui.c 프로젝트: gstroe/Arm
void ui_com_tx_stop(void)
{
#if 2 == LED_NUM
	LED_Clear(LED_YELLOW1);
#endif
}
예제 #19
0
파일: main.c 프로젝트: mknapik/avr-MAC
/**
 * @brief Displays the current counter value on the onboard LEDs.
 */
void UpdateLedValue(void)
{
    (counter & 0x01) ? LED_Set(0) : LED_Clear(0);
    (counter & 0x02) ? LED_Set(1) : LED_Clear(1);
    (counter & 0x04) ? LED_Set(2) : LED_Clear(2);
}
예제 #20
0
int flash_test( void )
{  
    unsigned int i, j;
    unsigned char error;
    unsigned int pBuffer[AT91C_IFLASH_PAGE_SIZE / 4];
    unsigned int lastPageAddress;
    volatile unsigned int *pLastPageData;
    //unsigned char pageLocked;

    // Initialize flash driver
    //FLASHD_Initialize( BOARD_MCK );

    // Unlock whole flash
    
    //printf("-I- Unlocking the whole flash\n\r");
    LED_Clear(LED_DS2); 
  
   
// The AT91SAM7A3 has 16 lock regions. Each lock region contains 16 pages of 256 bytes. 
// Each lock region has a size of 4 Kbytes, thus only the first 64 Kbytes can be locked.
#if defined(at91sam7a3)
    error = FLASHD_Unlock(AT91C_IFLASH, AT91C_IFLASH + 64 * 1024, 0, 0);  // 16* 16 * 256 = 64kB, Only the first 64KB can be locked in the SAM7A3
#else
    error = FLASHD_Unlock(AT91C_IFLASH, AT91C_IFLASH + AT91C_IFLASH_SIZE, 0, 0);
#endif
    //ASSERT(!error, "-F- Error while trying to unlock the whole flash (0x%02X)\n\r", error);
    
    if(error !=0 ) {
        while(1);
    }
    //fill data to sectors :  512 ~ 1024.
    for(j = 1; j<= 512; j++) {
      
        LED_Toggle(LED_DS2); 
        // Performs tests on last page (to avoid overriding existing program).
        lastPageAddress = AT91C_IFLASH + AT91C_IFLASH_SIZE - AT91C_IFLASH_PAGE_SIZE * j;
        pLastPageData = (volatile unsigned int *) lastPageAddress;
    
        // Write page with walking bit pattern (0x00000001, 0x00000002, ...)
        //printf("-I- Writing last page with walking bit pattern\n\r");
        for (i=0; i < (AT91C_IFLASH_PAGE_SIZE / 4); i++) {
    
            pBuffer[i] = 0xee;//(i % 32);
        }
        error = FLASHD_Write(lastPageAddress, pBuffer, AT91C_IFLASH_PAGE_SIZE);    
     
        //ASSERT(!error, "-F- Error when trying to write page (0x%02X)\n\r", error);
        // Check page contents
        //printf("-I- Checking page contents ");
        for (i=0; i < (AT91C_IFLASH_PAGE_SIZE / 4); i++) {
            //printf(".");
            //ASSERT(pLastPageData[i] == (1 << (i % 32)),\
                   "\n\r-F- Expected 0x%08X at address 0x%08X, found 0x%08X\n\r",\
                   (1 << (i % 32)), (unsigned int) &(pLastPageData[i]), pLastPageData[i]);
                     if( pLastPageData[i] != (1 << (i % 32))) {
                       LED_Set(LED_DS2); 
                       break;
                     }
        }
    
    }
    
    /*****************************************************************************/
    LED_Clear(LED_DS2);    
    //while(1);
        
    //printf(" ok \n\r");
 
#if defined(at91sam7a3)
    // Only the first 64Kb can be locked in the SAM7A3
    lastPageAddress = AT91C_IFLASH + (64*1024) - AT91C_IFLASH_PAGE_SIZE;
#endif

    
    // Lock page
    //printf("-I- Locking last page\n\r");
    //error = FLASHD_Lock(lastPageAddress, lastPageAddress + AT91C_IFLASH_PAGE_SIZE, 0, 0);
    //ASSERT(!error, "-F- Error when trying to lock page (0x%02X)\n\r", error);

    // Check that associated region is locked
    //printf("-I- Checking lock status ... ");
    //pageLocked = FLASHD_IsLocked(lastPageAddress, lastPageAddress + AT91C_IFLASH_PAGE_SIZE);
    //ASSERT(pageLocked, "\n\r-F- Page is not locked\n\r");
    //printf("ok\n\r");

    // Unlock page
    //printf("-I- Unlocking last page\n\r");
    //error = FLASHD_Unlock(lastPageAddress, lastPageAddress + AT91C_IFLASH_PAGE_SIZE, 0, 0);
    //ASSERT(!error, "-F- Error when trying to unlock page (0x%02X)\n\r", error);

    // Check that associated region is unlocked
    //printf("-I- Checking lock status ... ");
    //pageLocked = FLASHD_IsLocked(lastPageAddress, lastPageAddress + AT91C_IFLASH_PAGE_SIZE);
    //ASSERT(!pageLocked, "\n\r-F- Page is locked\n\r");
    //printf("ok\n\r");

    
#if (EFC_NUM_GPNVMS > 0)
    // Test GPNVM bit #1 (should be safe)
    if (FLASHD_IsGPNVMSet(1)) {

        //printf("-I- GPNVM #1 is set\n\r");

        // Clear GPNVM
        //printf("-I- Clearing GPNVM #%d\n\r", 1);
        error = FLASHD_ClearGPNVM(1);
        //ASSERT(!error, "-F- Error while trying to clear GPNVM (0x%02X)\n\r", error);
        //ASSERT(!FLASHD_IsGPNVMSet(1), "-F- GPNVM is set\n\r");

        // Set GPNVM
        //printf("-I- Setting GPNVM #%d\n\r", 1);
        error = FLASHD_SetGPNVM(1);
        //ASSERT(!error, "-F- Error while trying to set GPNVM (0x%02X)\n\r", error);
        //ASSERT(FLASHD_IsGPNVMSet(1), "-F- GPNVM is not set\n\r");

    }
    else {

        //printf("-I- GPNVM #1 is cleared\n\r");

        // Set GPNVM
        //printf("-I- Setting GPNVM #%d\n\r", 1);
        error = FLASHD_SetGPNVM(1);
        //ASSERT(!error, "-F- Error while trying to set GPNVM (0x%02X)\n\r", error);
        //ASSERT(FLASHD_IsGPNVMSet(1), "-F- GPNVM is not set\n\r");

        // Clear GPNVM
        //printf("-I- Clearing GPNVM #%d\n\r", 1);
        error = FLASHD_ClearGPNVM(1);
        //ASSERT(!error, "-F- Error while trying to clear GPNVM (0x%02X)\n\r", error);
        //ASSERT(!FLASHD_IsGPNVMSet(1), "-F- GPNVM is set\n\r");
    }
#endif

    //printf("-I- All tests ok\n\r");
  
    return 0;
}