X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=boards%2Fsam3n-ek%2Ftemplates%2Fempty%2Fmain.c;h=698992fee2962843f29b5cd5cba8ece32ee6a573;hb=a4e0e9b539899bf7cb0a0bae2bab53b7cfb5e39d;hp=0fc2146e082d73cc5dd27f052f67800b371bb894;hpb=b31313bb8069b73e75d7a330e17135ace483013f;p=bertos.git diff --git a/boards/sam3n-ek/templates/empty/main.c b/boards/sam3n-ek/templates/empty/main.c index 0fc2146e..698992fe 100644 --- a/boards/sam3n-ek/templates/empty/main.c +++ b/boards/sam3n-ek/templates/empty/main.c @@ -41,6 +41,8 @@ #include "hw/hw_led.h" #include "hw/hw_lcd.h" +#include + #include #include @@ -49,22 +51,24 @@ #include -struct SpiDmaAt91 spi; -static uint8_t raster[RAST_SIZE(LCD_WIDTH, LCD_HEIGHT)]; +/* Bitmap to display on the OLED display */ static Bitmap lcd_bitmap; -static int lcd_brightness = LCD_BACKLIGHT_MAX; +/* Raster associated to the Bitmap image */ +static uint8_t raster[RAST_SIZE(LCD_WIDTH, LCD_HEIGHT)]; +/* LCD spi context with DMA access */ +struct SpiDmaAt91 spi; static void init(void) { /* Enable all the interrupts */ IRQ_ENABLE; - /* Initialize debugging module (allow kprintf(), etc.) */ - kdbg_init(); - /* Initialize system timer */ - timer_init(); - /* Initialize LED driver */ - LED_INIT(); + /* Initialize debugging module (allow kprintf(), etc.) */ + kdbg_init(); + /* Initialize system timer */ + timer_init(); + /* Initialize LED driver */ + LED_INIT(); /* Init spi on dma to drive lcd */ spi_dma_init(&spi); spi_dma_setclock(LCD_SPICLOCK); @@ -72,17 +76,18 @@ static void init(void) lcd_ili9225_init(&spi.fd); /* Init the backligth display leds */ LCD_BACKLIGHT_INIT(); - lcd_setBacklight(lcd_brightness); - /* Draw an empty Bitmap on the screen */ - gfx_bitmapInit(&lcd_bitmap, raster, LCD_WIDTH, LCD_HEIGHT); - /* Refresh the display */ + lcd_setBacklight(LCD_BACKLIGHT_MAX); + /* Draw an empty Bitmap on the screen */ + gfx_bitmapInit(&lcd_bitmap, raster, LCD_WIDTH, LCD_HEIGHT); + /* Refresh the display */ lcd_ili9225_blitBitmap(&lcd_bitmap); - /* Initialize the keypad driver */ - kbd_init(); + /* Initialize the keypad driver */ + kbd_init(); } int main(void) { + /* Hardware initialization */ init();