Dispatcher
Your MCU receives text commands over UART1 (115200 baud, 8N1). Each command is a line ending with '\n'.
Supported commands: LED ON -> set PA5 HIGH, respond "OK\n" LED OFF -> set PA5 LOW, respond "OK\n" STATUS -> respond "LED:0\n" or "LED:1\n" (unknown)-> respond "ERR\n"
Commands arrive as a randomized stream, one line at a time. The exact sequence is chosen fresh for every submission, so the only way to reply correctly is to actually parse each command, track the LED state, and answer STATUS from that state. Commands may arrive one byte at a time or in bursts. Your parser must handle both correctly.