/* Draws a number of pixels of the same color to the display.  */
EMSTATUS DMD_writeColor(uint16_t x, uint16_t y, uint8_t red, uint8_t green, uint8_t blue, uint32_t numPixels)
/* Draws a number of pixels of the same color to the display.  */
EMSTATUS DMD_writeColor(uint16_t x, uint16_t y, uint8_t red, uint8_t green, uint8_t blue, uint32_t numPixels)
{
   uint32_t clipRemaining;
   uint32_t statusCode;
   uint32_t color;
   if (!initialized){
      return DMD_ERROR_DRIVER_NOT_INITIALIZED;
   }
   statusCode = setPixelAddress(x, y);
   if (statusCode != DMD_OK){
      return statusCode;
   }
   clipRemaining = (dimensions.clipHeight - y - 1) * dimensions.clipWidth +
      dimensions.clipWidth - x;
   if (numPixels > clipRemaining){
      return DMD_ERROR_TOO_MUCH_DATA;
   }
   DMDIF_prepareDataAccess( );
   color = colorTransform24To16bpp(red, green, blue);
   DMDIF_writeDataRepeated(color, numPixels);
   return DMD_OK;
}