fourletterphat

package module
v0.0.0-...-c7dece0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2019 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Go-FourLetterPhat-RPi

Library written in Go to allow controlling of the Pimoroni Four Letter pHAT (with HT16K33 controller onboard) with a Raspberry Pi.

Product from Pimoroni Four Letter pHAT

Four Letter pHAT has four 14-segment displays that you can use to display text, numbers, and a host of other characters. Its LEDs are a beautiful retro green, just like you old digital alarm clock. They're driven by the HT16K33 chip over I2C.

Usage

  1. go get github.com/adrianh-za/go-fourletterphat-rpi
  2. browse to $/go/src/github.com/adrianh-za/go-fourletterphat-rpi/examples
  3. sudo -E go run main.go
  4. run until end

Acknowledgements

This project uses the I2C library written and maintained by Denis Dyakov

Gits

https://github.com/d2r2/go-i2c

Documentation

Index

Constants

View Source
const (
	AddressDefault           = 0x70
	AddressBlinkCommand      = 0x80
	AddressBlinkDisplayOn    = 0x01
	AddressSystemSetup       = 0x20
	AddressOscillator        = 0x01
	AddressCommandBrightness = 0xE0
)

Variables

View Source
var CharMap = map[rune]LEDChar{
	' ':  "0000000000000000",
	'!':  "0000000000000110",
	'"':  "0000001000100000",
	'#':  "0001001011001110",
	'$':  "0001001011101101",
	'%':  "0000110000100100",
	'&':  "0010001101011101",
	'\'': "0010000100000000",
	'(':  "0010010000000000",
	')':  "0000100100000000",
	'*':  "0011111111000000",
	'+':  "0001001011000000",
	',':  "0000100000000000",
	'-':  "0000000011000000",
	'.':  "0000000000000000",
	'/':  "0000110000000000",
	'0':  "0000110000111111",
	'1':  "0000000000000110",
	'2':  "0000000011011011",
	'3':  "0000000010001111",
	'4':  "0000000011100110",
	'5':  "0010000001101001",
	'6':  "0000000011111101",
	'7':  "0000000000000111",
	'8':  "0000000011111111",
	'9':  "0000000011101111",
	':':  "0001001000000000",
	';':  "0000101000000000",
	'<':  "0010010000000000",
	'=':  "0000000011001000",
	'>':  "0000100100000000",
	'?':  "0001000010000011",
	'@':  "0000001010111011",
	'A':  "0000000011110111",
	'B':  "0001001010001111",
	'C':  "0000000000111001",
	'D':  "0001001000001111",
	'E':  "0000000011111001",
	'F':  "0000000001110001",
	'G':  "0000000010111101",
	'H':  "0000000011110110",
	'I':  "0001001000000000",
	'J':  "0000000000011110",
	'K':  "0010010001110000",
	'L':  "0000000000111000",
	'M':  "0000010100110110",
	'N':  "0010000100110110",
	'O':  "0000000000111111",
	'P':  "0000000011110011",
	'Q':  "0010000000111111",
	'R':  "0010000011110011",
	'S':  "0000000011101101",
	'T':  "0001001000000001",
	'U':  "0000000000111110",
	'V':  "0000110000110000",
	'W':  "0010100000110110",
	'X':  "0010110100000000",
	'Y':  "0001010100000000",
	'Z':  "0000110000001001",
	'[':  "0000000000111001",
	'\\': "0010000100000000",
	']':  "0000000000001111",
	'^':  "0000110000000011",
	'_':  "0000000000001000",
	'`':  "0000000100000000",
	'a':  "0001000001011000",
	'b':  "0010000001111000",
	'c':  "0000000011011000",
	'd':  "0000100010001110",
	'e':  "0000100001011000",
	'f':  "0000000001110001",
	'g':  "0000010010001110",
	'h':  "0001000001110000",
	'i':  "0001000000000000",
	'j':  "0000000000001110",
	'k':  "0011011000000000",
	'l':  "0000000000110000",
	'm':  "0001000011010100",
	'n':  "0001000001010000",
	'o':  "0000000011011100",
	'p':  "0000000101110000",
	'q':  "0000010010000110",
	'r':  "0000000001010000",
	's':  "0010000010001000",
	't':  "0000000001111000",
	'u':  "0000000000011100",
	'v':  "0010000000000100",
	'w':  "0010100000010100",
	'x':  "0010100011000000",
	'y':  "0010000000001100",
	'z':  "0000100001001000",
	'{':  "0000100101001001",
	'|':  "0001001000000000",
	'}':  "0010010010001001",
	'~':  "0000010100100000",
}

CharMap is a list of all characters that can be displayed with there associated binary bit mask that tells the display which parts of the LED to light up.

Functions

func ClearChars

func ClearChars(bus *i2c.I2C) error

ClearChars clears the LED display

func Initialize

func Initialize(bus *i2c.I2C) error

Initialize sets up the LED display

func ScrollCharacters

func ScrollCharacters(bus *i2c.I2C, text string, delayMS int, pad bool) error

ScrollCharacters will display the inputted text and scroll characters to the left if the length of the text is greater than 4 characters "." will be displayed for a character when it comes after a charecter. Mulltiple successsive "." will be ignored, only first "." will be displayed

func SetBlink(bus *i2c.I2C, blink LEDBlink) error

SetBlink sets the blink frequency of the LED display

func SetBrightness

func SetBrightness(bus *i2c.I2C, value int) error

SetBrightness sets the brightness of the LED display Valid brightness value is 0 to 15

func WriteCharacters

func WriteCharacters(bus *i2c.I2C, text string) error

WriteCharacters allows you to display characters on the LED display

Types

type LEDBlink byte

LEDBlink represents a blink setting that can be processed by the LED display

const (
	// BlinkOff - don't blink the display
	BlinkOff LEDBlink = 0x00
	// Blink2Hz - blink at 2Hz
	Blink2Hz LEDBlink = 0x02
	// Blink1Hz - blink at 1Hz
	Blink1Hz LEDBlink = 0x04
	// BlinkHalfHz - blink at half of 1Hz
	BlinkHalfHz LEDBlink = 0x06
)

type LEDChar

type LEDChar string

LEDChar represents a character that can be displayed by the LED display

const (
	// CharEmpty is a character where no LEDs are lit
	CharEmpty LEDChar = "0000000000000000"
	// CharAll is a character where all LEDs are lit
	CharAll LEDChar = "1111111111111111"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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