![]() |
Display_Lib_RPI 2.3.0
A C++ Library to connect electronic displays to Linux single board computers.
|
Class for Model 2. More...
#include <TM1638plus_Model2_RDL.hpp>
Public Member Functions | |
TM1638plus_Model2 (uint8_t strobe, uint8_t clock, uint8_t data, int gpioDev, bool swap_nibbles=false) | |
Constructor for class TM1638plus_Model2. | |
uint8_t | ReadKey16 (void) |
Read push buttons method ( one of two methods available) | |
uint16_t | ReadKey16Two (void) |
Read push buttons method ( one of two methods available) | |
void | DisplaySegments (uint8_t segment, uint8_t segmentValue) |
Send seven segment value to display. | |
void | DisplayHexNum (uint16_t numberUpper, uint16_t numberLower, uint8_t dots, AlignTextType_e=TMAlignTextLeft) |
Display an Hexadecimal number in each nibble (4 digits on display) | |
void | DisplayDecNum (unsigned long number, uint8_t dots, AlignTextType_e=TMAlignTextLeft) |
Display an decimal number. | |
rdlib::Return_Codes_e | DisplayStr (const char *string, uint16_t dots=0) |
Display a string, with decimal point display. | |
void | ASCIItoSegment (const uint8_t values[]) |
Takes in Array of 8 ASCII bytes , Called from DisplayStr . Scans each ASCII byte converts to array of 8 segment bytes where each byte represents a segment. Then calls DisplaySegments() method to display segments on display. | |
void | DisplayDecNumNibble (uint16_t numberUpper, uint16_t numberLower, uint8_t dots, AlignTextType_e=TMAlignTextLeft) |
Display an integer in each nibble (4 digits on display) | |
![]() | |
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. | |
Private Attributes | |
bool | _SWAP_NIBBLES = false |
Additional Inherited Members | |
![]() | |
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 } |
![]() | |
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 } |
![]() | |
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. | |
![]() | |
uint8_t | _Display_CS |
uint8_t | _Display_SDATA |
uint8_t | _Display_SCLK |
const uint8_t | _TMDisplaySize = 8 |
int | _DeviceNumGpioChip = 0 |
int | _GpioHandle = 0 |
Class for Model 2.
TM1638plus_Model2::TM1638plus_Model2 | ( | uint8_t | strobe, |
uint8_t | clock, | ||
uint8_t | data, | ||
int | gpioDev, | ||
bool | swap_nibbles = false |
||
) |
Constructor for class TM1638plus_Model2.
strobe | GPIO STB pin |
clock | GPIO CLK pin |
data | GPIO DIO pin |
gpioDev | The device number of a gpiochip. |
swap_nibbles | default false, if true, swaps nibbles on display byte. |
void TM1638plus_Model2::ASCIItoSegment | ( | const uint8_t | values[] | ) |
Takes in Array of 8 ASCII bytes , Called from DisplayStr . Scans each ASCII byte converts to array of 8 segment bytes where each byte represents a segment. Then calls DisplaySegments() method to display segments on display.
values | An array of 8 ASCII bytes |
void TM1638plus_Model2::DisplayDecNum | ( | unsigned long | number, |
uint8_t | dots, | ||
AlignTextType_e | TextAlignment = TMAlignTextLeft |
||
) |
Display an decimal number.
number | integer to display 2^32. |
dots | Decimal point display, switch's on decimal point for those positions. |
TextAlignment | leading zeros left or right text alignment on display. |
void TM1638plus_Model2::DisplayDecNumNibble | ( | uint16_t | numberUpper, |
uint16_t | numberLower, | ||
uint8_t | dots, | ||
AlignTextType_e | TextAlignment = TMAlignTextLeft |
||
) |
Display an integer in each nibble (4 digits on display)
numberUpper | upper nibble integer 2^16 |
numberLower | lower nibble integer 2^16 |
dots | Turn on or off decimal points to 0xFF d7d6d5d4d3d2d1d0 |
TextAlignment | leading zeros, left or right text alignment on display |
void TM1638plus_Model2::DisplayHexNum | ( | uint16_t | numberUpper, |
uint16_t | numberLower, | ||
uint8_t | dots, | ||
AlignTextType_e | TextAlignment = TMAlignTextLeft |
||
) |
Display an Hexadecimal number in each nibble (4 digits on display)
numberUpper | upper nibble integer 2^16 |
numberLower | lower nibble integer 2^16 |
dots | Decimal point display, switch's on decimal point for those positions. 0 to 0xFF |
TextAlignment | leading zeros, left or right text alignment on display |
void TM1638plus_Model2::DisplaySegments | ( | uint8_t | segment, |
uint8_t | digit | ||
) |
Send seven segment value to display.
segment | 0-7 byte of data corresponding to segments abcdefg(dp) 01234567. |
digit | display digit position, 0x00 to 0xFF d8d7d6d5d54d3d2d1. |
rdlib::Return_Codes_e TM1638plus_Model2::DisplayStr | ( | const char * | string, |
uint16_t | dots = 0 |
||
) |
Display a string, with decimal point display.
string | pointer to char array |
dots | Turn on or off decimal points 0 to 0xFF d7d6d5d4d3d2d1d0 |
unsigned char TM1638plus_Model2::ReadKey16 | ( | void | ) |
Read push buttons method ( one of two methods available)
uint16_t TM1638plus_Model2::ReadKey16Two | ( | void | ) |
Read push buttons method ( one of two methods available)
Data matrix for read key_value. c = datain c3 0110 0110 c2 0110 0110 c1 0110 0110 c0 0110 0110 :uint8_ts read 8,16 7,15 6,14 5,13 4,12 3,11 2,10 1,9 :button value
|
private |
Swap the nibbles on display byte