Erriez TM1638 library for Arduino  1.2.0
TM1638 button and LED controller library for Arduino
Classes | Macros
ErriezTM1638.h File Reference

TM1638 library for Arduino. More...

#include <Arduino.h>
Include dependency graph for ErriezTM1638.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  TM1638
 TM1638 class. More...
 

Macros

#define TM1638_CMD_DATA   0x40
 Display data command.
 
#define TM1638_CMD_CTRL   0x80
 Display control command.
 
#define TM1638_CMD_ADDR   0xc0
 Display address command.
 
#define TM1638_DATA_WRITE   0x00
 Write data.
 
#define TM1638_DATA_READ_KEYS   0x02
 Read keys.
 
#define TM1638_DATA_AUTO_INC_ADDR   0x00
 Auto increment address.
 
#define TM1638_DATA_FIXED_ADDR   0x04
 Fixed address.
 
#define TM1638_CTRL_PULSE_1_16   0x00
 Pulse width 1/16.
 
#define TM1638_CTRL_PULSE_2_16   0x01
 Pulse width 2/16.
 
#define TM1638_CTRL_PULSE_4_16   0x02
 Pulse width 4/16.
 
#define TM1638_CTRL_PULSE_10_16   0x03
 Pulse width 10/16.
 
#define TM1638_CTRL_PULSE_11_16   0x04
 Pulse width 11/16.
 
#define TM1638_CTRL_PULSE_12_16   0x05
 Pulse width 12/16.
 
#define TM1638_CTRL_PULSE_13_16   0x06
 Pulse width 13/16.
 
#define TM1638_CTRL_PULSE_14_16   0x07
 Pulse width 14/16.
 
#define TM1638_CTRL_DISPLAY_OFF   0x00
 Display off.
 
#define TM1638_CTRL_DISPLAY_ON   0x08
 Display on. More...
 
#define TM1638_NUM_GRIDS   16
 Number of grid registers.
 
#define TM1638_CLK_LOW()   { digitalWrite(_clkPin, LOW); }
 CLK pin low.
 
#define TM1638_CLK_HIGH()   { digitalWrite(_clkPin, HIGH); }
 CLK pin high.
 
#define TM1638_CLK_INPUT()   { pinMode(_clkPin, INPUT); }
 CLK pin input.
 
#define TM1638_CLK_OUTPUT()   { pinMode(_clkPin, OUTPUT); }
 CLK pin output.
 
#define TM1638_DIO_LOW()   { digitalWrite(_dioPin, LOW); }
 DIO pin low.
 
#define TM1638_DIO_HIGH()   { digitalWrite(_dioPin, HIGH); }
 DIO pin high.
 
#define TM1638_DIO_INPUT()   { pinMode(_dioPin, INPUT); }
 DIO pin input.
 
#define TM1638_DIO_OUTPUT()   { pinMode(_dioPin, OUTPUT); }
 DIO pin output.
 
#define TM1638_DIO_READ()   ( digitalRead(_dioPin) )
 DIO pin read.
 
#define TM1638_STB_LOW()   { digitalWrite(_stbPin, LOW); }
 STB pin low.
 
#define TM1638_STB_HIGH()   { digitalWrite(_stbPin, HIGH); }
 STB pin high.
 
#define TM1638_STB_INPUT()   { pinMode(_stbPin, INPUT); }
 STB pin input.
 
#define TM1638_STB_OUTPUT()   { pinMode(_stbPin, OUTPUT); }
 STB pin output.
 
#define TM1638_PIN_DELAY()
 Delay between pin changes.
 

Detailed Description

TM1638 library for Arduino.

Source: https://github.com/Erriez/ErriezTM1638 Documentation: https://erriez.github.io/ErriezTM1638

Command / register definitions

MSB           LSB
 7 6 5 4 3 2 1 0
-----------------
 0 1 - - - - - -    Data command
 1 0 - - - - - -    Display control command
 1 1 - - - - - -    Address command


7.1 Data Command Set

MSB           LSB
 7 6 5 4 3 2 1 0
-----------------
 0 1 0 0 0 - 0 0    Write display data
 0 1 0 0 0 - 1 0    Read key scan data
 0 1 0 0 0 0 - -    Auto address increment
 0 1 0 0 0 1 - -    Fixed address


7.2 Address command set

MSB           LSB
 7 6 5 4 3 2 1 0
-----------------
 1 1 0 - A A A A    Address 0x00..0x0F


7.3 Display Control

MSB           LSB
 7 6 5 4 3 2 1 0
-----------------
 1 0 0 0 - 0 0 0    Set the pulse width of 1 / 16
 1 0 0 0 - 0 0 1    Set the pulse width of 2 / 16
 1 0 0 0 - 0 1 0    Set the pulse width of 4 / 16
 1 0 0 0 - 0 1 1    Set the pulse width of 10 / 16
 1 0 0 0 - 1 0 0    Set the pulse width of 11 / 16
 1 0 0 0 - 1 0 1    Set the pulse width of 12 / 16
 1 0 0 0 - 1 1 0    Set the pulse width of 13 / 16
 1 0 0 0 - 1 1 1    Set the pulse width of 14 / 16
 1 0 0 0 0 - - -    Display off
 1 0 0 0 1 - - -    Display on

Definition in file ErriezTM1638.h.

Macro Definition Documentation

◆ TM1638_CTRL_DISPLAY_ON

#define TM1638_CTRL_DISPLAY_ON   0x08

Display on.

Pin defines

Definition at line 105 of file ErriezTM1638.h.