blob: d124a48c0e8f27b6541c1f9eccb058ac0e20c4e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package communication
import (
"fmt"
)
type SerialInterface struct {
phy physical
}
func NewSerialInterface() (SerialInterface, error) {
iface := SerialInterface{}
var err error
iface.phy, err = newPhysical()
if err != nil {
return iface, err
}
return iface, nil
}
func (i *SerialInterface) Start() {
i.phy.start()
}
func (i *SerialInterface) Cat() {
for {
data := <-i.phy.rx
fmt.Printf("%s", string(data))
}
}
|