Add support for ATtiny 0/1 series#1292
Conversation
Added the ATtiny 0/1 series with pin-out to the AVR platform
…reemovers-master
…of mixing the grouping around ATtiny
- also arrange supported platforms in alphabetical order
|
@jasoncoon , I just noticed that this never made it to the master branch. I got some errors when I tried the latest FastLED libraries and noticed some code is missing. After replacing fastpin_avr.h with my old version it ran just fine. |
|
If you rebase this on master I'll accept this PR if it's still relevant |
|
Would be great if someone could rework this and add the series 2 chips while their at it |
|
@zackees I've resolved the conflicts in the README against the master branch, no code conflicts. The CI checks are failing with a missing file . |
|
Sorry about that, i fixed my oopsie. If you rebase it should work. |
|
I rebased and pushed a new PR. Feel free to copy if you'd like a contributor badge. If no response then my PR goes in tomorrow at noon. Thank you for your stellar contribution to this library. I'll be making a build badge tomorrow to memorialize support in FastLED. |
|
Actually i think you can just git merge master. |
|
Thanks so much! Check out release_notes.md and feel free to issue a pull request if you thinks something should be added that people should know about your addition. I did a shallow dive on the attiny0/1 and it looks like there are quite a lot of chips in this low cost family! I put up a tester for attiny85, take a look Attiny85 test results: Surprisingly, all tests passed besides NoisyPlayground.ino. So i had to defer this test All the credit goes to Dan on that small binary size. I'll put in a compiled size test too and make sure that there aren't regressions in compiled binary size. Literally if someone includes iostream you guys are toast. And if that happens, a build badge will go red. Look for it in the compiled binary sizes section. |
|
Hi @zackees , thanks for maintaining this repository and merging the changes. I created #1718 to acknowledge credits to the main contributor for ATtiny, @jasoncoon . Longer story for this contribution:
About the library maintanence:
|
|
@freemovers would you able to help in validating if your reported errors resolved with the codes in master branch? Or release 3.7.8 when it's out. Thanks!
|
|
It compiles fine again for addressable LEDs with clock lines, thank you for that. That issue was already there when I made the changes, but was never able to figure out where the timer_millis were defined. |
|
I asked ai and it suggested this definition, i'm not going to use it because who knows if it actually works and is not a hallucination. But the important thing is that it looks like on some avr platforms its timer0_millis. I think this might solve your issue. Check out this suggested AI replacement and see if timer0_millis or some variation of that works for your platform. extern "C" {
# if defined(CORE_TEENSY) || defined(TEENSYDUINO)
extern volatile unsigned long timer0_millis_count;
# define MS_COUNTER timer0_millis_count
# elif defined(ATTINY_CORE)
extern volatile unsigned long millis_timer_millis;
# define MS_COUNTER millis_timer_millis
# elif defined(__AVR_ATtinyxy7__) || defined(__AVR_ATtinyxy6__) || defined(__AVR_ATtinyxy4__) || defined(__AVR_ATtinyxy2__)
extern volatile unsigned long timer_millis;
# define MS_COUNTER timer_millis
# elif defined(__AVR_ATmega4809__)
extern volatile unsigned long timer_millis;
# define MS_COUNTER timer_millis
# elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega2560__)
extern volatile unsigned long timer0_millis;
# define MS_COUNTER timer0_millis
# elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__)
extern volatile unsigned long timer0_millis;
# define MS_COUNTER timer0_millis
# else
extern volatile unsigned long timer_millis;
# define MS_COUNTER timer_millis
# endif
}; |
|
@freemovers just to confirm, the clockless version is having the error ? Are you able to locate the reletive examples for similar failure ? https://github.com/FASTLED/FastLED/tree/master/examples I think the possible cause is around these few lines, the confusion between Since this PR has already merged, I think you might be able to help with a new issue and/or PR . |
|
@freemovers yeah, what's the board you are using where you are getting this error linking error against the timer? I just did a test with a generic |
|
I think it's one of the ATtiny boards, since @freemovers started PR 1061. How about running a clockless examples on Attiny85 ? |
|
I'm testing with the ATtiny1616, using the megaTinyCore from SpenceKonde, and yes, it is the clockless version throwing that error (using the DemoReel100). I tried all different timers before, but none worked. I just don't understand where that timer is defined. My guess it is expected in FastLED defined by the core already, and the megaTinyCore might define it totally different. |
|
Bad news see that This source file gives a clue on whats going on, see comment: https://github.com/SpenceKonde/DxCore/blob/master/megaavr/cores/dxcore/wiring.c |
|
Ahh... looks like we have wiring.cpp in our repo so it looks like this just ins't being defined for your platform... |
|
Nevermind, wiring.cpp is compiled out. |
|
Yeah I'm more convinced that the attiny libs are stealing timer_millis out of the wiring.cpp file. This one has a pretty good write up on how to define it. |



This PR has been created to resolved merge conflicts to support ATtiny platforms, by cherry-picked all commits from https://github.com/FastLED/FastLED/pull/1183/commits.
As #1183 was created to resolve conflicts in #1061, the 2 PR(s) could be closed by merging this.
This PR also related to issues for ATmega4809: #858 , #716. These 2 issues for ATmega4809 seems to be partially supported by now.
Another small change in this PR is that
AVR_ATtinyxy?insrc/platforms/avr/fastpin_avr.hhas been replaced with__AVR_ATtinyxy?__for consistencies, and it seems ATtiny wasn't supported yet, so it's shouldn't be a big deal.