Skip to content

Commit fb05882

Browse files
committed
ADCUtils: Renamed *VoltageCheck*() to *VCCCheck*(), setADCMultiplexerAndReferenceForNextConversion() to setADCChannelAndReferenceForNextConversion() and changed signature of readUntil4ConsecutiveValuesAreEqual().
SimpleEMAFilters: Added "State Variable" / Biquad filter.
1 parent 80ca385 commit fb05882

13 files changed

+497
-158
lines changed

LICENSE.txt

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GNU GENERAL PUBLIC LICENSE
22
Version 3, 29 June 2007
33

4-
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
4+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
55
Everyone is permitted to copy and distribute verbatim copies
66
of this license document, but changing it is not allowed.
77

@@ -618,4 +618,57 @@ an absolute waiver of all civil liability in connection with the
618618
Program, unless a warranty or assumption of liability accompanies a
619619
copy of the Program in return for a fee.
620620

621-
END OF TERMS AND CONDITIONS
621+
END OF TERMS AND CONDITIONS
622+
623+
How to Apply These Terms to Your New Programs
624+
625+
If you develop a new program, and you want it to be of the greatest
626+
possible use to the public, the best way to achieve this is to make it
627+
free software which everyone can redistribute and change under these terms.
628+
629+
To do so, attach the following notices to the program. It is safest
630+
to attach them to the start of each source file to most effectively
631+
state the exclusion of warranty; and each file should have at least
632+
the "copyright" line and a pointer to where the full notice is found.
633+
634+
<one line to give the program's name and a brief idea of what it does.>
635+
Copyright (C) <year> <name of author>
636+
637+
This program is free software: you can redistribute it and/or modify
638+
it under the terms of the GNU General Public License as published by
639+
the Free Software Foundation, either version 3 of the License, or
640+
(at your option) any later version.
641+
642+
This program is distributed in the hope that it will be useful,
643+
but WITHOUT ANY WARRANTY; without even the implied warranty of
644+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645+
GNU General Public License for more details.
646+
647+
You should have received a copy of the GNU General Public License
648+
along with this program. If not, see <https://www.gnu.org/licenses/>.
649+
650+
Also add information on how to contact you by electronic and paper mail.
651+
652+
If the program does terminal interaction, make it output a short
653+
notice like this when it starts in an interactive mode:
654+
655+
<program> Copyright (C) <year> <name of author>
656+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657+
This is free software, and you are welcome to redistribute it
658+
under certain conditions; type `show c' for details.
659+
660+
The hypothetical commands `show w' and `show c' should show the appropriate
661+
parts of the General Public License. Of course, your program's commands
662+
might be different; for a GUI interface, you would use an "about box".
663+
664+
You should also get your employer (if you work as a programmer) or school,
665+
if any, to sign a "copyright disclaimer" for the program, if necessary.
666+
For more information on this, and how to apply and follow the GNU GPL, see
667+
<https://www.gnu.org/licenses/>.
668+
669+
The GNU General Public License does not permit incorporating your program
670+
into proprietary programs. If your program is a subroutine library, you
671+
may consider it more useful to permit linking proprietary applications with
672+
the library. If this is what you want to do, use the GNU Lesser General
673+
Public License instead of this License. But first, please read
674+
<https://www.gnu.org/licenses/why-not-lgpl.html>.

