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

    const sometimes_flat= E.toUint8Array(...data)
    const sometimes_flat= E.toArrayBuffer(...data) 
    

    in fact, this does not work either:

    const flat_str= E.toString(1,2,3,4);      
    const not_flat_arr= E.toUint8Array( flat_str);  
    

    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!

About

Avatar for mrQ @mrQ started