-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to work with UART? #41
Comments
@eleimt The normal architecture would be for a "periph.io/host" package to be included, and that "host" would as part of it's init locate all of the UARTs and register them with "uartreg". I did a grep of the periph.io/host package and find no files referencing uartreg() I remembered wondering about this a while ago, and here's the thread on it: |
I not understand how this using. Give me example please. Thanks. |
Here's a basic approach using a different library. The serial library for periph.io/conn is not implemented. package main
import (
"errors"
"fmt"
"log"
"time"
// "periph.io/x/conn/v3/gpio"
"periph.io/x/conn/v3/display"
"periph.io/x/conn/v3/display/displaytest"
"periph.io/x/devices/v3/serlcd"
// "periph.io/x/devices/v3/mow"
"go.bug.st/serial"
)
func main() {
fmt.Println("serlcd")
mode := &serial.Mode{
BaudRate: 9600,
Parity: serial.NoParity,
DataBits: 8,
StopBits: serial.OneStopBit,
}
port, err := serial.Open("/dev/ttyUSB0", mode)
if err != nil {
log.Fatal(err)
}
time.Sleep(time.Second)
mow := serlcd.NewSerLCD(port, 4, 20)
time.Sleep(time.Second)
defer mow.Halt()
mow.Clear()
// mow.Contrast(40)
time.Sleep(time.Second)
mow.Display(true)package main
import (
"errors"
"fmt"
"log"
"time"
"periph.io/x/conn/v3/display"
"periph.io/x/conn/v3/display/displaytest"
"periph.io/x/devices/v3/serlcd"
"go.bug.st/serial"
)
func main() {
fmt.Println("serlcd")
mode := &serial.Mode{
BaudRate: 9600,
Parity: serial.NoParity,
DataBits: 8,
StopBits: serial.OneStopBit,
}
port, err := serial.Open("/dev/ttyUSB0", mode)
if err != nil {
log.Fatal(err)
}
time.Sleep(time.Second)
mow := serlcd.NewSerLCD(port, 4, 20)
time.Sleep(time.Second)
defer mow.Halt()
mow.Clear()
// mow.Contrast(40)
time.Sleep(time.Second)
mow.Display(true)
time.Sleep(time.Second)
fmt.Println(mow.String())
n, err := mow.WriteString("abcdefg")
time.Sleep(time.Second)
fmt.Println(mow.String())
n, err := mow.WriteString("abcdefg")
} |
Describe the bug
No UART
To Reproduce
Steps to reproduce the behavior:
Expected behavior
UART list
Platform (please complete the following information):
Additional context
Also I use minicom 2.8 (
minicom -D /dev/ttyS0
), it's work.The text was updated successfully, but these errors were encountered: