38 lines
713 B
Go
38 lines
713 B
Go
package ssd1xxx
|
|
|
|
// Config describes the OLED configuration.
|
|
type Config struct {
|
|
Width int
|
|
Height int
|
|
ExternalVCC bool
|
|
Init []Command
|
|
Suspend []Command
|
|
Resume []Command
|
|
}
|
|
|
|
// Command is one or more command bytes.
|
|
type Command interface {
|
|
Bytes() []byte
|
|
}
|
|
|
|
type Register byte
|
|
|
|
func (r Register) Bytes() []byte { return []byte{byte(r)} }
|
|
|
|
type RegisterArgs struct {
|
|
Register Register
|
|
Args []byte
|
|
}
|
|
|
|
func (r RegisterArgs) Bytes() []byte { return append([]byte{byte(r.Register)}, r.Args...) }
|
|
|
|
type RegisterFunc struct {
|
|
Register Register
|
|
Func func() []byte
|
|
}
|
|
|
|
func (r RegisterFunc) Bytes() []byte {
|
|
args := r.Func()
|
|
return append([]byte{byte(r.Register)}, args...)
|
|
}
|