Skip to content

Commit 800e5fb

Browse files
Version 2.1.0
1 parent 51afd57 commit 800e5fb

File tree

8 files changed

+88
-39
lines changed

8 files changed

+88
-39
lines changed

Makefile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
# URL: https://github.com/gavinlyonsrepo/TM1638plus_RPI
44
# Library is installed to /usr/lib and include files are placed at /usr/include.
55
# Uninstall and clean options provided
6-
# Options
7-
# 1. make = install library
8-
# 2. clean = deletes .o files generated by step 1 from build directory
9-
# 3. make uninstall = uninstalls library
6+
7+
# == Options ==
8+
# 1. make = compile library
9+
# 2. make install = install library to filesystem may need sudo)
10+
# 3. clean = deletes .o files generated by step 1 from build directory
11+
# 4. make uninstall = uninstalls library (may need sudo)
12+
# =============
1013

1114
# Where you want it installed
1215
PREFIX=/usr
@@ -24,12 +27,11 @@ SRCS = $(wildcard $(SRC)/*.cpp)
2427
OBJS = $(patsubst $(SRC)%.cpp, $(OBJ)/%.o, $(SRCS))
2528

2629
CXX=g++
27-
CCFLAGS= -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -Iinclude/
30+
CCFLAGS= -march=native -mtune=native -mcpu=native -Iinclude/
2831
LDFLAGS= -lbcm2835
2932

3033
# make all
31-
# reinstall the library after each recompilation
32-
all: pre-build TM1638plus_RPI install
34+
all: clean pre-build TM1638plus_RPI
3335

3436
pre-build:
3537
@echo

README.md

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
* [Software](#software)
1212
* [Hardware](#hardware)
1313
* [Notes and Issues](#notes-and-issues)
14-
* [Compilation problems](#compilation-problems)
15-
* [Comms delay](#comms-delay)
1614

1715

1816
## Overview
@@ -25,11 +23,12 @@
2523
A Raspberry pi library to display data on a 8-digit TM1638 seven segment module.
2624
Dynamic install-able system level Raspberry Pi C++ library.
2725

28-
* Development Tool Chain
29-
1. Raspberry PI 3 model b,
30-
2. C++ , complier g++ (Raspbian 8.3.0-6+rpi1) 8.3.0
31-
3. Raspbian 10 buster OS , armv7l Linux 5.10.103-v7+, 32 bit
32-
4. bcm2835 Library 1.68 (Dependency: used for GPIO control and delays)
26+
* Development Tool chain.
27+
1. Raspberry PI 3 model b
28+
2. C++, g++ (Debian 12.2.0)
29+
3. Raspbian , Debian 12 bookworm OS, , 64 bit.
30+
4. kernel : aarch64 Linux 6.1.0-rpi7-rpi-v8
31+
5. bcm2835 Library 1.73 dependency. Provides low level I2C bus, delays and GPIO control.
3332

3433

3534
## Installation
@@ -43,15 +42,16 @@ Dynamic install-able system level Raspberry Pi C++ library.
4342
* Run following command to download from github.
4443

4544
```sh
46-
curl -sL https://github.com/gavinlyonsrepo/TM1638plus_RPI/archive/2.0.tar.gz | tar xz
45+
curl -sL https://github.com/gavinlyonsrepo/TM1638plus_RPI/archive/2.1.tar.gz | tar xz
4746
```
4847

49-
4. Run "make" to run the makefile in base folder to install library, it will be
48+
3. Run "make" to run the makefile in base folder to install library, it will be
5049
installed to usr/lib and usr/include
5150

5251
```sh
53-
cd TM1638plus_RPI-2.0
54-
sudo make
52+
cd TM1638plus_RPI-2.1
53+
make
54+
sudo make install
5555
```
5656

5757
## Test
@@ -78,8 +78,6 @@ Comment out the rest.
7878
Next enter the examples folder and run the makefile in THAT folder,
7979
This makefile builds the examples file using the just installed library.
8080
and creates a test exe file in "bin".
81-
Make run will use "sudo" as the bcm2835
82-
requires root permissions by default [ see here for more details on that](http://www.airspayce.com/mikem/bcm2835/)
8381

8482
```sh
8583
cd examples/
@@ -101,6 +99,13 @@ This library is a port of my Arduino Library. There at link below you will find
10199

102100
[ Arduino library github Link ](https://github.com/gavinlyonsrepo/TM1638plus)
103101

102+
### Comms delay
103+
104+
Communications optional delay.
105+
It may be necessary to adjust the constant TMCommDelay in the TM1638plus_common.h file. It is Microsecond delay used in communications clocking, it is currently set to 1,
106+
It can be set to 0 or higher. On a different CPU Frequency to one tested, it may be necessary to increase/decrease this.
107+
The user can do this with the Getter method provided. TMCommDelayGet.
108+
104109
## Hardware
105110

106111
Connections to RPI:
@@ -128,16 +133,4 @@ Pictured at from left to right.
128133

129134
## Notes and Issues
130135

131-
### Compilation problems
132136

133-
Note the tool chain used in overview section, If you have trouble compiling on other
134-
platforms or OS. For example 64-bit OS, user may need to remove or edit
135-
some of the CCFLAGS in root directory Makefile to allow for Compilation, if you see them throwing errors
136-
See [pull request on SSD1306 project](https://github.com/gavinlyonsrepo/SSD1306_OLED_RPI/pull/2) for details.
137-
Will upgrade in future release.
138-
139-
### Comms delay
140-
141-
Communications optional delay.
142-
It may be necessary to adjust the constant _TM_CommDelay in the TM1638plus_common.h file. It is Microsecond delay used in communications clocking, it is currently set to 1,
143-
It can be set to 0 or higher. On a different CPU Frequency to one tested, it may be necessary to increase/decrease this.

examples/src/HELLOWORLD_Model1/main.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@
2020
// Constructor object (GPIO STB , GPIO CLOCK , GPIO DIO, )
2121
TM1638plus_Model1 tm(STROBE_TM, CLOCK_TM , DIO_TM);
2222

23-
2423
int main(int argc, char **argv)
2524
{
2625
printf("Test Begin :: Model 1 :: TM1638plus_RPI\r\n");
27-
if(!bcm2835_init()) {return -1;}
28-
26+
printf("TM1638plus_RPI library version number :: %u\r\n", tm.libraryVersionNumberGet());
27+
if(!bcm2835_init())
28+
{
29+
printf("bcm2835 library failed to init, Run as root\r\n");
30+
return -1;
31+
}else
32+
{
33+
printf("bcm2835 library Version Number :%u\r\n", bcm2835_version());
34+
}
2935
tm.displayBegin();
3036
tm.displayText("helowrld");
3137
bcm2835_delay(5000);

examples/src/HELLOWORLD_Model2/main.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ TM1638plus_Model2 tm(STROBE_TM, CLOCK_TM , DIO_TM, swap_nibbles);
2424
int main(int argc, char **argv)
2525
{
2626
printf("Test Begin :: Model 2 :: TM1638plus_RPI\r\n");
27-
if(!bcm2835_init()) {return -1;}
27+
printf("TM1638plus_RPI library version number :: %u\r\n", tm.libraryVersionNumberGet());
28+
if(!bcm2835_init())
29+
{
30+
printf("bcm2835 library failed to init, Run as root\r\n");
31+
return -1;
32+
}else
33+
{
34+
printf("bcm2835 library Version Number :%u\r\n", bcm2835_version());
35+
}
2836

2937
tm.displayBegin();
3038
tm.DisplayStr("helowrld", 0); // Display "helowrld" in 7 segments with 0 decimal points set.

examples/src/HELLOWORLD_Model3/main.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ TM1638plus_Model3 tm(STROBE_TM, CLOCK_TM , DIO_TM);
2424
int main(int argc, char **argv)
2525
{
2626
printf("Test Begin\r\n");
27-
if(!bcm2835_init()) {return -1;}
27+
printf("TM1638plus_RPI library version number :: %u\r\n", tm.libraryVersionNumberGet());
28+
if(!bcm2835_init())
29+
{
30+
printf("bcm2835 library failed to init, Run as root\r\n");
31+
return -1;
32+
}else
33+
{
34+
printf("bcm2835 library Version Number :%u\r\n", bcm2835_version());
35+
}
2836

2937
tm.displayBegin();
3038
tm.displayText("helowrld");

extra/doc/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,13 @@
1010
* Optimizations + refactoring
1111
* Updated to match original Arduino port, v 2.0.0
1212
* Added "Doxygen" style comments to allow "Doxygen" software to generate an HTML API.
13+
14+
* version 2.0.0 April 2023
15+
* Optimizations + refactoring
16+
* Updated to match original Arduino port, v 2.0.0
17+
* Added "Doxygen" style comments to allow "Doxygen" software to generate an HTML API.
18+
19+
* version 2.1.0 Dec 2023
20+
* Minor Update.
21+
* Changed Makefile so the Library will compile on 64 bit systems without error
22+
* Added Getter and Setters methods fro TMCommDelay

include/TM1638plus_common.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ class TM1638plus_common{
5555
TM1638plus_common(uint8_t strobe, uint8_t clock, uint8_t data);
5656

5757
void reset(void);
58-
void displayBegin();
58+
void displayBegin(void);
5959
void brightness(uint8_t brightness);
60+
uint16_t libraryVersionNumberGet(void);
61+
uint16_t TMCommDelayGet(void);
62+
void TMCommDelayset(uint16_t);
6063

6164
protected:
6265
void sendCommand(uint8_t value);
@@ -72,7 +75,8 @@ class TM1638plus_common{
7275
const unsigned char * pFontSevenSegptr = SevenSeg; /**< Pointer to the seven segment font data table */
7376

7477
private:
75-
const uint16_t _TMCommDelay = 1; /**< uS delay used in communications , User adjust */
78+
const uint16_t _TMLibVerNum = 210; /**< Library version number 210 = 2.1.0*/
79+
uint16_t _TMCommDelay = 1; /**< uS delay used in communications , User adjust */
7680
const uint8_t _TMDefaultBrightness = 0x02; /**< can be 0x00 to 0x07 , User adjust */
7781

7882
/*! font , map of ASCII values/table to 7-segment, offset to position 32. */

src/TM1638plus_common.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,21 @@ void TM1638plus_common::HighFreqshiftOut(uint8_t dataPin, uint8_t clockPin, uint
125125
}
126126
}
127127

128+
/*!
129+
@brief get the library number
130+
@return The library number 210 = 2.1.0
131+
*/
132+
uint16_t TM1638plus_common::libraryVersionNumberGet(void) {return _TMLibVerNum;}
133+
134+
/*!
135+
@brief get the TM comm delay.
136+
@return The TM comm delay in uS
137+
*/
138+
uint16_t TM1638plus_common::TMCommDelayGet(void){return _TMCommDelay;}
139+
140+
/*!
141+
@brief set the TM comm delay.
142+
@param CommDelay The TM comm delay in uS
143+
*/
144+
void TM1638plus_common::TMCommDelayset(uint16_t CommDelay) {_TMCommDelay = CommDelay;}
145+

0 commit comments

Comments
 (0)