README.md

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
1-
# [ArduinoUtils](https://github.com/ArminJo/Arduino-Utils) - My utility collection for Arduino
1+
<div align = center>
2+
3+
# [ArduinoUtils](https://github.com/ArminJo/Arduino-Utils)
4+
My utility collection for Arduino
5+
6+
[![Badge License: GPLv3](https://img.shields.io/badge/License-GPLv3-brightgreen.svg)](https://www.gnu.org/licenses/gpl-3.0)
7+
&nbsp; &nbsp;
8+
[![Badge Version](https://img.shields.io/github/v/release/ArminJo/Arduino-Utils?include_prereleases&color=yellow&logo=DocuSign&logoColor=white)](https://github.com/ArminJo/Arduino-Utils/releases/latest)
9+
&nbsp; &nbsp;
10+
[![Badge Commits since latest](https://img.shields.io/github/commits-since/ArminJo/Arduino-Utils/latest?color=yellow)](https://github.com/ArminJo/Arduino-Utils/commits/master)
11+
&nbsp; &nbsp;
12+
[![Badge Build Status](https://github.com/ArminJo/Arduino-Utils/workflows/LibraryBuild/badge.svg)](https://github.com/ArminJo/Arduino-Utils/actions)
13+
&nbsp; &nbsp;
14+
![Badge Hit Counter](https://visitor-badge.laobi.icu/badge?page_id=ArminJo_Arduino-Utils)
15+
<br/>
16+
<br/>
17+
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)
218

3-
### [Version 1.0.0](https://github.com/ArminJo/Arduino-Utils/archive/master.zip)
19+
Not yet available as Arduino library.
420

5-
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
6-
[![Commits since latest](https://img.shields.io/github/commits-since/ArminJo/Arduino-Utils/latest)](https://github.com/ArminJo/Arduino-Utils/commits/master)
7-
[![Build Status](https://github.com/ArminJo/Arduino-Utils/workflows/LibraryBuild/badge.svg)](https://github.com/ArminJo/Arduino-Utils/actions)
8-
![Hit Counter](https://visitor-badge.laobi.icu/badge?page_id=ArminJo_Arduino-Utils)
9-
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)
21+
[![Button Install](https://img.shields.io/badge/Install-brightgreen?logoColor=white&logo=GitBook)](https://www.ardu-badge.com/Arduino-Utils)
22+
&nbsp; &nbsp;
23+
[![Button API](https://img.shields.io/badge/API-yellow?logoColor=white&logo=OpenStreetMap)](https://arminjo.github.io/Arduino-Utils/classArduino-Utils.html)
24+
&nbsp; &nbsp;
25+
[![Button Changelog](https://img.shields.io/badge/Changelog-blue?logoColor=white&logo=AzureArtifacts)](https://github.com/ArminJo/Arduino-Utils#revision-history)
26+
27+
</div>
28+
29+
<br/>
1030

1131
# Table of content
1232
* [SimpleEMAFilters.hpp](https://github.com/ArminJo/Arduino-Utils#simpleemafiltershpp)
@@ -125,6 +145,7 @@ Fast and flexible ADC conversions. **Intelligent handling of delays for referenc
125145
- Functions for easy **oversampling**.
126146
- Function for easy getting the maximum value of measurements.
127147
- Functions for getting **temperature and VCC voltage**. For VCC, resolution is 20 millivolt!
148+
- Functions to check if voltage is too low for a given period, used especially for Li-ion batteries supply.
128149

129150
# HCSR04
130151
- Blocking and **non-blocking** reading of HCSR04 US Sensors with timeouts and exact conversions.
@@ -221,6 +242,10 @@ If you are using [Sloeber](https://eclipse.baeyens.it) as your IDE, you can easi
221242
# Revision History
222243

223244
### Version 1.1.0 - work in progress
245+
- SimpleEMAFilters: Added "State Variable" / Biquad and double and triple Lowpass filters.
246+
- ADCUtils: Renamed `*VoltageCheck*()` to `*VCCCheck*()`, `setADCMultiplexerAndReferenceForNextConversion()` to `setADCChannelAndReferenceForNextConversion()` and changed signature of `readUntil4ConsecutiveValuesAreEqual()`.
247+
- Improvements.
248+
- Documentation.
224249

225250
### Version 1.0.0
226251
- Added unions.

pictures/LowPass_HighInput.png

-168 KB
Binary file not shown.

src/ADCUtils.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,21 @@
115115
extern float sVCCVoltage;
116116
extern uint16_t sVCCVoltageMillivolt;
117117

118-
extern long sLastVoltageCheckMillis;
119-
extern uint8_t sVoltageTooLowCounter;
118+
extern long sLastVCCCheckMillis;
119+
extern uint8_t sVCCTooLowCounter;
120120

121121
uint16_t readADCChannel(uint8_t aChannelNumber);
122122
uint16_t readADCChannelWithReference(uint8_t aChannelNumber, uint8_t aReference);
123123
uint16_t waitAndReadADCChannelWithReference(uint8_t aChannelNumber, uint8_t aReference);
124124
uint16_t waitAndReadADCChannelWithReferenceAndRestoreADMUXAndReference(uint8_t aChannelNumber, uint8_t aReference);
125125
uint16_t readADCChannelWithOversample(uint8_t aChannelNumber, uint8_t aOversampleExponent);
126-
void setADCMultiplexerAndReferenceForNextConversion(uint8_t aChannelNumber, uint8_t aReference);
126+
void setADCChannelAndReferenceForNextConversion(uint8_t aChannelNumber, uint8_t aReference);
127127
uint16_t readADCChannelWithReferenceOversample(uint8_t aChannelNumber, uint8_t aReference, uint8_t aOversampleExponent);
128128
uint16_t readADCChannelWithReferenceOversampleFast(uint8_t aChannelNumber, uint8_t aReference, uint8_t aOversampleExponent);
129129
uint16_t readADCChannelWithReferenceMultiSamples(uint8_t aChannelNumber, uint8_t aReference, uint8_t aNumberOfSamples);
130130
uint16_t readADCChannelWithReferenceMax(uint8_t aChannelNumber, uint8_t aReference, uint16_t aNumberOfSamples);
131131
uint16_t readADCChannelWithReferenceMaxMicros(uint8_t aChannelNumber, uint8_t aReference, uint16_t aMicrosecondsToAquire);
132-
uint16_t readUntil4ConsecutiveValuesAreEqual(uint8_t aChannelNumber, uint8_t aDelay, uint8_t aAllowedDifference,
132+
uint16_t readUntil4ConsecutiveValuesAreEqual(uint8_t aChannelNumber, uint8_t aReference, uint8_t aDelay, uint8_t aAllowedDifference,
133133
uint8_t aMaxRetries);
134134

135135
uint8_t checkAndWaitForReferenceAndChannelToSwitch(uint8_t aChannelNumber, uint8_t aReference);
@@ -157,7 +157,9 @@ float getTemperature(void);
157157

158158
bool isVCCTooLowMultipleTimes();
159159
void resetVCCTooLowMultipleTimes();
160-
bool isVoltageTooLow();
160+
bool isVCCTooLow();
161+
bool isVCCTooHigh();
162+
bool isVCCTooHighSimple();
161163

162164
#endif // defined(__AVR__) ...
163165
#endif // _ADC_UTILS_H

0 commit comments

Comments
 (0)