Skip to content

Commit 172ca07

Browse files
authored
add changelog.md (#10)
1 parent 3150e1f commit 172ca07

File tree

8 files changed

+141
-58
lines changed

8 files changed

+141
-58
lines changed

.arduino-ci.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
platforms:
2+
rpipico:
3+
board: rp2040:rp2040:rpipico
4+
package: rp2040:rp2040
5+
gcc:
6+
features:
7+
defines:
8+
- ARDUINO_ARCH_RP2040
9+
warnings:
10+
flags:
11+
12+
packages:
13+
rp2040:rp2040:
14+
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
15+
116
compile:
217
# Choosing to run compilation tests on 2 different Arduino platforms
318
platforms:
@@ -8,4 +23,6 @@ compile:
823
- m4
924
- esp32
1025
# - esp8266
11-
# - mega2560
26+
# - mega2560
27+
- rpipico
28+

CHANGELOG.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Change Log CountDown
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
6+
and this project adheres to [Semantic Versioning](http://semver.org/).
7+
8+
9+
## [0.2.7] - 2022-10-30
10+
- add changelog.md
11+
- add rp2040 to build-CI
12+
- minor edit unit test
13+
14+
15+
## [0.2.6] - 2021-12-14
16+
- update library.json, license
17+
18+
## [0.2.5] - 2021-10-19
19+
- update Arduino-CI
20+
- add badges
21+
22+
## [0.2.4] - 2021-01-15
23+
- start detect overflow now
24+
25+
## [0.2.3] - 2020-12-17
26+
- add Arduino-CI + unit test
27+
28+
## [0.2.2] - 2020-07-08
29+
- add MINUTES
30+
- refactor
31+
32+
## [0.2.1] - 2020-06-05
33+
- fix library.json
34+
35+
## [0.2.0] - 2020-03-29
36+
- add #pragma once
37+
- removed pre 1.0 support
38+
39+
----
40+
41+
## [0.1.3] - 2017-07-16
42+
- TODO improved seconds - OdoMeter see below ... TODO
43+
44+
## [0.1.2] - 2017-07-16
45+
- add start(days, hours, minutes, seconds) + cont() == continue countdown
46+
47+
## [0.1.1] - 2015-10-29
48+
- add start(h, m, s)
49+
50+
## [0.1.0] - 2015-10-27
51+
- initial version

CountDown.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
11
//
22
// FILE: CountDown.cpp
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.2.6
4+
// VERSION: 0.2.7
55
// PURPOSE: CountDown library for Arduino
66
// URL: https://github.com/RobTillaart/CountDown
77
//
8-
// HISTORY:
9-
// 0.1.0 2015-10-27 initial version
10-
// 0.1.1 2015-10-29 added start(h, m, s)
11-
// 0.1.2 2017-07-16 added start(days, hours, minutes, seconds) + cont() == continue countdown
12-
// 0.1.3 2017-07-16 TODO improved seconds - OdoMeter see below ... TODO
13-
// 0.2.0 2020-03-29 #pragma once, removed pre 1.0 support
14-
// 0.2.1 2020-06-05 fix library.json
15-
// 0.2.2 2020-07-08 add MINUTES; refactor
16-
// 0.2.3 2020-12-17 add Arduino-CI + unit test
17-
// 0.2.4 2021-01-15 start detect overflow now.
18-
// 0.2.5 2021-10-19 update Arduino-CI + badges
19-
// 0.2.6 2021-12-14 update library.json, license
8+
// HISTORY: see changelog.md
209

2110

2211
#include "CountDown.h"

CountDown.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
//
33
// FILE: CountDown.h
44
// AUTHOR: Rob Tillaart
5-
// VERSION: 0.2.6
5+
// VERSION: 0.2.7
66
// PURPOSE: CountDown library for Arduino
77
// URL: https://github.com/RobTillaart/CountDown
88
//
99

1010

1111
#include "Arduino.h"
1212

13-
#define COUNTDOWN_LIB_VERSION (F("0.2.6"))
13+
#define COUNTDOWN_LIB_VERSION (F("0.2.7"))
1414

1515

1616
class CountDown

README.md

Lines changed: 65 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,30 @@ Arduino Library to implement a CountDown clock (in SW polling, no HW timer).
1515

1616
The countdown library is a clock that counts down from a given time to zero.
1717
It does not call a function or so as the user is responsible to check the time remaining.
18-
Typically one checks the remaining time in every loop.
18+
Typically one checks the remaining time in every **loop()**.
1919

20-
UNder the hood the function uses **micros()** or **millis()** which results in a maximum time
21-
of 4294 seconds in micros (1h10m) or about 49+ days when using milliseconds.
20+
Under the hood the function uses **micros()** or **millis()** which results in a maximum time
21+
of 4294 seconds in micros (1h 10m) or about 49+ days when using milliseconds.
2222

23-
For longer periods one could cascade countDown, so when one is finished the next one starts.
23+
For longer periods one could cascade countDown objects, so when one is finished the next one starts.
24+
25+
Note the countdown object is as accurate as the underlying **millis()** or **micros()**.
26+
Interrupts etc might cause deviations.
2427

2528

2629
## Interface
2730

2831
The main functions of the CountDown clock are:
2932

30-
- **bool start(uint32_t ticks)**
31-
- **bool start(uint8_t days, uint16_t hours, uint32_t minutes, uint32_t seconds)**
32-
- **bool start(uint8_t days, uint16_t hours, uint32_t minutes)**
33-
- **void stop()**
34-
- **void cont()** *(note continue is a C-Keyword)*
35-
- **uint32_t remaining()**
36-
- **bool isRunning()**
33+
- **CountDown(const enum Resolution res = MILLIS)** constructor, with default resolution of milliseconds.
34+
- **bool start(uint32_t ticks)** (re)start in current resolution.
35+
- **bool start(uint8_t days, uint16_t hours, uint32_t minutes, uint32_t seconds)** Implicit set resolution to SECONDS.
36+
- **bool start(uint8_t days, uint16_t hours, uint32_t minutes)** Implicit set resolution to MINUTES.
37+
- **void stop()** stop the count-down.
38+
- **void cont()** resumes / continue the count-down.
39+
*(note continue is a C-Keyword)*
40+
- **uint32_t remaining()** returns the remaining ticks in current resolution.
41+
- **bool isRunning()** idem.
3742

3843
These functions work straightforward.
3944

@@ -42,36 +47,42 @@ These functions work straightforward.
4247

4348
The function **start(days, hours, minutes, seconds)** has changed its
4449
parameters type to minimize them, given that the total time may not exceed 2^32 milliseconds.
45-
This allows the user to call **start()** with e.g. four hundred minutes **start(0, 0, 400, 0)**
46-
or a million seconds **start(0, 0, 0, 1000000)** as parameter.
50+
This allows the user to call **start()** with e.g.
51+
- four hundred minutes **start(0, 0, 400, 0)**
52+
- a million seconds **start(0, 0, 0, 1000000)**
53+
- a unusual mix **start(0, 0, 400, 1000)** as parameter.
4754
The resolution is implicitly set to **CountDown::SECONDS**.
4855

4956
Since 0.2.4 the function **start()** will check if the parameters cause an overflow
50-
in the underlying math. If there is no overflow call to **start()** returns true.
51-
If there is an overflow it returns false.
52-
53-
Total amount of time to countdown for **CountDown::MICROS** may not exceed 2\^32 micros ~ 1 hour 10 minutes.
54-
Total amount of time to countdown for **CountDown::MILLIS**, **CountDown::SECONDS** and **CountDown::MINUTES**
55-
may not exceed 2\^32 milliseconds ~49 days.
57+
in the underlying math.
58+
If there is no overflow, a call to **start()** returns true.
59+
If there is an overflow, a call to **start()** returns false.
5660

61+
Total amount of time to countdown for **CountDown::MICROS** may not exceed 2\^32 micros
62+
which equals about 1 hour and 10 minutes.
63+
Total amount of time to countdown for **CountDown::MILLIS**, **CountDown::SECONDS**
64+
and **CountDown::MINUTES** may not exceed 2\^32 milliseconds, about 49 days.
5765

5866
The function **start(days, hours, minutes)** is new since 0.2.2.
59-
It also uses **millis()** under the hood. The resolution is implicitly set to **CountDown::MINUTES**.
67+
It also uses **millis()** under the hood.
68+
The resolution is implicitly set to **CountDown::MINUTES**.
6069

6170

62-
| Call to start() | resolution | max time | comments |
63-
|:--------------------------------------|:-----------------|:---------:|:---------|
64-
| start(days, hours, minutes, seconds) | SECONDS = millis | 49+ days | |
65-
| start(days, hours, minutes) | MINUTES = millis | 49+ days | |
66-
| start(ticks) | MILLIS = millis | 49+ days | default |
67-
| start(ticks) | MICROS = micros | ~70 min | use setResolution(CountDown::MICROS) |
68-
| start(ticks) | SECONDS = millis | 49+ days | use setResolution(CountDown::SECONDS) |
69-
| start(ticks) | MINUTES = millis | 49+ days | use setResolution(CountDown::MINUTES) |
71+
| Call to start() | resolution | max time | comments |
72+
|:-------------------------------------|:-----------------|:--------:|:---------|
73+
| start(days, hours, minutes, seconds) | SECONDS = millis | 49+ days | |
74+
| start(days, hours, minutes) | MINUTES = millis | 49+ days | |
75+
| start(ticks) | MILLIS = millis | 49+ days | default |
76+
| start(ticks) | MICROS = micros | ~70 min | setResolution(CountDown::MICROS) |
77+
| start(ticks) | SECONDS = millis | 49+ days | setResolution(CountDown::SECONDS) |
78+
| start(ticks) | MINUTES = millis | 49+ days | setResolution(CountDown::MINUTES) |
7079

7180

7281
The Countdown clock uses by default **millis()** to do the time keeping,
73-
although this can be changed runtime by **setResolution(res)**. The parameter
74-
**res** can be:
82+
although this can be changed runtime by **setResolution(res)**.
83+
84+
The parameter **res** can be:
85+
7586
- **CountDown::MICROS** // based upon micros()
7687
- **CountDown::MILLIS** // default
7788
- **CountDown::SECONDS** // based upon millis()
@@ -80,18 +91,34 @@ although this can be changed runtime by **setResolution(res)**. The parameter
8091
Although possible one should not change the resolution of the CountDown
8192
clock while it is running as you mix up different timescales.
8293

83-
One can call **start(...)** at any time to reset the running clock to
84-
a new value. This allows to implement a sort of watchdog clock in which e.g.
85-
the user must press a button at least once per minute to show he is still
86-
awake.
94+
95+
#### Watchdog
96+
97+
One can call **start(...)** at any time to reset the running clock to a new value.
98+
This allows to implement a sort of watchdog clock in which e.g.
99+
the user must press a button at least once per minute to show he is still awake.
87100

88101

89102
## Future
90103

91-
- incorporate a real time clock? or EEPROM to be reboot proof?
92-
- examples with visualisations (e.g. hexadecimal countdown)
93-
- Countdown based upon external pulses.
104+
#### must
105+
- documentation
106+
107+
#### should
108+
109+
110+
#### could
111+
- incorporate a real time clock
112+
- or EEPROM to be reboot proof?
113+
- examples
114+
- visualisations - hexadecimal - alphabetical (radix 26)
115+
- depends on sensor
94116
- uint64_t version ==> **CountDown64** class? (only on request)
95117
- would be useful for micros() in theory but drift / interrupts would make it fail.
96-
-
118+
- countdown with a big number e.g. billions/ second ==> national deficit coounter.
119+
120+
#### wont
121+
- Countdown based upon external pulses.
122+
- pulse counter
123+
97124

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"type": "git",
1616
"url": "https://github.com/RobTillaart/CountDown.git"
1717
},
18-
"version": "0.2.6",
18+
"version": "0.2.7",
1919
"license": "MIT",
2020
"frameworks": "arduino",
2121
"platforms": "*",

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=CountDown
2-
version=0.2.6
2+
version=0.2.7
33
author=Rob Tillaart <rob.tillaart@gmail.com>
44
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
55
sentence=Arduino library to implement a CountDown clock in SW.

test/unit_test_001.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
unittest_setup()
3434
{
35+
fprintf(stderr, "VERSION: %s\n", (char *) COUNTDOWN_LIB_VERSION);
3536
}
3637

3738

@@ -42,8 +43,6 @@ unittest_teardown()
4243

4344
unittest(test_constructor)
4445
{
45-
fprintf(stderr, "VERSION: %s\n", (char *) COUNTDOWN_LIB_VERSION);
46-
4746
CountDown a(CountDown::MINUTES);
4847
CountDown b(CountDown::SECONDS);
4948
CountDown c(CountDown::MILLIS);

0 commit comments

Comments
 (0)