0.2.4 timing

This commit is contained in:
rob tillaart 2022-11-26 14:28:31 +01:00
parent 7c3227ef2b
commit 207321dc01
6 changed files with 80 additions and 28 deletions

View File

@ -1,14 +1,30 @@
platforms:
rpipico:
board: rp2040:rp2040:rpipico
package: rp2040:rp2040
gcc:
features:
defines:
- ARDUINO_ARCH_RP2040
warnings:
flags:
packages:
rp2040:rp2040:
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
compile:
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
- uno
- due
- zero
- leonardo
# - due
# - zero
# - leonardo
- m4
- esp32
- esp8266
- mega2560
# - mega2560
- rpipico
libraries:
- "printHelpers"

View File

@ -0,0 +1,38 @@
# Change Log timing
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.2.4] - 2022-11-26
- Add RP2040 support to build-CI.
- Add CHANGELOG.md
- update readme.md
## [0.2.3] - 2021-12-29
- update library.json
- update license
- minor edits
## [0.2.2] - 2021-05-27
- added Arduino-lint
## [0.2.1] - 2021-01-09
- added Arduino-CI + unit test
## [0.2.0] - 2020-07-07
- renamed to timing.h
----
## [0.1.02] - 2015-03-02
- move all to mymillis.h file so compiler can optimize
## [0.1.01] - 2011-07-19
- add lib version
## [0.1.00] - 2011-01-04
- initial version

View File

@ -25,7 +25,7 @@ overflow and accuracy. Depending on e.g. interrupts millis and micros can drift.
| class | overflow after | Notes |
|:-------------|:-------------------------|:--------------------|
|:---------------|:---------------------------|:----------------------|
| seconds | 49 days, 17:02:47 | based upon millis() |
| milliSeconds | 49 days, 17:02:47.297 |
| microSeconds | 00 days 01:11:34.967296 |
@ -59,19 +59,26 @@ See examples.
## Future
#### must
- test on ESP32
- nanos() on ESP32 ?
- implement printable interface (add unit)
- ?
#### should
- implement toClock()
- idea to give it a clock print layout
- seconds.toClock() -> DD 12:34:56
- milliSeconds.toClock(3) -> 12:23:45.123 (3) == 3 decimals..
- milliSeconds.toClock(1) -> 12:23:45.1
- microSeconds.toCLock() -> 12:23:45.123456 ???
- printHelpers class?
- implement toSeconds()
- double milliSeconds.toSeconds() -> 45.123
- double microSeconds.toSeconds() -> 45.123456
#### could
- nanos() on ESP32 ?
- implement printable interface
- add unit (s, ms, us)
- what layout to use?
- update documentation
- rounding effect, describe

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/timing"
},
"version": "0.2.3",
"version": "0.2.4",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=timing
version=0.2.3
version=0.2.4
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library with wrapper classes for seconds millis micros.

View File

@ -2,21 +2,12 @@
//
// FILE: timing.h
// AUTHOR: Rob Tillaart
// VERSION: 0.2.3
// VERSION: 0.2.4
// PURPOSE: Arduino library with wrapper classes for seconds millis micros
// URL: https://github.com/RobTillaart/timing
//
// HISTORY:
// 0.1.00 2011-01-04 initial version
// 0.1.01 2011-07-19 lib version
// 0.1.02 2015-03-02 move all to mymillis.h file so compiler can optimize
// 0.2.0 2020-07-07 renamed to timing.h
// 0.2.1 2021-01-09 added Arduino-CI + unit test
// 0.2.2 2021-05-27 added Arduino-lint
// 0.2.3 2021-12-29 update library.json, license, minor edits
#define TIMING_LIB_VERSION (F("0.2.3"))
#define TIMING_LIB_VERSION (F("0.2.4"))
class microSeconds
@ -49,8 +40,8 @@ class seconds
{
public:
seconds() { set(0); }
uint32_t now() { return millis()/1000UL - _offset; }
void set(uint32_t value = 0UL) { _offset = millis()/1000UL - value; }
uint32_t now() { return millis() / 1000UL - _offset; }
void set(uint32_t value = 0UL) { _offset = millis() / 1000UL - value; }
uint32_t getOffset() { return _offset; };
private: