X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=drv%2Flcd_gfx.c;h=2054e41cc1a2a2f75030d95908519e23dddc3cd7;hb=c4a2aaf58b87121634905fc689312000aec47ef6;hp=9a25cf094bb41cb315abe06fae814a689a6df901;hpb=9411f259330967f9ad4e0cccd98ef37e811ba257;p=bertos.git diff --git a/drv/lcd_gfx.c b/drv/lcd_gfx.c index 9a25cf09..2054e41c 100755 --- a/drv/lcd_gfx.c +++ b/drv/lcd_gfx.c @@ -16,6 +16,15 @@ /*#* *#* $Log$ + *#* Revision 1.4 2006/04/27 05:40:11 bernie + *#* Naming convention fixes; Partial merge from project_grl. + *#* + *#* Revision 1.3 2006/02/10 12:35:31 bernie + *#* Enforce CONFIG_* definitions. + *#* + *#* Revision 1.2 2006/01/23 23:11:27 bernie + *#* Use RASTER_SIZE() to compute... err... the raster size. + *#* *#* Revision 1.1 2006/01/16 03:50:57 bernie *#* Import into DevLib. *#* @@ -34,7 +43,16 @@ #include #include -#ifdef CONFIG_LCD_SOFTINT_REFRESH +/* Configuration sanity checks */ +#if !defined(CONFIG_LCD_SOFTINT_REFRESH) || (CONFIG_LCD_SOFTINT_REFRESH != 0 && CONFIG_LCD_SOFTINT_REFRESH != 1) + #error CONFIG_LCD_SOFTINT_REFRESH must be defined to either 0 or 1 +#endif +#if !defined(CONFIG_LCD_SOFTINT_REFRESH) || (CONFIG_LCD_SOFTINT_REFRESH != 0 && CONFIG_LCD_SOFTINT_REFRESH != 1) + #error CONFIG_LCD_SOFTINT_REFRESH must be defined to either 0 or 1 +#endif + + +#if CONFIG_LCD_SOFTINT_REFRESH /*! Interval between softint driven lcd refresh */ # define LCD_REFRESH_INTERVAL 20 /* 20ms -> 50fps */ @@ -174,10 +192,13 @@ #define LCD_CMD_RESET 0xE2 /*@}*/ +MOD_DEFINE(lcd) + + /* Status flags */ #define LCDF_BUSY BV(7) -#ifdef CONFIG_LCD_WAIT +#if CONFIG_LCD_WAIT /*! * \code * __ __ @@ -222,14 +243,14 @@ * as required by the LCD driver. */ DECLARE_WALL(wall_before_raster, WALL_SIZE) -static uint8_t lcd_raster[LCD_WIDTH * ((LCD_HEIGHT + 7) / 8)]; +static uint8_t lcd_raster[RASTER_SIZE(LCD_WIDTH, LCD_HEIGHT)]; DECLARE_WALL(wall_after_raster, WALL_SIZE) /*! Default LCD bitmap */ struct Bitmap lcd_bitmap; -#ifdef CONFIG_LCD_SOFTINT_REFRESH +#if CONFIG_LCD_SOFTINT_REFRESH /*! Timer for regular LCD refresh */ static Timer *lcd_refresh_timer; @@ -349,7 +370,7 @@ static inline void lcd_write(uint8_t c, uint8_t chip) /*! * Set LCD contrast PWM. */ -void lcd_setpwm(int duty) +void lcd_setPwm(int duty) { ASSERT(duty >= LCD_MIN_PWM); ASSERT(duty <= LCD_MAX_PWM); @@ -372,7 +393,7 @@ static void lcd_clear(void) } -static void lcd_writeraster(const uint8_t *raster) +static void lcd_writeRaster(const uint8_t *raster) { uint8_t page, rows; const uint8_t *right_raster; @@ -398,16 +419,19 @@ static void lcd_writeraster(const uint8_t *raster) } } - -void lcd_blit_bitmap(Bitmap *bm) +/** + * Update the LCD display with data from the provided bitmap. + */ +void lcd_blitBitmap(Bitmap *bm) { - lcd_writeraster(bm->raster); + MOD_CHECK(lcd); + lcd_writeRaster(bm->raster); } -#ifdef CONFIG_LCD_SOFTINT_REFRESH +#if CONFIG_LCD_SOFTINT_REFRESH -static void lcd_refresh_softint(void) +static void lcd_refreshSoftint(void) { lcd_blit_bitmap(&lcd_bitmap); timer_add(lcd_refresh_timer); @@ -424,6 +448,8 @@ static void lcd_refresh_softint(void) */ void lcd_init(void) { + MOD_CHECK(timer); + // FIXME: interrupts are already disabled when we get here?!? cpuflags_t flags; IRQ_SAVE_DISABLE(flags); @@ -471,7 +497,7 @@ void lcd_init(void) gfx_bitmapInit(&lcd_bitmap, lcd_raster, LCD_WIDTH, LCD_HEIGHT); gfx_bitmapClear(&lcd_bitmap); -#ifdef CONFIG_LCD_SOFTINT_REFRESH +#if CONFIG_LCD_SOFTINT_REFRESH /* Init IRQ driven LCD refresh */ lcd_refresh_timer = timer_new(); @@ -481,4 +507,6 @@ void lcd_init(void) timer_add(lcd_refresh_timer); #endif /* CONFIG_LCD_SOFTINT_REFRESH */ + + MOD_INIT(lcd); }