ADCTouch for megaTinyCore #395
Replies: 3 comments 1 reply
-
Definitely possible. 2-series would need completely different implementation than 0/1-series, megaavr 0-series and AVR Dx-series (though all those parts could share one implementation - maybe with a couple of #defines for the maximum valuie of options and the like); . So I would stick to 0/1-series parts for this. If a classic AVR can do this these should be able to do it better. You have control over precisely how long the sampling time is in ADC clocks and can clock the ADC up to 1.5 MHz (megaTinyCore defaults to 1.0 or 1.25 depending on if it's 16 or 20 mhz derived clock)., that is like 6x faster than classic AVR (but you make up for the faster clock with longer sampling time if needed) you can swap the sampling cap between two values (that bit I think is only tinyAVR 0/1, not on the Dx series)...... Yeah definitely possible to adapt, And now I click the link and scroll through the code, goddamn that code is incredibly crude. You're saying that code gives meaningful output? |
Beta Was this translation helpful? Give feedback.
-
I generalized it to work on megaTinyCore 2.3.0+ DxCore 1.3.0+ amd ATTinyCore 2.0.0 (not yet released) .... any core that allows reading internal voltage sources with an ADC_GROUND constant passed to analogRead() will just work with it now. I can't say I'm super happy with how it behaves, it oscillates ( I suspect in response to local electromagnetic noise) on timescales longer than a set of samples. which is rather annoying. Also if you use an exact power of 2 as the number of samples, it uses less flash. I think someone who has more time on their hands than I do ,.I got interested in this stupid thing and didn;'t do other tasks that reaolly are important, likre ,my overdue taxes :-( |
Beta Was this translation helpful? Give feedback.
-
Hello all, at first of course I would like to say thank you for this project - its really amazing!
I am currently stuck with a not compatible library for capsense using only a single pin: ADCTouch
It is basically doing the following:
Do you see a chance to adapt it to work with megaTinyCore?
Or can you maybe give a helping hand to translate the registers ADMUX, ADCSRA, ADSC? Until now I was only using arduino core functionalities and user friendly libraries :-) but with some guidance I would give it a try and share the results if I am successful.
Thank you very much in advance.
Beta Was this translation helpful? Give feedback.
All reactions