tm1637

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: BSD-3-Clause Imports: 2 Imported by: 3

Documentation

Overview

Package tm1637 provides a driver for the TM1637 4-digit 7-segment LED display.

Datasheet: https://www.mcielectronics.cl/website_MCI/static/documents/Datasheet_TM1637.pdf

Index

Constants

View Source
const (
	TM1637_CMD1   = 0x40
	TM1637_CMD2   = 0xC0
	TM1637_CMD3   = 0x80
	TM1637_DSP_ON = 0x08
	TM1637_DELAY  = uint8(10)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

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

Device wraps the pins of the TM1637.

func New

func New(clk machine.Pin, dio machine.Pin, brightness uint8) Device

New creates a new TM1637 device.

func (*Device) Brightness

func (d *Device) Brightness(brightness uint8)

Brightness sets the brightness of the display (0-7).

func (*Device) ClearDisplay

func (d *Device) ClearDisplay()

ClearDisplay clears the display.

func (*Device) Configure

func (d *Device) Configure()

Configure sets up the pins.

func (*Device) DisplayChr

func (d *Device) DisplayChr(chr byte, pos uint8)

DisplayChr shows a single character (A-Z, a-z) on the display at position 0-3.

func (*Device) DisplayClock

func (d *Device) DisplayClock(num1 uint8, num2 uint8, colon bool)

DisplayClock allows you to display hour and minute numbers together with the colon on/off.

func (*Device) DisplayDigit

func (d *Device) DisplayDigit(digit uint8, pos uint8)

DisplayDigit shows a single-digit number (0-9) at position 0-3.

func (*Device) DisplayNumber

func (d *Device) DisplayNumber(num int16)

DisplayNumber shows a number on the display.

Only 4 rightmost digits of the number would be shown.

For negative numbers, only -999 to -1 would be shown with a negaive sign.

func (*Device) DisplayText

func (d *Device) DisplayText(text []byte)

DisplayText shows a text on the display.

Only the first 4 letters in the array text would be shown.

Jump to

Keyboard shortcuts

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