mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-09-19 16:46:11 -04:00
0.4.0 TM1637_RT
This commit is contained in:
parent
74e9af85cf
commit
9856cf8a0d
@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.4.0] - 2023-11-22
|
||||
- remove init() and keyscan()
|
||||
- minor edits
|
||||
|
||||
----
|
||||
|
||||
## [0.3.9] - 2023-11-22
|
||||
- update readme.md
|
||||
- section about hardware performance (Kudos to SteveMicroCode #29)
|
||||
@ -16,7 +22,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- patched examples.
|
||||
- minor edits
|
||||
|
||||
|
||||
## [0.3.8] - 2023-07-15
|
||||
- fix #27
|
||||
- replaced function data\[8] with a class level data\[8].
|
||||
|
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019-2023 Rob Tillaart
|
||||
Copyright (c) 2019-2024 Rob Tillaart
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -356,24 +356,22 @@ See examples
|
||||
|
||||
#### Must
|
||||
|
||||
- (0.4.0)
|
||||
- remove obsolete **init()** from code
|
||||
- remove keyscan() => keyScan()
|
||||
- **setLeadingZeros(bool on = false)** leading zeros flag, set data array to 0.
|
||||
- **getLeadingZeros()**
|
||||
- refactor readme.md
|
||||
- **setLeadingZeros(bool on = false)** leading zeros flag, set data array to 0.
|
||||
- **getLeadingZeros()**
|
||||
|
||||
#### Should
|
||||
|
||||
- testing other platforms.
|
||||
- refactor readme.md
|
||||
- remove degree sign from **displayCelsius()**
|
||||
- would allow one extra digit.
|
||||
- **displayFahrenheit()** idem.
|
||||
- could be optional when needed e.g. below -9 or above 99
|
||||
- code complexity?
|
||||
|
||||
#### Could
|
||||
|
||||
- add parameter for **hideSegement(idx, character == SPACE)** to overrule hide char.
|
||||
- add parameter for **hideSegment(idx, character == SPACE)** to overrule hide char.
|
||||
- space underscore or - are possible.
|
||||
- add **TM1637_UNDERSCORE** to char set. ```seg[19] == 0x08```
|
||||
- add **TM1637_UPPERSCORE** to char set. ```seg[20] == 0x01```
|
||||
|
@ -2,7 +2,7 @@
|
||||
// FILE: TM1637.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 2019-10-28
|
||||
// VERSION: 0.3.9
|
||||
// VERSION: 0.4.0
|
||||
// PURPOSE: TM1637 library for Arduino
|
||||
// URL: https://github.com/RobTillaart/TM1637_RT
|
||||
|
||||
@ -76,13 +76,6 @@ TM1637::TM1637()
|
||||
}
|
||||
|
||||
|
||||
// wrapper, init() will become obsolete 0.4.0.
|
||||
void TM1637::init(uint8_t clockPin, uint8_t dataPin, uint8_t digits)
|
||||
{
|
||||
begin(clockPin, dataPin, digits);
|
||||
}
|
||||
|
||||
|
||||
void TM1637::begin(uint8_t clockPin, uint8_t dataPin, uint8_t digits)
|
||||
{
|
||||
_clockPin = clockPin;
|
||||
|
@ -3,8 +3,8 @@
|
||||
// FILE: TM1637.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 2019-10-28
|
||||
// VERSION: 0.3.9
|
||||
// PUPROSE: TM1637 library for Arduino
|
||||
// VERSION: 0.4.0
|
||||
// PURPOSE: TM1637 library for Arduino
|
||||
// URL: https://github.com/RobTillaart/TM1637_RT
|
||||
|
||||
// NOTE:
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
#define TM1637_LIB_VERSION (F("0.3.9"))
|
||||
#define TM1637_LIB_VERSION (F("0.4.0"))
|
||||
|
||||
|
||||
class TM1637
|
||||
@ -28,7 +28,7 @@ class TM1637
|
||||
public:
|
||||
TM1637();
|
||||
|
||||
// replaces init()
|
||||
// begin replaces init()
|
||||
void begin(uint8_t clockPin, uint8_t dataPin, uint8_t digits = 6);
|
||||
|
||||
|
||||
@ -87,16 +87,7 @@ public:
|
||||
void dumpCache();
|
||||
|
||||
|
||||
// OBSOLETE
|
||||
// init() => begin() in 0.4.0
|
||||
[[deprecated("Use begin() instead")]]
|
||||
void init(uint8_t clockPin, uint8_t dataPin, uint8_t digits = 6);
|
||||
// keyscan() => keyScan() in 0.4.0
|
||||
[[deprecated("Use keyScan() instead => camelCase!")]]
|
||||
uint8_t keyscan(void) { return keyScan(); };
|
||||
|
||||
|
||||
private:
|
||||
protected:
|
||||
uint8_t _clockPin = -1;
|
||||
uint8_t _dataPin = -1;
|
||||
uint8_t _digits = 6;
|
||||
|
@ -3,9 +3,10 @@
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: demo TM1637 library
|
||||
// URL: https://github.com/RobTillaart/TM1637
|
||||
|
||||
//
|
||||
// test with 6 digits (decimal) display
|
||||
|
||||
|
||||
#include "TM1637.h"
|
||||
|
||||
TM1637 TM;
|
||||
@ -20,7 +21,7 @@ void setup()
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
|
||||
TM.begin(2, 3, 6); // clockpin, datapin, #digits
|
||||
TM.begin(2, 3, 6); // clock pin, data pin, #digits
|
||||
|
||||
TM.displayClear();
|
||||
delay(2000);
|
||||
@ -43,7 +44,7 @@ void test()
|
||||
start = millis();
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
TM.displayHex(val); // there is loop overhead etc
|
||||
TM.displayHex(val); // there is loop overhead etc.
|
||||
val++;
|
||||
}
|
||||
stop = millis();
|
||||
|
@ -1,7 +1,6 @@
|
||||
//
|
||||
// FILE: TM1637_alpha.ino
|
||||
// AUTHOR: William F. Dudley Jr.
|
||||
// VERSION: 0.1.0
|
||||
// PURPOSE: demo TM1637 library
|
||||
// DATE: 2021-10-12
|
||||
// URL: https://github.com/RobTillaart/TM1637
|
||||
@ -17,7 +16,7 @@ void setup()
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
|
||||
TM.begin(2, 3); // clockpin, datapin
|
||||
TM.begin(2, 3); // clockPin, dataPin
|
||||
|
||||
TM.setBrightness(2);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ void setup()
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
|
||||
TM.begin(7, 6, 4); // clockpin, datapin, #digits
|
||||
TM.begin(7, 6, 4); // clockPin, dataPin, #digits
|
||||
|
||||
TM.displayClear();
|
||||
delay(2000);
|
||||
@ -45,7 +45,7 @@ void setup()
|
||||
delay(2000);
|
||||
}
|
||||
|
||||
// mimick clock, not ok under 10 seconds
|
||||
// mimic clock, not OK under 10 seconds
|
||||
// left as exercise for the programmer ;)
|
||||
void loop()
|
||||
{
|
||||
|
@ -1,18 +1,20 @@
|
||||
//
|
||||
// FILE: TM1637_custom.ino
|
||||
// AUTHOR: Richard Jones
|
||||
// VERSION: 0.1.0
|
||||
// PURPOSE: demo TM1637 library
|
||||
// DATE: 3 October 2022
|
||||
// URL: https://github.com/radionerd
|
||||
// URL: https://github.com/RobTillaart/TM1637_RT
|
||||
|
||||
// Demonstration of how to display char *buff and override the TM1637 library asciiTo7Segment virtual function
|
||||
// to create a custom 7 segment character set.
|
||||
// The letter 'A' becomes swapped with @ in this trivial example
|
||||
// Status: Experimental. Tested on STM32F103C8T6 Blue Pill and Arduino Nano only
|
||||
|
||||
// Demonstration of how to display char *buff and override the TM1637 library asciiTo7Segment virtual function
|
||||
// to create a custom 7 segment character set.
|
||||
// The letter 'A' becomes swapped with @ in this trivial example
|
||||
// Status: Experimental. Tested on STM32F103C8T6 Blue Pill and Arduino Nano only
|
||||
|
||||
#include "TM1637.h"
|
||||
|
||||
|
||||
const int DISPLAY_DIGITS_6 = 6;
|
||||
|
||||
// This example shows how to override the TM1637_RT library 7 segment patterns and copy the display output
|
||||
@ -61,17 +63,19 @@ class myTM1637 : TM1637 {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
myTM1637 myTM;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
delay(1000);
|
||||
Serial.println(__FILE__);
|
||||
|
||||
// set clockpin, datapin to your own board pin names
|
||||
// set clock pin, data pin to your own board pin names
|
||||
// e.g. myTM.begin(PB8, PB9 , DISPLAY_DIGITS_6 );
|
||||
myTM.begin( 14, 15 , DISPLAY_DIGITS_6 ); // clockpin, datapin, and digits
|
||||
myTM.begin( 14, 15 , DISPLAY_DIGITS_6 ); // clock pin, data pin, and digits
|
||||
|
||||
myTM.setBrightness(2);
|
||||
|
||||
|
@ -16,7 +16,7 @@ void setup()
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
|
||||
TM.begin(7, 6, 4); // clockpin, datapin, #digits
|
||||
TM.begin(7, 6, 4); // clock pin, data pin, #digits
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@ void setup()
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
|
||||
TM.begin(7, 6, 4); // clockpin, datapin, #digits
|
||||
TM.begin(7, 6, 4); // clock pin, data pin, #digits
|
||||
|
||||
delay(10);
|
||||
start = micros();
|
||||
|
@ -16,10 +16,10 @@ void setup()
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
|
||||
TM.begin(7, 6, 4); // clockpin, datapin, #digits
|
||||
TM.begin(7, 6, 4); // clock pin, data pin, #digits
|
||||
|
||||
// AVR UNO
|
||||
// BITDELAY displayTime()
|
||||
// AVR UNO
|
||||
// BITDELAY displayTime()
|
||||
// 0 1352
|
||||
// 2 1364
|
||||
// 4 1384
|
||||
|
@ -17,7 +17,7 @@ void setup()
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
|
||||
TM.begin(7, 6, 4); // clockpin, datapin, #digits
|
||||
TM.begin(7, 6, 4); // clock pin, data pin, #digits
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@ void setup()
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
|
||||
TM.begin(2, 3); // clockpin, datapin
|
||||
TM.begin(2, 3); // clock pin, data pin
|
||||
|
||||
TM.displayFloat(1.42425);
|
||||
// TM.dumpCache();
|
||||
@ -47,7 +47,7 @@ void test()
|
||||
start = millis();
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
TM.displayFloat(f); // there is loop overhead etc
|
||||
TM.displayFloat(f); // there is loop overhead etc.
|
||||
f += 1;
|
||||
}
|
||||
stop = millis();
|
||||
|
@ -19,7 +19,7 @@ void setup()
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
|
||||
TM.begin(2, 3); // clockpin, datapin
|
||||
TM.begin(2, 3); // clock pin, data pin
|
||||
|
||||
TM.displayFloat(1.42425);
|
||||
delay(2000);
|
||||
@ -46,7 +46,7 @@ void test()
|
||||
start = millis();
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
TM.displayFloat(f, 2); // there is loop overhead etc
|
||||
TM.displayFloat(f, 2); // there is loop overhead etc.
|
||||
f += 1;
|
||||
}
|
||||
stop = millis();
|
||||
|
@ -16,7 +16,7 @@ void setup()
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
|
||||
TM.begin(7, 6, 4); // clockpin, datapin, #digits
|
||||
TM.begin(7, 6, 4); // clock pin, data pin, #digits
|
||||
|
||||
delay(10);
|
||||
start = micros();
|
||||
|
@ -19,7 +19,7 @@ void setup()
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
|
||||
TM.begin(2, 3); // clockpin, datapin
|
||||
TM.begin(2, 3); // clock pin, data pin
|
||||
|
||||
TM.displayClear();
|
||||
delay(1000);
|
||||
@ -45,7 +45,7 @@ void test()
|
||||
start = millis();
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
TM.displayInt(val); // there is loop overhead etc
|
||||
TM.displayInt(val); // there is loop overhead etc.
|
||||
val++;
|
||||
}
|
||||
stop = millis();
|
||||
|
@ -1,7 +1,6 @@
|
||||
//
|
||||
// FILE: TM1637_keypress_cooked.ino
|
||||
// AUTHOR: William F. Dudley Jr.
|
||||
// VERSION: 0.1.0
|
||||
// PURPOSE: demo TM1637 library - keyScan() cooked output
|
||||
// DATE: 2021-10-26
|
||||
// URL: https://github.com/RobTillaart/TM1637
|
||||
|
@ -1,7 +1,6 @@
|
||||
|
||||
// FILE: TM1637_keypress_raw.ino
|
||||
// AUTHOR: William F. Dudley Jr.
|
||||
// VERSION: 0.1.0
|
||||
// PURPOSE: demo TM1637 library - keyScan() raw output
|
||||
// DATE: 2021-10-26
|
||||
// URL: https://github.com/RobTillaart/TM1637
|
||||
|
@ -1,13 +1,13 @@
|
||||
//
|
||||
// FILE: TM1637_pchar.ino
|
||||
// AUTHOR: Richard Jones
|
||||
// VERSION: 0.1.0
|
||||
// PURPOSE: demo TM1637 library
|
||||
// DATE: 4 October 2022
|
||||
// URL: https://github.com/radionerd
|
||||
|
||||
// Demonstration of how to display char *buff
|
||||
// Status: Experimental. Tested on STM32F103C8T6 Blue Pill and Arduino Nano only
|
||||
// Demonstration of how to display char *buff
|
||||
// Status: Experimental. Tested on STM32F103C8T6 Blue Pill and Arduino Nano only
|
||||
|
||||
|
||||
#include "TM1637.h"
|
||||
|
||||
@ -15,15 +15,16 @@ const int DISPLAY_DIGITS_6 = 6;
|
||||
|
||||
TM1637 TM;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
delay(1000);
|
||||
Serial.println(__FILE__);
|
||||
|
||||
// set clockpin, datapin to your own board pin names
|
||||
// set clock pin, data pin to your own board pin names
|
||||
// e.g. myTM.begin(PB8, PB9 , DISPLAY_DIGITS_6 );
|
||||
TM.begin( 14, 15 , DISPLAY_DIGITS_6 ); // clockpin, datapin, and digits
|
||||
TM.begin( 14, 15 , DISPLAY_DIGITS_6 ); // clock pin, data pin, and digits
|
||||
|
||||
TM.setBrightness(2);
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/TM1637_RT"
|
||||
},
|
||||
"version": "0.3.9",
|
||||
"version": "0.4.0",
|
||||
"license": "MIT",
|
||||
"frameworks": "*",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=TM1637_RT
|
||||
version=0.3.9
|
||||
version=0.4.0
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=TM1637 Library for Arduino.
|
||||
|
@ -51,7 +51,7 @@ unittest_teardown()
|
||||
unittest(test_begin)
|
||||
{
|
||||
TM1637 TM;
|
||||
TM.init(2, 3, 6);
|
||||
TM.begin(2, 3, 6);
|
||||
|
||||
TM.displayClear();
|
||||
// TODO real tests....
|
||||
@ -62,7 +62,7 @@ unittest(test_begin)
|
||||
unittest(test_brightness)
|
||||
{
|
||||
TM1637 TM;
|
||||
TM.init(2, 3, 6);
|
||||
TM.begin(2, 3, 6);
|
||||
|
||||
for (uint8_t b = 0; b < 8; b++)
|
||||
{
|
||||
@ -82,7 +82,7 @@ unittest(test_brightness)
|
||||
unittest(test_set_bit_delay)
|
||||
{
|
||||
TM1637 TM;
|
||||
TM.init(2, 3, 6);
|
||||
TM.begin(2, 3, 6);
|
||||
|
||||
for (uint8_t b = 0; b < 100; b += 10)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user