コード例 #1
0
ファイル: flash.c プロジェクト: MtTsai/mbed-freertos
static portTASK_FUNCTION( vLEDFlashTask, pvParameters )
{
portTickType xFlashRate, xLastFlashTime;
unsigned portBASE_TYPE uxLED, uxFlashTaskNumber = ( unsigned portBASE_TYPE ) pvParameters;
	portLONG pin_map[] = {18, 20, 21, 23};	

	/* See which of the eight LED's we should use. */
	uxLED = pin_map[uxFlashTaskNumber++];

	xFlashRate = ledFLASH_RATE_BASE + (ledFLASH_RATE_BASE * (portTickType)uxFlashTaskNumber);
	xFlashRate /= portTICK_RATE_MS;

	/* We will turn the LED on and off again in the delay period, so each
	delay is only half the total period. */
	xFlashRate /= ( portTickType ) 2;

	/* We need to initialise xLastFlashTime prior to the first call to 
	vTaskDelayUntil(). */
	xLastFlashTime = xTaskGetTickCount();

	for(;;)
	{
		/* Delay for half the flash period then toggle the LED. */
		vTaskDelayUntil( &xLastFlashTime, xFlashRate );
		GPIO_PinToggle(1, uxLED);
	}
} /*lint !e715 !e818 !e830 Function definition must be standard for task creation. */
コード例 #2
0
/*
* @brief    KBI0 interrupt service routine.
* @param    None.
* @returns  None.
*/
void KBI0_Handler(void)
{
#if 1
	uint32_t ret_val;

	ret_val = KBI0->SP;
	
	if ((ret_val & (1 << 24)))
	{
		GPIO_PinToggle(GPIO_PTC1);
	}
	
	if ((ret_val & (1 << 25)))
	{
		GPIO_PinToggle(GPIO_PTC1);
	}
	
	/* Attention: The following two statements must be called to clear KBI interrupt flag. */	
	KBI0->SC |= KBI_SC_KBACK_MASK;      
	KBI0->SC |= KBI_SC_RSTKBSP_MASK;
#endif
}
コード例 #3
0
void myExtIntrIsr_1(void)
{
    GPIO_PinToggle(LED2); /* Toggle the LED2 (P2_1) */ 
}
コード例 #4
0
void  myTimerIsr_1(void)
{
    GPIO_PinToggle(LED2); /* Toggle the LED1 (P2_0) */ 
}
コード例 #5
0
void myExtIntrIsr_0(void)
{
    GPIO_PinToggle(LED1); /* Toggle the LED1 (P2_0) */ 
}