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
- type Device
- func (d *Device) Brightness(brightness uint8)
- func (d *Device) ClearDisplay()
- func (d *Device) Configure()
- func (d *Device) DisplayChr(chr byte, pos uint8)
- func (d *Device) DisplayClock(num1 uint8, num2 uint8, colon bool)
- func (d *Device) DisplayDigit(digit uint8, pos uint8)
- func (d *Device) DisplayNumber(num int16)
- func (d *Device) DisplayText(text []byte)
Constants ¶
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 (*Device) Brightness ¶
Brightness sets the brightness of the display (0-7).
func (*Device) DisplayChr ¶
DisplayChr shows a single character (A-Z, a-z) on the display at position 0-3.
func (*Device) DisplayClock ¶
DisplayClock allows you to display hour and minute numbers together with the colon on/off.
func (*Device) DisplayDigit ¶
DisplayDigit shows a single-digit number (0-9) at position 0-3.
func (*Device) DisplayNumber ¶
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 ¶
DisplayText shows a text on the display.
Only the first 4 letters in the array text would be shown.