-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from nykytenko/feature/minor_2021
tab correction & updated to 2021
- Loading branch information
Showing
5 changed files
with
768 additions
and
771 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,64 @@ | ||
# onyx-serial | ||
|
||
onyx-serial: the D simple serial port library. | ||
onyx-serial: Serial port library for D. | ||
|
||
|
||
## Key features: | ||
- Open/close serial port. | ||
- Write/read to/from serial port. | ||
- Setup speed - standard value from 50 to 4,000,000. | ||
- parity - none, odd, even. | ||
- Setup read timeout in mS. | ||
- Check is port open. | ||
- Working on posix OS (Linux, OSX, FreeBSD, Solaris). | ||
- Setup: speed - standard value from 50 to 4,000,000. | ||
- Setup: parity - none, odd, even. | ||
- Setup: read timeout in mS. | ||
- Check: is port open. | ||
- Platforms: posix OS (Linux, OSX, FreeBSD, Solaris). | ||
|
||
|
||
## Examples: | ||
|
||
```D | ||
import onyx.serial; | ||
import onyx.serial; | ||
/* Create ports */ | ||
auto port1 = OxSerialPort("dev/ttyS1", Speed.B9600, Parity.none, 1000); | ||
auto port2 = OxSerialPort("dev/ttyS2", Speed.B9600, Parity.none, 1000); | ||
/* Create ports */ | ||
auto port1 = OxSerialPort("dev/ttyS1", Speed.S9600, Parity.none, 1000); | ||
auto port2 = OxSerialPort("dev/ttyS2", Speed.S9600, Parity.none, 1000); | ||
port1.open; | ||
port2.open; | ||
port1.open; | ||
port2.open; | ||
ubyte[] data = [0x22, 0x33, 0xCC]; | ||
ubyte[] data = [0x22, 0x33, 0xCC]; | ||
port1.write(data); | ||
port1.write(data); | ||
ubyte[] buf = port2.read(3); | ||
ubyte[] buf = port2.read(3); | ||
assert (buf == data); | ||
assert (buf == data); | ||
port1.close(); | ||
port2.close(); | ||
port1.close(); | ||
port2.close(); | ||
``` | ||
|
||
|
||
```D | ||
string[] s1 = | ||
["[port]", | ||
"name = /dev/ttyr06", | ||
"speed = 57600", | ||
"parity = none", | ||
"time_out = 1500"]; | ||
string[] s1 = | ||
["[port]", | ||
"name = /dev/ttyr06", | ||
"speed = 57600", | ||
"parity = none", | ||
"time_out = 1500"]; | ||
auto bundle = new immutable Bundle(s1); | ||
auto bundle = new immutable Bundle(s1); | ||
auto port3 = OxSerialPort(bundle); | ||
auto port3 = OxSerialPort(bundle); | ||
``` | ||
|
||
|
||
```D | ||
auto bundle = new immutable Bundle("./config/port4.conf"); | ||
auto bundle = new immutable Bundle("./config/port4.conf"); | ||
auto port4 = OxSerialPort(bundle); | ||
auto port4 = OxSerialPort(bundle); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
name "onyx-serial" | ||
description "The D Serial port library" | ||
description "Serial port library for D." | ||
license "MIT" | ||
copyright "Copyright © 2014-2020" | ||
copyright "Copyright © 2014-2021" | ||
authors "Oleg Nykytenko" | ||
|
||
targetPath "./bin" | ||
|
||
configuration "test" { | ||
targetType "executable" | ||
sourcePaths "test/" "source/" | ||
mainSourceFile "test/main.d" | ||
versions "vOnyxSerialTest" | ||
targetType "executable" | ||
sourcePaths "test/" "source/" | ||
mainSourceFile "test/main.d" | ||
versions "vOnyxSerialTest" | ||
} | ||
|
||
configuration "library" { | ||
targetType "library" | ||
excludedSourceFiles "test/main.d" | ||
targetType "library" | ||
excludedSourceFiles "test/main.d" | ||
} | ||
|
||
|
||
dependency "onyx-config" version=">=2.0.12" | ||
dependency "onyx-config" version=">=2.0.13" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"fileVersion": 1, | ||
"versions": { | ||
"onyx-config": "2.0.3" | ||
"onyx-config": "2.0.13" | ||
} | ||
} |
Oops, something went wrong.