Display_Lib_RPI 2.3.0
A C++ Library to connect electronic displays to Linux single board computers.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
TM1638plus_common Class Reference

The base Class , used to store common data & functions for all models types. More...

#include <TM1638plus_common_RDL.hpp>

Inheritance diagram for TM1638plus_common:
Inheritance graph
[legend]

Public Types

enum  AlignTextType_e : uint8_t { TMAlignTextRight = 1 , TMAlignTextLeft = 2 , TMAlignTextZeros = 3 }
 
enum  TMOffsetsMasks : uint8_t { TM_ASCII_OFFSET = 0x20 , TM_HEX_OFFSET = 0x10 , TM_DOT_MASK_DEC = 0x80 , TM_BRIGHT_MASK = 0x07 }
 

Public Member Functions

 TM1638plus_common (uint8_t strobe, uint8_t clock, uint8_t data, int gpioDev)
 Constructor for class TM1638plus_common.
 
void reset (void)
 Reset / clear the display.
 
rdlib::Return_Codes_e displayBegin (void)
 Begin method , sets pin modes and activate display.
 
void brightness (uint8_t brightness)
 Sets the brightness level of segments in display on a scale of brightness.
 
uint16_t TMCommDelayGet (void)
 get the TM comm delay.
 
void TMCommDelayset (uint16_t)
 set the TM comm delay.
 
rdlib::Return_Codes_e displayClose (void)
 Close method , frees GPIO and deactivate display.
 

Protected Types

enum  TMCommands : uint8_t {
  TM_ACTIVATE = 0x8F , TM_BUTTONS_MODE = 0x42 , TM_WRITE_LOC = 0x44 , TM_WRITE_INC = 0x40 ,
  TM_SEG_ADR = 0xC0 , TM_LEDS_ADR = 0xC1 , TM_BRIGHT_ADR = 0x88
}
 

Protected Member Functions

void sendCommand (uint8_t value)
 Send command to display.
 
void sendData (uint8_t data)
 Send Data to display.
 
uint8_t HighFreqshiftin (void)
 Shifts in a byte of data from the Tm1638 SPI-like bus.
 
void HighFreqshiftOut (uint8_t val)
 Shifts out a byte of data on to the Tm1638 SPI-like bus.
 

Protected Attributes

uint8_t _Display_CS
 
uint8_t _Display_SDATA
 
uint8_t _Display_SCLK
 
const uint8_t _TMDisplaySize = 8
 
int _DeviceNumGpioChip = 0
 
int _GpioHandle = 0
 

Private Attributes

uint16_t _TMCommDelay = 1
 
const uint8_t _TMDefaultBrightness = 0x02
 

Detailed Description

The base Class , used to store common data & functions for all models types.

Member Enumeration Documentation

◆ AlignTextType_e

Alignment of text on display

Enumerator
TMAlignTextRight 

Align text to the right on display

TMAlignTextLeft 

Align text to the left on display

TMAlignTextZeros 

Add leading zeros to the text

◆ TMCommands

enum TM1638plus_common::TMCommands : uint8_t
protected

Tm1638 register commands

Enumerator
TM_ACTIVATE 

Start up

TM_BUTTONS_MODE 

Buttons mode

TM_WRITE_LOC 

Write to a location

TM_WRITE_INC 

Incremental write

TM_SEG_ADR 

leftmost segment Address C0 C2 C4 C6 C8 CA CC CE

TM_LEDS_ADR 

Leftmost LED address C1 C3 C5 C7 C9 CB CD CF

TM_BRIGHT_ADR 

Brightness address

◆ TMOffsetsMasks

Display Offsets and Masks

Enumerator
TM_ASCII_OFFSET 

32 Ascii table offset to jump over first missing 32 chars

TM_HEX_OFFSET 

16 Ascii table offset to reach number position

TM_DOT_MASK_DEC 

128 Mask to switch on decimal point in seven seg.

