/* Optimised routine to draw a horizontal line faster than setting individual pixels.  */
void lcdDrawHLine(uint16_t x0, uint16_t x1, uint16_t y, uint16_t color)
/* Optimised routine to draw a horizontal line faster than setting individual pixels.  */
void lcdDrawHLine(uint16_t x0, uint16_t x1, uint16_t y, uint16_t color)
{
  uint16_t x, pixels;
  if (x1 < x0)
  {
    x = x1;
    x1 = x0;
    x0 = x;
  }
  if (x1 >= lcdGetWidth())
  {
    x1 = lcdGetWidth() - 1;
  }
  if (x0 >= lcdGetWidth())
  {
    x0 = lcdGetWidth() - 1;
  }
  ili9325SetCursor(x0, y);
  ili9325WriteCmd(ILI9325_COMMANDS_WRITEDATATOGRAM);
  for (pixels = 0; pixels < x1 - x0 + 1; pixels++)
  {
    ili9325WriteData(color);
  }
}