Skip to content

2.2.7 - takeOverTCA0, openDrain() I/O

Compare
Choose a tag to compare
@SpenceKonde SpenceKonde released this 10 Feb 15:03
· 1355 commits to master since this release

This is planned as the final 2.2.x release with 2-series support starting in 2.3.0, and I want a release with all the non-2-series changes out, so we only have the 2-series as a headline thing waiting on 2.3.0 - but I wanted to get testing versions of 2.3.0 in peoples' hands quickly. Plus, it turned out that an update to avrdude.conf made the difference between working and not working with a bunch of new programmers, so we want that in the hands of everyone ASAP too,

So let's release this, and soon a 2.3.0-dev will be in master with 2-series parts sketched in, but no guarantees that anything works. Anyway, this adds the timer takeover functions (tell the core you're taking full control of the timer and to pretend it doesn't exist), and openDrain() (digitalWrite-esque wrapper around using a pin as an open drain output). And a few minor changes/fixes

2.2.7 changes:

  • Clean up Servo formatting and comments and synchronize with DxCore version of library.
  • We were waiting for ENRDY to be set before changing enable-protected registers of TCD0. That doesn't appear to be needed. We just can't re-enable it until ENRDY is set. It makes the glitch when turning PWM off or on... maybe 6 CLK_PER shorter? I think under default settings, the loop goes from one iteration to none....
  • Do not initialize the the compare values of TCA0. 1. They are guaranteed by hardware to start up at 0, and we don't CARE what they start up as, because before the core turns any of them on, it sets them to a value. 24 bytes saved! (STS x 6)
  • Add takeOverTCA0(), takeOverTCD0(). Calling these will set a flag that tells analogWrite() and digitalWrite() not to try to configure these timers, and instead to act like the pin has no PWM functionality. User assumes responsibility for the management of Waveform Output.
  • Update avrdude.conf to fix support for Snap, PICKit and Curiosity programmer options.
  • Fix macro definitions of sq() and constrain() which were still vulnerable to stupid stuff caused by macro leading to arguments being evaluated multiple times.
  • Add openDrain(), openDrainFast() - LOW, FLOAT, and CHANGE are supported. LOW set pin to output, FLOAT (#defined as 1 now) sets it input, and CHANGE toggles it. It does turn off PWM, and it does set the PORTx.OUT for that pin to 0 so carelessness can't lead you to switching a pin left set to HIGH's output on (on the reasoning that you may be switching a line connected to something that could be damaged if you drove it high). It does not, however, touch the PINnCTRL register (so pullup is left on if you'd already set it that way). However openDrainFast() - the fast-I/O version of that function - does NOT touch the PWM or PORTx.OUT register.
  • IDE should now highlight a few more keywords associated with megaTinyCore.
  • Minor formatting improvements in ChangeLog.md.
  • Update avr-gcc toolchain to azduino3.

(note - this is the second try at this release, hence the underscore in version number - I didn't check the CI results until after I'd released, and it turned out to be broken on 0-series. I pulled that after a half hour, without it ever having been available on board manager, but github won't let me reuse version numbers - you can never truly delete them)