/** @brief Writes one character to UART. @param data - Character to write. @param mode - Write mode @return UART_SUCCESS or error code. **/ int UART_WriteChar(char data, enWriteData mode) { if(mode == UART_WRITE) { UrtTx(pADI_UART, data); return UART_SUCCESS; } else { if (uart_tcnt == UART_TX_BUFFER_SIZE) { return UART_NO_TX_SPACE; } else { if (mode == UART_WRITE_NO_INT) { NVIC_DisableIRQ(UART_IRQn); /* Disable UART IRQ */ } if (uart_tbusy) { uart_tx_buffer[(uart_tpos + (uart_tcnt++)) % UART_TX_BUFFER_SIZE] = data; } else { UrtTx(pADI_UART, data); uart_tbusy = UART_TRUE; } if (mode == UART_WRITE_NO_INT) { NVIC_EnableIRQ(UART_IRQn); /* Enable UART IRQ */ } return UART_SUCCESS; } } }
/** @brief Writes one character to UART. @param data - Character to write. @param mode - Write mode @return UART_SUCCESS or error code. **/ void UART_WriteChar(char c, enWriteData mode) { if (mode == UART_WRITE) { uart_tx_queue[uart_tx_tail] = c; while ((uart_tx_tail == (uart_tx_head - 1)) || ((uart_tx_tail == (UART_TX_QUEUE_SIZE - 1)) && (uart_tx_head == 0))) ; if (uart_tx_tail == (UART_TX_QUEUE_SIZE - 1)) { uart_tx_tail = 0; } else { ++uart_tx_tail; } if (COMLSR_TEMT_BBA) { char COMTX = uart_tx_queue[uart_tx_head]; if (uart_tx_head == (UART_TX_QUEUE_SIZE - 1)) { uart_tx_head = 0; } else { ++uart_tx_head; } UrtTx(pADI_UART, COMTX); } } else { UrtTx(pADI_UART, c); } }
void UART_WriteChar(char c) { ucTxBufferEmpty = 0; UrtTx(pADI_UART,c); while (ucTxBufferEmpty == 0) { } }
void SendString (void) { for ( i = 0 ; i < nLen ; i++ ) // loop to send ADC0 result { ucTxBufferEmpty = 0; UrtTx(pADI_UART,szTemp[i]); while (ucTxBufferEmpty == 0) { } } }