honey_the_codewitch
Well-known member
I'm porting some code to make it friendlier to graphics libraries like mine and LVGL.
I'm confused about byte order.
See the if() in the code below. I know how to change the byte order of the else block, but not the if true block using the registers.
I was hoping for some help there - the same thing applies to DMA transfers. I need to turn off byte swapping.
Could anyone show me the secret sauce? I tried changing the ArduinoSPI settings but it was already MSBFIRST which I'm pretty sure is what i need based on my work on other platforms.
I'm confused about byte order.
See the if() in the code below. I know how to change the byte order of the else block, but not the if true block using the registers.
I was hoping for some help there - the same thing applies to DMA transfers. I need to turn off byte swapping.
Could anyone show me the secret sauce? I tried changing the ArduinoSPI settings but it was already MSBFIRST which I'm pretty sure is what i need based on my work on other platforms.
C++:
void SSD1351_t3::writedata16(uint16_t d)
{
if (hwSPI) {
maybeUpdateTCR(LPSPI_TCR_PCS(1) | LPSPI_TCR_FRAMESZ(15) | LPSPI_TCR_CONT);
_pimxrt_spi->TDR = d;
_pending_rx_count++; //
waitFifoNotFull();
} else {
DIRECT_WRITE_HIGH(_dcport, _dcpinmask);
spiwrite(d >> 8);
spiwrite(d);
}
}