Skip to content

Commit aedd8db

Browse files
Version 2.4.1
1 parent 866bffd commit aedd8db

File tree

17 files changed

+329
-59
lines changed

17 files changed

+329
-59
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ sudo make install
5656
* Run following command to download latest release from github.
5757

5858
```sh
59-
curl -sL https://github.com/gavinlyonsrepo/Display_Lib_RPI/archive/2.4.0.tar.gz | tar xz
59+
curl -sL https://github.com/gavinlyonsrepo/Display_Lib_RPI/archive/2.4.1.tar.gz | tar xz
6060
```
6161

6262
3. Install library : Run 'make' and 'sudo make install' to run the makefile to build and then install library.
6363
* It will be installed to usr/local/lib and usr/local/include by default.
6464

6565
```sh
66-
cd Display_Lib_RPI-2.4.0
66+
cd Display_Lib_RPI-2.4.1
6767
make
6868
sudo make install
6969
```

examples/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
# ================================================
4848

4949
# ================= TM1637 ======================
50-
#SRC=tm1637/test_model4
50+
#SRC=tm1637/test_model4a_semicolon
51+
#SRC=tm1637/test_model4b_decimal_points
5152
# ================================================
5253

5354
# ================= HD44780 LCD I2C ==============

examples/max7219/bcdmode/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ int HWSPI_DEVICE = 0; // A SPI device, >= 0. which SPI interface to use
2323
int HWSPI_CHANNEL = 0; // A SPI channel, >= 0. Which Chip enable pin to use
2424
int HWSPI_SPEED = 1000000; // The speed of serial communication in bits per second.
2525
int HWSPI_FLAGS = 0; // last 2 LSB bits define SPI mode, see readme, mode 0 for this device
26+
uint8_t NumberOfDisplays = 1; // Number of displays connected
2627

2728
// Constructor object
28-
MAX7219_SS_RPI myMAX(HWSPI_DEVICE, HWSPI_CHANNEL, HWSPI_SPEED, HWSPI_FLAGS);
29+
MAX7219_SS_RPI myMAX(HWSPI_DEVICE, HWSPI_CHANNEL, HWSPI_SPEED, HWSPI_FLAGS, NumberOfDisplays);
2930

3031
// Function Prototypes
3132
bool Setup(void);

examples/max7219/cascade_demo/main.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
@brief A demo file library for Max7219 seven segment displays
55
Shows simple example with two cascades displays
66
Hardware SPI Project Name: Display_Lib_RPI
7-
8-
@note NOT fully tested as only one display available
97
@test
108
-# Test 410 Cascade demonstration
119
*/
@@ -21,9 +19,10 @@ int HWSPI_DEVICE = 0; // A SPI device, >= 0. which SPI interface to use
2119
int HWSPI_CHANNEL = 0; // A SPI channel, >= 0. Which Chip enable pin to use
2220
int HWSPI_SPEED = 1000000; // The speed of serial communication in bits per second.
2321
int HWSPI_FLAGS = 0; // last 2 LSB bits define SPI mode, see readme, mode 0 for this device
22+
uint8_t NumberOfDisplays = 2; // Number of displays connected
2423

2524
// Constructor object
26-
MAX7219_SS_RPI myMAX(HWSPI_DEVICE, HWSPI_CHANNEL, HWSPI_SPEED, HWSPI_FLAGS);
25+
MAX7219_SS_RPI myMAX(HWSPI_DEVICE, HWSPI_CHANNEL, HWSPI_SPEED, HWSPI_FLAGS, NumberOfDisplays);
2726

2827
// Main loop
2928
int main()
@@ -67,16 +66,24 @@ int main()
6766
printf("Display 1 again\r\n");
6867
myMAX.DisplayIntNum(111, myMAX.AlignRight);
6968
delayMilliSecRDL(5000);
70-
69+
70+
// Write to Display one again
71+
myMAX.SetCurrentDisplayNumber(2);
72+
printf("Display 2 again\r\n");
73+
myMAX.DisplayIntNum(222, myMAX.AlignRight);
74+
delayMilliSecRDL(5000);
75+
7176
// Clear the displays
72-
printf("Clear the displays\r\n");
77+
printf("Clear the display 1\r\n");
7378
// -Clear Display one
7479
myMAX.SetCurrentDisplayNumber(1);
7580
myMAX.ClearDisplay();
81+
delayMilliSecRDL(2500);
82+
printf("Clear the display 2\r\n");
7683
// -Clear DisplayTwo
7784
myMAX.SetCurrentDisplayNumber(2);
7885
myMAX.ClearDisplay();
79-
86+
delayMilliSecRDL(1000);
8087
// End operations
8188
myMAX.DisplayEndOperations();
8289
printf("Test End\r\n");

