projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add comments and reformat.
[bertos.git]
/
boards
/
sam3n-ek
/
examples
/
display
/
main.c
diff --git
a/boards/sam3n-ek/examples/display/main.c
b/boards/sam3n-ek/examples/display/main.c
index b6c856e052513291195502dc3a4c99d42863b5b0..d79775e8d523fe1b8a408624b81719aecfa53197 100644
(file)
--- a/
boards/sam3n-ek/examples/display/main.c
+++ b/
boards/sam3n-ek/examples/display/main.c
@@
-35,21
+35,31
@@
* \author Stefano Fedrigo <aleph@develer.com>
*/
* \author Stefano Fedrigo <aleph@develer.com>
*/
+#include "bitmaps.h"
+
#include "hw/hw_led.h"
#include "hw/hw_lcd.h"
#include "hw/hw_led.h"
#include "hw/hw_lcd.h"
-#include "bitmaps.h"
+
+#include <cfg/debug.h>
#include <cpu/irq.h>
#include <cpu/irq.h>
+
#include <drv/timer.h>
#include <drv/kbd.h>
#include <drv/timer.h>
#include <drv/kbd.h>
-#include <cpu/arm/drv/spi_dma_at91.h>
#include <drv/lcd_ili9225.h>
#include <drv/lcd_ili9225.h>
+
+#include <cpu/arm/drv/spi_dma_at91.h>
+
#include <gfx/gfx.h>
#include <gfx/font.h>
#include <gfx/text.h>
#include <gfx/gfx.h>
#include <gfx/font.h>
#include <gfx/text.h>
+
#include <gui/menu.h>
#include <gui/menu.h>
+
#include <icons/logo.h>
#include <icons/logo.h>
+
#include <io/kfile.h>
#include <io/kfile.h>
+
#include <kern/signal.h>
#include <kern/proc.h>
#include <kern/signal.h>
#include <kern/proc.h>
@@
-60,13
+70,13
@@
#define PROC_STACK_SIZE KERN_MINSTACKSIZE * 2
#if CONFIG_KERN_HEAP
#define PROC_STACK_SIZE KERN_MINSTACKSIZE * 2
#if CONFIG_KERN_HEAP
-#define hp_stack NULL
-#define lp_stack NULL
-#define led_stack NULL
+
#define hp_stack NULL
+
#define lp_stack NULL
+
#define led_stack NULL
#else
#else
-static PROC_DEFINE_STACK(hp_stack, PROC_STACK_SIZE);
-static PROC_DEFINE_STACK(lp_stack, PROC_STACK_SIZE);
-static PROC_DEFINE_STACK(led_stack, PROC_STACK_SIZE);
+
static PROC_DEFINE_STACK(hp_stack, PROC_STACK_SIZE);
+
static PROC_DEFINE_STACK(lp_stack, PROC_STACK_SIZE);
+
static PROC_DEFINE_STACK(led_stack, PROC_STACK_SIZE);
#endif
struct SpiDmaAt91 spi;
#endif
struct SpiDmaAt91 spi;
@@
-81,21
+91,21
@@
static hptime_t start, end;
INLINE void led_on(int idx)
{
if (idx == 0)
INLINE void led_on(int idx)
{
if (idx == 0)
- LED_
ON(LED_BLUE_PIN
);
+ LED_
BLUE_ON(
);
else if (idx == 1)
else if (idx == 1)
- LED_
ON(LED_GREEN_PIN
);
+ LED_
GREEN_ON(
);
else if (idx == 2)
else if (idx == 2)
- LED_
ON(LED_AMBER_PIN
);
+ LED_
AMBER_ON(
);
}
INLINE void led_off(int idx)
{
if (idx == 0)
}
INLINE void led_off(int idx)
{
if (idx == 0)
- LED_
OFF(LED_BLUE_PIN
);
+ LED_
BLUE_OFF(
);
else if (idx == 1)
else if (idx == 1)
- LED_
OFF(LED_GREEN_PIN
);
+ LED_
GREEN_OFF(
);
else if (idx == 2)
else if (idx == 2)
- LED_
OFF(LED_AMBER_PIN
);
+ LED_
AMBER_OFF(
);
}
static bool led_blinking;
}
static bool led_blinking;
@@
-277,17
+287,6
@@
static void uptime(Bitmap *bm)
/*
* Lcd
*/
/*
* Lcd
*/
-static void setBacklight(unsigned level)
-{
- unsigned i;
-
- if (level > LCD_BACKLIGHT_MAX)
- level = LCD_BACKLIGHT_MAX;
-
- for (i = level; i <= LCD_BACKLIGHT_MAX; i++)
- LCD_BACKLIGHT_LEVEL_UP();
-}
-
static void setBrightness(Bitmap *bm)
{
while (1)
static void setBrightness(Bitmap *bm)
{
while (1)
@@
-306,7
+305,7
@@
static void setBrightness(Bitmap *bm)
{
if (++lcd_brightness > LCD_BACKLIGHT_MAX)
lcd_brightness = 0;
{
if (++lcd_brightness > LCD_BACKLIGHT_MAX)
lcd_brightness = 0;
- setBacklight(lcd_brightness);
+
lcd_
setBacklight(lcd_brightness);
}
}
}
}
}
}
@@
-361,7
+360,7
@@
int main(void)
spi_dma_setclock(LCD_SPICLOCK);
lcd_ili9225_init(&spi.fd);
LCD_BACKLIGHT_INIT();
spi_dma_setclock(LCD_SPICLOCK);
lcd_ili9225_init(&spi.fd);
LCD_BACKLIGHT_INIT();
- setBacklight(lcd_brightness);
+
lcd_
setBacklight(lcd_brightness);
gfx_bitmapInit(&lcd_bitmap, raster, LCD_WIDTH, LCD_HEIGHT);
gfx_setFont(&lcd_bitmap, &font_luBS14);
gfx_bitmapInit(&lcd_bitmap, raster, LCD_WIDTH, LCD_HEIGHT);
gfx_setFont(&lcd_bitmap, &font_luBS14);