Erriez TM1638 library for Arduino  1.2.0
TM1638 button and LED controller library for Arduino
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TM1638 Class Reference

TM1638 class. More...

#include <ErriezTM1638.h>

Public Member Functions

 TM1638 (uint8_t clkPin, uint8_t dioPin, uint8_t stbPin, bool displayOn=true, uint8_t brightness=5)
 TM1638 constructor. More...
 
virtual void begin ()
 Initialize TM1638 controller.
 
virtual void end ()
 Disable pins.
 
virtual void displayOn ()
 Turn Display on.
 
virtual void displayOff ()
 Turn display off.
 
virtual void setBrightness (uint8_t brightness)
 Set brightness LED's. More...
 
virtual void clear ()
 Turn all LED's off.
 
virtual void writeData (uint8_t address, uint8_t data)
 Write display register. More...
 
virtual void writeData (uint8_t address, const uint8_t *buf, uint8_t len)
 Write buffer to multiple display registers. More...
 
virtual uint32_t getKeys ()
 Get key states. More...
 

Protected Member Functions

virtual void writeDisplayControl ()
 Write display control register. More...
 
virtual void writeCommand (uint8_t cmd)
 Write command to TM1638.
 
virtual void writeByte (uint8_t data)
 Write byte to TM1638. More...
 
virtual uint8_t readByte ()
 Read byte from TM1638. More...
 

Protected Attributes

uint8_t _clkPin
 Clock pin.
 
uint8_t _dioPin
 Data pin.
 
uint8_t _stbPin
 Enable pin.
 
bool _displayOn
 Display on and off status for display control register.
 
uint8_t _brightness
 Display brightness for display control register.
 

Detailed Description

TM1638 class.

Definition at line 154 of file ErriezTM1638.h.

Constructor & Destructor Documentation

◆ TM1638()

TM1638::TM1638 ( uint8_t  clkPin,
uint8_t  dioPin,
uint8_t  stbPin,
bool  displayOn = true,
uint8_t  brightness = 5 
)

TM1638 constructor.

Constructor with pin arguments: C-D-E (Clock, Data, Enable)

Parameters
clkPinTM1638 CLK pin.
dioPinTM1638 DIO pin.
stbPinTM1638 STB pin.

Definition at line 43 of file ErriezTM1638.cpp.

Member Function Documentation

◆ getKeys()

uint32_t TM1638::getKeys ( )
virtual

Get key states.

Returns
One or more buttons. One bit per button.

Definition at line 190 of file ErriezTM1638.cpp.

◆ readByte()

uint8_t TM1638::readByte ( )
protectedvirtual

Read byte from TM1638.

Returns
8-bit value.

Definition at line 251 of file ErriezTM1638.cpp.

◆ setBrightness()

void TM1638::setBrightness ( uint8_t  brightness)
virtual

Set brightness LED's.

Parameters
brightnessDisplay brightness value 0..7

Definition at line 124 of file ErriezTM1638.cpp.

◆ writeByte()

void TM1638::writeByte ( uint8_t  data)
protectedvirtual

Write byte to TM1638.

Parameters
data8-bit value.

Definition at line 232 of file ErriezTM1638.cpp.

◆ writeData() [1/2]

void TM1638::writeData ( uint8_t  address,
uint8_t  data 
)
virtual

Write display register.

Parameters
addressDisplay address 0x00..0x0F
dataValue 0x00..0xFF

Definition at line 151 of file ErriezTM1638.cpp.

◆ writeData() [2/2]

void TM1638::writeData ( uint8_t  address,
const uint8_t *  buf,
uint8_t  len 
)
virtual

Write buffer to multiple display registers.

Write buffer to TM1638 with auto address increment

Parameters
addressDisplay address 0x00..0x0F
bufBuffer
lenBuffer length

Definition at line 173 of file ErriezTM1638.cpp.

◆ writeDisplayControl()

void TM1638::writeDisplayControl ( )
protectedvirtual

Write display control register.

Set brightness and display on/off

Definition at line 211 of file ErriezTM1638.cpp.


The documentation for this class was generated from the following files: