2012-04-13 04:28 AM
Hi,
why i have to enable USART1->CR1 |= USART_CR1_RXNEIE; for polling In Example of ST Lib i dont see such thing. I thought for polling i dont need this?2012-04-13 05:50 AM
get rid of your interruptifobia
why on earth would you want to poll? Erik2012-04-13 06:55 AM
why i have to enable USART1->CR1 |= USART_CR1_RXNEIE; for polling
In Example of ST Lib i dont see such thing. I thought for polling i dont need this?
You don't2012-05-03 01:58 AM
get rid of your interruptifobia
why on earth would you want to poll?
Erik ok im trying to get rid of the phobia... below the solution for irq. i enabled at init the RXNEIE. And set Prior to 2.void
USART2_handler(
void
)
{
if
(USART2->SR & USART_SR_RXNE){
if
(uart2_input_handler != NULL)
{
uart2_input_handler((
int
)(USART2->DR & 0xFF));
/*Bytewise*/
}
}
if
((USART2->SR & USART_SR_TXE) !=0){
USART2->CR1 ^= USART_CR1_TXEIE;
//Disable
}
}
void
u2_putchar(
char
c)
{
USART2->DR = (c & 0xFF);
USART2->CR1 |= USART_CR1_TXEIE;
//Enable
}