From c4b51ff71877240d11773c63caf245a829a35e28 Mon Sep 17 00:00:00 2001 From: dzzxzz Date: Tue, 8 Mar 2011 06:04:00 +0000 Subject: [PATCH] update Fujitsu FM3 easy kit IAR project: add LCD/ADC/KEY/LED device support using RTGUI to display the ADC and key status on the 128x64 LCD git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1317 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- bsp/fm3/application.c | 33 ++-- bsp/fm3/board.c | 47 ------ bsp/fm3/board.h | 16 +- bsp/fm3/fm3_easy_kit.ewp | 205 ++++++++++++++++++++++ bsp/fm3/info.c | 174 +++++++++++++++++++ bsp/fm3/key.c | 110 ++++++++++++ bsp/fm3/key.h | 46 +++++ bsp/fm3/lcd.c | 356 +++++++++++++++++++++++++++++++++++++++ bsp/fm3/lcd.h | 167 ++++++++++++++++++ bsp/fm3/led.c | 135 +++++++++++++++ bsp/fm3/led.h | 41 +++++ bsp/fm3/rtconfig.h | 24 +++ 12 files changed, 1282 insertions(+), 72 deletions(-) create mode 100644 bsp/fm3/info.c create mode 100644 bsp/fm3/key.c create mode 100644 bsp/fm3/key.h create mode 100644 bsp/fm3/lcd.c create mode 100644 bsp/fm3/lcd.h create mode 100644 bsp/fm3/led.c create mode 100644 bsp/fm3/led.h diff --git a/bsp/fm3/application.c b/bsp/fm3/application.c index 14d7868ad..2b0501755 100644 --- a/bsp/fm3/application.c +++ b/bsp/fm3/application.c @@ -19,18 +19,31 @@ #include #include "board.h" +#include "led.h" + +#ifdef RT_USING_RTGUI +#include "key.h" +#include "adc.h" +#include "lcd.h" +#include +extern void rtgui_startup(); +#endif void rt_init_thread_entry(void *parameter) { - while(1) - { - rt_hw_led_on(LED1); - rt_hw_led_off(LED2); - rt_thread_delay(100); - rt_hw_led_off(LED1); - rt_hw_led_on(LED2); - rt_thread_delay(100); - } + rt_hw_led_init(); + +#ifdef RT_USING_RTGUI + rt_hw_key_init(); + rt_hw_adc_init(); + rt_hw_lcd_init(); + + /* re-init device driver */ + rt_device_init_all(); + + /* startup rtgui */ + rtgui_startup(); +#endif } int rt_application_init() @@ -40,7 +53,7 @@ int rt_application_init() init_thread = rt_thread_create("init", rt_init_thread_entry, RT_NULL, 1024, 21, 20); if(init_thread != RT_NULL) rt_thread_startup(init_thread); - + return 0; } diff --git a/bsp/fm3/board.c b/bsp/fm3/board.c index 68be481ce..ac19ca8ca 100644 --- a/bsp/fm3/board.c +++ b/bsp/fm3/board.c @@ -42,58 +42,11 @@ void rt_hw_timer_handler(void) rt_interrupt_leave(); } -void led_init(void) -{ - /*Select CPIO function*/ - LED_PFR &= ~LED_MASK; - /*Set Pin to turn off leds*/ - LED_PDOR |= LED_MASK; - /*Make led pins outputs*/ - LED_DDR |= LED_MASK; -} - -void rt_hw_led_on(int n) -{ - switch(n) - { - case LED1: - LED_PDOR &= ~LED1; - break; - case LED2: - LED_PDOR &= ~LED2; - break; - case LED3: - LED_PDOR &= ~LED3; - break; - default: - break; - } -} - -void rt_hw_led_off(int n) -{ - switch(n) - { - case LED1: - LED_PDOR |= LED1; - break; - case LED2: - LED_PDOR |= LED2; - break; - case LED3: - LED_PDOR |= LED3; - break; - default: - break; - } -} - /** * This function will initial FM3 Easy Kit board. */ void rt_hw_board_init() { - led_init(); /* init systick */ SysTick_Config(SystemFrequency/RT_TICK_PER_SECOND - 1); } diff --git a/bsp/fm3/board.h b/bsp/fm3/board.h index 251b4b31f..951db46f7 100644 --- a/bsp/fm3/board.h +++ b/bsp/fm3/board.h @@ -10,24 +10,12 @@ * Change Logs: * Date Author Notes * 2009-09-22 Bernard add board.h to this bsp - * 2010-02-04 Magicoe add board.h to LPC176x bsp + * 2011-03-04 lgnq add board.h to FM3 bsp */ #ifndef __BOARD_H__ #define __BOARD_H__ -#include "mb9bf506r.h" - -/*LEDs*/ -#define LED1 (1UL<<10) -#define LED2 (1UL<<11) -#define LED3 (1UL<<12) -#define LED_MASK (LED1 | LED2 | LED3) - -#define LED_PFR (FM3_GPIO->PFR3) -#define LED_DDR (FM3_GPIO->DDR3) -#define LED_PDOR (FM3_GPIO->PDOR3) - //Internal SRAM memory size[Kbytes] <8-64> //MB9BF500 : 32 //MB9BF504 : 32 @@ -36,8 +24,6 @@ #define FM3_SRAM_SIZE 32 #define FM3_SRAM_END (0x1FFFC000 + FM3_SRAM_SIZE * 1024) -void rt_hw_led_on(int n); -void rt_hw_led_off(int n); void rt_hw_board_init(void); #endif diff --git a/bsp/fm3/fm3_easy_kit.ewp b/bsp/fm3/fm3_easy_kit.ewp index fc42ee361..fb6411113 100644 --- a/bsp/fm3/fm3_easy_kit.ewp +++ b/bsp/fm3/fm3_easy_kit.ewp @@ -278,6 +278,7 @@ $PROJ_DIR$\ $PROJ_DIR$\CMSIS $PROJ_DIR$\..\..\include + $PROJ_DIR$\..\..\components\rtgui\include