48 lines
944 B
C
48 lines
944 B
C
#include <stdio.h>
|
|
|
|
#include "main.h"
|
|
#include "usart_user.h"
|
|
|
|
int fputc(int ch, FILE *f)
|
|
{
|
|
LL_USART_TransmitData8(DEBUG_USART,(uint8_t) ch);
|
|
while(LL_USART_IsActiveFlag_TXE(DEBUG_USART)==RESET){}
|
|
|
|
return ch;
|
|
}
|
|
|
|
void UsartUserConfig(void)
|
|
{
|
|
|
|
}
|
|
|
|
void UsartEnableIT(USART_TypeDef* USARTx)
|
|
{
|
|
LL_USART_ReceiveData8(USARTx);
|
|
LL_USART_ClearFlag_IDLE(USARTx);
|
|
LL_USART_EnableIT_RXNE(USARTx);
|
|
LL_USART_EnableIT_IDLE(USARTx);
|
|
}
|
|
|
|
void UsartDisableIT(USART_TypeDef* USARTx)
|
|
{
|
|
LL_USART_ClearFlag_IDLE(USARTx);
|
|
LL_USART_DisableIT_RXNE(USARTx);
|
|
LL_USART_DisableIT_IDLE(USARTx);
|
|
}
|
|
|
|
void UsartxSendDataByte(USART_TypeDef* USARTx, uint16_t Data)
|
|
{
|
|
LL_USART_TransmitData8(USARTx, Data);
|
|
while(LL_USART_IsActiveFlag_TXE(USARTx) == RESET);
|
|
}
|
|
|
|
void UsartxSendDataStr(USART_TypeDef* USARTx, const uint8_t *Data, uint32_t len)
|
|
{
|
|
while(len--)
|
|
{
|
|
LL_USART_TransmitData8(USARTx, *(Data++));
|
|
while(LL_USART_IsActiveFlag_TXE(USARTx) == RESET);
|
|
}
|
|
}
|