summaryrefslogtreecommitdiff
path: root/bsp/mb9bf500r
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2021-05-28 16:20:08 +0800
committerGitHub <[email protected]>2021-05-28 16:20:08 +0800
commit92beddf3bccf6346e26aa097f82464456fb8e6bd (patch)
tree197e4a108118dda016ea02274172f0c40e7ee8ed /bsp/mb9bf500r
parentb18a99b44240ec3152011e159cc24a5af8dff0ce (diff)
parent03f4d40e30f3c94e1db0b3a65b3610dee695694a (diff)
Merge pull request #4737 from mysterywolf/3,1,xformatv3.1.5
[lts 3.1.x] format codes
Diffstat (limited to 'bsp/mb9bf500r')
-rw-r--r--bsp/mb9bf500r/adc.c92
-rw-r--r--bsp/mb9bf500r/adc.h10
-rw-r--r--bsp/mb9bf500r/application.c158
-rw-r--r--bsp/mb9bf500r/board.c10
-rw-r--r--bsp/mb9bf500r/cpuusage.h2
-rw-r--r--bsp/mb9bf500r/key.c94
-rw-r--r--bsp/mb9bf500r/lcd.c174
-rw-r--r--bsp/mb9bf500r/lcd.h230
-rw-r--r--bsp/mb9bf500r/led.c44
-rw-r--r--bsp/mb9bf500r/led.h10
-rw-r--r--bsp/mb9bf500r/rtconfig.h14
-rw-r--r--bsp/mb9bf500r/startup.c76
12 files changed, 457 insertions, 457 deletions
diff --git a/bsp/mb9bf500r/adc.c b/bsp/mb9bf500r/adc.c
index 03017a1030..afb1f47210 100644
--- a/bsp/mb9bf500r/adc.c
+++ b/bsp/mb9bf500r/adc.c
@@ -7,7 +7,7 @@
* Date Author Notes
* 2011-03-03 lgnq
*/
-
+
#include <rtthread.h>
#include <rthw.h>
#include "mb9bf506r.h"
@@ -29,45 +29,45 @@ static rt_err_t rt_adc_init(rt_device_t dev)
if(!(dev->flag & RT_DEVICE_FLAG_ACTIVATED))
{
- /* I/O setting AN08 - P18 */
+ /* I/O setting AN08 - P18 */
FM3_GPIO->ADE |= 0x100;
- FM3_GPIO->PFR1 = 0x100;
-
- /* A/DC setting */
- FM3_ADC0->SCIS1 = 0x01;
- FM3_ADC0->ADSS1 = 0x00; /* sampling timming ADST0 */
- FM3_ADC0->ADST1 = 0x43;
- FM3_ADC0->ADCT = 0x02;
- FM3_ADC0->SCCR = 0x10; /* FIFO clear,single mode */
- FM3_ADC0->CMPCR = 0x00; /* disable comparator */
-
- /* starting A/DC */
- FM3_ADC0->SCCR |= 0x01; /* A/DC start */
-
+ FM3_GPIO->PFR1 = 0x100;
+
+ /* A/DC setting */
+ FM3_ADC0->SCIS1 = 0x01;
+ FM3_ADC0->ADSS1 = 0x00; /* sampling timming ADST0 */
+ FM3_ADC0->ADST1 = 0x43;
+ FM3_ADC0->ADCT = 0x02;
+ FM3_ADC0->SCCR = 0x10; /* FIFO clear,single mode */
+ FM3_ADC0->CMPCR = 0x00; /* disable comparator */
+
+ /* starting A/DC */
+ FM3_ADC0->SCCR |= 0x01; /* A/DC start */
+
dev->flag |= RT_DEVICE_FLAG_ACTIVATED;
- }
- return RT_EOK;
+ }
+ return RT_EOK;
}
static rt_err_t rt_adc_control(rt_device_t dev, int cmd, void *args)
{
- RT_ASSERT(dev != RT_NULL);
+ RT_ASSERT(dev != RT_NULL);
- switch (cmd)
- {
- case RT_DEVICE_CTRL_ADC_START:
+ switch (cmd)
+ {
+ case RT_DEVICE_CTRL_ADC_START:
FM3_ADC0->SCCR |= 0x1;
- break;
-
- case RT_DEVICE_CTRL_ADC_RESULT:
+ break;
+
+ case RT_DEVICE_CTRL_ADC_RESULT:
while(FM3_ADC0->ADSR & 0x1)
;
*((rt_uint16_t*)args) = FM3_ADC0->SCFD;
*((rt_uint16_t*)args) = *((rt_uint16_t*)args) >> 6;
*((rt_uint16_t*)args) = (*((rt_uint16_t*)args)*3300)/1024;
- break;
- }
- return RT_EOK;
+ break;
+ }
+ return RT_EOK;
}
extern struct rt_messagequeue mq;
@@ -76,29 +76,29 @@ rt_uint16_t adc_value;
static void adc_thread_entry(void *parameter)
{
rt_device_t device;
-
+
#ifdef RT_USING_RTGUI
struct rtgui_event_command ecmd;
-
+
RTGUI_EVENT_COMMAND_INIT(&ecmd);
ecmd.type = RTGUI_CMD_USER_INT;
ecmd.command_id = ADC_UPDATE;
#else
struct lcd_msg msg;
-#endif
+#endif
device = rt_device_find("adc");
while(1)
{
- rt_device_control(device, RT_DEVICE_CTRL_ADC_START, RT_NULL);
+ rt_device_control(device, RT_DEVICE_CTRL_ADC_START, RT_NULL);
rt_device_control(device, RT_DEVICE_CTRL_ADC_RESULT, &adc_value);
pwm_update(adc_value/3);
#ifdef RT_USING_RTGUI
rtgui_thread_send(info_tid, &ecmd.parent, sizeof(ecmd));
#else
msg.type = ADC_MSG;
- msg.adc_value = adc_value;
+ msg.adc_value = adc_value;
rt_mq_send(&mq, &msg, sizeof(msg));
#endif
rt_thread_delay(20);
@@ -108,22 +108,22 @@ static void adc_thread_entry(void *parameter)
static rt_thread_t adc_thread;
void rt_hw_adc_init(void)
{
- adc.type = RT_Device_Class_Char;
- adc.rx_indicate = RT_NULL;
- adc.tx_complete = RT_NULL;
- adc.init = rt_adc_init;
- adc.open = RT_NULL;
- adc.close = RT_NULL;
- adc.read = RT_NULL;
- adc.write = RT_NULL;
- adc.control = rt_adc_control;
- adc.user_data = RT_NULL;
+ adc.type = RT_Device_Class_Char;
+ adc.rx_indicate = RT_NULL;
+ adc.tx_complete = RT_NULL;
+ adc.init = rt_adc_init;
+ adc.open = RT_NULL;
+ adc.close = RT_NULL;
+ adc.read = RT_NULL;
+ adc.write = RT_NULL;
+ adc.control = rt_adc_control;
+ adc.user_data = RT_NULL;
adc_thread = rt_thread_create("adc", adc_thread_entry, RT_NULL, 384, 26, 5);
- if(adc_thread != RT_NULL)
+ if(adc_thread != RT_NULL)
rt_thread_startup(adc_thread);
-
- /* register a character device */
- rt_device_register(&adc, "adc", RT_DEVICE_FLAG_RDWR);
+
+ /* register a character device */
+ rt_device_register(&adc, "adc", RT_DEVICE_FLAG_RDWR);
}
diff --git a/bsp/mb9bf500r/adc.h b/bsp/mb9bf500r/adc.h
index f8bc628b76..c8846b0beb 100644
--- a/bsp/mb9bf500r/adc.h
+++ b/bsp/mb9bf500r/adc.h
@@ -7,18 +7,18 @@
* Date Author Notes
* 2011-03-03 lgnq
*/
-
+
#ifndef __ADC_H__
#define __ADC_H__
/* Exported constants ---------------------------------------------------------*/
/* Exported macro -------------------------------------------------------------*/
-#define ADC_MODE_SINGLE 0x00UL
-#define ADC_MODE_SCAN 0x01UL
-#define ADC_MODE_TAILGATE 0x02UL
+#define ADC_MODE_SINGLE 0x00UL
+#define ADC_MODE_SCAN 0x01UL
+#define ADC_MODE_TAILGATE 0x02UL
#define RT_DEVICE_CTRL_ADC_START 0xF1 /* start ADC conversion */
-#define RT_DEVICE_CTRL_ADC_RESULT 0xF2 /* get ADC result */
+#define RT_DEVICE_CTRL_ADC_RESULT 0xF2 /* get ADC result */
#define ADC_UPDATE 0
diff --git a/bsp/mb9bf500r/application.c b/bsp/mb9bf500r/application.c
index d738d91b5a..1cbd0c2d83 100644
--- a/bsp/mb9bf500r/application.c
+++ b/bsp/mb9bf500r/application.c
@@ -11,7 +11,7 @@
/**
* @addtogroup FM3
*/
-
+
/*@{*/
#include <rtthread.h>
@@ -33,96 +33,96 @@ static char msg_pool[2048];
void rt_init_thread_entry(void *parameter)
{
- rt_device_t lcd;
-
+ rt_device_t lcd;
+
rt_hw_led_init();
- rt_hw_key_init();
- rt_hw_adc_init();
- rt_hw_lcd_init();
- rt_hw_cpu_init();
+ rt_hw_key_init();
+ rt_hw_adc_init();
+ rt_hw_lcd_init();
+ rt_hw_cpu_init();
#ifdef RT_USING_RTGUI
- extern void rtgui_system_server_init(void);
+ extern void rtgui_system_server_init(void);
+
+ /* find lcd device */
+ lcd = rt_device_find("lcd");
- /* find lcd device */
- lcd = rt_device_find("lcd");
-
- /* set lcd device as rtgui graphic driver */
- rtgui_graphic_set_device(lcd);
+ /* set lcd device as rtgui graphic driver */
+ rtgui_graphic_set_device(lcd);
- /* init rtgui system server */
- rtgui_system_server_init();
-
- /* startup rtgui */
- rtgui_startup();
+ /* init rtgui system server */
+ rtgui_system_server_init();
+
+ /* startup rtgui */
+ rtgui_startup();
#else
- {
- char buf[20] = {'\0'};
+ {
+ char buf[20] = {'\0'};
struct lcd_msg msg;
- rt_device_t device;
+ rt_device_t device;
device = rt_device_find("lcd");
- rt_device_control(device, RT_DEVICE_CTRL_LCD_CLEAR_SCR, RT_NULL);
- x = 1;
- y = 1;
- rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, "ADC");
- x = 1;
- y = 20;
- rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, "CPU");
- x = 1;
- y = 40;
- rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, "KEY");
-
+ rt_device_control(device, RT_DEVICE_CTRL_LCD_CLEAR_SCR, RT_NULL);
+ x = 1;
+ y = 1;
+ rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, "ADC");
+ x = 1;
+ y = 20;
+ rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, "CPU");
+ x = 1;
+ y = 40;
+ rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, "KEY");
+
while(1)
{
if (rt_mq_recv(&mq, &msg, sizeof(msg), RT_WAITING_FOREVER) == RT_EOK)
{
- switch(msg.type)
- {
- case ADC_MSG:
- x = 40;
- y = 1;
- rt_memset(buf, 0, sizeof(buf));
- rt_sprintf(buf, "%04d", msg.adc_value);
- rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, buf);
- break;
- case CPU_MSG:
- x = 40;
- y = 20;
- rt_memset(buf, 0, sizeof(buf));
- rt_sprintf(buf, "%03d %03d", msg.major, msg.minor);
- rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, buf);
- break;
- case KEY_MSG:
- x = 40;
- y = 40;
- rt_memset(buf, 0, sizeof(buf));
+ switch(msg.type)
+ {
+ case ADC_MSG:
+ x = 40;
+ y = 1;
+ rt_memset(buf, 0, sizeof(buf));
+ rt_sprintf(buf, "%04d", msg.adc_value);
+ rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, buf);
+ break;
+ case CPU_MSG:
+ x = 40;
+ y = 20;
+ rt_memset(buf, 0, sizeof(buf));
+ rt_sprintf(buf, "%03d %03d", msg.major, msg.minor);
+ rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, buf);
+ break;
+ case KEY_MSG:
+ x = 40;
+ y = 40;
+ rt_memset(buf, 0, sizeof(buf));
switch(msg.key)
- {
- case KEY_DOWN:
- rt_sprintf(buf, "DOWN KEY ");
- break;
- case KEY_UP:
- rt_sprintf(buf, "UP KEY ");
- break;
- case KEY_RIGHT:
- rt_sprintf(buf, "RIGHT KEY");
- break;
- case KEY_LEFT:
- rt_sprintf(buf, "LEFT KEY ");
- break;
- case KEY_ENTER:
- rt_sprintf(buf, "ENTER KEY");
- break;
- default:
- rt_sprintf(buf, "NO KEY ");
- break;
- }
- rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, buf);
- break;
- }
+ {
+ case KEY_DOWN:
+ rt_sprintf(buf, "DOWN KEY ");
+ break;
+ case KEY_UP:
+ rt_sprintf(buf, "UP KEY ");
+ break;
+ case KEY_RIGHT:
+ rt_sprintf(buf, "RIGHT KEY");
+ break;
+ case KEY_LEFT:
+ rt_sprintf(buf, "LEFT KEY ");
+ break;
+ case KEY_ENTER:
+ rt_sprintf(buf, "ENTER KEY");
+ break;
+ default:
+ rt_sprintf(buf, "NO KEY ");
+ break;
+ }
+ rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, buf);
+ break;
+ }
}
}
- }
+ }
#endif
}
@@ -130,12 +130,12 @@ int rt_application_init(void)
{
rt_thread_t init_thread;
- rt_mq_init(&mq, "mqt", &msg_pool[0], 128 - sizeof(void*), sizeof(msg_pool), RT_IPC_FLAG_FIFO);
-
+ rt_mq_init(&mq, "mqt", &msg_pool[0], 128 - sizeof(void*), sizeof(msg_pool), RT_IPC_FLAG_FIFO);
+
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/mb9bf500r/board.c b/bsp/mb9bf500r/board.c
index 9bfba04f05..f52a5fa3a8 100644
--- a/bsp/mb9bf500r/board.c
+++ b/bsp/mb9bf500r/board.c
@@ -29,13 +29,13 @@ extern const uint32_t SystemFrequency;
*/
void SysTick_Handler(void)
{
- /* enter interrupt */
- rt_interrupt_enter();
+ /* enter interrupt */
+ rt_interrupt_enter();
- rt_tick_increase();
+ rt_tick_increase();
- /* leave interrupt */
- rt_interrupt_leave();
+ /* leave interrupt */
+ rt_interrupt_leave();
}
/**
diff --git a/bsp/mb9bf500r/cpuusage.h b/bsp/mb9bf500r/cpuusage.h
index 16c7b171a5..6a53481f3f 100644
--- a/bsp/mb9bf500r/cpuusage.h
+++ b/bsp/mb9bf500r/cpuusage.h
@@ -7,7 +7,7 @@
* Date Author Notes
* 2011-03-03 lgnq
*/
-
+
#ifndef __CPUUSAGE_H__
#define __CPUUSAGE_H__
diff --git a/bsp/mb9bf500r/key.c b/bsp/mb9bf500r/key.c
index 2fc3274317..1886e72974 100644
--- a/bsp/mb9bf500r/key.c
+++ b/bsp/mb9bf500r/key.c
@@ -5,7 +5,7 @@
*
* Change Logs:
* Date Author Notes
- * 2011-03-03 lgnq
+ * 2011-03-03 lgnq
*/
#include <rtthread.h>
@@ -21,7 +21,7 @@ static void key_io_init(void)
{
/*Select CPIO function*/
KEY_PFR &= ~KEY_MASK;
- /*Set CPIO Pull-Up function*/
+ /*Set CPIO Pull-Up function*/
KEY_PCR |= KEY_MASK;
/*Make button pins inputs*/
KEY_DDR &= ~KEY_MASK;
@@ -34,7 +34,7 @@ static void key_thread_entry(void *parameter)
rt_uint8_t i;
struct rtgui_event_kbd kbd_event;
-
+
key_io_init();
/* init keyboard event */
@@ -105,49 +105,49 @@ static void key_thread_entry(void *parameter)
rt_thread_delay(next_delay);
}
#else
- extern struct rt_messagequeue mq;
- rt_time_t next_delay;
- struct lcd_msg msg;
- msg.type = KEY_MSG;
-
- key_io_init();
-
- while (1)
- {
- msg.key = NO_KEY;
-
- next_delay = RT_TICK_PER_SECOND/10;
-
- if (KEY_ENTER_GETVALUE() == 0 )
- {
- msg.key = KEY_ENTER;
- }
-
- if (KEY_DOWN_GETVALUE() == 0)
- {
- msg.key = KEY_DOWN;
- }
-
- if (KEY_UP_GETVALUE() == 0)
- {
- msg.key = KEY_UP;
- }
-
- if (KEY_RIGHT_GETVALUE() == 0)
- {
- msg.key = KEY_RIGHT;
- }
-
- if (KEY_LEFT_GETVALUE() == 0)
- {
- msg.key = KEY_LEFT;
- }
-
- rt_mq_send(&mq, &msg, sizeof(msg));
-
- /* wait next key press */
- rt_thread_delay(next_delay);
- }
+ extern struct rt_messagequeue mq;
+ rt_time_t next_delay;
+ struct lcd_msg msg;
+ msg.type = KEY_MSG;
+
+ key_io_init();
+
+ while (1)
+ {
+ msg.key = NO_KEY;
+
+ next_delay = RT_TICK_PER_SECOND/10;
+
+ if (KEY_ENTER_GETVALUE() == 0 )
+ {
+ msg.key = KEY_ENTER;
+ }
+
+ if (KEY_DOWN_GETVALUE() == 0)
+ {
+ msg.key = KEY_DOWN;
+ }
+
+ if (KEY_UP_GETVALUE() == 0)
+ {
+ msg.key = KEY_UP;
+ }
+
+ if (KEY_RIGHT_GETVALUE() == 0)
+ {
+ msg.key = KEY_RIGHT;
+ }
+
+ if (KEY_LEFT_GETVALUE() == 0)
+ {
+ msg.key = KEY_LEFT;
+ }
+
+ rt_mq_send(&mq, &msg, sizeof(msg));
+
+ /* wait next key press */
+ rt_thread_delay(next_delay);
+ }
#endif
}
@@ -155,6 +155,6 @@ static rt_thread_t key_thread;
void rt_hw_key_init(void)
{
key_thread = rt_thread_create("key", key_thread_entry, RT_NULL, 384, 28, 5);
- if (key_thread != RT_NULL)
+ if (key_thread != RT_NULL)
rt_thread_startup(key_thread);
}
diff --git a/bsp/mb9bf500r/lcd.c b/bsp/mb9bf500r/lcd.c
index 5aabb5f0e9..8b61abf2e0 100644
--- a/bsp/mb9bf500r/lcd.c
+++ b/bsp/mb9bf500r/lcd.c
@@ -55,7 +55,7 @@ void lcd_write_cmd(unsigned char command)
LCD_DATA_HIGH();
else
LCD_DATA_LOW();
-
+
LCD_CLK_LOW();
delay();
LCD_CLK_HIGH();
@@ -77,7 +77,7 @@ void lcd_write_data(unsigned char data)
LCD_DATA_HIGH();
else
LCD_DATA_LOW();
-
+
LCD_CLK_LOW();
delay();
LCD_CLK_HIGH();
@@ -93,12 +93,12 @@ void lcd_write_data(unsigned char data)
static void rt_hw_lcd_update(struct rt_device_rect_info *rect_info)
{
rt_uint8_t i,j = GUI_LCM_XMAX;
- rt_uint8_t* p = (rt_uint8_t*)gui_disp_buf;
-
+ rt_uint8_t* p = (rt_uint8_t*)gui_disp_buf;
+
for (i=0; i<GUI_LCM_PAGE; i++)
- {
- lcd_write_cmd(SET_PAGE_ADDR_0|i);
- lcd_write_cmd(SET_COLH_ADDR_0);
+ {
+ lcd_write_cmd(SET_PAGE_ADDR_0|i);
+ lcd_write_cmd(SET_COLH_ADDR_0);
lcd_write_cmd(SET_COLL_ADDR_0);
j = GUI_LCM_XMAX;
while (j--)
@@ -121,7 +121,7 @@ static void rt_hw_lcd_set_pixel(rtgui_color_t *c, int x, int y)
if (*c == rtgui_color_to_565(black))
gui_disp_buf[page][x] |= 1<<(y%8);
- else
+ else
if (*c == rtgui_color_to_565(white))
gui_disp_buf[page][x] &= ~(1<<(y%8));
}
@@ -130,7 +130,7 @@ static void rt_hw_lcd_get_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint8_t page;
page = y/8;
-
+
if (gui_disp_buf[page][x] & (1<<(y%8)))
*c = black;
else
@@ -140,16 +140,16 @@ static void rt_hw_lcd_get_pixel(rtgui_color_t *c, int x, int y)
static void rt_hw_lcd_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
{
rt_uint8_t page;
- rt_uint8_t i;
+ rt_uint8_t i;
page = y/8;
-
+
for (i=x1; i<x2; i++)
{
if (*c == rtgui_color_to_565(black))
gui_disp_buf[page][i] |= 1<<(y%8);
- else
+ else
if (*c == rtgui_color_to_565(white))
- gui_disp_buf[page][i] &= ~(1<<(y%8));
+ gui_disp_buf[page][i] &= ~(1<<(y%8));
}
}
@@ -165,13 +165,13 @@ static void rt_hw_lcd_draw_vline(rtgui_color_t *c, int x, int y1, int y2)
static void rt_hw_lcd_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y)
{
- rt_uint8_t coll;
- rt_uint8_t colh;
- rt_uint8_t page;
- rt_uint8_t i;
+ rt_uint8_t coll;
+ rt_uint8_t colh;
+ rt_uint8_t page;
+ rt_uint8_t i;
page = y/8;
-
+
for (i=x1; i<x2; i++)
{
gui_disp_buf[page][i] |= 1<<(y%8);
@@ -209,7 +209,7 @@ void lcd_io_init()
/*Select CPIO function*/
LCD_PS_PFR &= ~LCD_PS;
/*Make pin output*/
- LCD_PS_DDR |= LCD_PS;
+ LCD_PS_DDR |= LCD_PS;
/*Select CPIO function*/
LCD_CLK_PFR &= ~LCD_CLK;
/*Make pin output*/
@@ -224,7 +224,7 @@ void lcd_io_init()
static rt_err_t rt_lcd_init (rt_device_t dev)
{
lcd_io_init();
-
+
power_delay();
lcd_write_cmd(DISPLAY_OFF);
reset_delay();
@@ -235,19 +235,19 @@ static rt_err_t rt_lcd_init (rt_device_t dev)
lcd_write_cmd(SET_LCD_BIAS_9);
reset_delay();
// ADC selection: display from left to right
- lcd_write_cmd(SET_ADC_NORMAL);
+ lcd_write_cmd(SET_ADC_NORMAL);
reset_delay();
// Common output state selection: display from up to down
lcd_write_cmd(COM_SCAN_DIR_REVERSE);
reset_delay();
-
+
lcd_write_cmd(POWER_BOOSTER_ON);
power_delay(); // 50ms requried
lcd_write_cmd(POWER_REGULATOR_ON);
power_delay(); // 50ms
lcd_write_cmd(POWER_FOLLOWER_ON);
power_delay(); // 50ms
-
+
// Setting the built-in resistance radio for regulation of the V0 voltage
// Electronic volume control
// Power control setting
@@ -267,7 +267,7 @@ static rt_err_t rt_lcd_init (rt_device_t dev)
delay();
lcd_write_cmd(DISPLAY_ON);
delay();
-
+
lcd_write_cmd(DISPLAY_ALL_ON);
delay();
lcd_write_cmd(DISPLAY_OFF);
@@ -276,7 +276,7 @@ static rt_err_t rt_lcd_init (rt_device_t dev)
delay();
lcd_write_cmd(DISPLAY_ALL_NORMAL);
delay();
-
+
return RT_EOK;
}
@@ -287,15 +287,15 @@ static rt_err_t rt_lcd_init (rt_device_t dev)
* Output : None
* Return : None
*******************************************************************************/
-void LCD_FillAll(unsigned char* buffer)
+void LCD_FillAll(unsigned char* buffer)
{
unsigned char i,j = GUI_LCM_XMAX;
- unsigned char* p = buffer;
-
+ unsigned char* p = buffer;
+
for (i=0; i<GUI_LCM_PAGE; i++)
- {
- lcd_write_cmd(SET_PAGE_ADDR_0|i);
- lcd_write_cmd(SET_COLH_ADDR_0);
+ {
+ lcd_write_cmd(SET_PAGE_ADDR_0|i);
+ lcd_write_cmd(SET_COLH_ADDR_0);
lcd_write_cmd(SET_COLL_ADDR_0);
j = GUI_LCM_XMAX;
while (j--)
@@ -318,8 +318,8 @@ void LCD_ClearSCR(void)
unsigned char i, j;
for(i=0; i<GUI_LCM_PAGE; i++)
- {
- for(j = 0; j < GUI_LCM_XMAX; j++)
+ {
+ for(j = 0; j < GUI_LCM_XMAX; j++)
gui_disp_buf[i][j] = 0;
}
LCD_FillAll((unsigned char*)gui_disp_buf);
@@ -327,7 +327,7 @@ void LCD_ClearSCR(void)
/****************************************************************************
* Function Name : LCD_UpdatePoint
-* Description : refresh the point in screen
+* Description : refresh the point in screen
* Input : x X-coordinate
y Y-coordinate
* Output : None
@@ -340,16 +340,16 @@ void LCD_UpdatePoint(unsigned int x, unsigned int y)
page = y / 8;
coll = x & 0x0f;
colh = x >> 4;
-
- lcd_write_cmd(SET_PAGE_ADDR_0 | page); // page no.
- lcd_write_cmd(SET_COLH_ADDR_0 | colh); // fixed col first addr
+
+ lcd_write_cmd(SET_PAGE_ADDR_0 | page); // page no.
+ lcd_write_cmd(SET_COLH_ADDR_0 | colh); // fixed col first addr
lcd_write_cmd(SET_COLL_ADDR_0 | coll);
lcd_write_data(gui_disp_buf[page][x]);
}
/****************************************************************************
* Function Name : LCD_PutChar
-* Description : output a char to screen
+* Description : output a char to screen
(the char only can be ' ','0'~'9','A'~'Z','a'~'z')
* Input : x X-coordinate
y Y-coordinate
@@ -359,13 +359,13 @@ void LCD_UpdatePoint(unsigned int x, unsigned int y)
0 Fail
****************************************************************************/
unsigned char LCD_PutChar(unsigned long x, unsigned long y, unsigned char ch)
-{
+{
unsigned char data;
unsigned char i, j;
if( x >=(GUI_LCM_XMAX-8) ) return(0);
if( y >=(GUI_LCM_YMAX-8) ) return(0);
-
+
if(ch == 0x20)
ch -= 0x20;
else if((ch >= 0x30)&&(ch <= 0x39))
@@ -376,30 +376,30 @@ unsigned char LCD_PutChar(unsigned long x, unsigned long y, unsigned char ch)
ch -= 0x3C;
else
return(0);
-
+
for(i = 0; i < 8; i++)
- {
+ {
data = FONTTYPE8_8[ch][i];
-
+
for(j = 0; j < 8; j++)
- {
+ {
if( (data&BIT_MASK[j]) == 0)
gui_disp_buf[y / 8][x] &= (~(0x01 << ( y % 8)));
- else
+ else
gui_disp_buf[y / 8][x] |= (0x01 <<( y % 8));
LCD_UpdatePoint(x, y);
x ++;
}
- x -= 8;
- y++;
+ x -= 8;
+ y++;
}
-
+
return(1);
}
/****************************************************************************
* Function Name : LCD_PutString
-* Description : output string to screen
+* Description : output string to screen
* Input : x X-coordinate
y Y-coordinate
str pointer to string
@@ -407,32 +407,32 @@ unsigned char LCD_PutChar(unsigned long x, unsigned long y, unsigned char ch)
* Return : None
****************************************************************************/
void LCD_PutString(unsigned long x, unsigned long y, char *str)
-{
+{
while(1)
- {
+ {
if( (*str)=='\0' ) break;
if( LCD_PutChar(x, y, *str++) == 0 ) break;
- x += 6;
+ x += 6;
}
}
static rt_err_t rt_lcd_control (rt_device_t dev, int cmd, void *args)
{
- switch (cmd)
- {
-#ifdef RT_USING_RTGUI
- case RTGRAPHIC_CTRL_RECT_UPDATE:
- rt_hw_lcd_update(args);
- break;
- case RTGRAPHIC_CTRL_POWERON:
- break;
- case RTGRAPHIC_CTRL_POWEROFF:
- break;
- case RTGRAPHIC_CTRL_GET_INFO:
- rt_memcpy(args, &_lcd_info, sizeof(_lcd_info));
- break;
- case RTGRAPHIC_CTRL_SET_MODE:
- break;
+ switch (cmd)
+ {
+#ifdef RT_USING_RTGUI
+ case RTGRAPHIC_CTRL_RECT_UPDATE:
+ rt_hw_lcd_update(args);
+ break;
+ case RTGRAPHIC_CTRL_POWERON:
+ break;
+ case RTGRAPHIC_CTRL_POWEROFF:
+ break;
+ case RTGRAPHIC_CTRL_GET_INFO:
+ rt_memcpy(args, &_lcd_info, sizeof(_lcd_info));
+ break;
+ case RTGRAPHIC_CTRL_SET_MODE:
+ break;
#else
case RT_DEVICE_CTRL_LCD_DISPLAY_ON:
lcd_write_cmd(DISPLAY_ON);
@@ -446,32 +446,32 @@ static rt_err_t rt_lcd_control (rt_device_t dev, int cmd, void *args)
case RT_DEVICE_CTRL_LCD_CLEAR_SCR:
LCD_ClearSCR();
break;
-#endif
- }
+#endif
+ }
- return RT_EOK;
+ return RT_EOK;
}
void rt_hw_lcd_init(void)
{
- rt_device_t lcd = rt_malloc(sizeof(struct rt_device));
- if (lcd == RT_NULL) return; /* no memory yet */
+ rt_device_t lcd = rt_malloc(sizeof(struct rt_device));
+ if (lcd == RT_NULL) return; /* no memory yet */
- _lcd_info.bits_per_pixel = 16;
- _lcd_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565;
- _lcd_info.framebuffer = RT_NULL;
- _lcd_info.width = LCD_WIDTH;
- _lcd_info.height = LCD_HEIGHT;
+ _lcd_info.bits_per_pixel = 16;
+ _lcd_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565;
+ _lcd_info.framebuffer = RT_NULL;
+ _lcd_info.width = LCD_WIDTH;
+ _lcd_info.height = LCD_HEIGHT;
- /* init device structure */
- lcd->type = RT_Device_Class_Unknown;
- lcd->init = rt_lcd_init;
- lcd->open = RT_NULL;
- lcd->close = RT_NULL;
- lcd->control = rt_lcd_control;
+ /* init device structure */
+ lcd->type = RT_Device_Class_Unknown;
+ lcd->init = rt_lcd_init;
+ lcd->open = RT_NULL;
+ lcd->close = RT_NULL;
+ lcd->control = rt_lcd_control;
#ifdef RT_USING_RTGUI
- lcd->user_data = (void*)&_lcd_ops;
-#endif
- /* register lcd device to RT-Thread */
- rt_device_register(lcd, "lcd", RT_DEVICE_FLAG_RDWR);
+ lcd->user_data = (void*)&_lcd_ops;
+#endif
+ /* register lcd device to RT-Thread */
+ rt_device_register(lcd, "lcd", RT_DEVICE_FLAG_RDWR);
}
diff --git a/bsp/mb9bf500r/lcd.h b/bsp/mb9bf500r/lcd.h
index bb500f341f..e0fa9efdc3 100644
--- a/bsp/mb9bf500r/lcd.h
+++ b/bsp/mb9bf500r/lcd.h
@@ -15,166 +15,166 @@
#include "mb9bf506r.h"
/********* LCD Hardward Interface *************
-LCD_CS PORT1.7
-LCD_CD PORT1.6
-LCD_WR PORT1.5
-LCD_RD PORT1.4
-LCD_SCK PORT1.3
-LCD_MOSI PORT1.2
-LCD_C86 PORT1.1
-LCD_PS PORT1.0
-LCD_DATA[0..7] PORT5.[0..7]
+LCD_CS PORT1.7
+LCD_CD PORT1.6
+LCD_WR PORT1.5
+LCD_RD PORT1.4
+LCD_SCK PORT1.3
+LCD_MOSI PORT1.2
+LCD_C86 PORT1.1
+LCD_PS PORT1.0
+LCD_DATA[0..7] PORT5.[0..7]
***********************************************/
-#define LCD_CS (1UL << 7)
-#define LCD_CS_DDR (FM3_GPIO->DDR1)
-#define LCD_CS_PFR (FM3_GPIO->PFR1)
-#define LCD_CS_PDOR (FM3_GPIO->PDOR1)
+#define LCD_CS (1UL << 7)
+#define LCD_CS_DDR (FM3_GPIO->DDR1)
+#define LCD_CS_PFR (FM3_GPIO->PFR1)
+#define LCD_CS_PDOR (FM3_GPIO->PDOR1)
-#define LCD_CD (1UL << 6)
-#define LCD_CD_DDR (FM3_GPIO->DDR1)
-#define LCD_CD_PFR (FM3_GPIO->PFR1)
-#define LCD_CD_PDOR (FM3_GPIO->PDOR1)
+#define LCD_CD (1UL << 6)
+#define LCD_CD_DDR (FM3_GPIO->DDR1)
+#define LCD_CD_PFR (FM3_GPIO->PFR1)
+#define LCD_CD_PDOR (FM3_GPIO->PDOR1)
-#define LCD_PS (1UL << 0)
-#define LCD_PS_DDR (FM3_GPIO->DDR1)
-#define LCD_PS_PFR (FM3_GPIO->PFR1)
-#define LCD_PS_PDOR (FM3_GPIO->PDOR1)
+#define LCD_PS (1UL << 0)
+#define LCD_PS_DDR (FM3_GPIO->DDR1)
+#define LCD_PS_PFR (FM3_GPIO->PFR1)
+#define LCD_PS_PDOR (FM3_GPIO->PDOR1)
-#define LCD_CLK (1UL << 6)
-#define LCD_CLK_DDR (FM3_GPIO->DDR5)
-#define LCD_CLK_PFR (FM3_GPIO->PFR5)
-#define LCD_CLK_PDOR (FM3_GPIO->PDOR5)
+#define LCD_CLK (1UL << 6)
+#define LCD_CLK_DDR (FM3_GPIO->DDR5)
+#define LCD_CLK_PFR (FM3_GPIO->PFR5)
+#define LCD_CLK_PDOR (FM3_GPIO->PDOR5)
-#define LCD_DATA (1UL << 7)
-#define LCD_DATA_DDR (FM3_GPIO->DDR5)
-#define LCD_DATA_PFR (FM3_GPIO->PFR5)
-#define LCD_DATA_PDOR (FM3_GPIO->PDOR5)
+#define LCD_DATA (1UL << 7)
+#define LCD_DATA_DDR (FM3_GPIO->DDR5)
+#define LCD_DATA_PFR (FM3_GPIO->PFR5)
+#define LCD_DATA_PDOR (FM3_GPIO->PDOR5)
/* LCD driver for ZYMG12864C3 */
-#define LCD_WIDTH 128
-#define LCD_HEIGHT 64
+#define LCD_WIDTH 128
+#define LCD_HEIGHT 64
// Driver the LCD with Parallel or serial interface and the command/data control pin is gpio
-#define LCD_CS_HIGH() LCD_CS_PDOR |= LCD_CS
-#define LCD_CS_LOW() LCD_CS_PDOR &= ~LCD_CS
+#define LCD_CS_HIGH() LCD_CS_PDOR |= LCD_CS
+#define LCD_CS_LOW() LCD_CS_PDOR &= ~LCD_CS
-#define LCD_CD_HIGH() LCD_CD_PDOR |= LCD_CD
-#define LCD_CD_LOW() LCD_CD_PDOR &= ~LCD_CD
+#define LCD_CD_HIGH() LCD_CD_PDOR |= LCD_CD
+#define LCD_CD_LOW() LCD_CD_PDOR &= ~LCD_CD
-#define LCD_PS_HIGH() LCD_PS_PDOR |= LCD_PS
-#define LCD_PS_LOW() LCD_PS_PDOR &= ~LCD_PS
+#define LCD_PS_HIGH() LCD_PS_PDOR |= LCD_PS
+#define LCD_PS_LOW() LCD_PS_PDOR &= ~LCD_PS
-#define LCD_CLK_HIGH() LCD_CLK_PDOR |= LCD_CLK
-#define LCD_CLK_LOW() LCD_CLK_PDOR &= ~LCD_CLK
+#define LCD_CLK_HIGH() LCD_CLK_PDOR |= LCD_CLK
+#define LCD_CLK_LOW() LCD_CLK_PDOR &= ~LCD_CLK
-#define LCD_DATA_HIGH() LCD_DATA_PDOR |= LCD_DATA
-#define LCD_DATA_LOW() LCD_DATA_PDOR &= ~LCD_DATA
+#define LCD_DATA_HIGH() LCD_DATA_PDOR |= LCD_DATA
+#define LCD_DATA_LOW() LCD_DATA_PDOR &= ~LCD_DATA
// define the arrtibute of ZYMG12864(LCM)
-#define GUI_LCM_XMAX 128 // defined the lcd's line-number is 128
-#define GUI_LCM_YMAX 64 // defined the lcd's column-number is 64
-#define GUI_LCM_PAGE 8 // defined the lcd's page-number is 8(GUI_LCM_YMAX/8)
+#define GUI_LCM_XMAX 128 // defined the lcd's line-number is 128
+#define GUI_LCM_YMAX 64 // defined the lcd's column-number is 64
+#define GUI_LCM_PAGE 8 // defined the lcd's page-number is 8(GUI_LCM_YMAX/8)
/* set LCD command */
-#define DISPLAY_ON 0xAF // A0,RD,WR:010
-#define DISPLAY_OFF 0xAE // A0,RD,WR:010
+#define DISPLAY_ON 0xAF // A0,RD,WR:010
+#define DISPLAY_OFF 0xAE // A0,RD,WR:010
-#define SET_START_LINE_0 0x40 // A0,RD,WR:010; line0~line63
-#define SET_PAGE_ADDR_0 0xB0 // A0,RD,WR:010; addr0~addr8
-#define SET_COLH_ADDR_0 0x10 // A0,RD,WR:010;
-#define SET_COLL_ADDR_0 0x00 // A0,RD,WR:010; addr0~addr131
+#define SET_START_LINE_0 0x40 // A0,RD,WR:010; line0~line63
+#define SET_PAGE_ADDR_0 0xB0 // A0,RD,WR:010; addr0~addr8
+#define SET_COLH_ADDR_0 0x10 // A0,RD,WR:010;
+#define SET_COLL_ADDR_0 0x00 // A0,RD,WR:010; addr0~addr131
-#define READ_STATUS 0x-0 // A0,RD,WR:001; BUSY | ADC | ON/OFF | RESET | 0 0 0 0
-#define STATUS_BUSY 0x80
-#define STATUS_ADC_REVERSE 0x40 // column address 131-n : SEG n, else column address n : SEG n
-#define STATUS_DISPLAY_OFF 0x20
-#define STATUS_RESET 0x80
+#define READ_STATUS 0x-0 // A0,RD,WR:001; BUSY | ADC | ON/OFF | RESET | 0 0 0 0
+#define STATUS_BUSY 0x80
+#define STATUS_ADC_REVERSE 0x40 // column address 131-n : SEG n, else column address n : SEG n
+#define STATUS_DISPLAY_OFF 0x20
+#define STATUS_RESET 0x80
-#define WRITE_DATA 0x-- // A0,RD,WR:110
-#define READ_DATE 0x-- // A0,RD,WR:101; spi mode is unavailable
+#define WRITE_DATA 0x-- // A0,RD,WR:110
+#define READ_DATE 0x-- // A0,RD,WR:101; spi mode is unavailable
-#define SET_ADC_NORMAL 0xA0 // A0,RD,WR:010
-#define SET_ADC_REVERSE 0xA1 // A0,RD,WR:010
-#define DISPLAY_NORMAL 0xA6 // A0,RD,WR:010
-#define DISPLAY_REVERSE 0xA7 // A0,RD,WR:010; reverse color
-#define DISPLAY_ALL_ON 0xA5 // A0,RD,WR:010
-#define DISPLAY_ALL_NORMAL 0xA4 // A0,RD,WR:010
+#define SET_ADC_NORMAL 0xA0 // A0,RD,WR:010
+#define SET_ADC_REVERSE 0xA1 // A0,RD,WR:010
+#define DISPLAY_NORMAL 0xA6 // A0,RD,WR:010
+#define DISPLAY_REVERSE 0xA7 // A0,RD,WR:010; reverse color
+#define DISPLAY_ALL_ON 0xA5 // A0,RD,WR:010
+#define DISPLAY_ALL_NORMAL 0xA4 // A0,RD,WR:010
/*************************************************************
-* bias: 1/65duty | 1/49duty | 1/33duty | 1/55duty | 1/53duty *
-* ---------------|----------|----------|----------|--------- *
-* A2: 1/9 bias | 1/8 bias | 1/6 bias | 1/8 bias | 1/8 bias *
-* A3: 1/7 bias | 1/6 bias | 1/5 bias | 1/6 bias | 1/6 bias *
+* bias: 1/65duty | 1/49duty | 1/33duty | 1/55duty | 1/53duty *
+* ---------------|----------|----------|----------|--------- *
+* A2: 1/9 bias | 1/8 bias | 1/6 bias | 1/8 bias | 1/8 bias *
+* A3: 1/7 bias | 1/6 bias | 1/5 bias | 1/6 bias | 1/6 bias *
**************************************************************/
-#define SET_LCD_BIAS_7 0xA3 // A0,RD,WR:010
-#define SET_LCD_BIAS_9 0xA2 // A0,RD,WR:010
+#define SET_LCD_BIAS_7 0xA3 // A0,RD,WR:010
+#define SET_LCD_BIAS_9 0xA2 // A0,RD,WR:010
-#define RMW_MODE_ENABLE 0xE0 // A0,RD,WR:010; the column address locked when read command operating
-#define RMW_MODE_END 0xEE // A0,RD,WR:010; returns to the column address when RMW was entered.
-#define RESET_LCD 0xE2 // A0,RD,WR:010
+#define RMW_MODE_ENABLE 0xE0 // A0,RD,WR:010; the column address locked when read command operating
+#define RMW_MODE_END 0xEE // A0,RD,WR:010; returns to the column address when RMW was entered.
+#define RESET_LCD 0xE2 // A0,RD,WR:010
/**************************************************************************************
-* Com Scan Dir: | 1/65duty | 1/49duty | 1/33duty | 1/55duty | 1/53duty *
-* --------------|-------------|-------------|-------------|------------------------ *
-* C0: Normal | COM0:COM63 | COM0:COM47 | COM0:COM31 | COM0:COM53 | COM0:COM51 *
-* C8: Reverse | COM63:COM0 | COM47:COM0 | COM31:COM0 | COM53:COM0 | COM51:COM0 *
+* Com Scan Dir: | 1/65duty | 1/49duty | 1/33duty | 1/55duty | 1/53duty *
+* --------------|-------------|-------------|-------------|------------------------ *
+* C0: Normal | COM0:COM63 | COM0:COM47 | COM0:COM31 | COM0:COM53 | COM0:COM51 *
+* C8: Reverse | COM63:COM0 | COM47:COM0 | COM31:COM0 | COM53:COM0 | COM51:COM0 *
***************************************************************************************/
-#define COM_SCAN_DIR_NORMAL 0xC0 // A0,RD,WR:010
-#define COM_SCAN_DIR_REVERSE 0xC8 // A0,RD,WR:010
+#define COM_SCAN_DIR_NORMAL 0xC0 // A0,RD,WR:010
+#define COM_SCAN_DIR_REVERSE 0xC8 // A0,RD,WR:010
// 0 0 1 0 1 | Booster On | Regulator On | Follower On
-#define POWER_BOOSTER_ON 0x2C // A0,RD,WR:010
-#define POWER_REGULATOR_ON 0x2E // A0,RD,WR:010
-#define POWER_FOLLOWER_ON 0x2F // A0,RD,WR:010
+#define POWER_BOOSTER_ON 0x2C // A0,RD,WR:010
+#define POWER_REGULATOR_ON 0x2E // A0,RD,WR:010
+#define POWER_FOLLOWER_ON 0x2F // A0,RD,WR:010
-#define SET_RESISTOR_RATIO 0x20 // A0,RD,WR:010; 20~27:small~large
+#define SET_RESISTOR_RATIO 0x20 // A0,RD,WR:010; 20~27:small~large
-#define SET_ELECVOL_MODE 0x81 // A0,RD,WR:010; double byte command
-#define SET_ELECVOL_REG 0x20 // A0,RD,WR:010; the electronic volume(64 voltage levels:00~3F) function is not used.
+#define SET_ELECVOL_MODE 0x81 // A0,RD,WR:010; double byte command
+#define SET_ELECVOL_REG 0x20 // A0,RD,WR:010; the electronic volume(64 voltage levels:00~3F) function is not used.
-#define SLEEP_MODE_ENABLE 0xAC // A0,RD,WR:010; double byte command, preceding command
-#define SLEEP_MODE_DISABLE 0xAD // A0,RD,WR:010; preceding command
-#define SLEEP_MODE_DELIVER 0x00 // A0,RD,WR:010; following command
+#define SLEEP_MODE_ENABLE 0xAC // A0,RD,WR:010; double byte command, preceding command
+#define SLEEP_MODE_DISABLE 0xAD // A0,RD,WR:010; preceding command
+#define SLEEP_MODE_DELIVER 0x00 // A0,RD,WR:010; following command
-#define BOOST_RATIO_SET 0xF8 // A0,RD,WR:010; double byte command, preceding command
-#define BOOST_RATIO_234 0x00 // A0,RD,WR:010; following command
-#define BOOST_RATIO_5 0x01 // A0,RD,WR:010; following command
-#define BOOST_RATIO_6 0x03 // A0,RD,WR:010; following command
+#define BOOST_RATIO_SET 0xF8 // A0,RD,WR:010; double byte command, preceding command
+#define BOOST_RATIO_234 0x00 // A0,RD,WR:010; following command
+#define BOOST_RATIO_5 0x01 // A0,RD,WR:010; following command
+#define BOOST_RATIO_6 0x03 // A0,RD,WR:010; following command
-#define COMMAND_NOP 0xE3 // A0,RD,WR:010
-#define COMMAND_IC_TEST 0xFC // A0,RD,WR:010; don't use
+#define COMMAND_NOP 0xE3 // A0,RD,WR:010
+#define COMMAND_IC_TEST 0xFC // A0,RD,WR:010; don't use
-#define RT_DEVICE_CTRL_LCD_GET_WIDTH 0
-#define RT_DEVICE_CTRL_LCD_GET_HEIGHT 1
-#define RT_DEVICE_CTRL_LCD_GET_BPP 2
-#define RT_DEVICE_CTRL_LCD_GET_FRAMEBUFFER 3
-#define RT_DEVICE_CTRL_LCD_POWER_ON 4
-#define RT_DEVICE_CTRL_LCD_POWER_OFF 5
-#define RT_DEVICE_CTRL_LCD_CLEAR_SCR 6
-#define RT_DEVICE_CTRL_LCD_FILL_ALL 7
-#define RT_DEVICE_CTRL_LCD_UPDATE_POINT 8
-#define RT_DEVICE_CTRL_LCD_DISPLAY_ON 9
-#define RT_DEVICE_CTRL_LCD_DISPLAY_OFF 10
-#define RT_DEVICE_CTRL_LCD_PUT_STRING 11
+#define RT_DEVICE_CTRL_LCD_GET_WIDTH 0
+#define RT_DEVICE_CTRL_LCD_GET_HEIGHT 1
+#define RT_DEVICE_CTRL_LCD_GET_BPP 2
+#define RT_DEVICE_CTRL_LCD_GET_FRAMEBUFFER 3
+#define RT_DEVICE_CTRL_LCD_POWER_ON 4
+#define RT_DEVICE_CTRL_LCD_POWER_OFF 5
+#define RT_DEVICE_CTRL_LCD_CLEAR_SCR 6
+#define RT_DEVICE_CTRL_LCD_FILL_ALL 7
+#define RT_DEVICE_CTRL_LCD_UPDATE_POINT 8
+#define RT_DEVICE_CTRL_LCD_DISPLAY_ON 9
+#define RT_DEVICE_CTRL_LCD_DISPLAY_OFF 10
+#define RT_DEVICE_CTRL_LCD_PUT_STRING 11
-enum
+enum
{
- ADC_MSG,
- KEY_MSG,
- CPU_MSG,
- MAX_MSG,
+ ADC_MSG,
+ KEY_MSG,
+ CPU_MSG,
+ MAX_MSG,
};
struct lcd_msg
{
- rt_uint8_t type;
- rt_uint16_t adc_value;
- rt_uint8_t key;
- rt_uint16_t major;
- rt_uint16_t minor;
+ rt_uint8_t type;
+ rt_uint16_t adc_value;
+ rt_uint8_t key;
+ rt_uint16_t major;
+ rt_uint16_t minor;
};
extern rt_uint32_t x;
diff --git a/bsp/mb9bf500r/led.c b/bsp/mb9bf500r/led.c
index e546a6eadc..ee28af7035 100644
--- a/bsp/mb9bf500r/led.c
+++ b/bsp/mb9bf500r/led.c
@@ -7,7 +7,7 @@
* Date Author Notes
* 2011-03-03 lgnq
*/
-
+
#include <rtthread.h>
#include <rthw.h>
@@ -16,8 +16,8 @@
void rt_hw_led_on(rt_uint8_t num)
{
- RT_ASSERT(num < LEDS_MAX_NUMBER);
-
+ RT_ASSERT(num < LEDS_MAX_NUMBER);
+
switch (num)
{
case 1:
@@ -27,16 +27,16 @@ void rt_hw_led_on(rt_uint8_t num)
LED_PDOR &= ~LED2;
break;
case 3:
- LED_PDOR &= ~LED3;
+ LED_PDOR &= ~LED3;
break;
default:
break;
- }
+ }
}
void rt_hw_led_off(rt_uint8_t num)
{
- RT_ASSERT(num < LEDS_MAX_NUMBER);
+ RT_ASSERT(num < LEDS_MAX_NUMBER);
switch (num)
{
@@ -47,17 +47,17 @@ void rt_hw_led_off(rt_uint8_t num)
LED_PDOR |= LED2;
break;
case 3:
- LED_PDOR |= LED3;
+ LED_PDOR |= LED3;
break;
default:
break;
- }
+ }
}
void rt_hw_led_toggle(rt_uint8_t num)
{
- RT_ASSERT(num < LEDS_MAX_NUMBER);
-
+ RT_ASSERT(num < LEDS_MAX_NUMBER);
+
switch (num)
{
case 1:
@@ -76,11 +76,11 @@ void rt_hw_led_toggle(rt_uint8_t num)
if (LED_PDOR&LED3)
LED_PDOR &= ~LED3;
else
- LED_PDOR |= LED3;
+ LED_PDOR |= LED3;
break;
default:
break;
- }
+ }
}
static rt_err_t led_io_init(void)
@@ -91,23 +91,23 @@ static rt_err_t led_io_init(void)
LED_PDOR |= LED_MASK;
/*Make led pins outputs*/
LED_DDR |= LED_MASK;
-
+
//LED3 is controled by PWM
FM3_GPIO->PFR3 = 0x1000;
FM3_GPIO->EPFR04 = 0x00080000;
FM3_BT2_PWM->TMCR = 0x0018;
- FM3_BT2_PWM->TMCR2 = 0x01; /* cks=0b1000 count clk 1/512 */
+ FM3_BT2_PWM->TMCR2 = 0x01; /* cks=0b1000 count clk 1/512 */
FM3_BT2_PWM->STC = 0x00;
- FM3_BT2_PWM->PCSR = 0x61A; /* Down count = 1562 */
- FM3_BT2_PWM->PDUT = 0x0; /* Duty count = 16/1562=10% */
-
- FM3_BT2_PWM->TMCR |= 0x03; /* start base timer(softwere TRG) */
+ FM3_BT2_PWM->PCSR = 0x61A; /* Down count = 1562 */
+ FM3_BT2_PWM->PDUT = 0x0; /* Duty count = 16/1562=10% */
+
+ FM3_BT2_PWM->TMCR |= 0x03; /* start base timer(softwere TRG) */
return RT_EOK;
}
void pwm_update(rt_uint16_t value)
{
- FM3_BT2_PWM->PDUT = value;
+ FM3_BT2_PWM->PDUT = value;
}
static void led1_thread_entry(void *parameter)
@@ -135,11 +135,11 @@ void rt_hw_led_init(void)
led_io_init();
led1_thread = rt_thread_create("led1", led1_thread_entry, RT_NULL, 384, 29, 5);
- if (led1_thread != RT_NULL)
+ if (led1_thread != RT_NULL)
rt_thread_startup(led1_thread);
-
+
led2_thread = rt_thread_create("led2", led2_thread_entry, RT_NULL, 384, 30, 5);
- if (led2_thread != RT_NULL)
+ if (led2_thread != RT_NULL)
rt_thread_startup(led2_thread);
}
diff --git a/bsp/mb9bf500r/led.h b/bsp/mb9bf500r/led.h
index 1c7c2064e9..c4a433cb81 100644
--- a/bsp/mb9bf500r/led.h
+++ b/bsp/mb9bf500r/led.h
@@ -7,13 +7,13 @@
* Date Author Notes
* 2011-03-03 lgnq
*/
-
+
#ifndef __LED_H__
#define __LED_H__
#include "mb9bf506r.h"
-#define LEDS_MAX_NUMBER 4
+#define LEDS_MAX_NUMBER 4
/*LEDs*/
#define LED1 (1UL<<10)
@@ -25,9 +25,9 @@
#define LED_DDR (FM3_GPIO->DDR3)
#define LED_PDOR (FM3_GPIO->PDOR3)
-#define RT_DEVICE_CTRL_LED_ON 0
-#define RT_DEVICE_CTRL_LED_OFF 1
-#define RT_DEVICE_CTRL_LED_TOGGLE 2
+#define RT_DEVICE_CTRL_LED_ON 0
+#define RT_DEVICE_CTRL_LED_OFF 1
+#define RT_DEVICE_CTRL_LED_TOGGLE 2
void rt_hw_led_init(void);
void rt_hw_led_on(rt_uint8_t num);
diff --git a/bsp/mb9bf500r/rtconfig.h b/bsp/mb9bf500r/rtconfig.h
index cb2c62fccd..ac37ecb464 100644
--- a/bsp/mb9bf500r/rtconfig.h
+++ b/bsp/mb9bf500r/rtconfig.h
@@ -3,16 +3,16 @@
#define __RTTHREAD_CFG_H__
/* RT_NAME_MAX*/
-#define RT_NAME_MAX 8
+#define RT_NAME_MAX 8
/* RT_ALIGN_SIZE*/
-#define RT_ALIGN_SIZE 4
+#define RT_ALIGN_SIZE 4
/* PRIORITY_MAX */
-#define RT_THREAD_PRIORITY_MAX 32
+#define RT_THREAD_PRIORITY_MAX 32
/* Tick per Second */
-#define RT_TICK_PER_SECOND 100
+#define RT_TICK_PER_SECOND 100
/* SECTION: RT_DEBUG */
/* Thread Debug */
@@ -53,20 +53,20 @@
#define RT_USING_DEVICE
/* RT_USING_UART */
#define RT_USING_UART0
-#define RT_UART_RX_BUFFER_SIZE 64
+#define RT_UART_RX_BUFFER_SIZE 64
/* SECTION: Console options */
#define RT_TINY_SIZE
#define RT_USING_CONSOLE
/* the buffer size of console */
-#define RT_CONSOLEBUF_SIZE 128
+#define RT_CONSOLEBUF_SIZE 128
/* SECTION: RTGUI support */
/* using RTGUI support */
/* #define RT_USING_RTGUI */
/* name length of RTGUI object */
-#define RTGUI_NAME_MAX 16
+#define RTGUI_NAME_MAX 16
/* support 16 weight font */
//#define RTGUI_USING_FONT16
/* support 12 weight font */
diff --git a/bsp/mb9bf500r/startup.c b/bsp/mb9bf500r/startup.c
index 9fddacbee3..463bb21408 100644
--- a/bsp/mb9bf500r/startup.c
+++ b/bsp/mb9bf500r/startup.c
@@ -34,68 +34,68 @@ extern int __bss_end;
*/
void rtthread_startup(void)
{
- /* init board */
- rt_hw_board_init();
+ /* init board */
+ rt_hw_board_init();
- /* show version */
- rt_show_version();
+ /* show version */
+ rt_show_version();
- /* init tick */
- rt_system_tick_init();
+ /* init tick */
+ rt_system_tick_init();
- /* init kernel object */
- rt_system_object_init();
+ /* init kernel object */
+ rt_system_object_init();
- /* init timer system */
- rt_system_timer_init();
+ /* init timer system */
+ rt_system_timer_init();
#ifdef RT_USING_HEAP
- #ifdef __CC_ARM
- rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)FM3_SRAM_END);
- #elif __ICCARM__
- rt_system_heap_init(__segment_end("HEAP"), (void*)FM3_SRAM_END);
- #else
- /* init memory system */
- rt_system_heap_init((void*)&__bss_end, (void*)FM3_SRAM_END);
- #endif
+ #ifdef __CC_ARM
+ rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)FM3_SRAM_END);
+ #elif __ICCARM__
+ rt_system_heap_init(__segment_end("HEAP"), (void*)FM3_SRAM_END);
+ #else
+ /* init memory system */
+ rt_system_heap_init((void*)&__bss_end, (void*)FM3_SRAM_END);
+ #endif
#endif
- /* init scheduler system */
- rt_system_scheduler_init();
+ /* init scheduler system */
+ rt_system_scheduler_init();
#ifdef RT_USING_DEVICE
- /* init all device */
- rt_device_init_all();
+ /* init all device */
+ rt_device_init_all();
#endif
- /* init application */
- rt_application_init();
+ /* init application */
+ rt_application_init();
/* init timer thread */
rt_system_timer_thread_init();
- /* init idle thread */
- rt_thread_idle_init();
+ /* init idle thread */
+ rt_thread_idle_init();
- /* start scheduler */
- rt_system_scheduler_start();
+ /* start scheduler */
+ rt_system_scheduler_start();
- /* never reach here */
- return ;
+ /* never reach here */
+ return ;
}
int main(void)
{
- /* disable interrupt first */
- rt_hw_interrupt_disable();
+ /* disable interrupt first */
+ rt_hw_interrupt_disable();
- /* init system setting */
- SystemInit();
-
- /* startup RT-Thread RTOS */
- rtthread_startup();
+ /* init system setting */
+ SystemInit();
- return 0;
+ /* startup RT-Thread RTOS */
+ rtthread_startup();
+
+ return 0;
}
/*@}*/