void TM_USART_Send(USART_TypeDef* USARTx, uint8_t* DataArray, uint16_t count) { /* Go through entire data array */ while (count--) { /* Wait to be ready, buffer empty */ USART_WAIT(USARTx); /* Send data */ USART_WRITE_DATA(USARTx, (uint16_t)(*DataArray++)); /* Wait to be ready, buffer empty */ USART_WAIT(USARTx); } }
/** * @brief Puts character to USART port * @param *USARTx: Pointer to USARTx peripheral you will use * @param c: character to be send over USART * @retval None */ static __INLINE void TM_USART_Putc(USART_TypeDef* USARTx, volatile char c) { /* Check USART */ if ((USARTx->CR1 & USART_CR1_UE)) { /* Wait to be ready, buffer empty */ USART_WAIT(USARTx); /* Send data */ USART_WRITE_DATA(USARTx, (uint16_t)(c & 0x01FF)); /* Wait to be ready, buffer empty */ USART_WAIT(USARTx); } }
void TM_USART_Puts(USART_TypeDef* USARTx, char* str) { /* Go through entire string */ while (*str) { /* Wait to be ready, buffer empty */ USART_WAIT(USARTx); /* Send data */ USART_WRITE_DATA(USARTx, (uint16_t)(*str++)); /* Wait to be ready, buffer empty */ USART_WAIT(USARTx); } }