mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.1.3 Interval
This commit is contained in:
parent
161ec39243
commit
3a9edb2877
@ -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:
|
||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||
platforms:
|
||||
@ -9,3 +24,5 @@ compile:
|
||||
- esp32
|
||||
# - esp8266
|
||||
# - mega2560
|
||||
- rpipico
|
||||
|
||||
|
31
libraries/Interval/CHANGELOG.md
Normal file
31
libraries/Interval/CHANGELOG.md
Normal file
@ -0,0 +1,31 @@
|
||||
# Change Log Interval
|
||||
|
||||
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.1.3] - 2022-11-14
|
||||
- Add RP2040 support to build-CI.
|
||||
- Add CHANGELOG.md
|
||||
|
||||
|
||||
## [0.1.2] - 2021-12-20
|
||||
- update library.json
|
||||
- update license
|
||||
- minor edits
|
||||
|
||||
## [0.1.1] - 2021-05-27
|
||||
- add Arduino-lint
|
||||
|
||||
----
|
||||
|
||||
## [0.1.0] - 2020-12-30
|
||||
- Arduino-CI
|
||||
- unit tests
|
||||
- setRange()
|
||||
|
||||
## [0.0.1] - 2020-07-20
|
||||
- initial version (not complete)
|
||||
|
@ -2,14 +2,11 @@
|
||||
// FILE: Interval.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 2020-07-21
|
||||
// VERSION: 0.1.1
|
||||
// PURPOSE: Arduino library for Interval datatype
|
||||
// VERSION: 0.1.3
|
||||
// PURPOSE: Arduino library for Interval data type
|
||||
// URL: https://github.com/RobTillaart/Interval
|
||||
//
|
||||
// 0.0.1 2020-07-20 initial version (not complete)
|
||||
// 0.1.0 2020-12-30 Arduino-CI, unit tests, setRange()
|
||||
// 0.1.1 2021-05-27 Arduino-lint
|
||||
// 0.1.2 2021-12-20 update library.json, license, minor edits.
|
||||
// HISTORY: see changelog.md
|
||||
|
||||
|
||||
#include "Interval.h"
|
||||
@ -47,7 +44,7 @@ Interval::Interval()
|
||||
float Interval::relAccuracy()
|
||||
{
|
||||
if (value() == 0.0) return -1;
|
||||
return abs(range() / value()); // TODO /2 ?
|
||||
return abs(range() / value()); // TODO /2 ?
|
||||
}
|
||||
|
||||
|
||||
@ -59,7 +56,7 @@ void Interval::setRange(float r)
|
||||
}
|
||||
|
||||
|
||||
// PRINTABLE
|
||||
// PRINTABLE
|
||||
size_t Interval::printTo(Print& p) const
|
||||
{
|
||||
size_t n = 0;
|
||||
@ -74,7 +71,7 @@ size_t Interval::printTo(Print& p) const
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
//
|
||||
// MATH BASIC OPERATIONS
|
||||
// MATH BASIC OPERATIONS
|
||||
//
|
||||
Interval Interval::operator + (const Interval &in)
|
||||
{
|
||||
@ -134,7 +131,7 @@ Interval Interval::operator /= (const Interval &in)
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
//
|
||||
// COMPARISON OPERATIONS
|
||||
// COMPARISON OPERATIONS
|
||||
//
|
||||
|
||||
bool Interval::operator == (const Interval &in)
|
||||
@ -148,7 +145,7 @@ bool Interval::operator != (const Interval &in)
|
||||
return ((_lo != in._lo) || (_hi != in._hi));
|
||||
}
|
||||
|
||||
// VALUE FOR NOW...
|
||||
// VALUE FOR NOW...
|
||||
// bool Interval::operator > (const Interval &in)
|
||||
// {
|
||||
// return this->value() > in.value();
|
||||
|
@ -3,7 +3,7 @@
|
||||
// FILE: Interval.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 2020-07-21
|
||||
// VERSION: 0.1.2
|
||||
// VERSION: 0.1.3
|
||||
// PURPOSE: Arduino library for Interval datatype
|
||||
// URL: https://github.com/RobTillaart/Interval
|
||||
//
|
||||
@ -13,22 +13,22 @@
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
#define INTERVAL_LIB_VERSION (F("0.1.2"))
|
||||
#define INTERVAL_LIB_VERSION (F("0.1.3"))
|
||||
|
||||
|
||||
class Interval: public Printable
|
||||
{
|
||||
public:
|
||||
// CONSTRUCTOR
|
||||
// CONSTRUCTOR
|
||||
Interval();
|
||||
Interval(float lo, float hi);
|
||||
Interval(float f); // default zero interval [f, f]
|
||||
|
||||
// PRINTABLE
|
||||
// PRINTABLE
|
||||
size_t printTo(Print& p) const;
|
||||
void setDecimals(uint8_t n) { _decimals = n; };
|
||||
|
||||
// BASE FUNCTIONS
|
||||
// BASE FUNCTIONS
|
||||
float value() { return (_hi /2 + _lo /2); }; // assumption
|
||||
float range() { return _hi -_lo; };
|
||||
float high() { return _hi; };
|
||||
@ -36,7 +36,7 @@ public:
|
||||
float relAccuracy();
|
||||
void setRange(float r);
|
||||
|
||||
// MATH OPERATORS
|
||||
// MATH OPERATORS
|
||||
Interval operator + (const Interval&);
|
||||
Interval operator - (const Interval&);
|
||||
Interval operator * (const Interval&);
|
||||
@ -46,7 +46,7 @@ public:
|
||||
Interval operator *= (const Interval&);
|
||||
Interval operator /= (const Interval&);
|
||||
|
||||
// COMPARISON OPERATORS - compares value()
|
||||
// COMPARISON OPERATORS - compares value()
|
||||
bool operator == (const Interval&);
|
||||
bool operator != (const Interval&);
|
||||
// bool operator > (const Interval&);
|
||||
@ -55,7 +55,7 @@ public:
|
||||
// bool operator <= (const Interval&);
|
||||
|
||||
|
||||
// SET OPERATORS
|
||||
// SET OPERATORS
|
||||
// Interval operator & (const Interval&); // common part [1, 5] & [4, 8] => [4, 5]
|
||||
// Interval operator | (const Interval&); // superset [1, 5] | [4, 8] => [1, 8]
|
||||
// Interval operator ^ (const Interval&); //
|
||||
@ -69,3 +69,4 @@ private:
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/Interval"
|
||||
},
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.3",
|
||||
"license": "MIT",
|
||||
"frameworks": "*",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=Interval
|
||||
version=0.1.2
|
||||
version=0.1.3
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for Interval datatype
|
||||
|
Loading…
x
Reference in New Issue
Block a user