Skip to content

Commit

Permalink
Release 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ArminJo committed Sep 24, 2020
1 parent 03bb7ea commit 75f8ff1
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 43 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/LibraryBuildWithAction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- ATTinyCore:avr:attinyx5:chip=85,clock=1internal

# Specify parameters for each board.
# With examples-exclude you may exclude specific examples for a board. Use a comma separated list.
# With sketches-exclude you may exclude specific examples for a board. Use a comma separated list.
#############################################################################################################
include:
- arduino-boards-fqbn: digistump:avr:digispark-tiny:clock=clock1 # ATtiny85 board @1 MHz
Expand Down Expand Up @@ -83,4 +83,4 @@ jobs:
arduino-board-fqbn: ${{ matrix.arduino-boards-fqbn }}
required-libraries: ${{ env.REQUIRED_LIBRARIES }}
platform-url: ${{ matrix.platform-url }}
examples-exclude: ${{ matrix.examples-exclude }}
sketches-exclude: ${{ matrix.sketches-exclude }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ External circuit for 20x amplification configuration on a Digispark board.
- Added documentation.
- Added [`MEASURE_READ_SIGNAL_TIMING`](src/FrequencyDetector.h#L64) capability.
- Refactored [WhistleSwitch example](examples/WhistleSwitch) and adapted to [`EasyButtonAtInt01`](https://github.com/ArminJo/EasyButtonAtInt01) library.
- Removed blocking wait for ATmega32U4 Serial in examples.

### Version 1.1.1
- Moved libraries for WhistleSwitch example.
Expand Down
4 changes: 2 additions & 2 deletions examples/SimpleFrequencyDetector/SimpleFrequencyDetector.ino
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200);
#if defined(__AVR_ATmega32U4__)
while (!Serial); //delay for Leonardo, but this loops forever for Maple Serial
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL)
delay(2000); // To be able to connect Serial monitor after reset and before first printout
#endif
// Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_FREQUENCY_DETECTOR));
Expand Down
3 changes: 3 additions & 0 deletions examples/WhistleSwitch/EasyButtonAtInt01.cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/gpl.html>.
*/

#if defined(__AVR__)
#include <Arduino.h>
#include "EasyButtonAtInt01.h"

Expand Down Expand Up @@ -675,3 +676,5 @@ ISR(INT1_vect)
}
# endif
#endif // not defined(USE_ATTACH_INTERRUPT)

#endif // defined(__AVR__)
4 changes: 3 additions & 1 deletion examples/WhistleSwitch/EasyButtonAtInt01.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
* - Renamed to EasyButtonAtInt01.cpp.h
*/

#if defined(__AVR__)
#include <Arduino.h>

/*
Expand Down Expand Up @@ -317,7 +318,7 @@ class EasyButton {
void handleINT01Interrupts(); // internal use only

bool LastBounceWasChangeToInactive; // Internal state, reflects actual reading with spikes and bouncing. Negative logic: true / active means button pin is LOW
volatile bool ButtonStateIsActive; // Negative logic: true / active means button pin is LOW. If last press duration < BUTTON_DEBOUNCING_MILLIS it holds wrong value (true instead of false) :-(
volatile bool ButtonStateIsActive; // Negative logic: true / active means button pin is LOW. If last press duration < BUTTON_DEBOUNCING_MILLIS it holds wrong value (true instead of false) :-(
volatile bool ButtonToggleState; // Toggle is on press, not on release - initial value is false

/*
Expand Down Expand Up @@ -378,6 +379,7 @@ void __attribute__ ((weak)) handleINT0Interrupt();
void __attribute__ ((weak)) handleINT1Interrupt();
#endif

#endif // defined(__AVR__)
#endif /* EASY_BUTTON_AT_INT01_H_ */

