Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erdetn/vserialx
A tiny library for serial communication in Linux using V.
https://github.com/erdetn/vserialx
serial
Last synced: 3 months ago
JSON representation
A tiny library for serial communication in Linux using V.
- Host: GitHub
- URL: https://github.com/erdetn/vserialx
- Owner: erdetn
- License: mit
- Created: 2021-09-12T17:55:15.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-29T19:08:44.000Z (3 months ago)
- Last Synced: 2024-07-30T01:23:46.004Z (3 months ago)
- Topics: serial
- Language: V
- Homepage:
- Size: 495 KB
- Stars: 12
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-v - vserialx - A tiny (wrapper) serial communication library for Linux written in V. (Libraries / Serial Communications)
README
# vserialx
**vserialx** is a tiny library for serial communication in Linux using V.## Usage
```v
module mainimport time
import vserialx as vsfn main() {
mut dev := vs.new('/dev/ttyS20', .b9600, .@none, .@none, .one, .char8b)mut rc := dev.open()
if rc != .okay {
println('Failed to open.\nERROR: ${rc}')
return
}
defer {
dev.close()
}rc = dev.open()
if rc != .okay {
println('Failed to connect.\nERROR: ${rc}')
return
}for {
if dev.available_bytes() > 0 {
len, buff, rt := dev.read(10)
dump(rt)
if len > 0 {
println('BUFF: {${buff.hex()}}')
}
}
time.sleep(time.second)
}
}
```## TODO features
- [ ] Exclusive access (locking and unlocking mechanism).
- [ ] Reading configurations using `tcgetattr` and `ioctl`. Read only the baudrate for now.
- [ ] Better error/return code naming
- [ ] The documentation## TODO testings
- [ ] Other serial port configurations need to be tested.
- [ ] Bloking read/write need to be tested.