Skip to content

Commit

Permalink
libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
ArminJo committed Jun 8, 2020
1 parent da8cc97 commit 80e9201
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
3 changes: 0 additions & 3 deletions examples/EasyButtonExample/ATtinySerialOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -452,7 +450,6 @@ void TinySerialOut::println() {
print('\r');
print('\n');
}
#endif // !defined(TINY_SERIAL_INHERIT_FROM_PRINT)

/********************************
* Basic serial output function
Expand Down
16 changes: 4 additions & 12 deletions examples/EasyButtonExample/ATtinySerialOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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;
Expand Down Expand Up @@ -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:

Expand All @@ -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);
Expand All @@ -207,7 +199,6 @@ class TinySerialOut
void println(double aFloat, uint8_t aDigits = 2);

void println(void);
#endif // TINY_SERIAL_INHERIT_FROM_PRINT

};

Expand All @@ -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__)

Expand Down
25 changes: 25 additions & 0 deletions library.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]"
},
"license": "GPL-3.0-or-later",
"frameworks": "arduino",
"platforms": [
"atmelavr",
"atmelmegaavr",
"atmelsam",
"espressif8266",
"espressif32",
"ststm32"
]
}
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name=EasyButtonAtInt01
version=3.0.0
author=Armin Joachimsmeyer
maintainer=Armin Joachimsmeyer <[email protected]>
sentence=Small and easy to use Arduino library for using push buttons at INT0 and / or INT1 pin using interrupts.<br/><br/>Just connect buttons between ground and pin 2 or 3 of your Arduino - that's it<br/><br/>No call of begin() or update() function needed, no polling function to call. No blocking debouncing.<br/>
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.<br/><br/>In you main program define an EasyButton and use <i>ButtonStateIsActive</i> or <i>ButtonToggleState</i> to determine your action.<br/>Or use a <b>callback function</b> which will be called once on every button press or release.<br/><br/>Usage:<pre>#define USE_BUTTON_0<br/>#include "EasyButtonAtInt01.cpp.h"<br/>EasyButton Button0AtPin2;<br/><br/>void setup() {}<br/>void loop() {<br/>...<br/> digitalWrite(LED_BUILTIN, Button0AtPin2.ButtonToggleState);<br/>...<br/>}</pre><br/>Functions for long and double press detection are included.<br/><br/>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.<br/>Functions for long and double press detection are included.<br/><br/>Just connect buttons between ground and pin 2 or 3 of your Arduino - that's it<br/><br/><b>No call</b> of begin() or polling function like update() required. No blocking debouncing delay.<br/>
paragraph=<br/>Define an EasyButtonIn in you main program and use <i>ButtonStateIsActive</i> or <i>ButtonToggleState</i> to determine your action.<br/>Or use a <b>callback function</b> which will be called once on every button press or release.<br/><br/>Usage:<pre>#define USE_BUTTON_0<br/>#include "EasyButtonAtInt01.cpp.h"<br/>EasyButton Button0AtPin2;<br/><br/>void setup() {}<br/>void loop() {<br/>...<br/> digitalWrite(LED_BUILTIN, Button0AtPin2.ButtonToggleState);<br/>...<br/>}</pre><br/><br/>New: Added button release handler.<br/>
category=Signal Input/Output
url=https://github.com/ArminJo/EasyButtonAtInt01
architectures=avr

0 comments on commit 80e9201

Please sign in to comment.