X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=boards%2Fsam3n-ek%2Ftemplates%2Fempty%2Fmain.c;h=8e5fb7826052bda9b9cf54a2dd415de3f11d6c48;hb=f6583713e24d19800f93733fb5adba6a8408b6f5;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..8e5fb782 100644 --- a/boards/sam3n-ek/templates/empty/main.c +++ b/boards/sam3n-ek/templates/empty/main.c @@ -41,30 +41,34 @@ #include "hw/hw_led.h" #include "hw/hw_lcd.h" +#include + #include -#include +#include #include #include #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 SpiDma 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();