Documentation ¶
Index ¶
- Variables
- type PertelianX2040
- func (pert *PertelianX2040) Blank(line uint8) error
- func (pert *PertelianX2040) Centered(line uint8, text string) error
- func (pert *PertelianX2040) Clear() error
- func (pert *PertelianX2040) Close() error
- func (pert *PertelianX2040) GetCharacters(slots ...uint8) string
- func (pert *PertelianX2040) Light(state bool) error
- func (pert *PertelianX2040) Off() error
- func (pert *PertelianX2040) On() error
- func (pert *PertelianX2040) Print(text string) error
- func (pert *PertelianX2040) PrintAt(line uint8, char uint8, textString string) error
- func (pert *PertelianX2040) SetCharacter(position uint8, char PertelianX2040Character) error
- func (pert *PertelianX2040) SetLineDrawingCharacters()
- func (pert *PertelianX2040) Splash()
- func (pert *PertelianX2040) Write(data []byte) (int, error)
- func (pert *PertelianX2040) WriteGibberish(data []byte) (int, error)
- type PertelianX2040Character
Constants ¶
This section is empty.
Variables ¶
var ErrX2040CharWant8Lines = errors.New("characters must be made up of exactly 8 lines")
var ErrX2040CharWidth5 = errors.New("character lines must be exactly 5 runes long")
var ErrX2040DeviceNotFound = errors.New("x2040 device not found")
var ErrX2040InvalidCharacterPosition = errors.New("invalid character position")
var ErrX2040OutOfRange = errors.New("target out of display range")
var ErrX2040UnknownWriteError = errors.New("unknown error writing to device")
Functions ¶
This section is empty.
Types ¶
type PertelianX2040 ¶
type PertelianX2040 struct {
// contains filtered or unexported fields
}
func NewX2040 ¶
func NewX2040(ctx *gousb.Context) (PertelianX2040, error)
NewX2040 instantiates a new PertelianX2040 for you to play with.
func (*PertelianX2040) Blank ¶
func (pert *PertelianX2040) Blank(line uint8) error
Blank overwrites the given line with all spaces, effectively blanking it.
func (*PertelianX2040) Centered ¶
func (pert *PertelianX2040) Centered(line uint8, text string) error
Centered attempts to send the given string so it's centered on the given line.
func (*PertelianX2040) Clear ¶
func (pert *PertelianX2040) Clear() error
Clear removes all data visible on the display.
func (*PertelianX2040) Close ¶
func (pert *PertelianX2040) Close() error
Close closes down the interface and closes the device. **DOES NOT** clear the display, turn off the light, or any of that.
func (*PertelianX2040) GetCharacters ¶
func (pert *PertelianX2040) GetCharacters(slots ...uint8) string
GetCharacters returns a string built with the characters previously stored with SetCharacter.
func (*PertelianX2040) Light ¶
func (pert *PertelianX2040) Light(state bool) error
Light sets the display light to the requested state.
func (*PertelianX2040) Off ¶
func (pert *PertelianX2040) Off() error
Off turns off the light, and then the display.
func (*PertelianX2040) On ¶
func (pert *PertelianX2040) On() error
On turns on the display, initializes it, clears any data already on there and turns the light on.
func (*PertelianX2040) Print ¶
func (pert *PertelianX2040) Print(text string) error
Print sends a string entry to wherever the cursor happens to be.
func (*PertelianX2040) PrintAt ¶
func (pert *PertelianX2040) PrintAt(line uint8, char uint8, textString string) error
PrintAt sends a string entry to the given line and character.
func (*PertelianX2040) SetCharacter ¶
func (pert *PertelianX2040) SetCharacter(position uint8, char PertelianX2040Character) error
SetCharacter stores the given character in the display for later display. You get 7 slots, 0-6.
func (*PertelianX2040) SetLineDrawingCharacters ¶
func (pert *PertelianX2040) SetLineDrawingCharacters()
SetLineDrawingCharacters stores a set of line drawing characters in the display.
func (*PertelianX2040) Splash ¶
func (pert *PertelianX2040) Splash()
Splash does some line drawing and text to look fancy.
func (*PertelianX2040) Write ¶
func (pert *PertelianX2040) Write(data []byte) (int, error)
Write writes directly to the device, pausing slightly after the first two characters. Note that this is done in one transmission per byte to minimize the chance of corruption.
func (*PertelianX2040) WriteGibberish ¶
func (pert *PertelianX2040) WriteGibberish(data []byte) (int, error)
WriteGibberish writes directly to the device with no waiting for command processing, which *often* leads to corruption.
type PertelianX2040Character ¶
type PertelianX2040Character struct {
Lines [charSize]byte
}
func NewX2040Char ¶
func NewX2040Char(lines ...string) (PertelianX2040Character, error)
NewX2040Char assists in creating a properly formatted custom character for the display.