diff --git a/README.md b/README.md index a9728913..3ff85a2a 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ In versions prior to 2.0.0, this was instead configured using the Tools -> SPI P This core disables the SS pin when running in SPI master mode. This means that the "SS" pin can be used for whatever purpose you want - unlike classic AVRs, where this could not be disabled. Earlier versions of this document incorrectly stated that this behavior was enabled in megaTinyCore; it never was, and SS was always disabled. It should be re-enabled and the SS pin configured appropriately (probably as INPUT_PULLUP) if master/slave functionality is required. ### I2C (TWI) support -All of these parts have a single hardware I2C (TWI) peripheral. It works exactly like the one on official Arduino boards using the Wire.h library, except for the additional features noted below. See the pinout charts for the location of these pins. You must be sure to use external pullup resistors on the SDA and SCL lines if the devices you are connecting do not have thos integrated (many Arduino/hobby targeted breakout boards do - typically 10k). The 30k-50k internal pullup resistors were never suitable for I2C pullup resistors - they were, in my opinion, the worst of both worlds; they often did work with the simple test case, leading the developer on their merry way thinking they were all set, only to discover that when they added another I2C device or two, or moved the device to the end of a longer cable, I2C suddenly no longer worked - it's probably better for it to fail immediately, prompting investigation and subsequent addition of appropriate pullup resistors. Note that there is nothing *preventing* one from enabling the internal pullups manually - you just should do so knowing that even if it happens to work, it's not a robust solution. +All of these parts have a single hardware I2C (TWI) peripheral. It works exactly like the one on official Arduino boards using the Wire.h library, except for the additional features noted below. See the pinout charts for the location of these pins. You must be sure to use external pullup resistors on the SDA and SCL lines if the devices you are connecting do not have those on board (many Arduino/hobby targeted breakout boards do - typically 10k). The 30k-50k internal pullup resistors were never suitable for I2C pullup resistors - they were, in my opinion, the worst of both worlds; they often did work with the simple test case, leading the developer on their merry way thinking they were all set, only to discover that when they added another I2C device or two, or moved the device to the end of a longer cable, I2C suddenly no longer worked - it's probably better for it to fail immediately, prompting investigation and subsequent addition of appropriate pullup resistors. Note that there is nothing *preventing* one from enabling the internal pullups manually - you just should do so knowing that even if it happens to work, it's not a robust solution. On all parts with more than 8 pins, the TWI pins can be swapped to an alternate location. @@ -274,10 +274,16 @@ Like ATTinyCore, Sketch -> Export compiled binary will generate an assembly list ### EESAVE configuration option The EESAVE fuse can be controlled via the Tools -> Save EEPROM menu. If this is set to "EEPROM retained", when the board is erased during programming, the EEPROM will not be erased. If this is set to "EEPROM not retained", uploading a new sketch will clear out the EEPROM memory. You must do Burn Bootloader to apply this setting. -**WARNING** In megaTinyCore 1.0.6 and earlier, this setting is backwards - setting it to retained will not retain, and vice versa. This is corrected in 1.0.7 and later. +**WARNING** In megaTinyCore 1.0.6 and earlier, this setting is backwards - setting it to retained will not retain, and vice versa. This is corrected in 1.0.7 and later. Prior to 2.1.0, there were problems with the EEPROM library as well which could mimic that behavior. + +### SerialEvent support option +The Arduino API provides a rarely used method for receiving data from a serial port called [serialEvent](https://www.arduino.cc/reference/en/language/functions/communication/serial/serialevent/). This is truly the simplest implementation of something like that imaginable: Between each iteration of loop(), it will check Serial.available(), and run serialEvent() if it is (otherwise, it's a weakly defined empty function). The problem with serialEvent is that it's no different from just checking Serial.available() in loop() - and that check happens every pass through loop. Even if not using the serial port at all, even if you did your own test of Serial.available(), etc. At best, it's the same, and in all other cases it's worse. As of 2.1.0, SerialEvent is disabled by default, but can be enabled with the + +### Startup Time option +As of 2.1.0, there's now an option to set the time between reset (from any cause) and the start of code execution (previously it was always 8ms) - options are 1ms, 8ms (default), and 64ms. The default option is generally fine; occasionally (for example, with particularly slow rising power supplies and no BOD), the slower time may be needed. ### BOD configuration options -These parts officially support BOD trigger levels of 1.8V, 2.6V, and 4.2V, with Disabled, Active, and Sampled operation options for when the chip is in Active and Sleep modes - Disabled uses no extra power, Active uses the most, and Sampled is in the middle. See the datasheet for details on power consumption and the meaning of these options. You must do Burn Bootloader to apply this setting. +These parts officially support BOD trigger levels of 1.8V, 2.6V, and 4.2V, with Disabled, Active, and Sampled operation options for when the chip is in Active and Sleep modes - Disabled uses no extra power, Active uses the most, and Sampled is in the middle. As of 2.1.0, the active/sleep modes have been combined into a single menu, the nonsensical options removed, and the previously unexposed options added: sampled mode is now available with two sample rates (the faster one uses ever so slightly more power, as you would expect), and "Enabled hold wake" - in that mode, BOD is disabled in sleep, enabled when not sleeing, and when waking up, code execution does not begin until the BOD is ready. See the datasheet for details on power consumption and the meaning of these options. You must do Burn Bootloader to apply this setting. #### Unofficial BOD levels Between the initial header file and preliminary datasheet release, and the most recent versions of each, several BOD settings (which were described as "unqualified" in the release notes- which I believe means they were not tested or guaranteed to behave correctly) were removed from the datasheet and io.h files. These are still supported by the dropdown menu, but (as of 2.0.4 - the first version that has the new headers) are marked as such in the submenu. Note that the new headers no longer provide the `*_gc` enum entries for these BOD levels. *When using these, proper operation should not be counted on without doing your own testing* @@ -330,7 +336,7 @@ Version information for MEGATINYCORE is also provided by a few additional define * MEGATINYCORE_PATCH 2 * MEGATINYCORE_RELEASED 1 * MEGATINYCORE_NUM 0x02000201 -Be warned that the historical record has been +Be warned that the historical record has been rather spotty w/regards to my remembering to update these with each release, making it rather less useful... ### Identifying Timers Each timer has a number associated with it, as shown below. This may be used by preprocessor macros (`#if` et. al.) or `if()` statenebts to check what `MILLIS_TIMER` is, or to identify which timer (if any) is associated with a pin using the `digitalPinToTimer(pin)` macro. diff --git a/megaavr/cores/megatinycore/UART.h b/megaavr/cores/megatinycore/UART.h index 1f7cdbe0..0a00bee5 100644 --- a/megaavr/cores/megatinycore/UART.h +++ b/megaavr/cores/megatinycore/UART.h @@ -197,4 +197,3 @@ class UartClass : public HardwareSerial extern UartClass Serial3; #define HAVE_HWSERIAL3 #endif - diff --git a/megaavr/cores/megatinycore/abi.cpp b/megaavr/cores/megatinycore/abi.cpp index 8d719b8e..2941d2c3 100644 --- a/megaavr/cores/megatinycore/abi.cpp +++ b/megaavr/cores/megatinycore/abi.cpp @@ -32,4 +32,3 @@ void __cxa_deleted_virtual(void) { //std::terminate(); abort(); } - diff --git a/megaavr/cores/megatinycore/api/Client.h b/megaavr/cores/megatinycore/api/Client.h index c8ebc9fe..f5941eb5 100644 --- a/megaavr/cores/megatinycore/api/Client.h +++ b/megaavr/cores/megatinycore/api/Client.h @@ -40,4 +40,3 @@ class Client : public Stream { protected: uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); }; }; - diff --git a/megaavr/cores/megatinycore/api/Common.h b/megaavr/cores/megatinycore/api/Common.h index 8581f390..fe6f4104 100644 --- a/megaavr/cores/megatinycore/api/Common.h +++ b/megaavr/cores/megatinycore/api/Common.h @@ -86,7 +86,7 @@ int atexit(void (*func)()) __attribute__((weak)); int main() __attribute__((weak)); #ifdef EXTENDED_PIN_MODE -// Platforms who wnat to declare more than 256 pins need to define EXTENDED_PIN_MODE globally +// Platforms who want to declare more than 256 pins need to define EXTENDED_PIN_MODE globally typedef uint32_t pin_size_t; #else typedef uint8_t pin_size_t; diff --git a/megaavr/cores/megatinycore/api/HardwareI2C.h b/megaavr/cores/megatinycore/api/HardwareI2C.h index 4ffbbc31..7ceea939 100644 --- a/megaavr/cores/megatinycore/api/HardwareI2C.h +++ b/megaavr/cores/megatinycore/api/HardwareI2C.h @@ -40,4 +40,3 @@ class HardwareI2C : public Stream virtual void onReceive(void(*)(int)) = 0; virtual void onRequest(void(*)(void)) = 0; }; - diff --git a/megaavr/cores/megatinycore/api/IPAddress.h b/megaavr/cores/megatinycore/api/IPAddress.h index 29dbe8ff..dc3b0644 100644 --- a/megaavr/cores/megatinycore/api/IPAddress.h +++ b/megaavr/cores/megatinycore/api/IPAddress.h @@ -73,4 +73,3 @@ class IPAddress : public Printable { }; extern const IPAddress INADDR_NONE; - diff --git a/megaavr/cores/megatinycore/api/PluggableUSB.h b/megaavr/cores/megatinycore/api/PluggableUSB.h index c289d903..86d6baab 100644 --- a/megaavr/cores/megatinycore/api/PluggableUSB.h +++ b/megaavr/cores/megatinycore/api/PluggableUSB.h @@ -25,7 +25,7 @@ #include // core need to define -void* epBuffer(unsigned int n); // -> returns a poointer to the Nth element of the EP buffer structure +void* epBuffer(unsigned int n); // -> returns a pointer to the Nth element of the EP buffer structure class PluggableUSBModule { public: diff --git a/megaavr/cores/megatinycore/api/Print.h b/megaavr/cores/megatinycore/api/Print.h index c8eda6a8..c0d641d6 100644 --- a/megaavr/cores/megatinycore/api/Print.h +++ b/megaavr/cores/megatinycore/api/Print.h @@ -81,4 +81,3 @@ class Print int16_t printf(const char *format, ...); int16_t printf(const __FlashStringHelper *format, ...); }; - diff --git a/megaavr/cores/megatinycore/api/Printable.h b/megaavr/cores/megatinycore/api/Printable.h index de45907d..63f93d4c 100644 --- a/megaavr/cores/megatinycore/api/Printable.h +++ b/megaavr/cores/megatinycore/api/Printable.h @@ -33,4 +33,3 @@ class Printable public: virtual size_t printTo(Print& p) const = 0; }; - diff --git a/megaavr/cores/megatinycore/api/Server.h b/megaavr/cores/megatinycore/api/Server.h index 86756825..0e970dfa 100644 --- a/megaavr/cores/megatinycore/api/Server.h +++ b/megaavr/cores/megatinycore/api/Server.h @@ -25,4 +25,3 @@ class Server : public Print { public: virtual void begin() = 0; }; - diff --git a/megaavr/cores/megatinycore/api/Stream.h b/megaavr/cores/megatinycore/api/Stream.h index ec98f2c6..1b74dcae 100644 --- a/megaavr/cores/megatinycore/api/Stream.h +++ b/megaavr/cores/megatinycore/api/Stream.h @@ -24,7 +24,7 @@ #include #include "Print.h" -// compatability macros for testing +// compatibility macros for testing /* #define getInt() parseInt() #define getInt(ignore) parseInt(ignore) diff --git a/megaavr/cores/megatinycore/api/String.h b/megaavr/cores/megatinycore/api/String.h index ebf2b59f..dd63a792 100644 --- a/megaavr/cores/megatinycore/api/String.h +++ b/megaavr/cores/megatinycore/api/String.h @@ -101,7 +101,7 @@ class String // returns true on success, false on failure (in which case, the string // is left unchanged). if the argument is null or invalid, the - // concatenation is considered unsucessful. + // concatenation is considered unsuccessful. unsigned char concat(const String &str); unsigned char concat(const char *cstr); unsigned char concat(char c); @@ -158,7 +158,7 @@ class String unsigned char startsWith(const String &prefix, unsigned int offset) const; unsigned char endsWith(const String &suffix) const; - // character acccess + // character access char charAt(unsigned int index) const; void setCharAt(unsigned int index, char c); char operator [] (unsigned int index) const; diff --git a/megaavr/cores/megatinycore/api/Udp.h b/megaavr/cores/megatinycore/api/Udp.h index 8a1842fe..86baf390 100644 --- a/megaavr/cores/megatinycore/api/Udp.h +++ b/megaavr/cores/megatinycore/api/Udp.h @@ -83,4 +83,3 @@ class UDP : public Stream { protected: uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); }; }; - diff --git a/megaavr/cores/megatinycore/api/deprecated-avr-comp/avr/dtostrf.c.impl b/megaavr/cores/megatinycore/api/deprecated-avr-comp/avr/dtostrf.c.impl index 96987a8f..7f96b117 100644 --- a/megaavr/cores/megatinycore/api/deprecated-avr-comp/avr/dtostrf.c.impl +++ b/megaavr/cores/megatinycore/api/deprecated-avr-comp/avr/dtostrf.c.impl @@ -34,4 +34,3 @@ char *dtostrf (double val, signed char width, unsigned char prec, char *sout) { sprintf(sout, fmt, val); return sout; } - diff --git a/megaavr/cores/megatinycore/api/deprecated/Client.h b/megaavr/cores/megatinycore/api/deprecated/Client.h index 5f8d4be9..8cb5a89d 100644 --- a/megaavr/cores/megatinycore/api/deprecated/Client.h +++ b/megaavr/cores/megatinycore/api/deprecated/Client.h @@ -21,5 +21,3 @@ // This include is added for compatibility, it will be remove on the next // major release of the API #include "../Client.h" - - diff --git a/megaavr/cores/megatinycore/api/deprecated/IPAddress.h b/megaavr/cores/megatinycore/api/deprecated/IPAddress.h index bf7fb7f0..3c4b9150 100644 --- a/megaavr/cores/megatinycore/api/deprecated/IPAddress.h +++ b/megaavr/cores/megatinycore/api/deprecated/IPAddress.h @@ -21,5 +21,3 @@ // This include is added for compatibility, it will be remove on the next // major release of the API #include "../IPAddress.h" - - diff --git a/megaavr/cores/megatinycore/api/deprecated/Print.h b/megaavr/cores/megatinycore/api/deprecated/Print.h index 2ac088d8..6f673533 100644 --- a/megaavr/cores/megatinycore/api/deprecated/Print.h +++ b/megaavr/cores/megatinycore/api/deprecated/Print.h @@ -21,4 +21,3 @@ // This include is added for compatibility, it will be remove on the next // major release of the API #include "../Print.h" - diff --git a/megaavr/cores/megatinycore/api/deprecated/Printable.h b/megaavr/cores/megatinycore/api/deprecated/Printable.h index bd721264..be87545c 100644 --- a/megaavr/cores/megatinycore/api/deprecated/Printable.h +++ b/megaavr/cores/megatinycore/api/deprecated/Printable.h @@ -21,4 +21,3 @@ // This include is added for compatibility, it will be remove on the next // major release of the API #include "../Printable.h" - diff --git a/megaavr/cores/megatinycore/api/deprecated/Server.h b/megaavr/cores/megatinycore/api/deprecated/Server.h index f3b02c16..cbf0da7a 100644 --- a/megaavr/cores/megatinycore/api/deprecated/Server.h +++ b/megaavr/cores/megatinycore/api/deprecated/Server.h @@ -21,5 +21,3 @@ // This include is added for compatibility, it will be remove on the next // major release of the API #include "../Server.h" - - diff --git a/megaavr/cores/megatinycore/api/deprecated/Stream.h b/megaavr/cores/megatinycore/api/deprecated/Stream.h index aa5dc8e0..fb96a333 100644 --- a/megaavr/cores/megatinycore/api/deprecated/Stream.h +++ b/megaavr/cores/megatinycore/api/deprecated/Stream.h @@ -21,5 +21,3 @@ // This include is added for compatibility, it will be remove on the next // major release of the API #include "../Stream.h" - - diff --git a/megaavr/cores/megatinycore/api/deprecated/Udp.h b/megaavr/cores/megatinycore/api/deprecated/Udp.h index 56980603..46317c77 100644 --- a/megaavr/cores/megatinycore/api/deprecated/Udp.h +++ b/megaavr/cores/megatinycore/api/deprecated/Udp.h @@ -21,5 +21,3 @@ // This include is added for compatibility, it will be remove on the next // major release of the API #include "../Udp.h" - - diff --git a/megaavr/cores/megatinycore/api/deprecated/WString.h b/megaavr/cores/megatinycore/api/deprecated/WString.h index 072323e0..d64b0e48 100644 --- a/megaavr/cores/megatinycore/api/deprecated/WString.h +++ b/megaavr/cores/megatinycore/api/deprecated/WString.h @@ -21,4 +21,3 @@ // This include is added for compatibility, it will be remove on the next // major release of the API #include "../String.h" - diff --git a/megaavr/cores/megatinycore/api/itoa.h b/megaavr/cores/megatinycore/api/itoa.h index 55b28493..a0e9633d 100644 --- a/megaavr/cores/megatinycore/api/itoa.h +++ b/megaavr/cores/megatinycore/api/itoa.h @@ -34,4 +34,3 @@ extern char* ultoa(unsigned long value, char *string, int radix); #ifdef __cplusplus } // extern "C" #endif - diff --git a/megaavr/cores/megatinycore/main.cpp b/megaavr/cores/megatinycore/main.cpp index f9f07098..142e2cd0 100644 --- a/megaavr/cores/megatinycore/main.cpp +++ b/megaavr/cores/megatinycore/main.cpp @@ -51,4 +51,3 @@ int main(void) return 0; } - diff --git a/megaavr/cores/megatinycore/new.cpp b/megaavr/cores/megatinycore/new.cpp index cf6f89c1..7a6f416c 100644 --- a/megaavr/cores/megatinycore/new.cpp +++ b/megaavr/cores/megatinycore/new.cpp @@ -33,4 +33,3 @@ void operator delete(void * ptr) { void operator delete[](void * ptr) { free(ptr); } - diff --git a/megaavr/cores/megatinycore/new.h b/megaavr/cores/megatinycore/new.h index 6e1b68f0..3a4facb2 100644 --- a/megaavr/cores/megatinycore/new.h +++ b/megaavr/cores/megatinycore/new.h @@ -27,4 +27,3 @@ void operator delete(void * ptr); void operator delete[](void * ptr); #endif - diff --git a/megaavr/libraries/SD/examples/Datalogger/Datalogger.ino b/megaavr/libraries/SD/examples/Datalogger/Datalogger.ino index c2631c0a..8ecc7c55 100644 --- a/megaavr/libraries/SD/examples/Datalogger/Datalogger.ino +++ b/megaavr/libraries/SD/examples/Datalogger/Datalogger.ino @@ -73,12 +73,3 @@ void loop() { Serial.println("error opening datalog.txt"); } } - - - - - - - - - diff --git a/megaavr/libraries/SD/examples/DumpFile/DumpFile.ino b/megaavr/libraries/SD/examples/DumpFile/DumpFile.ino index 74919991..fbc66c90 100644 --- a/megaavr/libraries/SD/examples/DumpFile/DumpFile.ino +++ b/megaavr/libraries/SD/examples/DumpFile/DumpFile.ino @@ -62,4 +62,3 @@ void setup() { void loop() { } - diff --git a/megaavr/libraries/SD/examples/Files/Files.ino b/megaavr/libraries/SD/examples/Files/Files.ino index cabebba5..4eecd0e0 100644 --- a/megaavr/libraries/SD/examples/Files/Files.ino +++ b/megaavr/libraries/SD/examples/Files/Files.ino @@ -70,6 +70,3 @@ void setup() { void loop() { // nothing happens after setup finishes. } - - - diff --git a/megaavr/libraries/SD/examples/ReadWrite/ReadWrite.ino b/megaavr/libraries/SD/examples/ReadWrite/ReadWrite.ino index d964668c..3b6b2477 100644 --- a/megaavr/libraries/SD/examples/ReadWrite/ReadWrite.ino +++ b/megaavr/libraries/SD/examples/ReadWrite/ReadWrite.ino @@ -75,5 +75,3 @@ void setup() { void loop() { // nothing happens after setup } - - diff --git a/megaavr/libraries/SD/examples/listfiles/listfiles.ino b/megaavr/libraries/SD/examples/listfiles/listfiles.ino index 48f84fb9..b03b9fbe 100644 --- a/megaavr/libraries/SD/examples/listfiles/listfiles.ino +++ b/megaavr/libraries/SD/examples/listfiles/listfiles.ino @@ -75,6 +75,3 @@ void printDirectory(File dir, int numTabs) { entry.close(); } } - - - diff --git a/megaavr/libraries/SD/src/File.cpp b/megaavr/libraries/SD/src/File.cpp index 5e37166b..0b77c071 100644 --- a/megaavr/libraries/SD/src/File.cpp +++ b/megaavr/libraries/SD/src/File.cpp @@ -165,4 +165,3 @@ File::operator bool() { } return false; } - diff --git a/megaavr/libraries/SD/src/README.txt b/megaavr/libraries/SD/src/README.txt index fedccdde..8c7f5de2 100644 --- a/megaavr/libraries/SD/src/README.txt +++ b/megaavr/libraries/SD/src/README.txt @@ -9,4 +9,3 @@ License: GNU General Public License V3 (C) Copyright 2010 SparkFun Electronics Now better than ever with optimization, multiple file support, directory handling, etc - ladyada! -