我正在开发一个项目,我在UART6_RX上接收串行数据。 这完全没问题。
但是,当我向屏幕添加触摸屏按钮并在主循环中检查是否触摸时,UART_RX不再接收任何数据。我觉得它与中断有关。
我目前有以下代码:
int main()
{
device.baud(31250);
lcd.Clear(BACK_COLOR);
Button firstButton(lcd, ts, 10, Y0, btnWidth, btnHeight,LCD_COLOR_RED, BACK_COLOR, "My First Button", Font24);
while(1) {
if (firstButton.Touched()) //If I remove this if statement, everything works perfectly.
{
int n = 10;
}
// __disable_irq(); //Tried this, but without succes
if (device.readable()) {
char cReceivedByte = device.getc();
unsigned long result= doSomethingAmazing(cOntvangenByte);
char buf[10];
sprintf(buf, "%05lu\r\n", result);
lcd.SetBackColor(LCD_COLOR_GREEN);
lcd.SetTextColor(LCD_COLOR_WHITE);
lcd.SetFont(&Font24);
lcd.DisplayStringAt(270, LINE(5), (uint8_t *)buf, LEFT_MODE);
}
// __enable_irq();
}
}
我使用ARM-mbed编译器并在以下开发板上运行它: - STM32F7-Discovery
谁知道发生了什么以及如何解决?
万分感谢,
亚历