TM_BRIGHT_MASK 

Brightness mask

Constructor & Destructor Documentation

◆ TM1638plus_common()

TM1638plus_common::TM1638plus_common ( uint8_t  strobe,
uint8_t  clock,
uint8_t  data,
int  gpioDev 
)

Constructor for class TM1638plus_common.

Parameters
strobeSTB pin
clockCLk pin
dataDIO pin
gpioDevThe device number of a gpiochip.

Member Function Documentation

◆ brightness()

void TM1638plus_common::brightness ( uint8_t  brightness)

Sets the brightness level of segments in display on a scale of brightness.

Parameters
brightnessbyte with value 0 to 7 The DEFAULT_BRIGHTNESS = 0x02

◆ displayBegin()

rdlib::Return_Codes_e TM1638plus_common::displayBegin ( void  )

Begin method , sets pin modes and activate display.

Returns
  1. rdlib::Success
  2. rdlib::GpioChipDevice;
  3. rdlib::GpioPinClaim
Note
Call in Setup

◆ displayClose()

rdlib::Return_Codes_e TM1638plus_common::displayClose ( void  )

Close method , frees GPIO and deactivate display.

Returns
  1. rdlib::Success
  2. rdlib::GpioChipDevice
  3. rdlib::GpioPinFree
Note
call at end of program

◆ HighFreqshiftin()

uint8_t TM1638plus_common::HighFreqshiftin ( void  )
protected

Shifts in a byte of data from the Tm1638 SPI-like bus.

Returns
Data byte
Note
_TMCommDelay microsecond delay may have to be adjusted depending on processor

◆ HighFreqshiftOut()

void TM1638plus_common::HighFreqshiftOut ( uint8_t  val)
protected

Shifts out a byte of data on to the Tm1638 SPI-like bus.

Parameters
valThe byte of data to shift out
Note
_TMCommDelay microsecond delay may have to be adjusted depending on processor

◆ reset()

void TM1638plus_common::reset ( void  )

Reset / clear the display.

Note
The display is cleared by writing zero to all data segment addresses.

◆ sendCommand()

void TM1638plus_common::sendCommand ( uint8_t  value)
protected

Send command to display.

Parameters
valuecommand byte to send

◆ sendData()

void TM1638plus_common::sendData ( uint8_t  data)
protected

Send Data to display.

Parameters
dataData byte to send

◆ TMCommDelayGet()

uint16_t TM1638plus_common::TMCommDelayGet ( void  )

get the TM comm delay.

Returns
The TM comm delay in uS

◆ TMCommDelayset()

void TM1638plus_common::TMCommDelayset ( uint16_t  CommDelay)

set the TM comm delay.

Parameters
CommDelayThe TM comm delay in uS

Member Data Documentation

◆ _DeviceNumGpioChip

int TM1638plus_common::_DeviceNumGpioChip = 0
protected

The device number of a gpiochip ls /dev/gpio

◆ _Display_CS

uint8_t TM1638plus_common::_Display_CS
protected

GPIO connected to STB on Tm1638

◆ _Display_SCLK

uint8_t TM1638plus_common::_Display_SCLK
protected

GPIO connected to CLk on Tm1638

◆ _Display_SDATA

uint8_t TM1638plus_common::_Display_SDATA
protected

GPIO connected to DIO on Tm1638

◆ _GpioHandle

int TM1638plus_common::_GpioHandle = 0
protected

This returns a handle to a gpiochip device.

◆ _TMCommDelay

uint16_t TM1638plus_common::_TMCommDelay = 1
private

uS delay used in communications , User adjust

◆ _TMDefaultBrightness

const uint8_t TM1638plus_common::_TMDefaultBrightness = 0x02
private

can be 0x00 to 0x07 , User adjust

◆ _TMDisplaySize

const uint8_t TM1638plus_common::_TMDisplaySize = 8
protected

size of display in digts


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