This package provides a small UART-driven command-line application in Livt. It collects bytes from UART, echoes typed characters, dispatches complete command lines, and streams command responses back over UART.
For background on the line-buffered command loop and command components, see DESIGN_NOTE.md.
The current package is organized around one top-level application and a small set of command components:
UartCliAppowns the UART instance, input queue, and command loop.CommandParserconverts a completed input line into a command component.HelpCommand,HelloCommand,ByeCommand, andUnknownCommandprovide concrete response behavior.
The example supports these commands:
helphellobye
Unknown input returns Unknown. CRLF terminal input is supported by
ignoring CR and executing the command on LF.
.
├── src/
│ ├── ByeCommand.lvt
│ ├── CommandInterface.lvt
│ ├── CommandParser.lvt
│ ├── HelloCommand.lvt
│ ├── HelpCommand.lvt
│ ├── UartCliApp.lvt
│ └── UnknownCommand.lvt
├── tests/
│ └── UartCliAppTest.lvt
├── DESIGN_NOTE.md
├── LICENSE
├── README.md
└── livt.toml
Build the package with:
livt buildThe package configuration is defined in livt.toml. The current
project name there is UartCliApp.
Run the full test suite with:
livt testConfigured test components:
UartCliAppTest
The integration test simulates UART sessions for hello, bye, help, and an
unknown command submitted with CRLF.
Top-level UART command application in the Livt.App namespace.
Features:
- UART receive and transmit integration through the external
Uartpackage - typed-character echo
- command execution on
LF CRignored for commonCRLFterminal input- FIFO line buffering through the external
Queuepackage
Constructor:
new(rx: in logic, tx: out logic)
All commands implement CommandInterface.
| Command | Input | Response |
|---|---|---|
HelpCommand |
help |
hello bye |
HelloCommand |
hello |
Hello |
ByeCommand |
bye |
Bye |
UnknownCommand |
any other line | Unknown |
Instantiate UartCliApp with UART RX and TX signals and connect it to a serial
terminal configured for the same baud settings as the underlying Uart package.
By default, the Uart package uses TICKS_PER_BIT = 868, which corresponds to
115200 baud with a 100 MHz clock.
A typical terminal session looks like:
help
hello bye
hello
Hello
bye
Bye
Typed command characters are echoed before the response is sent.
This package depends on:
Uart = "1.0.0"Queue = "1.0.0"
Queue is used as the bounded FIFO input-line buffer.
- This is an application-level example, not a UART implementation.
- The UART transport is provided by the external
Uartpackage. - The command loop is intentionally small and bounded so the design remains easy to understand and test.
- Input longer than the queue capacity is ignored by the queue once it is full.
- Command responses are kept within the UART transmit FIFO capacity.
Contributions are welcome. Areas that would be natural extensions for this package include:
- configurable command-line length
- explicit overflow reporting for overlong input
- paced response scheduling for longer command output
- prompt and line-ending response formatting
- argument parsing beyond exact command matching
- backspace handling or simple line editing
This project is licensed under the MIT License. See LICENSE.