I'm reading chunks of data using Waveform, which returns UInt values.
There are accompanying single measurements via analogRead. Unfortunately analogRead values need to be converted from Float to Integer to be comparable with the Waveform data. Is there a way to make analogRead return integers (may be a flag)?
Any other reliable, though probably hacky way to get ADC data fast and as int?
Just multiply the analogRead value by 65536 (assuming you're reading a 16 bit waveform?) - that's all you should need.
Well, of course. In the code there is a function jshPinAnalogFast - can I acces it from JS?
... or can and want you enhance analogRead to take an optional 2nd parameter (boolean, true) to return the integer?
You can't access it from JS - I don't understand why you'd want to? It produces a lower quality output most of the time - but when you're calling it from JS the speed really doesn't matter - it's a very small percentage of the overall JS execution time
Having seen that in the C code for analogRead, as one of the last steps the data is divided by 65536, I thought why not shortcut it.
I'm really fine with multiplying again in my special case.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem