[mb9bf500r] 手动-自动格式整理
This commit is contained in:
parent
061182271f
commit
75405b62b8
|
@ -1,15 +1,11 @@
|
|||
/*
|
||||
* 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>
|
||||
|
@ -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;
|
||||
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 */
|
||||
/* 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 */
|
||||
/* 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;
|
||||
break;
|
||||
|
||||
case RT_DEVICE_CTRL_ADC_RESULT:
|
||||
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;
|
||||
|
@ -102,7 +98,7 @@ static void adc_thread_entry(void *parameter)
|
|||
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)
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
/*
|
||||
* 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
|
||||
|
@ -17,12 +13,12 @@
|
|||
|
||||
/* 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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -40,93 +36,93 @@ void rt_init_thread_entry(void *parameter)
|
|||
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();
|
||||
/* init rtgui system server */
|
||||
rtgui_system_server_init();
|
||||
|
||||
/* startup rtgui */
|
||||
rtgui_startup();
|
||||
/* startup rtgui */
|
||||
rtgui_startup();
|
||||
#else
|
||||
{
|
||||
char buf[20] = {'\0'};
|
||||
{
|
||||
char buf[20] = {'\0'};
|
||||
struct lcd_msg msg;
|
||||
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.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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -134,7 +130,7 @@ 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)
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
@ -88,7 +97,7 @@ static void cpu_thread_entry(void *parameter)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
/*
|
||||
* 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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
rtgui_rect_inflate(&rect, -1);
|
||||
|
||||
/* draw text */
|
||||
/* draw text */
|
||||
rtgui_widget_get_rect(widget, &rect);
|
||||
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;
|
||||
|
@ -117,8 +126,8 @@ static rt_bool_t view_event_handler(struct rtgui_widget* widget, struct rtgui_ev
|
|||
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);
|
||||
rt_sprintf(str, "ADC = %d mv", adc_value);
|
||||
rtgui_dc_draw_text(dc, str, &rect);
|
||||
break;
|
||||
case CPU_UPDATE:
|
||||
cpu_usage_get(&major, &minor);
|
||||
|
@ -127,8 +136,8 @@ static rt_bool_t view_event_handler(struct rtgui_widget* widget, struct rtgui_ev
|
|||
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);
|
||||
rt_sprintf(str, "CPU : %d.%d%", major, minor);
|
||||
rtgui_dc_draw_text(dc, str, &rect);
|
||||
|
||||
rect.y1 = 23;
|
||||
rect.y2 = 63;
|
||||
|
@ -147,39 +156,39 @@ static rt_bool_t view_event_handler(struct rtgui_widget* widget, struct rtgui_ev
|
|||
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_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;
|
||||
|
@ -196,7 +205,7 @@ void rtgui_startup()
|
|||
{
|
||||
rtgui_rect_t rect;
|
||||
|
||||
/* GUIϵͳ³õʼ»¯ */
|
||||
/* GUIϵͳ<CFB5><CDB3>ʼ<EFBFBD><CABC> */
|
||||
rtgui_system_server_init();
|
||||
|
||||
/* register dock panel */
|
||||
|
@ -207,8 +216,8 @@ void rtgui_startup()
|
|||
rtgui_panel_register("info", &rect);
|
||||
rtgui_panel_set_default_focused("info");
|
||||
|
||||
/* Æô¶¯info workbench */
|
||||
info_init();
|
||||
/* <20><><EFBFBD><EFBFBD>info workbench */
|
||||
info_init();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
@ -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;
|
||||
extern struct rt_messagequeue mq;
|
||||
rt_time_t next_delay;
|
||||
struct lcd_msg msg;
|
||||
msg.type = KEY_MSG;
|
||||
|
||||
key_io_init();
|
||||
key_io_init();
|
||||
|
||||
while (1)
|
||||
{
|
||||
msg.key = NO_KEY;
|
||||
while (1)
|
||||
{
|
||||
msg.key = NO_KEY;
|
||||
|
||||
next_delay = RT_TICK_PER_SECOND/10;
|
||||
next_delay = RT_TICK_PER_SECOND/10;
|
||||
|
||||
if (KEY_ENTER_GETVALUE() == 0 )
|
||||
{
|
||||
msg.key = KEY_ENTER;
|
||||
}
|
||||
if (KEY_ENTER_GETVALUE() == 0 )
|
||||
{
|
||||
msg.key = KEY_ENTER;
|
||||
}
|
||||
|
||||
if (KEY_DOWN_GETVALUE() == 0)
|
||||
{
|
||||
msg.key = KEY_DOWN;
|
||||
}
|
||||
if (KEY_DOWN_GETVALUE() == 0)
|
||||
{
|
||||
msg.key = KEY_DOWN;
|
||||
}
|
||||
|
||||
if (KEY_UP_GETVALUE() == 0)
|
||||
{
|
||||
msg.key = KEY_UP;
|
||||
}
|
||||
if (KEY_UP_GETVALUE() == 0)
|
||||
{
|
||||
msg.key = KEY_UP;
|
||||
}
|
||||
|
||||
if (KEY_RIGHT_GETVALUE() == 0)
|
||||
{
|
||||
msg.key = KEY_RIGHT;
|
||||
}
|
||||
if (KEY_RIGHT_GETVALUE() == 0)
|
||||
{
|
||||
msg.key = KEY_RIGHT;
|
||||
}
|
||||
|
||||
if (KEY_LEFT_GETVALUE() == 0)
|
||||
{
|
||||
msg.key = KEY_LEFT;
|
||||
}
|
||||
if (KEY_LEFT_GETVALUE() == 0)
|
||||
{
|
||||
msg.key = KEY_LEFT;
|
||||
}
|
||||
|
||||
rt_mq_send(&mq, &msg, sizeof(msg));
|
||||
rt_mq_send(&mq, &msg, sizeof(msg));
|
||||
|
||||
/* wait next key press */
|
||||
rt_thread_delay(next_delay);
|
||||
}
|
||||
/* wait next key press */
|
||||
rt_thread_delay(next_delay);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -144,7 +140,7 @@ 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++)
|
||||
|
@ -170,9 +166,9 @@ 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 colh;
|
||||
rt_uint8_t page;
|
||||
rt_uint8_t i;
|
||||
|
||||
page = y/8;
|
||||
|
||||
|
@ -291,7 +287,7 @@ 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;
|
||||
|
@ -345,8 +341,8 @@ void LCD_UpdatePoint(unsigned int x, unsigned int y)
|
|||
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]);
|
||||
}
|
||||
|
@ -422,21 +418,21 @@ void LCD_PutString(unsigned long x, unsigned long y, char *str)
|
|||
|
||||
static rt_err_t rt_lcd_control (rt_device_t dev, int cmd, void *args)
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
#ifdef RT_USING_RTGUI
|
||||
case RTGRAPHIC_CTRL_RECT_UPDATE:
|
||||
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;
|
||||
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);
|
||||
|
@ -451,31 +447,31 @@ static rt_err_t rt_lcd_control (rt_device_t dev, int cmd, void *args)
|
|||
LCD_ClearSCR();
|
||||
break;
|
||||
#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;
|
||||
lcd->user_data = (void*)&_lcd_ops;
|
||||
#endif
|
||||
/* register lcd device to RT-Thread */
|
||||
rt_device_register(lcd, "lcd", RT_DEVICE_FLAG_RDWR);
|
||||
/* register lcd device to RT-Thread */
|
||||
rt_device_register(lcd, "lcd", RT_DEVICE_FLAG_RDWR);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
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;
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
/*
|
||||
* 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
|
||||
|
@ -20,7 +16,7 @@
|
|||
|
||||
void rt_hw_led_on(rt_uint8_t num)
|
||||
{
|
||||
RT_ASSERT(num < LEDS_MAX_NUMBER);
|
||||
RT_ASSERT(num < LEDS_MAX_NUMBER);
|
||||
|
||||
switch (num)
|
||||
{
|
||||
|
@ -40,7 +36,7 @@ void rt_hw_led_on(rt_uint8_t num)
|
|||
|
||||
void rt_hw_led_off(rt_uint8_t num)
|
||||
{
|
||||
RT_ASSERT(num < LEDS_MAX_NUMBER);
|
||||
RT_ASSERT(num < LEDS_MAX_NUMBER);
|
||||
|
||||
switch (num)
|
||||
{
|
||||
|
@ -60,7 +56,7 @@ void rt_hw_led_off(rt_uint8_t num)
|
|||
|
||||
void rt_hw_led_toggle(rt_uint8_t num)
|
||||
{
|
||||
RT_ASSERT(num < LEDS_MAX_NUMBER);
|
||||
RT_ASSERT(num < LEDS_MAX_NUMBER);
|
||||
|
||||
switch (num)
|
||||
{
|
||||
|
@ -100,12 +96,12 @@ static rt_err_t led_io_init(void)
|
|||
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->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->TMCR |= 0x03; /* start base timer(softwere TRG) */
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
/*
|
||||
* 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
|
||||
|
@ -17,7 +13,7 @@
|
|||
|
||||
#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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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();
|
||||
/* init system setting */
|
||||
SystemInit();
|
||||
|
||||
/* startup RT-Thread RTOS */
|
||||
rtthread_startup();
|
||||
/* startup RT-Thread RTOS */
|
||||
rtthread_startup();
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
|
Loading…
Reference in New Issue