mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.3.2 DistanceTable
This commit is contained in:
parent
1008eefee1
commit
5b2d1af728
@ -1,3 +1,18 @@
|
|||||||
|
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:
|
compile:
|
||||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||||
platforms:
|
platforms:
|
||||||
@ -8,4 +23,6 @@ compile:
|
|||||||
- m4
|
- m4
|
||||||
- esp32
|
- esp32
|
||||||
# - esp8266
|
# - esp8266
|
||||||
# - mega2560
|
# - mega2560
|
||||||
|
- rpipico
|
||||||
|
|
||||||
|
72
libraries/DistanceTable/CHANGELOG.md
Normal file
72
libraries/DistanceTable/CHANGELOG.md
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
# Change Log DistanceTable
|
||||||
|
|
||||||
|
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.3.2] - 2022-11.02
|
||||||
|
- add changelog.md
|
||||||
|
- add rp2040 to build-CI
|
||||||
|
- update readme.md
|
||||||
|
|
||||||
|
## [0.3.1] - 2022-07-22
|
||||||
|
- fix set() get() test order
|
||||||
|
- set() returns bool on success.
|
||||||
|
- adds sum() and average()
|
||||||
|
- add Pascal Triangle example.
|
||||||
|
|
||||||
|
## [0.3.0] - 2022-01-06
|
||||||
|
- add invert flag, add unit tests
|
||||||
|
- add countAbove(), countBelow()
|
||||||
|
- fix allocation + # elements
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
## [0.2.2] - 2021-12-17
|
||||||
|
- update license
|
||||||
|
- update readme.md
|
||||||
|
- minor edits
|
||||||
|
|
||||||
|
## [0.2.1] - 2021-10-26
|
||||||
|
- update build-CI
|
||||||
|
- update readme.md
|
||||||
|
- default value in constructor
|
||||||
|
|
||||||
|
## [0.2.0] - 2021-01-19
|
||||||
|
- refactor
|
||||||
|
- properly named functions,
|
||||||
|
- add setAll()
|
||||||
|
- add minimum(), maximum()
|
||||||
|
- add count()
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
## [0.1.6] - 2020-12-20
|
||||||
|
- Arduino-CI + unit test
|
||||||
|
|
||||||
|
## [0.1.5] - 2020-06-07
|
||||||
|
- fix library.json
|
||||||
|
- minor edits
|
||||||
|
|
||||||
|
## [0.1.4] - 2019-01-10
|
||||||
|
- add size()
|
||||||
|
|
||||||
|
## [0.1.3] - 2017-07-27
|
||||||
|
- Fix issue #33
|
||||||
|
|
||||||
|
## [0.1.2]
|
||||||
|
- fix overflow
|
||||||
|
- add some error detection
|
||||||
|
- revert float to float to memory
|
||||||
|
|
||||||
|
## [0.1.01]
|
||||||
|
- refactor
|
||||||
|
|
||||||
|
## [0.1.00]
|
||||||
|
- initial version
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,32 +1,11 @@
|
|||||||
//
|
//
|
||||||
// FILE: DistanceTable.cpp
|
// FILE: DistanceTable.cpp
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.3.1
|
// VERSION: 0.3.2
|
||||||
// PURPOSE: Arduino library to store a symmetrical distance table in less memory
|
// PURPOSE: Arduino library to store a symmetrical distance table in less memory
|
||||||
// URL: https://github.com/RobTillaart/DistanceTable
|
// URL: https://github.com/RobTillaart/DistanceTable
|
||||||
|
//
|
||||||
// HISTORY
|
// HISTORY: see changelog.md
|
||||||
// 0.1.00 initial version
|
|
||||||
// 0.1.01 refactor
|
|
||||||
// 0.1.2 fix overflow; add some error detection; revert float to float to memory
|
|
||||||
// 0.1.3 2017-07-27 Fix issue #33
|
|
||||||
// 0.1.4 2019-01-10 add size()
|
|
||||||
// 0.1.5 2020-06-07 fix library.json, minor edits
|
|
||||||
// 0.1.6 2020-12-20 Arduino-CI + unit test
|
|
||||||
// 0.2.0 2021-01-19 refactor
|
|
||||||
// properly named functions,
|
|
||||||
// add setAll(), minimum(), maximum() and count()
|
|
||||||
// 0.2.1 2021-10-26 update build-CI, update readme.md
|
|
||||||
// default value in constructor
|
|
||||||
// 0.2.2 2021-12-17 update license, readme, minor edits
|
|
||||||
// 0.3.0 2022-01-06 add invert flag, add unit tests
|
|
||||||
// add countAbove(), countBelow()
|
|
||||||
// fix allocation + # elements
|
|
||||||
// 0.3.1 2022-07-22 fix set() get() test order
|
|
||||||
// set() returns bool on success.
|
|
||||||
// adds sum() and average()
|
|
||||||
// add Pascal Triangle example.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "DistanceTable.h"
|
#include "DistanceTable.h"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// FILE: DistanceTable.h
|
// FILE: DistanceTable.h
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.3.1
|
// VERSION: 0.3.2
|
||||||
// PURPOSE: Arduino library to store a symmetrical distance table in less memory
|
// PURPOSE: Arduino library to store a symmetrical distance table in less memory
|
||||||
// URL: https://github.com/RobTillaart/DistanceTable
|
// URL: https://github.com/RobTillaart/DistanceTable
|
||||||
//
|
//
|
||||||
@ -11,7 +11,7 @@
|
|||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
|
|
||||||
|
|
||||||
#define DISTANCETABLE_LIB_VERSION (F("0.3.1"))
|
#define DISTANCETABLE_LIB_VERSION (F("0.3.2"))
|
||||||
|
|
||||||
|
|
||||||
class DistanceTable
|
class DistanceTable
|
||||||
@ -31,31 +31,31 @@ public:
|
|||||||
bool getInvert() { return _invert; };
|
bool getInvert() { return _invert; };
|
||||||
|
|
||||||
|
|
||||||
// minimum and maximum skip x == y pairs as these are 0.
|
// minimum and maximum skip x == y pairs as these are 0.
|
||||||
float minimum(uint8_t &x, uint8_t &y);
|
float minimum(uint8_t &x, uint8_t &y);
|
||||||
float maximum(uint8_t &x, uint8_t &y);
|
float maximum(uint8_t &x, uint8_t &y);
|
||||||
float sum();
|
float sum();
|
||||||
float average();
|
float average();
|
||||||
|
|
||||||
|
|
||||||
// epsilon allows 'almost equal' searches
|
// epsilon allows 'almost equal' searches
|
||||||
// if (invert == false) count counts both (x,y) and (y,x) => always even nr.
|
// if (invert == false) count counts both (x,y) and (y,x) => always even nr.
|
||||||
// if (invert == true) count counts (x,y) and (y,x) separately.
|
// if (invert == true) count counts (x,y) and (y,x) separately.
|
||||||
// count skips x == y pairs so counting zero's is missing the diagonal.
|
// count skips x == y pairs so counting zero's is missing the diagonal.
|
||||||
uint16_t count(float value, float epsilon = 0.0);
|
uint16_t count(float value, float epsilon = 0.0);
|
||||||
uint16_t countAbove(float value);
|
uint16_t countAbove(float value);
|
||||||
uint16_t countBelow(float value);
|
uint16_t countBelow(float value);
|
||||||
|
|
||||||
|
|
||||||
// debug
|
// debug
|
||||||
// default dumps to Serial but other stream are possible
|
// default dumps to Serial but other stream are possible
|
||||||
void dump(Print * stream = &Serial);
|
void dump(Print * stream = &Serial);
|
||||||
uint8_t dimension() { return _dimension; };
|
uint8_t dimension() { return _dimension; };
|
||||||
uint16_t elements() { return _elements; };
|
uint16_t elements() { return _elements; };
|
||||||
uint16_t memoryUsed() { return _elements * sizeof(float); };
|
uint16_t memoryUsed() { return _elements * sizeof(float); };
|
||||||
|
|
||||||
|
|
||||||
// Obsolete in future
|
// Obsolete in future 0.4.0
|
||||||
uint16_t size() { return memoryUsed(); };
|
uint16_t size() { return memoryUsed(); };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/RobTillaart/DistanceTable"
|
"url": "https://github.com/RobTillaart/DistanceTable"
|
||||||
},
|
},
|
||||||
"version": "0.3.1",
|
"version": "0.3.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"frameworks": "arduino",
|
"frameworks": "arduino",
|
||||||
"platforms": "*",
|
"platforms": "*",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=DistanceTable
|
name=DistanceTable
|
||||||
version=0.3.1
|
version=0.3.2
|
||||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
sentence=Library for a memory efficient DistanceTable for Arduino.
|
sentence=Library for a memory efficient DistanceTable for Arduino.
|
||||||
|
Loading…
Reference in New Issue
Block a user