attiny icon indicating copy to clipboard operation
attiny copied to clipboard

tone support

Open cstickel opened this issue 11 years ago • 7 comments

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.

cstickel avatar Mar 26 '13 20:03 cstickel

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.)

damellis avatar Mar 31 '13 16:03 damellis

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.

cstickel avatar Mar 31 '13 22:03 cstickel

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.

damellis avatar Apr 01 '13 21:04 damellis

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.

cstickel avatar Apr 01 '13 22:04 cstickel

https://github.com/SpenceKonde/ATTinyCore has tone() support for ATTiny85.

zdila avatar Jan 23 '17 22:01 zdila

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.

chino avatar Jan 07 '23 04:01 chino

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.

chino avatar Jan 07 '23 04:01 chino