How to create an array of 16-bit words?
Posted: Tue Aug 09, 2016 10:06 pm
I'd like the use the ADC in 12-bit resolution mode and write to a buffer of 16-bit words. How to create this array in uPython? Doing "a = array.array('i',range(100))" creates an array of 4-byte words. Is there something like bytearray but for words?
I guess there is plenty of RAM in the CPU and I could use 4-byte arrays for the buffer. But since my final goal is to send the ADC samples over the radio_fast link, I want to pack the samples efficiently into the transmission frame, which has a max payload of 32 bytes. What are the available functions for picking out individual words and bytes from a long word?
I guess there is plenty of RAM in the CPU and I could use 4-byte arrays for the buffer. But since my final goal is to send the ADC samples over the radio_fast link, I want to pack the samples efficiently into the transmission frame, which has a max payload of 32 bytes. What are the available functions for picking out individual words and bytes from a long word?