examples/max7219/clock_demo/main.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
-# Display one shows time
77
-# Display two shows Date
88
-# Hardware SPI Project Name: MAX7219_7SEG_RPI
9-
10-
@note not fully tested as only one display available
119
@test
1210
-# Test 403 Clock demonstration
1311
*/
@@ -30,9 +28,10 @@ int HWSPI_DEVICE = 0; // A SPI device, >= 0. which SPI interface to use
3028
int HWSPI_CHANNEL = 0; // A SPI channel, >= 0. Which Chip enable pin to use
3129
int HWSPI_SPEED = 1000000; // The speed of serial communication in bits per second.
3230
int HWSPI_FLAGS = 0; // last 2 LSB bits define SPI mode, see readme, mode 0 for this device
31+
uint8_t NumberOfDisplays = 2; // Number of displays connected
3332

3433
// Constructor object
35-
MAX7219_SS_RPI myMAX(HWSPI_DEVICE, HWSPI_CHANNEL, HWSPI_SPEED, HWSPI_FLAGS);
34+
MAX7219_SS_RPI myMAX(HWSPI_DEVICE, HWSPI_CHANNEL, HWSPI_SPEED, HWSPI_FLAGS, NumberOfDisplays);
3635

3736
// Function Prototypes
3837
std::string UTC_string(void);

examples/max7219/tests_hwspi/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ int HWSPI_DEVICE = 0; // A SPI device, >= 0. which SPI interface to use
3737
int HWSPI_CHANNEL = 0; // A SPI channel, >= 0. Which Chip enable pin to use
3838
int HWSPI_SPEED = 1000000; // The speed of serial communication in bits per second.
3939
int HWSPI_FLAGS = 0; // last 2 LSB bits define SPI mode, see readme, mode 0 for this device
40+
uint8_t NumberOfDisplays = 1; // Number of displays connected
4041

4142
// Constructor object
42-
MAX7219_SS_RPI myMAX(HWSPI_DEVICE, HWSPI_CHANNEL, HWSPI_SPEED, HWSPI_FLAGS);
43+
MAX7219_SS_RPI myMAX(HWSPI_DEVICE, HWSPI_CHANNEL, HWSPI_SPEED, HWSPI_FLAGS, NumberOfDisplays);
4344

4445
// Function Prototypes
4546
bool Setup(void);

examples/max7219/tests_swspi/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ uint8_t CLK =16; // clock GPIO, connected to clock line of module
3232
uint8_t CS =20; // Chip Select GPIO, connected to CS line of module
3333
uint8_t DIN =21; // data in GPIO, connected to DIN line of module
3434
int GPIO_CHIP_DEVICE = 0; // GPIO chip device number usually 0
35+
uint8_t NumberOfDisplays = 1; // Number of displays connected
3536

3637

3738
// Delays for testing
@@ -40,7 +41,7 @@ int GPIO_CHIP_DEVICE = 0; // GPIO chip device number usually 0
4041
#define TEST_DELAY1 1000
4142

4243
// Constructor object
43-
MAX7219_SS_RPI myMAX(CLK, CS ,DIN, GPIO_CHIP_DEVICE);
44+
MAX7219_SS_RPI myMAX(CLK, CS ,DIN, GPIO_CHIP_DEVICE, NumberOfDisplays );
4445

4546
// Function Prototypes
4647
bool Setup(void);

examples/tm1637/test_model4/main.cpp renamed to examples/tm1637/test_model4a_semicolon/main.cpp

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
2-
@file examples/tm1637/test_model4/main.cpp
2+
@file examples/tm1637/test_model4a_semicolon/main.cpp
33
@author Gavin Lyons
4-
@brief A demo file library for TM1637 module Works on Model 4
4+
@brief A demo file library for TM1637 module Works on Model 4A semi colon :
55
Carries out series of tests demonstrating arduino library TM1637plus.
66
Project Name: Display_Lib_RPI
77
@details
@@ -12,7 +12,7 @@
1212
https://en.wikipedia.org/wiki/Seven-segment_display
1313
URL: https://github.com/gavinlyonsrepo/Display_Lib_RPI
1414
@note
15-
Only tested on 4 digit + semi colon model,
15+
Only tested on 4 digit + semi colon model, Model 4A
1616
@test
1717
-# Test 1 setSegments and encode digit functions
1818
-# Test 2 decimal number testing
@@ -30,7 +30,6 @@
3030
#define GPIO_CHIP_DEVICE 0 // try 0 or 4 , ls /dev/gpio*
3131
#define COMM_DELAY_US 75 // Internal Serial Communications delay in uS
3232
#define NUM_OF_DIGITS 4 // number of digits in display.
33-
#define SEMI_COLON_ON (0x40)
3433

