#ifndef GFXDRIVER_H
#define GFXDRIVER_H


/**
 * Base address of the first LCD controller
 */
#define LCD_IOBASE0   0x600

/**
 * Base address of the second LCD controller
 */
#define LCD_IOBASE1   0x500

/**
 * The brightness PWM signal is derived from the LCD_CLOCK.
 * Some displays have constraints on the duty cycle of the
 * clock signal, so the minimum and maximum duty cycles can be
 * set by LCD_MINPWMON and LCD_MINPWMOFF (in timer ticks)
 *
 * \note
 *   If you have problems with your LCD, you should try
 *   higher PWM values first! I had a real debugging
 *   nightmare when i got random pixels on my display,
 *   only to find out that the timing was too tight..
 *
 *   50 and 10 should do for any SED1520 driven display,
 *   while still allowing brightness control between 4 and
 *   99.2% (i even tried heating it with a hairdryer,
 *   because the display controller seems to get slower
 *   when it's warm :)
 */
#define LCD_CLOCK       2000
#define LCD_MINPWMON      50
#define LCD_MINPWMOFF     10


/**
 * Use this if you want to mount the display upside down.
 * (Thanks to Robert Dubber)
 */
// #define LCD_UPSIDEDOWN


/**
 * Width of the LCD display.
 *
 */
#define LCD_WIDTH   122


/**
 * Height of the LCD display. This should always be a
 * multiple of 8 pixels, because SED1520 Displays
 * are organized in pages of 8 vertical pixels per byte.
 */
#define LCD_HEIGHT   32


/**
 * Number of LCD pages. Usually (LCD_HEIGHT+7)/8
 */
#define LCD_PAGES    ((LCD_HEIGHT+7)/8)

extern  void  LCD_Init();
extern  void  LCD_Done();

extern  void  LCD_Clear(unsigned char pattern = 0x00);
extern  void  LCD_Update(Bitmap *bm);
extern  void  LCD_SetBrightness(int level);

#endif