You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Port configuration.// Serial ports are just files, \\.\COM1 for COM1 on Windows:varserial=trystd.fs.cwd().openFile("\\\\.\\COM1", .{ .mode=.read_write }) ;
deferserial.close();
tryzig_serial.configureSerialPort(serial, zig_serial.SerialConfig{
.baud_rate=19200,
.word_size=8,
.parity=.none,
.stop_bits=.one,
.handshake=.none,
});
Usage
Library integration
Integrate the library in your project via the Zig package manager:
add serial to your .zig.zon file by providing the URL to the archive of a tag or specific commit of the library
to update the hash, run zig fetch --save [URL/to/tag/or/commit.tar.gz]
Running tests
The build.zig file contains a test step that can be called with zig build test. Note that this requires a serial port to be available on the system;
Linux: /dev/ttyUSB0
Mac: /dev/cu.usbmodem101
Windows: COM3
Building the examples
You can build the examples from the ./examples directory by calling zig build examples. Binaries will be generated in ./zig-out/bin by default.
Note that the list_port_info example currently only works on Windows
Building the documentation
You can generate the documentation by running zig build docs.
After that you can browse it by:
starting the web server. For example, by running python -m http.server 8000 zig-out/docs
reading the docs from your browser at https://127.0.0.1:8000