Documentation
¶
Index ¶
- Constants
- Variables
- type Renderer
- func NewBlinkingGrid(r Renderer, visibleFrames, totalFrames uint) Renderer
- func NewConcatenateGrid(innerGrids []Renderer) Renderer
- func NewFitInsideGrid(r Renderer, fitToSize uint) Renderer
- func NewRepeatGrid(r Renderer, repeatCount uint) Renderer
- func NewScrollingGrid(r Renderer, width uint) Renderer
- func NewSequenceGrid(contents []Renderer, frameDurations []uint) (Renderer, error)
- func NewVerticalSequenceGrid(contents []Renderer, frameDurations []uint) (Renderer, error)
- type SpiScreen
- type StaticGrid
Constants ¶
const ( MAX7219_REG_NOOP max7219Reg = 0 MAX7219_REG_DIGIT0 = iota MAX7219_REG_DIGIT1 MAX7219_REG_DIGIT2 MAX7219_REG_DIGIT3 MAX7219_REG_DIGIT4 MAX7219_REG_DIGIT5 MAX7219_REG_DIGIT6 MAX7219_REG_DIGIT7 MAX7219_REG_DECODEMODE MAX7219_REG_INTENSITY MAX7219_REG_SCANLIMIT MAX7219_REG_SHUTDOWN MAX7219_REG_DISPLAYTEST = 0x0F )
const ClockRefString string = " XXXXX \n X X\n X X\n X XXXX\n X X X\n XX X\n XXXXX "
const HeadphonesRefString string = " XXX \n XXXXXXX\n X\n X\n X\n X\n XXXXXXX\n XXX "
const MIN_CLOCK_TIME = 80 * time.Microsecond //try slowing down the whole thing
const MIN_CLOCK_TIME = 20 * time.Microsecond //TODO get the exact time from the spec
const TrainRefString string = " XXXXX \n XX X \n XX X \n XXXXX \nXXX XX \nXXX X X\n XXXXX X\nXXX X \nXXX X \n XXX \n XX "
const TramRefString string = "" /* 158-byte string literal not displayed */
const VERTICAL_TRANSITION_FRAMECOUNT = 16
Variables ¶
var ALCOVE_FONT = [][]byte{}/* 1112 elements not displayed */
original font by https://fontstruct.com/fontstructions/show/2461533/alcove-5x7 rendered and encoded by rom-vtn
var ATARI_FONT = [][]byte{}/* 255 elements not displayed */
var CP437_FONT = [][]byte{} // end of CP437_FONT /* 256 elements not displayed */
copied from https://github.com/d2r2/go-max7219/blob/master/fonts.go
Functions ¶
This section is empty.
Types ¶
type Renderer ¶
type Renderer interface {
Render(frame uint) StaticGrid //renders on a given frame
GetFrameCount() uint //gives the total number of frames
GetWidth() uint //number of columns the content takes on the screen
}
a Renderer is "something that can be displayed", consisting of 1 or more frames and a given width
func NewBlinkingGrid ¶
NewBlinkingGrid returns a Renderer which will show r for visibleFrames frames, and then show a blank grid until totalFrames
func NewConcatenateGrid ¶
NewConcatenateGrid returns a Renderer which will concatenate the given Renderers (width = sum of widths, frame count = maximum frame count given)
func NewFitInsideGrid ¶
NewFitInsideGrid returns a Renderer that shows r's content while ensuring it fits in the given size, padding (and centering) if too small and scrolling if too large
func NewRepeatGrid ¶
NewRepeatGrid returns a Renderer which behaved identically to r, but with an extended frame count to repeat it the given amount of times
func NewScrollingGrid ¶
NewScrollingGrid returns a Renderer which scrolls the content of r on the given width
func NewSequenceGrid ¶
NewSequenceGrid returns a Renderer that displays the given Renderers for the given frame durations.
type SpiScreen ¶
type SpiScreen struct {
// contains filtered or unexported fields
}
an SpiScreen is a physical SPI device (hopefully) connected to a max7219 array.
func NewDeviceAndOpen ¶
func NewDeviceAndOpen(spibus, spidevice uint, cascadeCount uint, brightness uint, rotateCount uint, flipHorizontal, flipVertical bool) (*SpiScreen, error)
NewDeviceAndOpen opens the SPI interface at the given bus/device and sets config parameters, then sends init signals to the screen to prepare it to display
type StaticGrid ¶
type StaticGrid []byte
StaticGrid represents static raw content; its width is its content's width and its frame count is 1
func NewBytesTextRender ¶
func NewBytesTextRender(codePage [][]byte, codePoints []byte) StaticGrid
NewBytesTextRender renders the given code points (byte per byte) using the given code page. This requires all codepoints to fit in a signle byte (not compatible with >255 codepoints)
func NewRawGridFromPattern ¶
func NewRawGridFromPattern(pattern string) StaticGrid
TODO make a better function? Returns a StaticGrid which renders the given pattern as a multiline string (separated by \n)
func NewRunesTextRender ¶
func NewRunesTextRender(codePage [][]byte, codePoints []rune) StaticGrid
NewRunesTextRender renders text as a series of runes, but allows runes to be >=256
func NewStringTextRender ¶
func NewStringTextRender(codePage [][]byte, content string) StaticGrid
NewStringTextRender renders the given string (converting it to runes, then to bytes) using the given code page
func (StaticGrid) GetFrameCount ¶
func (sg StaticGrid) GetFrameCount() uint
func (StaticGrid) GetWidth ¶
func (sg StaticGrid) GetWidth() uint
func (StaticGrid) Render ¶
func (sg StaticGrid) Render(frame uint) StaticGrid