Skip to content

eccelerators/livt-uart-hello-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UART Hello World Demo

This project is a minimal Livt application that uses the Uart package to send a fixed "Hello, World!" message over UART.

📋 Overview

The project defines a single component, UartHelloApp, in src/UartHelloApp.lvt. It imports Livt.IO, instantiates Uart, and exposes a SendHelloWorld() method that queues "Hello, World!" for transmission.

namespace Livt.App

using Livt.IO

component UartHelloApp
{
	uart: Uart

	new(rx: in logic, tx: out logic)
	{
		this.uart = new Uart(rx, tx)
	}

	public fn SendHelloWorld() bool
	{
		var helloWorld = "Hello, World!".Encode()

		return this.uart.Send(helloWorld)
	}
}

The Uart dependency is declared in livt.toml and resolved by the Livt package manager. Its source code is hosted in the livt-uart GitHub repository. The package currently provides these main components:

  • Uart
  • BufferedUart
  • UartBase
  • UartReceiver
  • UartTransmitter
  • LoopbackUart

📁 Project Structure

.
├── .gitignore
├── src/
│   └── UartHelloApp.lvt
├── tests/
│   └── UartHelloAppTest.lvt
├── LICENSE
├── livt.toml
└── README.md

🔧 Configuration

The Livt package configuration lives in livt.toml:

  • Project name: UartHelloApp
  • Source path: src
  • Output directory: out
  • Test path: tests
  • Test component: UartHelloAppTest
  • Dependency: Uart = "1.0.0"

When dependencies are resolved, the Livt package manager fetches the declared Uart package version and makes it available to the application.

By default, the Uart package uses TICKS_PER_BIT = 868 in both the receiver and transmitter. That corresponds to 115200 baud with a 100 MHz clock, so this example assumes those default timing settings unless you reconfigure the dependency.

🔨 Building

Build the package with:

livt build

🧪 Running Tests

Run the test suite with:

livt test

The current test component is tests/UartHelloAppTest.lvt. It instantiates UartHelloApp in loopback mode, sends the demo message, waits for transmission to complete, and verifies that the received bytes match the expected payload.

💡 Usage

Instantiate UartHelloApp with UART RX and TX signals, then call SendHelloWorld() when you want to queue the demo message for transmission through Uart. The method returns true when the full message was accepted for transmission and false if there is not enough transmit space.

📝 Notes

This repository is an application-level example, not a UART implementation. The UART functionality is provided by the external Uart dependency package.

📄 License

This project is licensed under the MIT License. See LICENSE.

About

A minimal Livt application that uses the Uart package.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors