From 80e920115ea14340a4b6d7175ffd51f8375224ce Mon Sep 17 00:00:00 2001 From: Armin Date: Tue, 9 Jun 2020 00:34:22 +0200 Subject: [PATCH] libraries --- .../EasyButtonExample/ATtinySerialOut.cpp | 3 --- examples/EasyButtonExample/ATtinySerialOut.h | 16 +++--------- library.json | 25 +++++++++++++++++++ library.properties | 4 +-- 4 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 library.json diff --git a/examples/EasyButtonExample/ATtinySerialOut.cpp b/examples/EasyButtonExample/ATtinySerialOut.cpp index 4cdd41f..dd04690 100644 --- a/examples/EasyButtonExample/ATtinySerialOut.cpp +++ b/examples/EasyButtonExample/ATtinySerialOut.cpp @@ -346,8 +346,6 @@ size_t TinySerialOut::write(uint8_t aByte) { return 1; } -#if !defined(TINY_SERIAL_INHERIT_FROM_PRINT) - void TinySerialOut::print(const char* aStringPtr) { writeString(aStringPtr); } @@ -452,7 +450,6 @@ void TinySerialOut::println() { print('\r'); print('\n'); } -#endif // !defined(TINY_SERIAL_INHERIT_FROM_PRINT) /******************************** * Basic serial output function diff --git a/examples/EasyButtonExample/ATtinySerialOut.h b/examples/EasyButtonExample/ATtinySerialOut.h index 4922c11..17ee3e0 100644 --- a/examples/EasyButtonExample/ATtinySerialOut.h +++ b/examples/EasyButtonExample/ATtinySerialOut.h @@ -98,11 +98,6 @@ #define USE_115200BAUD #endif -/* - * Define or comment this out, if you want to use this class as a replacement for standard Serial as the print class - * Adds around 800 Bytes of code - */ -//#define TINY_SERIAL_INHERIT_FROM_PRINT /* * Define or comment this out, if you want to save code size and if you can live with 87 micro seconds intervals of disabled interrupts for each sent byte. */ @@ -129,11 +124,13 @@ inline void writeValue(uint8_t aValue) { write1Start8Data1StopNoParity(aValue); } -// The same class as for plain arduino +// The same class definition as for plain arduino #if defined(ARDUINO_AVR_DIGISPARK) // The digispark library defines (2/2019) F but not __FlashStringHelper //# define F(string_literal) ((fstr_t*)PSTR(string_literal)) +# if ! defined(__FlashStringHelper) #define __FlashStringHelper fstr_t +# endif #endif #if not defined(F) class __FlashStringHelper; @@ -164,11 +161,7 @@ void writeFloat(double aFloat, uint8_t aDigits); char nibbleToHex(uint8_t aByte); -#if defined(TINY_SERIAL_INHERIT_FROM_PRINT) -class TinySerialOut: public Print -#else class TinySerialOut -#endif { public: @@ -185,7 +178,6 @@ class TinySerialOut size_t write(uint8_t aByte); operator bool() { return true; } // To support "while (!Serial); // wait for serial port to connect. Needed for Leonardo only -#if !defined(TINY_SERIAL_INHERIT_FROM_PRINT) void print(const __FlashStringHelper * aStringPtr); void print(const char* aStringPtr); void print(char aChar); @@ -207,7 +199,6 @@ class TinySerialOut void println(double aFloat, uint8_t aDigits = 2); void println(void); -#endif // TINY_SERIAL_INHERIT_FROM_PRINT }; @@ -222,6 +213,7 @@ extern TinySerialOut SerialOut; #else extern TinySerialOut Serial; #endif +#define Print TinySerialOut #endif // defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__) diff --git a/library.json b/library.json new file mode 100644 index 0000000..6cbb003 --- /dev/null +++ b/library.json @@ -0,0 +1,25 @@ +{ + "name": "ServoEasing", + "keywords": "Servo", + "description": "Arduino library to enable smooth servo movement.", + "repository": { + "type": "git", + "url": "https://github.com/ArminJo/ServoEasing" + }, + "version": "2.0.0", + "exclude": "pictures", + "authors": { + "name": "Armin Joachimsmeyer", + "email": "armin.joachimsmeyer@gmail.com" + }, + "license": "GPL-3.0-or-later", + "frameworks": "arduino", + "platforms": [ + "atmelavr", + "atmelmegaavr", + "atmelsam", + "espressif8266", + "espressif32", + "ststm32" + ] +} \ No newline at end of file diff --git a/library.properties b/library.properties index 80bdfec..b1f6978 100644 --- a/library.properties +++ b/library.properties @@ -2,8 +2,8 @@ name=EasyButtonAtInt01 version=3.0.0 author=Armin Joachimsmeyer maintainer=Armin Joachimsmeyer -sentence=Small and easy to use Arduino library for using push buttons at INT0 and / or INT1 pin using interrupts.

Just connect buttons between ground and pin 2 or 3 of your Arduino - that's it

No call of begin() or update() function needed, no polling function to call. No blocking debouncing.
-paragraph=INT0 and INT1 are connected to Pin 2 / 3 on most Arduinos (ATmega328), to PB6 / PA3 on ATtiny167 and on ATtinyX5 we have only INT0 at PB2.

In you main program define an EasyButton and use ButtonStateIsActive or ButtonToggleState to determine your action.
Or use a callback function which will be called once on every button press or release.

Usage:
#define USE_BUTTON_0
#include "EasyButtonAtInt01.cpp.h"
EasyButton Button0AtPin2;

void setup() {}
void loop() {
...
digitalWrite(LED_BUILTIN, Button0AtPin2.ButtonToggleState);
...
}

Functions for long and double press detection are included.

New: Added button release handler. +sentence=Small and easy to use Arduino library for using push buttons at INT0/pin2 and / or INT1/pin3 using interrupts.
Functions for long and double press detection are included.

Just connect buttons between ground and pin 2 or 3 of your Arduino - that's it

No call of begin() or polling function like update() required. No blocking debouncing delay.
+paragraph=
Define an EasyButtonIn in you main program and use ButtonStateIsActive or ButtonToggleState to determine your action.
Or use a callback function which will be called once on every button press or release.

Usage:
#define USE_BUTTON_0
#include "EasyButtonAtInt01.cpp.h"
EasyButton Button0AtPin2;

void setup() {}
void loop() {
...
digitalWrite(LED_BUILTIN, Button0AtPin2.ButtonToggleState);
...
}


New: Added button release handler.
category=Signal Input/Output url=https://github.com/ArminJo/EasyButtonAtInt01 architectures=avr