adafruit / Adafruit_ILI9341

Library for Adafruit ILI9341 displays
406 stars 281 forks source link

Please re-add pushColors (plural of pushColor) #29

Closed osos closed 7 years ago

osos commented 7 years ago

It seems that during the refactoring and optimization of the code, the pushColors functions was removed.

I see that the pushColor was re-added later, but I have some code relaying on the former pushColors (plural) which in turn could also take into consideration if data alignment has big/littleEndian.

Unfortunately I am not sure how to re-add the function myself.

PaintYourDragon commented 7 years ago

Suggest using writePixels() instead, which is part of the newer SPI-transaction-based code. You'll need to start/end the transaction, but otherwise the address window and write operation are similar to before, something like:

display.startWrite();
display.setAddrWindow(...);
display.writePixels(...);
display.endWrite();
ideaalab commented 4 years ago

We needed pushColors for a project from a couple of years ago. Solved it adding this:

void Adafruit_ILI9341::pushColors(void * colorBuffer, uint16_t nr_pixels, uint8_t async){
  if (hwSPI) spi_begin();

  *dcport |=  dcpinmask;
  *csport &= ~cspinmask;

  if (async==0) {
    SPI.dmaSend(colorBuffer, nr_pixels, 1);
    *csport |= cspinmask;
  } else {
    SPI.dmaSendAsync(colorBuffer, nr_pixels, 1);
  }

  if (hwSPI) spi_end();

Dont know if its ok, but the project is working fine.