Skip to content

2.5.0 - A gargantuan update! Lots of new stuff!

Compare
Choose a tag to compare
@SpenceKonde SpenceKonde released this 18 Dec 11:56
· 777 commits to master since this release

Totally Rewritten Wire library

Among other things, it supports DualMode (and master/slave without dual mode), which has been an oft-requested issue.

  • Completely new Wire.h library with exciting features - Thanks to @MX682X!
    • See the Wire library readme for more details.
    • Master + Slave on the same TWI - either using the same pins or in dual mode
    • Support for TWI1 assuming your device has it.
    • Enhanced slave functionality:
      • When set to match multiple addresses, method provided to find which address was used most recently.
      • After the master has read data from the slave, method provided to find out how many bytes were actually read.
      • Slave now has a way to test whether there is currently an ongoing transaction.
        All that, and it uses less flash too!

Serial is better now too!

That's not the only thing that's seen major rewrites: So has Serial - also thanks to @MX682X! These changes aren't as comprehensive, and I did more work here than on Wire.h (where I did virtually nothing other than the documentation). Check out the Serial Reference for more details, but in short

  • Added support for loopback, rs485, open drain mode!!
  • Added support for using event input instead of the RX pin (Untested)
  • Even added support for MSPI and synch (clocked) mode
  • Reimplemented ISRs in assembly, saving up to 1k of flash, and improving execution time such that you could receive bursts of characters at the maximum baud rate and not miss characters.
  • Adjusted serial buffer size 512b and 1k parts by adding an intermediate 32b serial buffer size.
  • Hoped for size improvements didn't materialize, but the assembly was enough to keep it from getting too bloated, at least.

Other new features:

  • Expanded Event library. Greatly Improved functionality for portable code/libraries
    • Add a set of compatibility defines to make life easier for people porting non-Event-library event-using code to 0/1-series.
  • Actually prevent disabling warnings - -Wall for all! You should not be compiling code with warnings disabled, the vast majority of the time, they're pointing to problems, and in the cases that aren't bugs, they're still a weak point that future bugs could come from (and that people will comment on when you post the code on forums to ask for help). I thought I'd done this a long time ago. Also pull in some warning-related flags from DxCore, including making implicit function declarations error, since the implied declarations when this happens are basically never result in working code, but it occasionally compiles and malfunctions.
  • Major progress on doc enhancements.
  • Using millis or micros (or rather attempting to) when they are unavailable due to millis being disabled, or in the case of micros, RTC used as millis time source, give better errors. You can test for #if defined(millis) and #if defined(micros) to check if those are available.
  • Clarified licence (for one thing, renamed to a .md so people can read it more easily, and know that it's readable if they're on windows) for tinyNeoPixel.
  • Harmonize Comparator.h with DxCore.
    Add avrdude.conf for the 32k 2-series parts which are now becoming available.
  • Port micros and delay-microseconds improvements from DxCore. (delayMicroseconds is more accurate now for the compiletime-unknown delays, and the micros math is faster because it was reimplemented in hand tuned assembly for the most important speeds).
  • SerialUPDI reference now links to it's actual location.
  • Port new attach interrupt from DxCore.
  • Port new printf option from DxCore.
  • Update callbacks to match DxCore 1.4.0, most notably the init_reset_flags(). It will automatically clear reset flags if not overridden, stashing them in GPIOR0 (chosen because has lower overhead than a variable)
  • Platform.txt organization and commenting. Fix issues where defines were missing from lib-discovery phase.
  • Reduce flash footprint of pinMode.
  • Improve methods used to block attempts to use "upload using programmer" when an optiboot board is selected. That confiuration is guaranteed not to work, and we should not do things that we know 100% will not work. We would need a merged output file for this, but the IDE doesn;t make those for us here. (only over on attinycore, where they're not usable and we must go out of our way to delete the damned things)
  • Timers.h shared with DxCore.

Bugfixes

  • Recent change to C++17 required additions to new.cpp and new.h, including sized deallocation (delete) and alignment-aware new and delete operators. The sized deallocation operator is called when existing code that worked before is compiled to the C++ 17 standard; since free() doesn't care about the size, implementation was straightforward. Discussion is ongoing about the aligned new and delete operators, which are also new in this version of the standards. It is likely that we will not support them, since other Arduino cores aren't even building to C++ 17 standard, so if your code needs aligned new/delete, it also won't work anywhere else in Arduino-land. While we are not shy about adding features, we do so only to support hardware features. If conditions change we will revisit this matter.
  • Fix timekeeping on clock speeds only supported with external clocks or tuning when a TCA or TCB is used for millis (it's still busted with the TCD)
  • Correct SYSCFG0 fuse settings when burning bootloader for 2-series parts - they default the reserved bits to 1 not 0, and worse still, setting them to 0 enables a mode we probably don't want.
  • Stop clearing fuse 4 by writing the default values for TCD0 on a 1-series. Now, with great difficulty, we only set that on parts that actually have the type D timer in order to keep our promise of burn bootloader restoring the chip to a fully known state. (well, except for the user row, and EEPROM if you've got it set to retain).
  • Fix theoretical EEPROM.h bug inherited from avr-libc, and keep millis() from losing time when writing more than one byte at a time; update and harmonize with DxCore.
  • Fix 402 with bad signature support.
  • Fix names of .lst and .map
  • Fix bug with disabled millis on tinyNeoPixel libraries not working. Again.

Like I said, this is HUGE.....