Documentation ¶
Overview ¶
Package microdotphat implements a pure Go interface to the Micro Dot pHAT LED matrix display board. The API is based on that of the official microdotphat Python library, and features an automatically resized scrollable on/off pixel buffer and built-in text drawing capabilities.
Passing negative coordinates to any function will cause a panic.
Index ¶
- Constants
- Variables
- func Clear()
- func Close() error
- func DrawTiny(display int, s string)
- func Fill(lit bool)
- func Open(name string) error
- func Scroll(dx, dy int)
- func ScrollTo(x, y int)
- func SetBrightness(brightness float64) error
- func SetCol(x int, col byte)
- func SetDecimal(display int, lit bool)
- func SetMirror(x, y bool)
- func SetPixel(x, y int, lit bool)
- func Show() error
- func String() string
- func WriteChar(char rune, x, y int)
- func WriteString(s string, x, y int, kern bool)
Constants ¶
const ( // Width is the width of the full display in pixels. Width = 45 // Height is the height of the full display in pixels. Height = 7 )
Variables ¶
var (
ErrNoConn = errors.New("I2C bus connection not open")
)
Functions ¶
func DrawTiny ¶
DrawTiny draws tiny numbers to the buffer. Display is the zero-based index of the display to draw numbers on; s is a string containing digits (non-digit characters are discarded). This function is not designed for use with scrolled buffers.
func Open ¶
Open initializes the library, opening a connection to the I2C bus with the given name. If left blank, the default bus is used, which is usually sufficient.
func SetBrightness ¶
SetBrightness sets the display brightness in the range [0.0, 1.0].
func SetCol ¶
SetCol sets a whole column of the buffer (only useful when not scrolling vertically). The 7 least significant bits of col correspond to each row of the column, with the least significant bit on top.
func SetDecimal ¶
SetDecimal sets the state of a decimal point on a zero-indexed display. Panics if the display index is out of range.
func SetMirror ¶
func SetMirror(x, y bool)
SetMirror sets whether the display should be flipped horizontally and/or vertically. To rotate the display 180 degrees, flip both x and y.
func String ¶
func String() string
String returns a string representing the expected LED display state.
func WriteChar ¶
WriteChar writes a single character to the buffer at the specified position. Characters not covered by the built-in font are discarded.
func WriteString ¶
WriteString writes a string to the buffer at the specified position. If kern is true, characters will be written closely together, ideal for scrolling displays. If kern is false, characters are arranged one per display. Characters not covered by the built-in font are discarded.
Types ¶
This section is empty.