flat arrays are a mandatory thing when working with DMA.
but, what is the recommended way to create a flat array for sure?
this does not work for n<23, and does not reliably work and n>=23.
const sometimes_flat= new Uint8Array(n); // does not generate *flat* arr. for n<23
this generates always a flat variable, but it's a string and not a arraybuffer as needed.
furthermore i can not create a empty buffer just specifying the length.
const always_flat_or_undefined= E.toString(1,2,3,4); // creates *flat* var even for <23 bytes
good to know, that these two behave like new UintXArray (and not like E.toString)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
flat arrays are a mandatory thing when working with DMA.
but, what is the recommended way to create a flat array for sure?
this does not work for n<23, and does not reliably work and n>=23.
this generates always a flat variable, but it's a string and not a arraybuffer as needed.
furthermore i can not create a empty buffer just specifying the length.
good to know, that these two behave like new UintXArray (and not like E.toString)
in fact, this does not work either:
my workaround for the moment: create always a UintXArray >=23 byte
but this wether very elegant, nor guaranteed to work with future firmware versions.
are there any recommendations how to create a flat UintXArray, independent of it's length?
thx!