adafruit / Adafruit_SHARP_Memory_Display

This is an Arduino library for the Adafruit Monochrome SHARP Memory Displays
http://www.adafruit.com/products/1393
Other
60 stars 54 forks source link

Add "clearBuffer" command to reduce screen flickering. #14

Closed pguerra75 closed 4 years ago

pguerra75 commented 6 years ago

This is likely not an issue for everyone, but for me using the 400x240 display on a SAMD21 clearing the screen before every refresh makes it flicker. To keep it looking smooth I added a "clearBuffer" command that allows the user to write new data to the screen, without completely clearing it first.

/**/ /! @brief Clears the content of the write buffer. / /**/ void Adafruit_SharpMem::clearBuffer() { memset(sharpmem_buffer, 0xff, (WIDTH * HEIGHT) / 8); }

ladyada commented 4 years ago

someone added it as a PR!

netkruzer commented 1 month ago

FYI, for future me/past me. This was added as "clearDisplayBuffer"

/**************************************************************************/
/*!
    @brief Clears the display buffer without outputting to the display
*/
/**************************************************************************/
void Adafruit_SharpMem::clearDisplayBuffer() {
  memset(sharpmem_buffer, 0xff, (WIDTH * HEIGHT) / 8);
}