summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bsp/mb9bf500r/adc.c102
-rw-r--r--bsp/mb9bf500r/adc.h18
-rw-r--r--bsp/mb9bf500r/application.c166
-rw-r--r--bsp/mb9bf500r/board.c18
-rw-r--r--bsp/mb9bf500r/board.h8
-rw-r--r--bsp/mb9bf500r/cpuusage.c117
-rw-r--r--bsp/mb9bf500r/cpuusage.h10
-rw-r--r--bsp/mb9bf500r/font.h649
-rw-r--r--bsp/mb9bf500r/info.c146
-rw-r--r--bsp/mb9bf500r/key.c102
-rw-r--r--bsp/mb9bf500r/key.h8
-rw-r--r--bsp/mb9bf500r/lcd.c182
-rw-r--r--bsp/mb9bf500r/lcd.h238
-rw-r--r--bsp/mb9bf500r/led.c52
-rw-r--r--bsp/mb9bf500r/led.h18
-rw-r--r--bsp/mb9bf500r/rtconfig.h14
-rw-r--r--bsp/mb9bf500r/startup.c72
17 files changed, 947 insertions, 973 deletions
diff --git a/bsp/mb9bf500r/adc.c b/bsp/mb9bf500r/adc.c
index 85b4dc36ea..2e431e90c9 100644
--- a/bsp/mb9bf500r/adc.c
+++ b/bsp/mb9bf500r/adc.c
@@ -1,17 +1,13 @@
/*
- * File : adc.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2011, RT-Thread Develop Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
- * 2011-03-03 lgnq
+ * 2011-03-03 lgnq First version
*/
-
+
#include <rtthread.h>
#include <rthw.h>
#include "mb9bf506r.h"
@@ -33,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;
@@ -80,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);
@@ -112,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 edbafcf831..c8846b0beb 100644
--- a/bsp/mb9bf500r/adc.h
+++ b/bsp/mb9bf500r/adc.h
@@ -1,28 +1,24 @@
/*
- * File : adc.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2011, RT-Thread Develop Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* 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 ff22c008b1..1cbd0c2d83 100644
--- a/bsp/mb9bf500r/application.c
+++ b/bsp/mb9bf500r/application.c
@@ -1,11 +1,7 @@
/*
- * File : application.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2009 - 2012, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
@@ -15,7 +11,7 @@
/**
* @addtogroup FM3
*/
-
+
/*@{*/
#include <rtthread.h>
@@ -37,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
}
@@ -134,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 f9f83d99ed..f52a5fa3a8 100644
--- a/bsp/mb9bf500r/board.c
+++ b/bsp/mb9bf500r/board.c
@@ -1,11 +1,7 @@
/*
- * File : board.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2009 - 2011 RT-Thread Develop Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
@@ -33,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/board.h b/bsp/mb9bf500r/board.h
index ac5823cec1..2b419c759e 100644
--- a/bsp/mb9bf500r/board.h
+++ b/bsp/mb9bf500r/board.h
@@ -1,11 +1,7 @@
/*
- * File : board.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2009, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
diff --git a/bsp/mb9bf500r/cpuusage.c b/bsp/mb9bf500r/cpuusage.c
index 78e65bced6..df8ba2c240 100644
--- a/bsp/mb9bf500r/cpuusage.c
+++ b/bsp/mb9bf500r/cpuusage.c
@@ -1,3 +1,12 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ */
+
#include <rtthread.h>
#include <rthw.h>
#include "cpuusage.h"
@@ -9,73 +18,73 @@
#include <rtgui/rtgui_system.h>
#endif
-#define CPU_USAGE_CALC_TICK 10
-#define CPU_USAGE_LOOP 100
+#define CPU_USAGE_CALC_TICK 10
+#define CPU_USAGE_LOOP 100
static rt_uint8_t cpu_usage_major = 0, cpu_usage_minor= 0;
static rt_uint32_t total_count = 0;
static void cpu_usage_idle_hook()
{
- rt_tick_t tick;
- rt_uint32_t count;
- volatile rt_uint32_t loop;
+ rt_tick_t tick;
+ rt_uint32_t count;
+ volatile rt_uint32_t loop;
- if (total_count == 0)
- {
- loop = 0;
+ if (total_count == 0)
+ {
+ loop = 0;
- /* get total count */
- rt_enter_critical();
- tick = rt_tick_get();
- while(rt_tick_get() - tick < CPU_USAGE_CALC_TICK)
- {
- total_count ++;
- while (loop < CPU_USAGE_LOOP) loop ++;
- }
- rt_exit_critical();
- }
+ /* get total count */
+ rt_enter_critical();
+ tick = rt_tick_get();
+ while(rt_tick_get() - tick < CPU_USAGE_CALC_TICK)
+ {
+ total_count ++;
+ while (loop < CPU_USAGE_LOOP) loop ++;
+ }
+ rt_exit_critical();
+ }
- count = 0;
- loop = 0;
- /* get CPU usage */
- tick = rt_tick_get();
- while (rt_tick_get() - tick < CPU_USAGE_CALC_TICK)
- {
- count ++;
- while (loop < CPU_USAGE_LOOP) loop ++;
- }
+ count = 0;
+ loop = 0;
+ /* get CPU usage */
+ tick = rt_tick_get();
+ while (rt_tick_get() - tick < CPU_USAGE_CALC_TICK)
+ {
+ count ++;
+ while (loop < CPU_USAGE_LOOP) loop ++;
+ }
- /* calculate major and minor */
- if (count < total_count)
- {
- count = total_count - count;
- cpu_usage_major = (count * 100) / total_count;
- cpu_usage_minor = ((count * 100) % total_count) * 100 / total_count;
- }
- else
- {
- total_count = count;
+ /* calculate major and minor */
+ if (count < total_count)
+ {
+ count = total_count - count;
+ cpu_usage_major = (count * 100) / total_count;
+ cpu_usage_minor = ((count * 100) % total_count) * 100 / total_count;
+ }
+ else
+ {
+ total_count = count;
- /* no CPU usage */
- cpu_usage_major = 0;
- cpu_usage_minor = 0;
- }
+ /* no CPU usage */
+ cpu_usage_major = 0;
+ cpu_usage_minor = 0;
+ }
}
void cpu_usage_get(rt_uint8_t *major, rt_uint8_t *minor)
{
- RT_ASSERT(major != RT_NULL);
- RT_ASSERT(minor != RT_NULL);
+ RT_ASSERT(major != RT_NULL);
+ RT_ASSERT(minor != RT_NULL);
- *major = cpu_usage_major;
- *minor = cpu_usage_minor;
+ *major = cpu_usage_major;
+ *minor = cpu_usage_minor;
}
void cpu_usage_init()
{
- /* set idle thread hook */
- rt_thread_idle_sethook(cpu_usage_idle_hook);
+ /* set idle thread hook */
+ rt_thread_idle_sethook(cpu_usage_idle_hook);
}
extern struct rt_messagequeue mq;
extern rt_thread_t info_tid;
@@ -83,12 +92,12 @@ static void cpu_thread_entry(void *parameter)
{
#ifdef RT_USING_RTGUI
struct rtgui_event_command ecmd;
-
+
RTGUI_EVENT_COMMAND_INIT(&ecmd);
ecmd.type = RTGUI_CMD_USER_INT;
ecmd.command_id = CPU_UPDATE;
#else
- struct lcd_msg msg;
+ struct lcd_msg msg;
#endif
while (1)
@@ -96,10 +105,10 @@ static void cpu_thread_entry(void *parameter)
#ifdef RT_USING_RTGUI
rtgui_thread_send(info_tid, &ecmd.parent, sizeof(ecmd));
#else
- msg.type = CPU_MSG;
- msg.major = cpu_usage_major;
- msg.minor = cpu_usage_minor;
- rt_mq_send(&mq, &msg, sizeof(msg));
+ msg.type = CPU_MSG;
+ msg.major = cpu_usage_major;
+ msg.minor = cpu_usage_minor;
+ rt_mq_send(&mq, &msg, sizeof(msg));
#endif
rt_thread_delay(20);
}
@@ -110,6 +119,6 @@ void rt_hw_cpu_init(void)
{
cpu_usage_init();
cpu_thread = rt_thread_create("cpu", cpu_thread_entry, RT_NULL, 384, 27, 5);
- if(cpu_thread != RT_NULL)
+ if(cpu_thread != RT_NULL)
rt_thread_startup(cpu_thread);
}
diff --git a/bsp/mb9bf500r/cpuusage.h b/bsp/mb9bf500r/cpuusage.h
index c7dd70c944..6a53481f3f 100644
--- a/bsp/mb9bf500r/cpuusage.h
+++ b/bsp/mb9bf500r/cpuusage.h
@@ -1,17 +1,13 @@
/*
- * File : cpuusage.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2011, RT-Thread Develop Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2011-03-03 lgnq
*/
-
+
#ifndef __CPUUSAGE_H__
#define __CPUUSAGE_H__
diff --git a/bsp/mb9bf500r/font.h b/bsp/mb9bf500r/font.h
index bc56c0bb34..92253c59c3 100644
--- a/bsp/mb9bf500r/font.h
+++ b/bsp/mb9bf500r/font.h
@@ -1,263 +1,272 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ */
+
#ifndef __FONT_H
#define __FONT_H
/* Font definition */
-#define ________ 0x00
-#define _______X 0x01
-#define ______X_ 0x02
-#define ______XX 0x03
-#define _____X__ 0x04
-#define _____X_X 0x05
-#define _____XX_ 0x06
-#define _____XXX 0x07
-#define ____X___ 0x08
-#define ____X__X 0x09
-#define ____X_X_ 0x0a
-#define ____X_XX 0x0b
-#define ____XX__ 0x0c
-#define ____XX_X 0x0d
-#define ____XXX_ 0x0e
-#define ____XXXX 0x0f
-#define ___X____ 0x10
-#define ___X___X 0x11
-#define ___X__X_ 0x12
-#define ___X__XX 0x13
-#define ___X_X__ 0x14
-#define ___X_X_X 0x15
-#define ___X_XX_ 0x16
-#define ___X_XXX 0x17
-#define ___XX___ 0x18
-#define ___XX__X 0x19
-#define ___XX_X_ 0x1a
-#define ___XX_XX 0x1b
-#define ___XXX__ 0x1c
-#define ___XXX_X 0x1d
-#define ___XXXX_ 0x1e
-#define ___XXXXX 0x1f
-#define __X_____ 0x20
-#define __X____X 0x21
-#define __X___X_ 0x22
-#define __X___XX 0x23
-#define __X__X__ 0x24
-#define __X__X_X 0x25
-#define __X__XX_ 0x26
-#define __X__XXX 0x27
-#define __X_X___ 0x28
-#define __X_X__X 0x29
-#define __X_X_X_ 0x2a
-#define __X_X_XX 0x2b
-#define __X_XX__ 0x2c
-#define __X_XX_X 0x2d
-#define __X_XXX_ 0x2e
-#define __X_XXXX 0x2f
-#define __XX____ 0x30
-#define __XX___X 0x31
-#define __XX__X_ 0x32
-#define __XX__XX 0x33
-#define __XX_X__ 0x34
-#define __XX_X_X 0x35
-#define __XX_XX_ 0x36
-#define __XX_XXX 0x37
-#define __XXX___ 0x38
-#define __XXX__X 0x39
-#define __XXX_X_ 0x3a
-#define __XXX_XX 0x3b
-#define __XXXX__ 0x3c
-#define __XXXX_X 0x3d
-#define __XXXXX_ 0x3e
-#define __XXXXXX 0x3f
-#define _X______ 0x40
-#define _X_____X 0x41
-#define _X____X_ 0x42
-#define _X____XX 0x43
-#define _X___X__ 0x44
-#define _X___X_X 0x45
-#define _X___XX_ 0x46
-#define _X___XXX 0x47
-#define _X__X___ 0x48
-#define _X__X__X 0x49
-#define _X__X_X_ 0x4a
-#define _X__X_XX 0x4b
-#define _X__XX__ 0x4c
-#define _X__XX_X 0x4d
-#define _X__XXX_ 0x4e
-#define _X__XXXX 0x4f
-#define _X_X____ 0x50
-#define _X_X___X 0x51
-#define _X_X__X_ 0x52
-#define _X_X__XX 0x53
-#define _X_X_X__ 0x54
-#define _X_X_X_X 0x55
-#define _X_X_XX_ 0x56
-#define _X_X_XXX 0x57
-#define _X_XX___ 0x58
-#define _X_XX__X 0x59
-#define _X_XX_X_ 0x5a
-#define _X_XX_XX 0x5b
-#define _X_XXX__ 0x5c
-#define _X_XXX_X 0x5d
-#define _X_XXXX_ 0x5e
-#define _X_XXXXX 0x5f
-#define _XX_____ 0x60
-#define _XX____X 0x61
-#define _XX___X_ 0x62
-#define _XX___XX 0x63
-#define _XX__X__ 0x64
-#define _XX__X_X 0x65
-#define _XX__XX_ 0x66
-#define _XX__XXX 0x67
-#define _XX_X___ 0x68
-#define _XX_X__X 0x69
-#define _XX_X_X_ 0x6a
-#define _XX_X_XX 0x6b
-#define _XX_XX__ 0x6c
-#define _XX_XX_X 0x6d
-#define _XX_XXX_ 0x6e
-#define _XX_XXXX 0x6f
-#define _XXX____ 0x70
-#define _XXX___X 0x71
-#define _XXX__X_ 0x72
-#define _XXX__XX 0x73
-#define _XXX_X__ 0x74
-#define _XXX_X_X 0x75
-#define _XXX_XX_ 0x76
-#define _XXX_XXX 0x77
-#define _XXXX___ 0x78
-#define _XXXX__X 0x79
-#define _XXXX_X_ 0x7a
-#define _XXXX_XX 0x7b
-#define _XXXXX__ 0x7c
-#define _XXXXX_X 0x7d
-#define _XXXXXX_ 0x7e
-#define _XXXXXXX 0x7f
-#define X_______ 0x80
-#define X______X 0x81
-#define X_____X_ 0x82
-#define X_____XX 0x83
-#define X____X__ 0x84
-#define X____X_X 0x85
-#define X____XX_ 0x86
-#define X____XXX 0x87
-#define X___X___ 0x88
-#define X___X__X 0x89
-#define X___X_X_ 0x8a
-#define X___X_XX 0x8b
-#define X___XX__ 0x8c
-#define X___XX_X 0x8d
-#define X___XXX_ 0x8e
-#define X___XXXX 0x8f
-#define X__X____ 0x90
-#define X__X___X 0x91
-#define X__X__X_ 0x92
-#define X__X__XX 0x93
-#define X__X_X__ 0x94
-#define X__X_X_X 0x95
-#define X__X_XX_ 0x96
-#define X__X_XXX 0x97
-#define X__XX___ 0x98
-#define X__XX__X 0x99
-#define X__XX_X_ 0x9a
-#define X__XX_XX 0x9b
-#define X__XXX__ 0x9c
-#define X__XXX_X 0x9d
-#define X__XXXX_ 0x9e
-#define X__XXXXX 0x9f
-#define X_X_____ 0xa0
-#define X_X____X 0xa1
-#define X_X___X_ 0xa2
-#define X_X___XX 0xa3
-#define X_X__X__ 0xa4
-#define X_X__X_X 0xa5
-#define X_X__XX_ 0xa6
-#define X_X__XXX 0xa7
-#define X_X_X___ 0xa8
-#define X_X_X__X 0xa9
-#define X_X_X_X_ 0xaa
-#define X_X_X_XX 0xab
-#define X_X_XX__ 0xac
-#define X_X_XX_X 0xad
-#define X_X_XXX_ 0xae
-#define X_X_XXXX 0xaf
-#define X_XX____ 0xb0
-#define X_XX___X 0xb1
-#define X_XX__X_ 0xb2
-#define X_XX__XX 0xb3
-#define X_XX_X__ 0xb4
-#define X_XX_X_X 0xb5
-#define X_XX_XX_ 0xb6
-#define X_XX_XXX 0xb7
-#define X_XXX___ 0xb8
-#define X_XXX__X 0xb9
-#define X_XXX_X_ 0xba
-#define X_XXX_XX 0xbb
-#define X_XXXX__ 0xbc
-#define X_XXXX_X 0xbd
-#define X_XXXXX_ 0xbe
-#define X_XXXXXX 0xbf
-#define XX______ 0xc0
-#define XX_____X 0xc1
-#define XX____X_ 0xc2
-#define XX____XX 0xc3
-#define XX___X__ 0xc4
-#define XX___X_X 0xc5
-#define XX___XX_ 0xc6
-#define XX___XXX 0xc7
-#define XX__X___ 0xc8
-#define XX__X__X 0xc9
-#define XX__X_X_ 0xca
-#define XX__X_XX 0xcb
-#define XX__XX__ 0xcc
-#define XX__XX_X 0xcd
-#define XX__XXX_ 0xce
-#define XX__XXXX 0xcf
-#define XX_X____ 0xd0
-#define XX_X___X 0xd1
-#define XX_X__X_ 0xd2
-#define XX_X__XX 0xd3
-#define XX_X_X__ 0xd4
-#define XX_X_X_X 0xd5
-#define XX_X_XX_ 0xd6
-#define XX_X_XXX 0xd7
-#define XX_XX___ 0xd8
-#define XX_XX__X 0xd9
-#define XX_XX_X_ 0xda
-#define XX_XX_XX 0xdb
-#define XX_XXX__ 0xdc
-#define XX_XXX_X 0xdd
-#define XX_XXXX_ 0xde
-#define XX_XXXXX 0xdf
-#define XXX_____ 0xe0
-#define XXX____X 0xe1
-#define XXX___X_ 0xe2
-#define XXX___XX 0xe3
-#define XXX__X__ 0xe4
-#define XXX__X_X 0xe5
-#define XXX__XX_ 0xe6
-#define XXX__XXX 0xe7
-#define XXX_X___ 0xe8
-#define XXX_X__X 0xe9
-#define XXX_X_X_ 0xea
-#define XXX_X_XX 0xeb
-#define XXX_XX__ 0xec
-#define XXX_XX_X 0xed
-#define XXX_XXX_ 0xee
-#define XXX_XXXX 0xef
-#define XXXX____ 0xf0
-#define XXXX___X 0xf1
-#define XXXX__X_ 0xf2
-#define XXXX__XX 0xf3
-#define XXXX_X__ 0xf4
-#define XXXX_X_X 0xf5
-#define XXXX_XX_ 0xf6
-#define XXXX_XXX 0xf7
-#define XXXXX___ 0xf8
-#define XXXXX__X 0xf9
-#define XXXXX_X_ 0xfa
-#define XXXXX_XX 0xfb
-#define XXXXXX__ 0xfc
-#define XXXXXX_X 0xfd
-#define XXXXXXX_ 0xfe
-#define XXXXXXXX 0xff
+#define ________ 0x00
+#define _______X 0x01
+#define ______X_ 0x02
+#define ______XX 0x03
+#define _____X__ 0x04
+#define _____X_X 0x05
+#define _____XX_ 0x06
+#define _____XXX 0x07
+#define ____X___ 0x08
+#define ____X__X 0x09
+#define ____X_X_ 0x0a
+#define ____X_XX 0x0b
+#define ____XX__ 0x0c
+#define ____XX_X 0x0d
+#define ____XXX_ 0x0e
+#define ____XXXX 0x0f
+#define ___X____ 0x10
+#define ___X___X 0x11
+#define ___X__X_ 0x12
+#define ___X__XX 0x13
+#define ___X_X__ 0x14
+#define ___X_X_X 0x15
+#define ___X_XX_ 0x16
+#define ___X_XXX 0x17
+#define ___XX___ 0x18
+#define ___XX__X 0x19
+#define ___XX_X_ 0x1a
+#define ___XX_XX 0x1b
+#define ___XXX__ 0x1c
+#define ___XXX_X 0x1d
+#define ___XXXX_ 0x1e
+#define ___XXXXX 0x1f
+#define __X_____ 0x20
+#define __X____X 0x21
+#define __X___X_ 0x22
+#define __X___XX 0x23
+#define __X__X__ 0x24
+#define __X__X_X 0x25
+#define __X__XX_ 0x26
+#define __X__XXX 0x27
+#define __X_X___ 0x28
+#define __X_X__X 0x29
+#define __X_X_X_ 0x2a
+#define __X_X_XX 0x2b
+#define __X_XX__ 0x2c
+#define __X_XX_X 0x2d
+#define __X_XXX_ 0x2e
+#define __X_XXXX 0x2f
+#define __XX____ 0x30
+#define __XX___X 0x31
+#define __XX__X_ 0x32
+#define __XX__XX 0x33
+#define __XX_X__ 0x34
+#define __XX_X_X 0x35
+#define __XX_XX_ 0x36
+#define __XX_XXX 0x37
+#define __XXX___ 0x38
+#define __XXX__X 0x39
+#define __XXX_X_ 0x3a
+#define __XXX_XX 0x3b
+#define __XXXX__ 0x3c
+#define __XXXX_X 0x3d
+#define __XXXXX_ 0x3e
+#define __XXXXXX 0x3f
+#define _X______ 0x40
+#define _X_____X 0x41
+#define _X____X_ 0x42
+#define _X____XX 0x43
+#define _X___X__ 0x44
+#define _X___X_X 0x45
+#define _X___XX_ 0x46
+#define _X___XXX 0x47
+#define _X__X___ 0x48
+#define _X__X__X 0x49
+#define _X__X_X_ 0x4a
+#define _X__X_XX 0x4b
+#define _X__XX__ 0x4c
+#define _X__XX_X 0x4d
+#define _X__XXX_ 0x4e
+#define _X__XXXX 0x4f
+#define _X_X____ 0x50
+#define _X_X___X 0x51
+#define _X_X__X_ 0x52
+#define _X_X__XX 0x53
+#define _X_X_X__ 0x54
+#define _X_X_X_X 0x55
+#define _X_X_XX_ 0x56
+#define _X_X_XXX 0x57
+#define _X_XX___ 0x58
+#define _X_XX__X 0x59
+#define _X_XX_X_ 0x5a
+#define _X_XX_XX 0x5b
+#define _X_XXX__ 0x5c
+#define _X_XXX_X 0x5d
+#define _X_XXXX_ 0x5e
+#define _X_XXXXX 0x5f
+#define _XX_____ 0x60
+#define _XX____X 0x61
+#define _XX___X_ 0x62
+#define _XX___XX 0x63
+#define _XX__X__ 0x64
+#define _XX__X_X 0x65
+#define _XX__XX_ 0x66
+#define _XX__XXX 0x67
+#define _XX_X___ 0x68
+#define _XX_X__X 0x69
+#define _XX_X_X_ 0x6a
+#define _XX_X_XX 0x6b
+#define _XX_XX__ 0x6c
+#define _XX_XX_X 0x6d
+#define _XX_XXX_ 0x6e
+#define _XX_XXXX 0x6f
+#define _XXX____ 0x70
+#define _XXX___X 0x71
+#define _XXX__X_ 0x72
+#define _XXX__XX 0x73
+#define _XXX_X__ 0x74
+#define _XXX_X_X 0x75
+#define _XXX_XX_ 0x76
+#define _XXX_XXX 0x77
+#define _XXXX___ 0x78
+#define _XXXX__X 0x79
+#define _XXXX_X_ 0x7a
+#define _XXXX_XX 0x7b
+#define _XXXXX__ 0x7c
+#define _XXXXX_X 0x7d
+#define _XXXXXX_ 0x7e
+#define _XXXXXXX 0x7f
+#define X_______ 0x80
+#define X______X 0x81
+#define X_____X_ 0x82
+#define X_____XX 0x83
+#define X____X__ 0x84
+#define X____X_X 0x85
+#define X____XX_ 0x86
+#define X____XXX 0x87
+#define X___X___ 0x88
+#define X___X__X 0x89
+#define X___X_X_ 0x8a
+#define X___X_XX 0x8b
+#define X___XX__ 0x8c
+#define X___XX_X 0x8d
+#define X___XXX_ 0x8e
+#define X___XXXX 0x8f
+#define X__X____ 0x90
+#define X__X___X 0x91
+#define X__X__X_ 0x92
+#define X__X__XX 0x93
+#define X__X_X__ 0x94
+#define X__X_X_X 0x95
+#define X__X_XX_ 0x96
+#define X__X_XXX 0x97
+#define X__XX___ 0x98
+#define X__XX__X 0x99
+#define X__XX_X_ 0x9a
+#define X__XX_XX 0x9b
+#define X__XXX__ 0x9c
+#define X__XXX_X 0x9d
+#define X__XXXX_ 0x9e
+#define X__XXXXX 0x9f
+#define X_X_____ 0xa0
+#define X_X____X 0xa1
+#define X_X___X_ 0xa2
+#define X_X___XX 0xa3
+#define X_X__X__ 0xa4
+#define X_X__X_X 0xa5
+#define X_X__XX_ 0xa6
+#define X_X__XXX 0xa7
+#define X_X_X___ 0xa8
+#define X_X_X__X 0xa9
+#define X_X_X_X_ 0xaa
+#define X_X_X_XX 0xab
+#define X_X_XX__ 0xac
+#define X_X_XX_X 0xad
+#define X_X_XXX_ 0xae
+#define X_X_XXXX 0xaf
+#define X_XX____ 0xb0
+#define X_XX___X 0xb1
+#define X_XX__X_ 0xb2
+#define X_XX__XX 0xb3
+#define X_XX_X__ 0xb4
+#define X_XX_X_X 0xb5
+#define X_XX_XX_ 0xb6
+#define X_XX_XXX 0xb7
+#define X_XXX___ 0xb8
+#define X_XXX__X 0xb9
+#define X_XXX_X_ 0xba
+#define X_XXX_XX 0xbb
+#define X_XXXX__ 0xbc
+#define X_XXXX_X 0xbd
+#define X_XXXXX_ 0xbe
+#define X_XXXXXX 0xbf
+#define XX______ 0xc0
+#define XX_____X 0xc1
+#define XX____X_ 0xc2
+#define XX____XX 0xc3
+#define XX___X__ 0xc4
+#define XX___X_X 0xc5
+#define XX___XX_ 0xc6
+#define XX___XXX 0xc7
+#define XX__X___ 0xc8
+#define XX__X__X 0xc9
+#define XX__X_X_ 0xca
+#define XX__X_XX 0xcb
+#define XX__XX__ 0xcc
+#define XX__XX_X 0xcd
+#define XX__XXX_ 0xce
+#define XX__XXXX 0xcf
+#define XX_X____ 0xd0
+#define XX_X___X 0xd1
+#define XX_X__X_ 0xd2
+#define XX_X__XX 0xd3
+#define XX_X_X__ 0xd4
+#define XX_X_X_X 0xd5
+#define XX_X_XX_ 0xd6
+#define XX_X_XXX 0xd7
+#define XX_XX___ 0xd8
+#define XX_XX__X 0xd9
+#define XX_XX_X_ 0xda
+#define XX_XX_XX 0xdb
+#define XX_XXX__ 0xdc
+#define XX_XXX_X 0xdd
+#define XX_XXXX_ 0xde
+#define XX_XXXXX 0xdf
+#define XXX_____ 0xe0
+#define XXX____X 0xe1
+#define XXX___X_ 0xe2
+#define XXX___XX 0xe3
+#define XXX__X__ 0xe4
+#define XXX__X_X 0xe5
+#define XXX__XX_ 0xe6
+#define XXX__XXX 0xe7
+#define XXX_X___ 0xe8
+#define XXX_X__X 0xe9
+#define XXX_X_X_ 0xea
+#define XXX_X_XX 0xeb
+#define XXX_XX__ 0xec
+#define XXX_XX_X 0xed
+#define XXX_XXX_ 0xee
+#define XXX_XXXX 0xef
+#define XXXX____ 0xf0
+#define XXXX___X 0xf1
+#define XXXX__X_ 0xf2
+#define XXXX__XX 0xf3
+#define XXXX_X__ 0xf4
+#define XXXX_X_X 0xf5
+#define XXXX_XX_ 0xf6
+#define XXXX_XXX 0xf7
+#define XXXXX___ 0xf8
+#define XXXXX__X 0xf9
+#define XXXXX_X_ 0xfa
+#define XXXXX_XX 0xfb
+#define XXXXXX__ 0xfc
+#define XXXXXX_X 0xfd
+#define XXXXXXX_ 0xfe
+#define XXXXXXXX 0xff
@@ -272,8 +281,8 @@ const unsigned char FONTTYPE8_8[][8] = {
________,
________,
________,
- ________}
-
+ ________}
+
/* 0 */
,{
__XXX___,
@@ -283,7 +292,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX___XX_,
_XX_XX__,
__XXX___,
- ________}
+ ________}
/* 1 */
,{
@@ -294,7 +303,7 @@ const unsigned char FONTTYPE8_8[][8] = {
___XX___,
___XX___,
_XXXXXX_,
- ________}
+ ________}
/* 2 */
,{
@@ -305,7 +314,7 @@ const unsigned char FONTTYPE8_8[][8] = {
__XX____,
_XX__XX_,
XXXXXXX_,
- ________}
+ ________}
/* 3 */
,{
@@ -316,7 +325,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_____XX_,
XX___XX_,
_XXXXX__,
- ________}
+ ________}
/* 4 */
,{
@@ -327,7 +336,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XXXXXXX_,
____XX__,
___XXXX_,
- ________}
+ ________}
/* 5 */
,{
@@ -338,7 +347,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_____XX_,
XX___XX_,
_XXXXX__,
- ________}
+ ________}
/* 6 */
,{
@@ -349,7 +358,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX___XX_,
XX___XX_,
_XXXXX__,
- ________}
+ ________}
/* 7 */
,{
@@ -360,7 +369,7 @@ const unsigned char FONTTYPE8_8[][8] = {
__XX____,
__XX____,
__XX____,
- ________}
+ ________}
/* 8 */
,{
@@ -371,7 +380,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX___XX_,
XX___XX_,
_XXXXX__,
- ________}
+ ________}
/* 9 */
,{
@@ -382,7 +391,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_____XX_,
____XX__,
_XXXX___,
- ________}
+ ________}
/* A */
,{
@@ -393,7 +402,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX___XX_,
XX___XX_,
XX___XX_,
- ________}
+ ________}
/* B */
,{
@@ -404,7 +413,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XX__XX_,
_XX__XX_,
XXXXXX__,
- ________}
+ ________}
/* C */
,{
@@ -415,7 +424,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX______,
_XX__XX_,
__XXXX__,
- ________}
+ ________}
/* D */
,{
@@ -426,7 +435,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XX__XX_,
_XX_XX__,
XXXXX___,
- ________}
+ ________}
/* E */
,{
@@ -437,7 +446,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XX_X___,
_XX___X_,
XXXXXXX_,
- ________}
+ ________}
/* F */
,{
@@ -448,7 +457,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XX_X___,
_XX_____,
XXXX____,
- ________}
+ ________}
/* G */
,{
@@ -459,7 +468,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX__XXX_,
_XX__XX_,
__XXX_X_,
- ________}
+ ________}
/* H */
,{
@@ -470,7 +479,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX___XX_,
XX___XX_,
XX___XX_,
- ________}
+ ________}
/* I */
,{
@@ -481,7 +490,7 @@ const unsigned char FONTTYPE8_8[][8] = {
___XX___,
___XX___,
__XXXX__,
- ________}
+ ________}
/* J */
,{
@@ -492,7 +501,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX__XX__,
XX__XX__,
_XXXX___,
- ________}
+ ________}
/* K */
,{
@@ -503,7 +512,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XX_XX__,
_XX__XX_,
XXX__XX_,
- ________}
+ ________}
/* L */
,{
@@ -514,7 +523,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XX___X_,
_XX__XX_,
XXXXXXX_,
- ________}
+ ________}
/* M */
,{
@@ -525,7 +534,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX_X_XX_,
XX___XX_,
XX___XX_,
- ________}
+ ________}
/* N */
,{
@@ -536,7 +545,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX__XXX_,
XX___XX_,
XX___XX_,
- ________}
+ ________}
/* O */
,{
@@ -547,7 +556,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX___XX_,
XX___XX_,
_XXXXX__,
- ________}
+ ________}
/* P */
,{
@@ -558,7 +567,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XX_____,
_XX_____,
XXXX____,
- ________}
+ ________}
/* Q */
,{
@@ -569,7 +578,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX___XX_,
XX__XXX_,
_XXXXX__,
- ____XXX_}
+ ____XXX_}
/* R */
,{
@@ -580,7 +589,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XX_XX__,
_XX__XX_,
XXX__XX_,
- ________}
+ ________}
/* S */
,{
@@ -591,7 +600,7 @@ const unsigned char FONTTYPE8_8[][8] = {
____XX__,
_XX__XX_,
__XXXX__,
- ________}
+ ________}
/* T */
,{
@@ -602,7 +611,7 @@ const unsigned char FONTTYPE8_8[][8] = {
___XX___,
___XX___,
__XXXX__,
- ________}
+ ________}
/* U */
,{
@@ -613,7 +622,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX___XX_,
XX___XX_,
_XXXXX__,
- ________}
+ ________}
/* V */
,{
@@ -624,7 +633,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX___XX_,
_XX_XX__,
__XXX___,
- ________}
+ ________}
/* W */
,{
@@ -635,7 +644,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX_X_XX_,
XXXXXXX_,
_XX_XX__,
- ________}
+ ________}
/* X */
,{
@@ -646,7 +655,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XX_XX__,
XX___XX_,
XX___XX_,
- ________}
+ ________}
/* Y */
,{
@@ -657,7 +666,7 @@ const unsigned char FONTTYPE8_8[][8] = {
___XX___,
___XX___,
__XXXX__,
- ________}
+ ________}
/* Z */
,{
@@ -668,7 +677,7 @@ const unsigned char FONTTYPE8_8[][8] = {
__XX__X_,
_XX__XX_,
XXXXXXX_,
- ________}
+ ________}
/* a */
,{
@@ -679,7 +688,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XXXXX__,
XX__XX__,
_XXX_XX_,
- ________}
+ ________}
/* b */
,{
@@ -690,7 +699,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XX__XX_,
_XX__XX_,
XX_XXX__,
- ________}
+ ________}
/* c */
,{
@@ -701,7 +710,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX______,
XX___XX_,
_XXXXX__,
- ________}
+ ________}
/* d */
,{
@@ -712,7 +721,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX__XX__,
XX__XX__,
_XXX_XX_,
- ________}
+ ________}
/* e */
,{
@@ -723,7 +732,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XXXXXXX_,
XX______,
_XXXXX__,
- ________}
+ ________}
/* f */
,{
@@ -734,7 +743,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XX_____,
_XX_____,
XXXX____,
- ________}
+ ________}
/* g */
,{
@@ -745,7 +754,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX__XX__,
_XXXXX__,
____XX__,
- XXXXX___}
+ XXXXX___}
/* h */
,{
@@ -756,7 +765,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XX__XX_,
_XX__XX_,
XXX__XX_,
- ________}
+ ________}
/* i */
,{
@@ -767,7 +776,7 @@ const unsigned char FONTTYPE8_8[][8] = {
___XX___,
___XX___,
__XXXX__,
- ________}
+ ________}
/* j */
,{
@@ -778,7 +787,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_____XX_,
_XX__XX_,
_XX__XX_,
- __XXXX__}
+ __XXXX__}
/* k */
,{
@@ -789,7 +798,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XXXX___,
_XX_XX__,
XXX__XX_,
- ________}
+ ________}
/* l */
,{
@@ -800,7 +809,7 @@ const unsigned char FONTTYPE8_8[][8] = {
___XX___,
___XX___,
__XXXX__,
- ________}
+ ________}
/* m */
,{
@@ -811,7 +820,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX_X_XX_,
XX_X_XX_,
XX_X_XX_,
- ________}
+ ________}
/* n */
,{
@@ -822,7 +831,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XX__XX_,
_XX__XX_,
_XX__XX_,
- ________}
+ ________}
/* o */
,{
@@ -833,7 +842,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX___XX_,
XX___XX_,
_XXXXX__,
- ________}
+ ________}
/* p */
,{
@@ -844,7 +853,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XX__XX_,
_XXXXX__,
_XX_____,
- XXXX____}
+ XXXX____}
/* q */
,{
@@ -855,7 +864,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX__XX__,
_XXXXX__,
____XX__,
- ___XXXX_}
+ ___XXXX_}
/* r */
,{
@@ -866,7 +875,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XX_____,
_XX_____,
XXXX____,
- ________}
+ ________}
/* s */
,{
@@ -877,7 +886,7 @@ const unsigned char FONTTYPE8_8[][8] = {
_XXXXX__,
_____XX_,
XXXXXX__,
- ________}
+ ________}
/* t */
,{
@@ -888,7 +897,7 @@ const unsigned char FONTTYPE8_8[][8] = {
__XX____,
__XX_XX_,
___XXX__,
- ________}
+ ________}
/* u */
,{
@@ -899,7 +908,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX__XX__,
XX__XX__,
_XXX_XX_,
- ________}
+ ________}
/* v */
,{
@@ -910,7 +919,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX___XX_,
_XX_XX__,
__XXX___,
- ________}
+ ________}
/* w */
,{
@@ -921,7 +930,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX_X_XX_,
XXXXXXX_,
_XX_XX__,
- ________}
+ ________}
/* x */
,{
@@ -932,7 +941,7 @@ const unsigned char FONTTYPE8_8[][8] = {
__XXX___,
_XX_XX__,
XX___XX_,
- ________}
+ ________}
/* y */
,{
@@ -943,7 +952,7 @@ const unsigned char FONTTYPE8_8[][8] = {
XX___XX_,
_XXXXXX_,
_____XX_,
- XXXXXX__}
+ XXXXXX__}
/* z */
,{
@@ -954,7 +963,7 @@ const unsigned char FONTTYPE8_8[][8] = {
___XX___,
__XX__X_,
_XXXXXX_,
- ________}
+ ________}
};
diff --git a/bsp/mb9bf500r/info.c b/bsp/mb9bf500r/info.c
index 6e76c95e59..fcf514f1b0 100644
--- a/bsp/mb9bf500r/info.c
+++ b/bsp/mb9bf500r/info.c
@@ -1,3 +1,12 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ */
+
#include <rtthread.h>
#ifdef RT_USING_RTGUI
@@ -15,37 +24,37 @@ extern rt_uint16_t adc_value;
static rt_uint8_t index = 0 ;
static rt_bool_t view_event_handler(struct rtgui_widget* widget, struct rtgui_event* event)
{
- if (event->type == RTGUI_EVENT_PAINT)
- {
- struct rtgui_dc* dc;
- struct rtgui_rect rect;
+ if (event->type == RTGUI_EVENT_PAINT)
+ {
+ struct rtgui_dc* dc;
+ struct rtgui_rect rect;
- dc = rtgui_dc_begin_drawing(widget);
- if (dc == RT_NULL)
+ dc = rtgui_dc_begin_drawing(widget);
+ if (dc == RT_NULL)
return RT_FALSE;
- rtgui_widget_get_rect(widget, &rect);
+ rtgui_widget_get_rect(widget, &rect);
- rtgui_dc_fill_rect(dc, &rect);
- rect.x2 -= 1; rect.y2 -= 1;
- rtgui_dc_draw_hline(dc, rect.x1, rect.x2, rect.y1);
- rtgui_dc_draw_vline(dc, rect.x1, rect.y1, rect.y2);
+ rtgui_dc_fill_rect(dc, &rect);
+ rect.x2 -= 1; rect.y2 -= 1;
+ rtgui_dc_draw_hline(dc, rect.x1, rect.x2, rect.y1);
+ rtgui_dc_draw_vline(dc, rect.x1, rect.y1, rect.y2);
+
+ rtgui_dc_draw_hline(dc, rect.x1, rect.x2, rect.y2);
+ rtgui_dc_draw_vline(dc, rect.x2, rect.y1, rect.y2 + 1);
- rtgui_dc_draw_hline(dc, rect.x1, rect.x2, rect.y2);
- rtgui_dc_draw_vline(dc, rect.x2, rect.y1, rect.y2 + 1);
-
/* shrink border */
- rtgui_rect_inflate(&rect, -1);
-
- /* draw text */
+ rtgui_rect_inflate(&rect, -1);
+
+ /* draw text */
rtgui_widget_get_rect(widget, &rect);
- rect.y1 += 25;
+ rect.y1 += 25;
rtgui_dc_draw_text(dc, " FM3 Easy Kit Demo", &rect);
rect.y1 += 10;
rtgui_dc_draw_text(dc, " rt-thread / RTGUI", &rect);
- rtgui_dc_end_drawing(dc, RT_TRUE);
+ rtgui_dc_end_drawing(dc, RT_TRUE);
- return RT_FALSE;
- }
+ return RT_FALSE;
+ }
else if (event->type == RTGUI_EVENT_KBD)
{
struct rtgui_dc* dc;
@@ -67,18 +76,18 @@ static rt_bool_t view_event_handler(struct rtgui_widget* widget, struct rtgui_ev
break;
case RTGUIK_UP:
rt_sprintf(key_str, "%s", "U");
- break;
+ break;
default:
rt_sprintf(key_str, "%s", "S");
break;
}
dc = rtgui_dc_begin_drawing(widget);
- if (dc == RT_NULL)
+ if (dc == RT_NULL)
return RT_FALSE;
rect.x1 = 118;
- rect.y1 = 1;
+ rect.y1 = 1;
rect.x2 = 127;
- rect.y2 = 10;
+ rect.y2 = 10;
rtgui_dc_fill_rect(dc, &rect);
rtgui_dc_draw_text(dc, key_str, &rect);
rtgui_dc_end_drawing(dc, RT_TRUE);
@@ -86,12 +95,12 @@ static rt_bool_t view_event_handler(struct rtgui_widget* widget, struct rtgui_ev
else if (ekbd->type == RTGUI_KEYUP)
{
dc = rtgui_dc_begin_drawing(widget);
- if (dc == RT_NULL)
+ if (dc == RT_NULL)
return RT_FALSE;
rect.x1 = 118;
- rect.y1 = 1;
+ rect.y1 = 1;
rect.x2 = 127;
- rect.y2 = 10;
+ rect.y2 = 10;
rtgui_dc_fill_rect(dc, &rect);
//rtgui_dc_draw_text(dc, key_str, &rect);
rtgui_dc_end_drawing(dc, RT_TRUE);
@@ -105,38 +114,38 @@ static rt_bool_t view_event_handler(struct rtgui_widget* widget, struct rtgui_ev
struct rtgui_event_command* ecmd;
rt_uint8_t major,minor;
dc = rtgui_dc_begin_drawing(widget);
- if (dc == RT_NULL)
+ if (dc == RT_NULL)
return RT_FALSE;
-
+
ecmd = (struct rtgui_event_command*)event;
switch (ecmd->command_id)
- {
+ {
case ADC_UPDATE:
rect.x1 = 1;
- rect.y1 = 1;
+ rect.y1 = 1;
rect.x2 = 117;
- rect.y2 = 10;
- rtgui_dc_fill_rect(dc, &rect);
- rt_sprintf(str, "ADC = %d mv", adc_value);
- rtgui_dc_draw_text(dc, str, &rect);
+ rect.y2 = 10;
+ rtgui_dc_fill_rect(dc, &rect);
+ rt_sprintf(str, "ADC = %d mv", adc_value);
+ rtgui_dc_draw_text(dc, str, &rect);
break;
case CPU_UPDATE:
cpu_usage_get(&major, &minor);
rect.x1 = 1;
- rect.y1 = 12;
+ rect.y1 = 12;
rect.x2 = 127;
- rect.y2 = 22;
- rtgui_dc_fill_rect(dc, &rect);
- rt_sprintf(str, "CPU : %d.%d%", major, minor);
- rtgui_dc_draw_text(dc, str, &rect);
+ rect.y2 = 22;
+ rtgui_dc_fill_rect(dc, &rect);
+ rt_sprintf(str, "CPU : %d.%d%", major, minor);
+ rtgui_dc_draw_text(dc, str, &rect);
- rect.y1 = 23;
- rect.y2 = 63;
+ rect.y1 = 23;
+ rect.y2 = 63;
index++;
if (index == 127)
- {
+ {
index = 1;
- rtgui_dc_fill_rect(dc, &rect);
+ rtgui_dc_fill_rect(dc, &rect);
}
if (major>40)
rtgui_dc_draw_vline(dc, index, rect.y1, rect.y2);
@@ -144,42 +153,42 @@ static rt_bool_t view_event_handler(struct rtgui_widget* widget, struct rtgui_ev
rtgui_dc_draw_vline(dc, index, rect.y2-major, rect.y2);
break;
}
- rtgui_dc_end_drawing(dc, RT_TRUE);
+ rtgui_dc_end_drawing(dc, RT_TRUE);
}
- return rtgui_view_event_handler(widget, event);
+ return rtgui_view_event_handler(widget, event);
}
static void info_entry(void* parameter)
{
- rt_mq_t mq;
- struct rtgui_view* view;
- struct rtgui_workbench* workbench;
+ rt_mq_t mq;
+ struct rtgui_view* view;
+ struct rtgui_workbench* workbench;
- mq = rt_mq_create("qInfo", 256, 4, RT_IPC_FLAG_FIFO);
- rtgui_thread_register(rt_thread_self(), mq);
+ mq = rt_mq_create("qInfo", 256, 4, RT_IPC_FLAG_FIFO);
+ rtgui_thread_register(rt_thread_self(), mq);
- workbench = rtgui_workbench_create("info", "workbench");
- if(workbench == RT_NULL)
+ workbench = rtgui_workbench_create("info", "workbench");
+ if(workbench == RT_NULL)
return;
- view = rtgui_view_create("view");
- RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(view)) = white;
+ view = rtgui_view_create("view");
+ RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(view)) = white;
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(view)) = black;
- rtgui_widget_set_event_handler(RTGUI_WIDGET(view), view_event_handler);
+ rtgui_widget_set_event_handler(RTGUI_WIDGET(view), view_event_handler);
- rtgui_workbench_add_view(workbench, view);
+ rtgui_workbench_add_view(workbench, view);
/* this view can be focused */
RTGUI_WIDGET(view)->flag |= RTGUI_WIDGET_FLAG_FOCUSABLE;
/* set widget focus */
- rtgui_widget_focus(RTGUI_WIDGET(view));
+ rtgui_widget_focus(RTGUI_WIDGET(view));
- rtgui_view_show(view, RT_FALSE);
+ rtgui_view_show(view, RT_FALSE);
- rtgui_workbench_event_loop(workbench);
+ rtgui_workbench_event_loop(workbench);
- rtgui_thread_deregister(rt_thread_self());
- rt_mq_delete(mq);
+ rtgui_thread_deregister(rt_thread_self());
+ rt_mq_delete(mq);
}
rt_thread_t info_tid;
@@ -195,10 +204,9 @@ void info_init()
void rtgui_startup()
{
rtgui_rect_t rect;
-
- /* GUIϵͳ��ʼ�� */
+
rtgui_system_server_init();
-
+
/* register dock panel */
rect.x1 = 0;
rect.y1 = 0;
@@ -206,9 +214,9 @@ void rtgui_startup()
rect.y2 = 64;
rtgui_panel_register("info", &rect);
rtgui_panel_set_default_focused("info");
-
- /* ����info workbench */
- info_init();
+
+ /*init info workbench */
+ info_init();
}
#endif
diff --git a/bsp/mb9bf500r/key.c b/bsp/mb9bf500r/key.c
index 6a574a1251..1886e72974 100644
--- a/bsp/mb9bf500r/key.c
+++ b/bsp/mb9bf500r/key.c
@@ -1,15 +1,11 @@
/*
- * File : key.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2011, RT-Thread Develop Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
- * 2011-03-03 lgnq
+ * 2011-03-03 lgnq
*/
#include <rtthread.h>
@@ -25,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;
@@ -38,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 */
@@ -109,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
}
@@ -159,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/key.h b/bsp/mb9bf500r/key.h
index edabf1dffb..45c044c7c0 100644
--- a/bsp/mb9bf500r/key.h
+++ b/bsp/mb9bf500r/key.h
@@ -1,11 +1,7 @@
/*
- * File : key.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2011, RT-Thread Develop Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
diff --git a/bsp/mb9bf500r/lcd.c b/bsp/mb9bf500r/lcd.c
index db2f272a8a..8b61abf2e0 100644
--- a/bsp/mb9bf500r/lcd.c
+++ b/bsp/mb9bf500r/lcd.c
@@ -1,11 +1,7 @@
/*
- * File : lcd.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2011, RT-Thread Develop Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
@@ -59,7 +55,7 @@ void lcd_write_cmd(unsigned char command)
LCD_DATA_HIGH();
else
LCD_DATA_LOW();
-
+
LCD_CLK_LOW();
delay();
LCD_CLK_HIGH();
@@ -81,7 +77,7 @@ void lcd_write_data(unsigned char data)
LCD_DATA_HIGH();
else
LCD_DATA_LOW();
-
+
LCD_CLK_LOW();
delay();
LCD_CLK_HIGH();
@@ -97,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--)
@@ -125,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));
}
@@ -134,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
@@ -144,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));
}
}
@@ -169,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);
@@ -213,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*/
@@ -228,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();
@@ -239,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
@@ -271,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);
@@ -280,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;
}
@@ -291,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--)
@@ -322,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);
@@ -331,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
@@ -344,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
@@ -363,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))
@@ -380,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
@@ -411,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);
@@ -450,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 8c0462d6e3..e0fa9efdc3 100644
--- a/bsp/mb9bf500r/lcd.h
+++ b/bsp/mb9bf500r/lcd.h
@@ -1,11 +1,7 @@
/*
- * File : lcd.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006, RT-Thread Develop Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
@@ -19,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 72c01b4507..ee28af7035 100644
--- a/bsp/mb9bf500r/led.c
+++ b/bsp/mb9bf500r/led.c
@@ -1,17 +1,13 @@
/*
- * File : led.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2011, RT-Thread Develop Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2011-03-03 lgnq
*/
-
+
#include <rtthread.h>
#include <rthw.h>
@@ -20,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:
@@ -31,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)
{
@@ -51,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:
@@ -80,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)
@@ -95,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)
@@ -139,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 6dd71c0d95..c4a433cb81 100644
--- a/bsp/mb9bf500r/led.h
+++ b/bsp/mb9bf500r/led.h
@@ -1,23 +1,19 @@
/*
- * File : led.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2011, RT-Thread Develop Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* 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)
@@ -29,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 a8718750fc..1e7309ae3e 100644
--- a/bsp/mb9bf500r/startup.c
+++ b/bsp/mb9bf500r/startup.c
@@ -1,11 +1,7 @@
/*
- * File : startup.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2009 - 2011, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
@@ -38,57 +34,57 @@ 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 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();
- /* 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;
}
/*@}*/