#pragma once
6 changes: 3 additions & 3 deletions examples/WhistleSwitch/WhistleSwitch.ino
Original file line number Diff line number Diff line change
Expand Up @@ -872,9 +872,9 @@ void setup() {

#else // defined(__AVR_ATtiny85__)
Serial.begin(115200);
#if defined(__AVR_ATmega32U4__)
while (!Serial); //delay for Leonardo, but this loops forever for Maple Serial
#endif
# if defined(__AVR_ATmega32U4__) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL)
delay(2000); // To be able to connect Serial monitor after reset and before first printout
# endif

pinMode(LED_LOWER, OUTPUT);
pinMode(LED_MATCH, OUTPUT);
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version=2.0.0
author=Armin Joachimsmeyer
maintainer=Armin Joachimsmeyer <armin.joachimsmeyer@gmail.com>
sentence=Measure the main frequency of analog captured signal connected to an Arduino and check for noise and mute.<br/>
paragraph=Detects frequency from 38 Hz to 9612 Hz and works even on an ATTiny85 with 1 MHz up to 4806 Hz. Signal can be delivered e.g. by a microphone. Tested for UNO, Nano and ATtiny85.<br/>Examples includes a whistle switch (Pfeiffschalter) designed to react to human whistling.<br/>Like <a href="https://www.arduino.cc/en/Tutorial/SimpleAudioFrequencyMeter"> Arduino Simple Audio Frequency Meter</a><br/><br/><b>New: </b> Arduino Serial Plotter output of input signal, renamed doPlausi() to doEqualDistributionPlausi().<br/>
paragraph=Detects frequency from 38 Hz to 9612 Hz and works even on an ATTiny85 with 1 MHz up to 4806 Hz. Signal can be delivered e.g. by a microphone. Tested for UNO, Nano and ATtiny85.<br/>Examples includes a whistle switch (Pfeiffschalter) designed to react to human whistling.<br/>Like <a href="https://www.arduino.cc/en/Tutorial/SimpleAudioFrequencyMeter"> Arduino Simple Audio Frequency Meter</a><br/><br/><b>New: </b>Added plotter output of input signal. Renamed doPlausi() to doEqualDistributionPlausi().<br/>
category=Signal Input/Output
url=https://github.com/ArminJo/Arduino-FrequencyDetector
depends=ATtinySerialOut
Expand Down
4 changes: 3 additions & 1 deletion src/FrequencyDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@
#define VERSION_FREQUENCY_DETECTOR_MINOR 0

/*
* Version 2.0.0 - 5/2020
* Version 2.0.0 - 9/2020
* - Renamed `doPlausi()` to `doEqualDistributionPlausi()`.
* - Changed error values and computation.
* - Added documentation.
* - Added MEASURE_READ_SIGNAL_TIMING capability.
* - Added plotter output of input signal.
* - Removed blocking wait for ATmega32U4 Serial in examples.
*
*
* Version 1.1.0 - 1/2020
* - Corrected formula for compensating millis().
Expand Down
67 changes: 34 additions & 33 deletions src/MillisUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,39 +38,6 @@
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif

/*
* Function for speedTest
* calling a function consisting of just __asm__ volatile ("nop"); gives 0 to 1 micro second
* Use of Serial. makes it incompatible with BlueDisplay library.
*/
//void speedTestWith1kCalls(void (*aFunctionUnderTest)(void)) {
// uint32_t tMillisStart = millis();
// for (uint8_t i = 0; i < 100; ++i) {
// // unroll 10 times
// aFunctionUnderTest();
// aFunctionUnderTest();
// aFunctionUnderTest();
// aFunctionUnderTest();
// aFunctionUnderTest();
// aFunctionUnderTest();
// aFunctionUnderTest();
// aFunctionUnderTest();
// aFunctionUnderTest();
// aFunctionUnderTest();
// }
// uint32_t tMillisNeeded = millis() - tMillisStart;
// Serial.print(F("Function call takes "));
// if (tMillisNeeded > 1000000) {
// Serial.print(tMillisNeeded / 1000);
// Serial.print(",");
// Serial.print((tMillisNeeded % 1000) / 100);
// Serial.print(F(" milli"));
// } else {
// Serial.print(tMillisNeeded);
// Serial.print(F(" micro"));
// }
// Serial.println(F(" seconds."));
//}
/*
*
*/
Expand Down Expand Up @@ -136,3 +103,37 @@ bool areMillisGone(unsigned int aMillis, unsigned long * aLastMillisPtr) {
return false;
}
#endif // ! defined(TEENSYDUINO)

/*
* Function for speedTest
* calling a function consisting of just __asm__ volatile ("nop"); gives 0 to 1 micro second
* Use of Serial. makes it incompatible with BlueDisplay library.
*/
//void speedTestWith1kCalls(void (*aFunctionUnderTest)(void)) {
// uint32_t tMillisStart = millis();
// for (uint8_t i = 0; i < 100; ++i) {
// // unroll 10 times
// aFunctionUnderTest();
// aFunctionUnderTest();
// aFunctionUnderTest();
// aFunctionUnderTest();
// aFunctionUnderTest();
// aFunctionUnderTest();
// aFunctionUnderTest();
// aFunctionUnderTest();
// aFunctionUnderTest();
// aFunctionUnderTest();
// }
// uint32_t tMillisNeeded = millis() - tMillisStart;
// Serial.print(F("Function call takes "));
// if (tMillisNeeded > 1000000) {
// Serial.print(tMillisNeeded / 1000);
// Serial.print(",");
// Serial.print((tMillisNeeded % 1000) / 100);
// Serial.print(F(" milli"));
// } else {
// Serial.print(tMillisNeeded);
// Serial.print(F(" micro"));
// }
// Serial.println(F(" seconds."));
//}

0 comments on commit 75f8ff1

Please sign in to comment.