Exemplo n.º 1
0
/**
 * Flashes an LED.
 * @param n - Unique ID of the LED to flash.
 * @param onTime - Time the LED is on (in ms)
 * @param offTime - Time the LED is off (in ms)
 * @return TRUE if parameters are valid and the flash task is running, otherwise false.
 */
bool d1k_LED_Flash ( d1k_LED_ID_t n, uint32 onTime, uint32 offTime )
{
	if ( offTime > 0 && onTime > 0 )
	{
		leds[n].offTime = offTime;
		leds[n].onTime = onTime;

		// If we have not yet created the task, create it.
		if ( flashHandles[n] == NULL )
		{
			xTaskCreate(d1k_LED_Flash_Task,"LEDFLSH",256,&(leds[n]),1,&(flashHandles[n]));
			return true;
		}

		// If a task is already created, resume it.
		if ( eTaskStateGet( flashHandles[n] ) == eSuspended )
		{
			xTaskResumeFromISR( flashHandles[n] );
			return true;
		}

		// Task is already running, just update it.
		return true;
	}
	else
	{
		// If a task is running, it will suspend itself.
		leds[n].onTime = 0;
		leds[n].offTime = 0;
		d1k_LED_Off(n);
	}

	return false;
}
Exemplo n.º 2
0
void vComTestUnsuspendTask( void )
{
	/* The task that is suspended on the semaphore will be referenced from the
	Suspended list as it is blocking indefinitely.  This call just checks that
	the kernel correctly detects this and does not attempt to unsuspend the
	task. */
	xTaskResumeFromISR( xSemTestTaskHandle );
}
Exemplo n.º 3
0
AJ_Status AJ_ResumeTask(struct AJ_TaskHandle* handle, uint8_t inISR)
{
    if (inISR) {
        xTaskResumeFromISR(handle->t);
    } else {
        vTaskResume(handle->t);
    }
    return AJ_OK;
}
Exemplo n.º 4
0
/**
* @brief  Resume execution of a suspended thread.
* @param   thread_id   thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
* @retval  status code that indicates the execution status of the function.
*/
osStatus osThreadResume (osThreadId thread_id)
{
#if (INCLUDE_vTaskSuspend == 1)
  if(inHandlerMode())
  {
    xTaskResumeFromISR(thread_id);
  }
  else
  {
    vTaskResume(thread_id);
  }
  return osOK;
#else
  return osErrorResource;
#endif
}
Exemplo n.º 5
0
Arquivo: main.c Projeto: ChakChel/Ix
/**
 * @fn      void __ISR( _UART2_VECTOR, IPL2SOFT ) intUart3AHandler( void )
 * @brief   Vecteur d'interruption de l'UART1A
 */
void __ISR(_UART1_VECTOR, IPL2SOFT ) IntUart1Handler(void) {

    // Si on a reçu une donnée
    if (mU1ARXGetIntFlag()) {
        // Réception de l'ordre
        aux = uartGetChar();

	// Notification de réception
        xTaskResumeFromISR(xDialogueUARTHandle);

        // On baisse le flag
        mU1ARXClearIntFlag();
    }
    // On ignore les interruptions sur TX
    mU1ATXClearIntFlag();
}
Exemplo n.º 6
0
void vUART1_ISR( void )
{
    static portBASE_TYPE
                xHigherPriorityTaskWoken;
    UART_DATA   rx_data;
    static int  i = 0;

    if( INTGetFlag( INT_U1RX ) )
    {
        INTClearFlag( INT_U1RX );
        
        /*----------------------------------------------------------------------
            Rx interrupt functionality
        ----------------------------------------------------------------------*/
        rx_data = UARTGetData( TARGET_UART );
        rx_buffer = rx_data.__data;
        
        xHigherPriorityTaskWoken = xTaskResumeFromISR( rx_task_handle );

        xSemaphoreGiveFromISR( inputByteBuffer, &xHigherPriorityTaskWoken );
        
        // set Rx task to resume
        portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
    }
    else
    {
        if( INTGetFlag( INT_U1TX ) )
        {
            INTClearFlag( INT_U1TX );

            /*------------------------------------------------------------------
                Tx interrupt functionality
            ------------------------------------------------------------------*/
            // transmit tx_buffer
            if( tx_buffer[ i ] != '\0' )
                UARTSendDataByte( TARGET_UART, tx_buffer[ i++ ] );
            else
            {
                i = 0;
                
                xHigherPriorityTaskWoken = pdFALSE;
                xSemaphoreGiveFromISR( outputStringBuffer, &xHigherPriorityTaskWoken );
            }
        }
    }
}
Exemplo n.º 7
0
void ProgramManager::audioReady(){
#if defined AUDIO_TASK_SUSPEND || defined AUDIO_TASK_YIELD
  if(xProgramHandle != NULL){
    BaseType_t xHigherPriorityTaskWoken = 0; 
    xHigherPriorityTaskWoken = xTaskResumeFromISR(xProgramHandle);
    portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
  }
#elif defined AUDIO_TASK_SEMAPHORE
  signed long int xHigherPriorityTaskWoken = pdFALSE; 
  // signed BaseType_t xHigherPriorityTaskWoken = pdFALSE;
  xSemaphoreGiveFromISR(xSemaphore, &xHigherPriorityTaskWoken);
  // xSemaphoreGiveFromISR(xSemaphore, NULL);
  portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
#else /* AUDIO_TASK_DIRECT */
  audioStatus = AUDIO_READY_STATUS;
  // getProgramVector()->status = AUDIO_READY_STATUS;
#endif
}
Exemplo n.º 8
0
/**
* @brief  Resume execution of a suspended thread.
* @param   thread_id   thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
* @retval  status code that indicates the execution status of the function.
*/
osStatus osThreadResume (osThreadId thread_id)
{
#if (INCLUDE_vTaskSuspend == 1)  
  if(inHandlerMode())
  {
    if (xTaskResumeFromISR(thread_id) == pdTRUE)
    {
      portYIELD_FROM_ISR(pdTRUE);
    }
  }
  else
  {
    vTaskResume(thread_id);
  }
  return osOK;
#else
  return osErrorResource;
#endif
}
Exemplo n.º 9
0
void Task::resumeFromISR()
{
	xTaskResumeFromISR(_hnd);
}