/* Sets the horizontal timings of the LCD controller. Meaningful for both STN and TFT displays.  */
void LCD_SetHorizontalTimings(unsigned int hbp, unsigned int hpw, unsigned int hfp)
/* Sets the horizontal timings of the LCD controller. Meaningful for both STN and TFT displays.  */
void LCD_SetHorizontalTimings(unsigned int hbp, unsigned int hpw, unsigned int hfp)
{
    ASSERT(((hbp-1) & 0xFFFFFF00) == 0,
           "LCD_SetHorizontalTimings: Wrong hbp value.\n\r");
    ASSERT(((hpw-1) & 0xFFFFFFC0) == 0,
           "LCD_SetHorizontalTimings: Wrong hpw value.\n\r");
    ASSERT(((hfp-1) & 0xFFFFFF00) == 0,
           "LCD_SetHorizontalTimings: Wrong hfp value.\n\r");
    AT91C_BASE_LCDC->LCDC_TIM2 = (hbp-1) | ((hpw-1) << 8) | ((hfp-1) << 24);
}