Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove init() and keyscan() #32

Merged
merged 2 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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].
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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```
Expand Down
9 changes: 1 addition & 8 deletions TM1637.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;
Expand Down
19 changes: 5 additions & 14 deletions TM1637.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -20,15 +20,15 @@

#include "Arduino.h"

#define TM1637_LIB_VERSION (F("0.3.9"))
#define TM1637_LIB_VERSION (F("0.4.0"))


class TM1637
{
public:
TM1637();

// replaces init()
// begin replaces init()
void begin(uint8_t clockPin, uint8_t dataPin, uint8_t digits = 6);


Expand Down Expand Up @@ -87,16 +87,7 @@ class TM1637
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;
Expand Down
7 changes: 4 additions & 3 deletions examples/TM1637_HEX/TM1637_HEX.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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();
Expand Down
3 changes: 1 addition & 2 deletions examples/TM1637_alpha/TM1637_alpha.ino
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions examples/TM1637_clock_4digits/TM1637_clock_4digits.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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()
{
Expand Down
18 changes: 11 additions & 7 deletions examples/TM1637_custom/TM1637_custom.ino
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion examples/TM1637_displayCelsius/TM1637_displayCelsius.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand Down
2 changes: 1 addition & 1 deletion examples/TM1637_displayTime/TM1637_displayTime.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions examples/TM1637_displayTime2/TM1637_displayTime2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/TM1637_displayTwoInt/TM1637_displayTwoInt.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand Down
4 changes: 2 additions & 2 deletions examples/TM1637_float/TM1637_float.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions examples/TM1637_float_point/TM1637_float_point.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion examples/TM1637_hide_segment/TM1637_hide_segment.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions examples/TM1637_int/TM1637_int.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down
1 change: 0 additions & 1 deletion examples/TM1637_keyscan_cooked/TM1637_keyscan_cooked.ino
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion examples/TM1637_keyscan_raw/TM1637_keyscan_raw.ino
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 6 additions & 5 deletions examples/TM1637_pchar/TM1637_pchar.ino
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
//
// 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"

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);

Expand Down
Loading
Loading