diff --git a/README.md b/README.md index 57276f7..b6ec4c0 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,11 @@ * [Model Three](#model-three) * [Tested](#tested) * [Notes](#notes) - + * [Swapped data nibbles](#swapped-data-nibbles) + * [Read buttons anomaly](#read-buttons-anomaly) + * [Multiple displays](#multiple-displays) + * [Multiple buttons pressed together](#multiple-buttons-pressed-together) + ## Overview * Name: TM1638plus @@ -153,13 +157,9 @@ SetLEDs: When you pass call the setLEDs function you can pass a word pattern whe ## Notes -1. Swapped data on Display issue on some Model 2 modules -2. Anomaly's on High frequency micro-controllers. -3. Driving multiple displays. -4. Detecting multiple buttons pressed together. - -**Note 1 : Swapped display Issue: Model 2 only** - +### Swapped data nibbles + +Model 2 only. For Some users using this library the nibbles in information display byte where swapped around. This is because there are different versions of modules on market with different wiring. See issue #3 on github called Swapped display :: "12345678" becomes "56781234". If you test library and you see this issue, in order to fix this when you declare the @@ -170,8 +170,9 @@ Object, set the fourth parameter "swap_nibbles" to True, The default is false. | QYF-TM1638 | default operation | false | | QYF-TM1638 -Ver 1.0 | Swapped display Fix | true | -**Note 2 : High frequency micro-controllers.** +### Read buttons anomaly +Read buttons anomaly on High frequency micro-controllers. This library uses a software SPI-like protocol and may not work fully on micro-controllers running at a very high frequency, without some adjustments to timing. It is a SPI-like interface with a single bidirectional data wire DIO. @@ -195,12 +196,16 @@ The Teensy results have been sent in by email, I don't have these MCU's them at | Teensy 4.0| 150Mhz | Working model 1, no Data rest of models | | Teensy 4.0| 396Mhz | Not working on m1 pre v1.6, no data after, no Data rest of models | -**Note 3 : Driving multiple displays.** +### Multiple displays +Driving multiple displays. It is possible to drive multiple modules. Share the DIO and CLK lines and use a unique STB line for each device. see issue number 10 at github for example code. -**Note 4 : Detecting multiple buttons pressed together.** + +### Multiple buttons pressed together + +Detecting multiple buttons pressed together. Model 1 and Model 3 CAN detect multiple buttons pressed. diff --git a/examples/TM1638plus_BUTTON_Model1/TM1638plus_BUTTON_Model1.ino b/examples/TM1638plus_BUTTON_Model1/TM1638plus_BUTTON_Model1.ino index c3b5d9a..b92e11c 100644 --- a/examples/TM1638plus_BUTTON_Model1/TM1638plus_BUTTON_Model1.ino +++ b/examples/TM1638plus_BUTTON_Model1/TM1638plus_BUTTON_Model1.ino @@ -10,9 +10,10 @@ // GPIO I/O pins on the Arduino connected to strobe, clock, data, // pick on any I/O you want. -#define STROBE_TM 4 -#define CLOCK_TM 6 -#define DIO_TM 7 +#define STROBE_TM 4 // strobe = GPIO connected to strobe line of module +#define CLOCK_TM 6 // clock = GPIO connected to clock line of module +#define DIO_TM 7 // data = GPIO connected to data line of module + bool high_freq = false; // default false, If using a high freq CPU > ~100 MHZ set to true. diff --git a/examples/TM1638plus_HELLOWORLD_Model2/TM1638plus_HELLOWORLD_Model2.ino b/examples/TM1638plus_HELLOWORLD_Model2/TM1638plus_HELLOWORLD_Model2.ino index 98e6c5e..49b1350 100644 --- a/examples/TM1638plus_HELLOWORLD_Model2/TM1638plus_HELLOWORLD_Model2.ino +++ b/examples/TM1638plus_HELLOWORLD_Model2/TM1638plus_HELLOWORLD_Model2.ino @@ -9,7 +9,7 @@ #include // GPIO I/O pins on the Arduino connected to strobe, clock, data, pick on any I/O pin you want. -#define STROBE_TM 4 // strobe = GPIO connected to strobe line of module +#define STROBE_TM 4 // strobe = GPIO connected to strobe line of module #define CLOCK_TM 6 // clock = GPIO connected to clock line of module #define DIO_TM 7 // data = GPIO connected to data line of module bool swap_nibbles = false; //Default is false if left out, see issues section in readme at URL diff --git a/examples/TM1638plus_TEST_Model1/TM1638plus_TEST_Model1.ino b/examples/TM1638plus_TEST_Model1/TM1638plus_TEST_Model1.ino index c161fb3..65b92f5 100644 --- a/examples/TM1638plus_TEST_Model1/TM1638plus_TEST_Model1.ino +++ b/examples/TM1638plus_TEST_Model1/TM1638plus_TEST_Model1.ino @@ -109,7 +109,7 @@ void Test3() { uint8_t pos = 0; for (pos = 0 ; pos<8 ; pos++) { - tm.display7Seg(pos, 1<<7-pos); // Displays a single seg in (dp)gfedcba) in each pos 0-7 + tm.display7Seg(pos, 1<<(7-pos)); // Displays a single seg in (dp)gfedcba) in each pos 0-7 delay(myTestDelay1); } } @@ -137,7 +137,7 @@ void Test4() { delay(myTestDelay3); // display 89ABCDEF tm.reset(); - tm.displayHex(1, 0xFFFE); + tm.displayHex(1, 0xFE); tm.displayHex(7, 0x10); delay(myTestDelay3); // display " E 0" @@ -249,7 +249,7 @@ void Test12() { { tm.displayText(textScroll); unsigned long currentMillis = millis(); - + yield(); // Added to prevent ESP8266 crash. if (currentMillis - previousMillis_display >= interval_display) { previousMillis_display = currentMillis; diff --git a/examples/TM1638plus_TEST_Model2/TM1638plus_TEST_Model2.ino b/examples/TM1638plus_TEST_Model2/TM1638plus_TEST_Model2.ino index 1c331b3..3e5f009 100644 --- a/examples/TM1638plus_TEST_Model2/TM1638plus_TEST_Model2.ino +++ b/examples/TM1638plus_TEST_Model2/TM1638plus_TEST_Model2.ino @@ -224,6 +224,7 @@ void Test7(void) { tm.DisplayStr(textScroll, 0); unsigned long currentMillis = millis(); + yield(); // Added to prevent ESP8266 crash. // update data every interval_display delay if (currentMillis - previousMillis_display >= interval_display) { diff --git a/examples/TM1638plus_TEST_Model3/TM1638plus_TEST_Model3.ino b/examples/TM1638plus_TEST_Model3/TM1638plus_TEST_Model3.ino index 739d9ca..862658f 100644 --- a/examples/TM1638plus_TEST_Model3/TM1638plus_TEST_Model3.ino +++ b/examples/TM1638plus_TEST_Model3/TM1638plus_TEST_Model3.ino @@ -30,9 +30,9 @@ // GPIO I/O pins on the Arduino connected to strobe, clock, data, //pick on any I/O you want. -#define STROBE_TM 4 -#define CLOCK_TM 6 -#define DIO_TM 7 +#define STROBE_TM 4 // strobe = GPIO connected to strobe line of module +#define CLOCK_TM 6 // clock = GPIO connected to clock line of module +#define DIO_TM 7 // data = GPIO connected to data line of module bool high_freq = false; //default false,, If using a high freq CPU > ~100 MHZ set to true. @@ -117,7 +117,7 @@ void Test3() { uint8_t pos = 0; for (pos = 0 ; pos<8 ; pos++) { - tm.display7Seg(pos, 1<<7-pos); // Displays a single seg in (dp)gfedcba) in each pos 0-7 + tm.display7Seg(pos, 1<<(7-pos)); // Displays a single seg in (dp)gfedcba) in each pos 0-7 delay(myTestDelay1); } } @@ -146,7 +146,7 @@ void Test4() { tm.reset(); - tm.displayHex(1, 0xFFFE); + tm.displayHex(1, 0xFE); tm.displayHex(7, 0x10); delay(myTestDelay3); // display " E 0" } @@ -252,11 +252,11 @@ void Test12() { char textScroll[17] = " Hello world 123"; unsigned long previousMillis_display = 0; // will store last time display was updated const long interval_display = 1000; // interval at which to update display (milliseconds) - while(1) { tm.displayText(textScroll); unsigned long currentMillis = millis(); + yield(); // Added to prevent ESP8266 crash. if (currentMillis - previousMillis_display >= interval_display) { previousMillis_display = currentMillis; diff --git a/extra/CHANGELOG.md b/extra/CHANGELOG.md index c7b18bb..924c4d3 100755 --- a/extra/CHANGELOG.md +++ b/extra/CHANGELOG.md @@ -66,3 +66,7 @@ * Added Example file TM1638plus_BUTTON_Model1. * Added "Doxyen" style comments in order to use "Doxygen" software to automatically generate a html based software API. + +* Version 2.0.1 November 2024 + * Minor update, change to examples files only. Removed some new compiler warnings + and added a 'yield()' statement to scroll tests as the watch dog timer was crashing ESP8266 during scroll loop, noticed during debugging of [github issue 24](https://github.com/gavinlyonsrepo/TM1638plus/issues/24) diff --git a/extra/GPIO_OTHER_MCUs.txt b/extra/GPIO_OTHER_MCUs.txt index 9457255..da7eefc 100644 --- a/extra/GPIO_OTHER_MCUs.txt +++ b/extra/GPIO_OTHER_MCUs.txt @@ -6,7 +6,9 @@ ESP-32S Board 2.4GHz ESP-WROOM-32 ESP8266 ESP12-E CH340 NodeMcu V3 Lua WIF -Not Documented +#define STROBE_TM D0 // strobe = GPIO connected to strobe line of module +#define CLOCK_TM D1 // clock = GPIO connected to clock line of module +#define DIO_TM D2 // data = GPIO connected to data line of module STM32 blue pill STM32F103C8T6 ARM STM32 diff --git a/library.properties b/library.properties index 508c535..d87dc1b 100755 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TM1638plus -version=2.0.0 +version=2.0.1 author=Gavin Lyons maintainer=Gavin Lyons sentence=TM1638plus is an Arduino library to control TM1638 seven segment modules.