Exemple #1
0
/* Function required in order to link UARTCommandConsole.c - which is used by
multiple different demo application. */
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )
{
    const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 5000 );

    /* Only one port is supported. */
    ( void ) pxPort;

    /* Don't send the string unless the previous string has been sent. */
    if( ( xSendingTask == NULL ) && ( usStringLength > 0 ) ) {
        /* Ensure the calling task's notification state is not already
        pending. */
        xTaskNotifyStateClear( NULL );

        /* Store the handle of the transmitting task.  This is used to unblock
        the task when the transmission has completed. */
        xSendingTask = xTaskGetCurrentTaskHandle();

        /* Send the string using the auto-generated API. */
        R_SCIFA2_Serial_Send( ( uint8_t * ) pcString, usStringLength );

        /* Wait in the Blocked state (so not using any CPU time) until the
        transmission has completed. */
        ulTaskNotifyTake( pdTRUE, xMaxBlockTime );
    }
}
Exemple #2
0
/***********************************************************************************************************************
* Function Name: io_put_char
* Description  : Character "buffer" is output to SCIFA2.
*              : This function keeps waiting until it becomes the transmission
*              : enabled state.
* Arguments    : char buffer : character to output
* Return Value : None
***********************************************************************************************************************/
void io_put_char (char buffer)
{     
    /* Check if it is possible to transmit (TDFE flag) */
    while (0 == SCIFA2.FSR.BIT.TDFE)
    {
        /* Wait */
    }

    /* Send the character via the terminal output */
    R_SCIFA2_Serial_Send((uint8_t *)&buffer, 1); 

    /* Clear TEND flag */
    SCIFA2.FSR.BIT.TEND = 0u;
}