mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.2.6 CountDown
This commit is contained in:
parent
a354364faa
commit
3691d36272
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FILE: CountDown.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.2.5
|
||||
// VERSION: 0.2.6
|
||||
// PURPOSE: CountDown library for Arduino
|
||||
// URL: https://github.com/RobTillaart/CountDown
|
||||
//
|
||||
@ -13,9 +13,10 @@
|
||||
// 0.2.0 2020-03-29 #pragma once, removed pre 1.0 support
|
||||
// 0.2.1 2020-06-05 fix library.json
|
||||
// 0.2.2 2020-07-08 add MINUTES; refactor
|
||||
// 0.2.3 2020-12-17 add arduino-ci + unit test
|
||||
// 0.2.3 2020-12-17 add Arduino-CI + unit test
|
||||
// 0.2.4 2021-01-15 start detect overflow now.
|
||||
// 0.2.5 2021-10-19 update Arduino-CI + badgets
|
||||
// 0.2.5 2021-10-19 update Arduino-CI + badges
|
||||
// 0.2.6 2021-12-14 update library.json, license
|
||||
|
||||
|
||||
#include "CountDown.h"
|
||||
|
@ -2,18 +2,15 @@
|
||||
//
|
||||
// FILE: CountDown.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.2.5
|
||||
// VERSION: 0.2.6
|
||||
// PURPOSE: CountDown library for Arduino
|
||||
// URL: https://github.com/RobTillaart/CountDown
|
||||
//
|
||||
// HISTORY: See CountDown.cpp
|
||||
//
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
|
||||
#define COUNTDOWN_LIB_VERSION (F("0.2.5"))
|
||||
#define COUNTDOWN_LIB_VERSION (F("0.2.6"))
|
||||
|
||||
|
||||
class CountDown
|
||||
|
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2015-2021 Rob Tillaart
|
||||
Copyright (c) 2015-2022 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
|
||||
|
@ -18,7 +18,7 @@ It does not call a function or so as the user is responsible to check the time r
|
||||
Typically one checks the remaining time in every loop.
|
||||
|
||||
UNder the hood the function uses **micros()** or **millis()** which results in a maximum time
|
||||
of 4294 seconds in micros (1h10m) or about 49+ days when using millis.
|
||||
of 4294 seconds in micros (1h10m) or about 49+ days when using milliseconds.
|
||||
|
||||
For longer periods one could cascade countDown, so when one is finished the next one starts.
|
||||
|
||||
@ -31,7 +31,7 @@ The main functions of the CountDown clock are:
|
||||
- **bool start(uint8_t days, uint16_t hours, uint32_t minutes, uint32_t seconds)**
|
||||
- **bool start(uint8_t days, uint16_t hours, uint32_t minutes)**
|
||||
- **void stop()**
|
||||
- **void cont()** *(continue is a C-Keyword)*
|
||||
- **void cont()** *(note continue is a C-Keyword)*
|
||||
- **uint32_t remaining()**
|
||||
- **bool isRunning()**
|
||||
|
||||
@ -48,11 +48,11 @@ The resolution is implicitly set to **CountDown::SECONDS**.
|
||||
|
||||
Since 0.2.4 the function **start()** will check if the parameters cause an overflow
|
||||
in the underlying math. If there is no overflow call to **start()** returns true.
|
||||
If there is an overflow it returns false
|
||||
If there is an overflow it returns false.
|
||||
|
||||
Total amount of time to countdown for **CountDown::MICROS** may not exceed 2\^32 micros ~ 1 hour 10 minutes.
|
||||
Total amount of time to countdown for **CountDown::MILLIS**, **CountDown::SECONDS** and **CountDown::MINUTES**
|
||||
may not exceed 2\^32 milliseconds ~49 days
|
||||
may not exceed 2\^32 milliseconds ~49 days.
|
||||
|
||||
|
||||
The function **start(days, hours, minutes)** is new since 0.2.2.
|
||||
@ -90,6 +90,8 @@ awake.
|
||||
|
||||
- incorporate a real time clock? or EEPROM to be reboot proof?
|
||||
- examples with visualisations (e.g. hexadecimal countdown)
|
||||
- Countdown based upon external pulses
|
||||
- uint64_t version ==> **CountDown64** class?
|
||||
- Countdown based upon external pulses.
|
||||
- uint64_t version ==> **CountDown64** class? (only on request)
|
||||
- would be useful for micros() in theory but drift / interrupts would make it fail.
|
||||
-
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
# Syntax Coloring CountDown
|
||||
# Syntax Colouring CountDown
|
||||
|
||||
# Datatypes (KEYWORD1)
|
||||
# Data types (KEYWORD1)
|
||||
CountDown KEYWORD1
|
||||
|
||||
|
||||
# Methods and Functions (KEYWORD2)
|
||||
setResolution KEYWORD2
|
||||
start KEYWORD2
|
||||
|
@ -15,8 +15,9 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/CountDown.git"
|
||||
},
|
||||
"version": "0.2.5",
|
||||
"version": "0.2.6",
|
||||
"license": "MIT",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "*"
|
||||
"platforms": "*",
|
||||
"headers": "CountDown.h"
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=CountDown
|
||||
version=0.2.5
|
||||
version=0.2.6
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library to implement a CountDown clock in SW.
|
||||
|
@ -42,7 +42,7 @@ unittest_teardown()
|
||||
|
||||
unittest(test_constructor)
|
||||
{
|
||||
fprintf(stderr, "VERSION: %s\n", COUNTDOWN_LIB_VERSION);
|
||||
fprintf(stderr, "VERSION: %s\n", (char *) COUNTDOWN_LIB_VERSION);
|
||||
|
||||
CountDown a(CountDown::MINUTES);
|
||||
CountDown b(CountDown::SECONDS);
|
||||
|
Loading…
Reference in New Issue
Block a user