The OP
Published on 2021-8-9 09:35
Only look at the author
This post is from stm32/stm8
Latest reply
The LL library is as follows, see if you can use it.
/**
* @brief This function handles USART1 global interrupt.
*/
void USART1_IRQHandler(void)
{
/* USER CODE BEGIN USART1_IRQn 0 */
if (LL_USART_IsActiveFlag_RXNE(USART1)) {
uart[0].rdBuff[uart[0].rdPtr++] = LL_USART_ReceiveData8(USART1);
if (uart[0].rdEnabled==1) {
if (uart[0].rdPtr==1 && uart[0].rdBuff[0]!=0xBB) uart[0].rdPtr=0;
if (uart[0].rdPtr==2 && uart[0].rdBuff[1]!=0x66) uart[0].rdPtr=0;
if (uart[0].rdPtr==3 && uart[0].rdBuff[2]!=0x66) uart[0].rdPtr=0;
if (uart[0].rdPtr==4 && uart[0].rdBuff[3]!=0xBB) uart[0].rdPtr=0;
}
else uart[0].rdPtr=0;
LL_USART_ClearFlag_RXNE(USART1);
}
else if (LL_USART_IsActiveFlag_IDLE(USART1)) {
uart[0].rdEnded=1;
LL_USART_ClearFlag_IDLE(USART1);
}
/* USER CODE END USART1_IRQn 0 */
Details
Published on 2021-8-9 09:46
| ||
|
||
daemondong
Currently offline
|
2
Published on 2021-8-9 09:46
Only look at the author
This post is from stm32/stm8
Comments | |
|
||
|
This post is from stm32/stm8
| ||
|
||
|
This post is from stm32/stm8
| ||
|
||
|
EEWorld Datasheet Technical Support
EEWorld
subscription
account
EEWorld
service
account
Automotive
development
circle
About Us Customer Service Contact Information Datasheet Sitemap LatestNews
Room 1530, Zhongguancun MOOC Times Building, Block B, 18 Zhongguancun Street, Haidian District, Beijing 100190, China Tel:(010)82350740 Postcode:100190