Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/ZigEmbeddedGroup/serial

Serial port configuration library for Zig
https://github.com/ZigEmbeddedGroup/serial

serial serial-port uart zig zig-package ziglang

Last synced: 2 months ago
JSON representation

Serial port configuration library for Zig

Lists

README

        

# Zig Serial Port Helper

Helper library for configuring and listing serial ports.

## Features

- Basic serial port configuration
- Baud Rate
- Parity (none, even, odd, mark, space)
- Stop Bits (one, two)
- Handshake (none, hardware, software)
- Byte Size (5, 6, 7, 8)
- Flushing of the serial port receive buffers
- Supports windows and linux with the API
- Listing available serial ports

## Example

```zig
// Serial ports are just files, \\.\COM1 for COM1 on windows:
var serial = try std.fs.cwd().openFile("\\\\.\\COM1", .{ .mode = .read_write }) ;
defer serial.close();

try zig_serial.configureSerialPort(serial, zig_serial.SerialConfig{
.baud_rate = 19200,
.word_size = 8,
.parity = .none,
.stop_bits = .one,
.handshake = .none,
});
```