Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions matrixorbital/example_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright 2024 The Periph Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.

package matrixorbital_test

import (
"errors"
"fmt"
"log"
"time"

"periph.io/x/conn/v3/display"
"periph.io/x/conn/v3/display/displaytest"
"periph.io/x/conn/v3/i2c"
"periph.io/x/conn/v3/i2c/i2creg"
"periph.io/x/devices/v3/matrixorbital"
"periph.io/x/host/v3"
)

func Example() {
if _, err := host.Init(); err != nil {
log.Fatal(err)
}

bus, err := i2creg.Open("")
if err != nil {
log.Fatal(err)
}
defer bus.Close()

conn := &i2c.Dev{Bus: bus, Addr: 0x11}
dev := matrixorbital.NewConnLK2047T(conn, 4, 20)
_ = dev.Clear()
n, err := dev.WriteString("Hello")
fmt.Printf("n=%d, err=%s\n", n, err)

time.Sleep(10 * time.Second)

fmt.Println("calling TestTextDisplay")

errs := displaytest.TestTextDisplay(dev, true)
fmt.Println("back from TestTextDsiplay")
for _, e := range errs {
if !errors.Is(e, display.ErrNotImplemented) {
fmt.Println(e)
}
}

}
Loading