Aucune description

Michael Redig ba9f5e6773 (feat) add PortMode il y a 2 ans
Examples 91a7ea35b6 add extra test for binary il y a 6 ans
Sources ba9f5e6773 (feat) add PortMode il y a 2 ans
.gitignore ecf296c107 Initial commit of jayjun's improvements https://github.com/jayjun/SwiftLinuxSerial/tree/idiomatic-swift il y a 9 ans
LICENSE 214e55d74c Initial commit il y a 9 ans
Package.swift 8cc19e4c43 (feat) added background async read from serial il y a 2 ans
README.md 9fa7887f4f (refactor) rewrite Readme il y a 2 ans
README.original.md 9fa7887f4f (refactor) rewrite Readme il y a 2 ans
first-slide.png 8a8dfcb190 slides il y a 9 ans
swift-serial-talk-slides.pptx 8a8dfcb190 slides il y a 9 ans

README.md

Swift Serial

This project began its life as yeokm1's SwiftSerial. He has since archived the project and was kind enough to link this project going forward.

Getting started


import SwiftSerial

...

// setup
let serialPort = SerialPort(path: "/dev/cu.usbmodem1234") // you'll need to find the correct device on your own, but this is what it will resemble on a mac
try serialPort.openPort()

serialPort.setSettings(
	receiveRate: 115200,
	transmitRate: 115200,
	minimumBytesToRead: 1)


// read output
Task {
	let readStream = try serialPort.asyncLines()

	for await line in readStream {
		print(line, terminator: "")
	}
}

// send data
try serialPort.writeString("foo")
// or
try serialPort.writeData(Data([1,2,3,4]))

SPM Import

.package(url: "https://github.com/mredig/SwiftSerial", .upToNextMinor("1.0.0")