3534
// Constructor object
3635
TM1637plus_Model4 tm(CLOCK_TM , DIO_TM, GPIO_CHIP_DEVICE, COMM_DELAY_US, NUM_OF_DIGITS);
@@ -66,7 +65,7 @@ int main(void)
6665
// ************** Function Space ***********
6766
bool Setup(void)
6867
{
69-
printf("Test Begin :: Model 4 :: TM1637plus\r\n");
68+
printf("Test Begin :: Model 4A :: TM1637plus\r\n");
7069
delaySecRDL(myTestDelay1);
7170
if (tm.displayBegin() != rdlib::Success)
7271
{
@@ -108,6 +107,14 @@ void Test1(void)
108107
tm.setSegments(data,4,0);
109108
delaySecRDL(myTestDelay);
110109

110+
printf("Test 1D: SetSegments semi-colon only : \r\n");
111+
data[0] = 0x00;
112+
data[1] = 0x80;
113+
data[2] = 0x00;
114+
data[3] = 0x00;
115+
tm.setSegments(data,4,0);
116+
delaySecRDL(myTestDelay);
117+
111118
}
112119

113120
void Test2(void)
@@ -134,23 +141,23 @@ void Test2(void)
134141
delaySecRDL(myTestDelay);
135142

136143
printf("Test 2C: decimal number leading zeros off, with semi:colon on \r\n");
137-
tm.DisplayDecimalwDot(1, SEMI_COLON_ON, false, 4, 0);
144+
tm.DisplayDecimalwDot(1, tm.SEMI_COLON_ON, false, 4, 0);
138145
delaySecRDL(myTestDelay);
139-
tm.DisplayDecimalwDot(23, SEMI_COLON_ON, false, 4, 0);
146+
tm.DisplayDecimalwDot(23, tm.SEMI_COLON_ON, false, 4, 0);
140147
delaySecRDL(myTestDelay);
141-
tm.DisplayDecimalwDot(784, SEMI_COLON_ON, false, 4, 0);
148+
tm.DisplayDecimalwDot(784, tm.SEMI_COLON_ON, false, 4, 0);
142149
delaySecRDL(myTestDelay);
143-
tm.DisplayDecimalwDot(6281, SEMI_COLON_ON, false, 4, 0);
150+
tm.DisplayDecimalwDot(6281, tm.SEMI_COLON_ON, false, 4, 0);
144151
delaySecRDL(myTestDelay);
145152

146153
printf("Test 2D: decimal number leading zeros on , with semi:colon on\r\n");
147-
tm.DisplayDecimalwDot(1, SEMI_COLON_ON, true, 4, 0);
154+
tm.DisplayDecimalwDot(1, tm.SEMI_COLON_ON, true, 4, 0);
148155
delaySecRDL(myTestDelay);
149-
tm.DisplayDecimalwDot(23, SEMI_COLON_ON, true, 4, 0);
156+
tm.DisplayDecimalwDot(23, tm.SEMI_COLON_ON, true, 4, 0);
150157
delaySecRDL(myTestDelay);
151-
tm.DisplayDecimalwDot(784, SEMI_COLON_ON, true, 4, 0);
158+
tm.DisplayDecimalwDot(784, tm.SEMI_COLON_ON, true, 4, 0);
152159
delaySecRDL(myTestDelay);
153-
tm.DisplayDecimalwDot(6281, SEMI_COLON_ON, true, 4, 0);
160+
tm.DisplayDecimalwDot(6281, tm.SEMI_COLON_ON, true, 4, 0);
154161
delaySecRDL(myTestDelay);
155162
tm.displayClear();
156163
}
@@ -165,14 +172,20 @@ void Test3(void)
165172
printf("Test 3B: string 2 digit + semi colon\r\n");
166173
char min[] = "07";
167174
char sec[] = "53";
168-
tm.DisplayString(min, SEMI_COLON_ON, 2, 0); // Display "07" starting at position 0
169-
tm.DisplayString(sec, SEMI_COLON_ON, 2, 2); // Display "53" starting at position 2
175+
tm.DisplayString(min, tm.SEMI_COLON_ON, 2, 0); // Display "07" starting at position 0
176+
tm.DisplayString(sec, tm.SEMI_COLON_ON, 2, 2); // Display "53" starting at position 2
170177
delaySecRDL(myTestDelay);
171178

172179
printf("Test 3C: string 4 digit\r\n");
173180
char string[] = "OPEN";
174181
tm.DisplayString(string, 0, 4, 0); // Display "OPEN" starting at position 0
175182
delaySecRDL(myTestDelay);
183+
tm.displayClear();
184+
185+
printf("Test 3D: string 1 digit\r\n");
186+
char Astring[] = "2";
187+
tm.DisplayString(Astring, 0, 1, 3); // Display " 2" starting at position 4
188+
delaySecRDL(myTestDelay);
176189

177190
}
178191

0 commit comments

Comments
 (0)