attiny
attiny copied to clipboard
tone support
Are there any plans to add support for tone()? There is another ATtiny core with tone support, but it doesn't seem to be maintained anymore: http://code.google.com/p/arduino-tiny/
Maybe the sourcecode from that core can be reused to get tone() working without to much work.
It would be good to include but I might not get to it for a while. In particular, it might require patches to the main Arduino core to allow tone() to use a different hardware timer. (It currently uses timer 2, which I don't think exists on the ATtiny's supported here.)
Isn't it possible to reuse the sourcecode from the other attiny core? http://code.google.com/p/arduino-tiny/source/browse/trunk/hardware/tiny/cores/tiny/Tone.cpp
Sorry that i can't contribute to the code, but i'm quite new to microcontroller development and that exceeds my knowledge.
Kind of, but that code needs to go into the Arduino core (and repository), not this ATtiny repository. This repository actually doesn't include the whole core, just the configuration (header) files that the main Arduino core needs to run on the ATtiny. So many improvement in functionality need to be integrated into the main Arduino core. But yes, in theory, it's possible to take the work from the arduino-tiny project and put it into the main Arduino core. But it might be a while before I get to it.
Since the other core does work great for projects, that use tone(), there is no need for a soon integration. It would be more a nice to have feature. The only reason not to use the other core is that it doesn't seem to be maintained anymore.
https://github.com/SpenceKonde/ATTinyCore has tone() support for ATTiny85.
I believe TinyCore does as well but it doesn't seem to support SoftwareSerial. I think I like the idea of using the real Arduino core instead and I was really enjoying this setup. Throwing in my +1 for this.
Not sure if this helps at all but it appears that the ATtiny85 has two timers. Maybe it's possible to simply instruct the Arduino Tone library to use a specific timer? or maybe there is a way to map Timer 2 to another existing timer?
https://www.etechnophiles.com/attiny85-pinout-specs-guide
It also has two 8-bit timers or counters, one high-speed, with four pulse-width modulations (PWM) outputs, and a four-channel 10-bit ADC.