spi.send with Uint16Array #264
Replies: 8 comments
-
Posted at 2014-04-30 by @gfwilliams Well, #2 should work - or: Is it possible that the byte ordering is wrong? I'm not 100% sure but does #2 have the same result as:
The other option (faster than #1) may be:
But if #2 (or some variant) will work, that would be ideal. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-30 by JumJum Thanks for the feedback, I now have some more options:
I'm sending 0xf800, which for ILI9341 is red So,where is the problem, between my ears, or in interpretation of data ? Oh, just checked version from yesterday, there is a new parameter for SPI called order. Will check it later today or tomorrow. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-30 by @gfwilliams @jumjum the SPI bit order won't help you - it's byte order that's your problem... It's whether you're storing data in little endian or big endian formats. This isn't a regression is it? I thought that the ILI9341 module worked just fine with the Graphics lib? Where are you getting the Uint16Array from? can't you just create the 16 bit numbers in the right order in the first place? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-30 by JumJum @gordon,
Data should have same format as for writing. I could switch upper and lower byte, thats correct. Any suggestion, how to do that ? May be a short assembler is best solution ? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-30 by @gfwilliams You could try:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-05-01 by JumJum It's very interesting, to see, what experts like Gordon can do with Javascript on this small board.
Next changed reading function in displaydriver to:
Now it takes 0.34 seconds, 44% faster. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-05-02 by JumJum Some more timing info: sending data to Display with spi.send(uintarray) needs 0,02 secs only |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-05-02 by @gfwilliams It's a real shame it's not easier to iterate over the array 3 at a time! You could just use SPI.send to read all the data at once, and could convert it with the assembler. You might get some speed improvement by doing:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-30 by JumJum
For the ILI99341 driver, I would like to send an Uint16Array via spi.send
I tried 3 versions yet
1st version is slowest, but works fine
2nd shows wrong colors and other minor problems
3rd is totally wrong
I did not test another option given with Graphics.drawImage. In my (poor) understanding, this is based on setPixel, which would be very slow.
For now I live with 1st solution, any other idea ?
Beta Was this translation helpful? Give feedback.
All reactions