抱歉各位, 请问在 C# 要怎样可以做以下情形:
public void Test1()
{
do_something1();
.....
while(uart0_IRQ);
do_something2();
}
就是指做完 do_something1() 后, 我在等收到uart0的 Interrupt后
再往下做do_something2();
原本我写好UART0 的Rx ReceiveData() func:
public bool uart0_IRQ = false;
public void ReceiveData(object s, SerialDataReceivedEventArgs e)
{
uart0_IRQ = true;
}
但这样Test1() 好像永远都收不到这个 uart0_IRQ 变成true.
我不想将 do_something2() 及后面的流程放在 ReceiveData()内,
因为 Interrupt Func不该做太耗时的工作.
请问正确应该要怎样写??? 谢谢..