Esempio n. 1
0
/**
 * @brief   Initializes the standard part of a @p UARTDriver structure.
 *
 * @param[out] uartp    pointer to the @p UARTDriver object
 *
 * @init
 */
void uartObjectInit(UARTDriver *uartp) {

    uartp->state   = UART_STOP;
    uartp->txstate = UART_TX_IDLE;
    uartp->rxstate = UART_RX_IDLE;
    uartp->config  = NULL;
    /* Optional, user-defined initializer.*/
#if defined(UART_DRIVER_EXT_INIT_HOOK)
    UART_DRIVER_EXT_INIT_HOOK(uartp);
#endif
}
Esempio n. 2
0
/**
 * @brief   Initializes the standard part of a @p UARTDriver structure.
 *
 * @param[out] uartp    pointer to the @p UARTDriver object
 *
 * @init
 */
void uartObjectInit(UARTDriver *uartp) {

  uartp->state      = UART_STOP;
  uartp->txstate    = UART_TX_IDLE;
  uartp->rxstate    = UART_RX_IDLE;
  uartp->config     = NULL;
#if UART_USE_WAIT == TRUE
  uartp->early      = false;
  uartp->threadrx   = NULL;
  uartp->threadtx   = NULL;
#endif /* UART_USE_WAIT */
#if UART_USE_MUTUAL_EXCLUSION == TRUE
  osalMutexObjectInit(&uartp->mutex);
#endif /* UART_USE_MUTUAL_EXCLUSION */

  /* Optional, user-defined initializer.*/
#if defined(UART_DRIVER_EXT_INIT_HOOK)
  UART_DRIVER_EXT_INIT_HOOK(uartp);
#endif
}