uprint

package module
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 2 Imported by: 0

README

uPrint

uPrint (microPrint) is a simple TinyGo library to print text on OLED display. Drivers implementing 'drivers.Displayer' are supported. Tested on Raspberry Pi Pico and ssd1306.

Example

	machine.SPI0.Configure(machine.SPIConfig{
		Frequency: 10 * 1024 * 1024,
	})

	time.Sleep(time.Second)

	device := ssd1306.NewSPI(machine.SPI0, machine.Pin(17), machine.Pin(20), machine.Pin(16))
	device.Configure(ssd1306.Config{})

	device.ClearDisplay()

	p := uprint.New(&device, "font7x10")
	p.Print("Hello!", 0, 0, color.RGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff})

	device.Display()

	for {
		time.Sleep(time.Second)
	}

fonts downloaded from: https://github.com/Nondzu/ssd1306_font

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Display added in v0.0.3

type Display struct {
	// contains filtered or unexported fields
}

func New

func New(d drivers.Displayer, fname string) *Display

New inits font and driver. Accepted fonts are: 'font6x8', 'font7x10', 'font11x18', 'font16x26'.

func (*Display) Print added in v0.0.3

func (t *Display) Print(s string, x, y int, c color.RGBA)

Print prints string at specific coordinates.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL