Skip to content

Commit

Permalink
Change serial package (#28)
Browse files Browse the repository at this point in the history
* switch serial to github.com/tarm/serial

* version bump
  • Loading branch information
wybiral authored Jul 4, 2018
1 parent 2df528d commit 10a22ee
Show file tree
Hide file tree
Showing 17 changed files with 761 additions and 992 deletions.
10 changes: 5 additions & 5 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion hookah.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// Version of hookah API
const Version = "1.0.4"
const Version = "1.0.5"

// API is an instance of the Hookah API.
type API struct {
Expand Down
20 changes: 6 additions & 14 deletions pkg/input/serial.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/url"
"strconv"

"github.com/jacobsa/go-serial/serial"
"github.com/tarm/serial"
)

// Serial creates a serial input and returns ReadCloser
Expand All @@ -14,21 +14,13 @@ func Serial(device string, opts url.Values) (io.ReadCloser, error) {
if len(baudstr) == 0 {
baudstr = "9600"
}
baud, err := strconv.ParseUint(baudstr, 10, 32)
baud, err := strconv.ParseInt(baudstr, 10, 32)
if err != nil {
return nil, err
}
options := serial.OpenOptions{
PortName: device,
BaudRate: uint(baud),
DataBits: 8,
StopBits: 1,
ParityMode: serial.PARITY_NONE,
InterCharacterTimeout: 100,
MinimumReadSize: 0,
Rs485Enable: false,
Rs485RtsHighDuringSend: false,
Rs485RtsHighAfterSend: false,
c := &serial.Config{
Name: device,
Baud: int(baud),
}
return serial.Open(options)
return serial.OpenPort(c)
}
20 changes: 6 additions & 14 deletions pkg/output/serial.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/url"
"strconv"

"github.com/jacobsa/go-serial/serial"
"github.com/tarm/serial"
)

// Serial creates a serial output and returns WriteCloser
Expand All @@ -14,21 +14,13 @@ func Serial(device string, opts url.Values) (io.WriteCloser, error) {
if len(baudstr) == 0 {
baudstr = "9600"
}
baud, err := strconv.ParseUint(baudstr, 10, 32)
baud, err := strconv.ParseInt(baudstr, 10, 32)
if err != nil {
return nil, err
}
options := serial.OpenOptions{
PortName: device,
BaudRate: uint(baud),
DataBits: 8,
StopBits: 1,
ParityMode: serial.PARITY_NONE,
InterCharacterTimeout: 100,
MinimumReadSize: 0,
Rs485Enable: false,
Rs485RtsHighDuringSend: false,
Rs485RtsHighAfterSend: false,
c := &serial.Config{
Name: device,
Baud: int(baud),
}
return serial.Open(options)
return serial.OpenPort(c)
}
202 changes: 0 additions & 202 deletions vendor/github.com/jacobsa/go-serial/LICENSE

This file was deleted.

8 changes: 0 additions & 8 deletions vendor/github.com/jacobsa/go-serial/serial/Makefile

This file was deleted.

Loading

0 comments on commit 10a22ee

Please sign in to comment.