forked from xuos/xiuos
1、support musl libc on nuttx and add test case on xidatong-arm32 2、register lcd device on xidatong-riscv64 on nuttx
it is OK
This commit is contained in:
commit
75259c4006
|
@ -2,7 +2,6 @@
|
||||||
# APP_Framework/Applications/Make.defs
|
# APP_Framework/Applications/Make.defs
|
||||||
############################################################################
|
############################################################################
|
||||||
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Applications
|
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Applications
|
||||||
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Applications/app_test
|
|
||||||
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Applications/general_functions/list
|
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Applications/general_functions/list
|
||||||
|
|
||||||
include $(wildcard $(APPDIR)/../../../APP_Framework/Applications/*/Make.defs)
|
include $(wildcard $(APPDIR)/../../../APP_Framework/Applications/*/Make.defs)
|
||||||
|
|
|
@ -10,6 +10,14 @@ ifeq ($(CONFIG_ADD_NUTTX_FETURES),y)
|
||||||
CSRCS += test_lcd.c
|
CSRCS += test_lcd.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_BSP_USING_TOUCH),y)
|
||||||
|
CSRCS += test_touch.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_MUSL_LIBC),y)
|
||||||
|
CSRCS += test_musl.c
|
||||||
|
endif
|
||||||
|
|
||||||
include $(APPDIR)/Application.mk
|
include $(APPDIR)/Application.mk
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -1,26 +1,22 @@
|
||||||
/****************************************************************************
|
/*
|
||||||
* apps/examples/fb/fb_main.c
|
* Copyright (c) 2020 AIIT XUOS Lab
|
||||||
*
|
* XiUOS is licensed under Mulan PSL v2.
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
* You may obtain a copy of Mulan PSL v2 at:
|
||||||
* this work for additional information regarding copyright ownership. The
|
* http://license.coscl.org.cn/MulanPSL2
|
||||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
* "License"); you may not use this file except in compliance with the
|
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
* License. You may obtain a copy of the License at
|
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
*
|
* See the Mulan PSL v2 for more details.
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
*/
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
* License for the specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/**
|
||||||
* Included Files
|
* @file: test_lcd.c
|
||||||
****************************************************************************/
|
* @brief: a application of dac function
|
||||||
|
* @version: 2.0
|
||||||
|
* @author: AIIT XUOS Lab
|
||||||
|
* @date: 2022/1/11
|
||||||
|
*/
|
||||||
|
|
||||||
#include <transform.h>
|
#include <transform.h>
|
||||||
|
|
||||||
|
@ -29,40 +25,39 @@
|
||||||
#ifdef CONFIG_K210_LCD
|
#ifdef CONFIG_K210_LCD
|
||||||
void LcdDemo(void)
|
void LcdDemo(void)
|
||||||
{
|
{
|
||||||
int x1 = 50, y1 = 50, x2 = LCD_XSIZE_TFT - 50, y2 = LCD_YSIZE_TFT - 50;
|
int lcd_fd = PrivOpen("/dev/lcd_dev",O_RDWR);
|
||||||
|
LcdWriteParam disp_info;
|
||||||
|
|
||||||
Main_Image_Start_Address(LCD_START_ADDR);
|
disp_info.type = 0;
|
||||||
Main_Image_Width(LCD_XSIZE_TFT);
|
disp_info.string_info.x_pos = 80;
|
||||||
Main_Window_Start_XY(0, 0);
|
disp_info.string_info.y_pos = 80;
|
||||||
Canvas_Image_Start_address(LCD_START_ADDR);
|
disp_info.string_info.width = 250;
|
||||||
Canvas_image_width(LCD_XSIZE_TFT);
|
disp_info.string_info.height = 24;
|
||||||
Active_Window_XY(0, 0);
|
disp_info.string_info.font_size = 24;
|
||||||
Active_Window_WH(LCD_XSIZE_TFT, LCD_YSIZE_TFT);
|
disp_info.string_info.addr = "wecome test lcd";
|
||||||
up_mdelay(10);
|
disp_info.string_info.font_color = GREEN;
|
||||||
Canvas_Image_Start_address(LCD_START_ADDR);
|
disp_info.string_info.back_color = BLUE;
|
||||||
|
PrivWrite(lcd_fd, &disp_info, sizeof(LcdWriteParam));
|
||||||
|
PrivTaskDelay(2000);
|
||||||
|
|
||||||
for(int i = 0; i < 3; i++)
|
disp_info.type = 1;
|
||||||
{
|
lv_color_t redcolor = {
|
||||||
x1 = 50;
|
.ch = {
|
||||||
y1 = 50;
|
.red = 0b11111,
|
||||||
x2 = LCD_XSIZE_TFT - 50;
|
.green = 0,
|
||||||
y2 = LCD_YSIZE_TFT - 50;
|
.blue = 0
|
||||||
syslog(LOG_NOTICE, "Disp_demo %d (%d,%d - %d,%d)\n", i, x1, y1, x2, y2);
|
}
|
||||||
LT768_DrawSquare_Fill(x1, y1, x2, y2, Red);
|
};
|
||||||
up_mdelay(2000);
|
disp_info.pixel_info.x_startpos = 0;
|
||||||
x1 += 20;
|
disp_info.pixel_info.x_endpos = 50;
|
||||||
y1 += 20;
|
disp_info.pixel_info.y_startpos = 0;
|
||||||
x2 -= 20;
|
disp_info.pixel_info.y_endpos = 50;
|
||||||
y2 -= 20;
|
disp_info.pixel_info.pixel_color = &redcolor;
|
||||||
LT768_DrawSquare_Fill(x1, y1, x2, y2, Green);
|
PrivWrite(lcd_fd, &disp_info, sizeof(LcdWriteParam));
|
||||||
up_mdelay(2000);
|
PrivTaskDelay(2000);
|
||||||
x1 += 20;
|
|
||||||
y1 += 20;
|
disp_info.type = SHOW_TRIANGLE;
|
||||||
x2 -= 20;
|
PrivWrite(lcd_fd, &disp_info, sizeof(LcdWriteParam));
|
||||||
y2 -= 20;
|
|
||||||
LT768_DrawSquare_Fill(x1, y1, x2, y2, Blue);
|
|
||||||
up_mdelay(2000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 AIIT XUOS Lab
|
||||||
|
* XiUOS is licensed under Mulan PSL v2.
|
||||||
|
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
* You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
* http://license.coscl.org.cn/MulanPSL2
|
||||||
|
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the Mulan PSL v2 for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file: test_musl.c
|
||||||
|
* @brief: a application of musl test function
|
||||||
|
* @version: 2.0
|
||||||
|
* @author: AIIT XUOS Lab
|
||||||
|
* @date: 2022/11/8
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <transform.h>
|
||||||
|
|
||||||
|
#ifdef ADD_NUTTX_FETURES
|
||||||
|
|
||||||
|
#if defined(CONFIG_MUSL_LIBC) && defined(CONFIG_FS_AUTOMOUNTER)
|
||||||
|
|
||||||
|
static void file_read_and_write(void)
|
||||||
|
{
|
||||||
|
FILE *p;
|
||||||
|
char s[] = "good luck to you!";
|
||||||
|
char buffer[20];
|
||||||
|
|
||||||
|
if((p = fopen("/mnt/sdcard/test.txt","w+")) == NULL)
|
||||||
|
{
|
||||||
|
printf("Can not open file!\n");
|
||||||
|
}
|
||||||
|
fwrite(s, sizeof(s) + 1, 1, p);
|
||||||
|
fseek(p, SEEK_SET, 0);
|
||||||
|
fread(buffer, sizeof(buffer) + 1, 1, p);
|
||||||
|
printf("read string is: %s\n", buffer);
|
||||||
|
fclose(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void file_operations(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
FILE *fp;
|
||||||
|
char filename1[] = "/mnt/sdcard/file1.txt";
|
||||||
|
char filename2[] = "/mnt/sdcard/file2.txt";
|
||||||
|
|
||||||
|
fp = fopen(filename1, "w");
|
||||||
|
|
||||||
|
fprintf(fp, "%s", "this is runoob.com");
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
ret = remove(filename1);
|
||||||
|
|
||||||
|
if(ret == 0)
|
||||||
|
{
|
||||||
|
printf("remove file1 success!\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("error,can not remove file1!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = remove(filename2);
|
||||||
|
if(ret == 0)
|
||||||
|
{
|
||||||
|
printf("remove file2 success!\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("error,can not remove file2!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void malloc_and_free(void)
|
||||||
|
{
|
||||||
|
int *p;
|
||||||
|
int len;
|
||||||
|
for(int i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
len = 1024*(i+1);
|
||||||
|
p = malloc(len);
|
||||||
|
if(p)
|
||||||
|
{
|
||||||
|
printf("malloc %d bytes success!\n",len);
|
||||||
|
free(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void Testmusl(void)
|
||||||
|
{
|
||||||
|
printf("--------start test file read and write!--------\n");
|
||||||
|
file_read_and_write();
|
||||||
|
printf("----------start test file operationsn!---------\n");
|
||||||
|
file_operations();
|
||||||
|
printf("---------start test malloc and free!-----------\n");
|
||||||
|
malloc_and_free();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -0,0 +1,43 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* apps/examples/fb/fb_main.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <transform.h>
|
||||||
|
|
||||||
|
#ifdef ADD_NUTTX_FETURES
|
||||||
|
|
||||||
|
#ifdef CONFIG_BSP_USING_TOUCH
|
||||||
|
void TestTouch(void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
TouchDataParam point = {0, 0, 0};
|
||||||
|
fd = PrivOpen("/dev/touch_dev", O_RDWR);
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
PrivRead(fd,&point,1);
|
||||||
|
printf("Now touch point:(%d,%d)\n",point.x,point.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -26,6 +26,7 @@
|
||||||
#include <nuttx/semaphore.h>
|
#include <nuttx/semaphore.h>
|
||||||
#include <nuttx/time.h>
|
#include <nuttx/time.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <nuttx/clock.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -44,6 +45,7 @@
|
||||||
#ifdef CONFIG_USER_TEST_LCD
|
#ifdef CONFIG_USER_TEST_LCD
|
||||||
#ifdef CONFIG_K210_LCD
|
#ifdef CONFIG_K210_LCD
|
||||||
# include "nuttx/lcd/lt768.h"
|
# include "nuttx/lcd/lt768.h"
|
||||||
|
# include "nuttx/lcd/lt768_learn.h"
|
||||||
# include "nuttx/lcd/lt768_lib.h"
|
# include "nuttx/lcd/lt768_lib.h"
|
||||||
# include "nuttx/lcd/if_port.h"
|
# include "nuttx/lcd/if_port.h"
|
||||||
#else
|
#else
|
||||||
|
@ -127,6 +129,23 @@ extern "C" {
|
||||||
#define EOK 0
|
#define EOK 0
|
||||||
#define x_err_t int
|
#define x_err_t int
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
struct {
|
||||||
|
uint16_t blue : 5;
|
||||||
|
uint16_t green : 6;
|
||||||
|
uint16_t red : 5;
|
||||||
|
} ch;
|
||||||
|
uint16_t full;
|
||||||
|
} lv_color16_t;
|
||||||
|
typedef lv_color16_t lv_color_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint16_t x;
|
||||||
|
uint16_t y;
|
||||||
|
uint16_t press;
|
||||||
|
}TouchDataParam;
|
||||||
|
|
||||||
struct PinDevIrq
|
struct PinDevIrq
|
||||||
{
|
{
|
||||||
int irq_mode;//< RISING/FALLING/HIGH/LOW
|
int irq_mode;//< RISING/FALLING/HIGH/LOW
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
CONFIG_ADD_NUTTX_FETURES=y
|
||||||
|
CONFIG_ARCH="arm"
|
||||||
|
CONFIG_ARCH_BOARD="xidatong-arm32"
|
||||||
|
CONFIG_ARCH_BOARD_XIDATONG_ARM32=y
|
||||||
|
CONFIG_ARCH_CHIP="imxrt"
|
||||||
|
CONFIG_ARCH_CHIP_IMXRT=y
|
||||||
|
CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=10240
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_ARMV7M_DCACHE=y
|
||||||
|
CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y
|
||||||
|
CONFIG_ARMV7M_ICACHE=y
|
||||||
|
CONFIG_ARMV7M_USEBASEPRI=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=104926
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_FAT_LCNAMES=y
|
||||||
|
CONFIG_CLOCK_MONOTONIC=y
|
||||||
|
CONFIG_FAT_LFN=y
|
||||||
|
CONFIG_FS_FAT=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||||
|
CONFIG_EXAMPLES_HELLO=y
|
||||||
|
CONFIG_IMXRT_GPIO_IRQ=y
|
||||||
|
CONFIG_IMXRT_GPIO2_16_31_IRQ=y
|
||||||
|
CONFIG_IMXRT_GPIO3_0_15_IRQ=y
|
||||||
|
CONFIG_DEV_GPIO=y
|
||||||
|
CONFIG_IMXRT_LPUART1=y
|
||||||
|
CONFIG_IMXRT_USDHC1=y
|
||||||
|
CONFIG_IMXRT_USDHC1_WIDTH_D1_D4=y
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_IOB_NBUFFERS=24
|
||||||
|
CONFIG_IOB_NCHAINS=8
|
||||||
|
CONFIG_LIBC_STRERROR=y
|
||||||
|
CONFIG_LPUART1_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_MMCSD=y
|
||||||
|
CONFIG_MMCSD_SDIO=y
|
||||||
|
CONFIG_MM_IOB=y
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_CMDOPT_DD_STATS=y
|
||||||
|
CONFIG_NSH_DISABLE_IFUPDOWN=y
|
||||||
|
CONFIG_NSH_FILEIOSIZE=32768
|
||||||
|
CONFIG_NSH_LINELEN=64
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_RAM_SIZE=524288
|
||||||
|
CONFIG_RAM_START=0x20200000
|
||||||
|
CONFIG_RAW_BINARY=y
|
||||||
|
CONFIG_SCHED_CHILD_STATUS=y
|
||||||
|
CONFIG_SCHED_HAVE_PARENT=y
|
||||||
|
CONFIG_SCHED_HPWORK=y
|
||||||
|
CONFIG_SCHED_LPWORK=y
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_SDIO_BLOCKSETUP=y
|
||||||
|
CONFIG_SERIAL_TERMIOS=y
|
||||||
|
CONFIG_START_DAY=14
|
||||||
|
CONFIG_START_MONTH=3
|
||||||
|
CONFIG_SYSTEM_CLE_CMD_HISTORY=y
|
||||||
|
CONFIG_SYSTEM_COLOR_CLE=y
|
||||||
|
CONFIG_FS_AUTOMOUNTER=y
|
||||||
|
CONFIG_XIDATONG_ARM32_SDIO_AUTOMOUNT=y
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_READLINE_CMD_HISTORY=y
|
||||||
|
CONFIG_READLINE_CMD_HISTORY_LEN=100
|
||||||
|
CONFIG_READLINE_CMD_HISTORY_LINELEN=120
|
||||||
|
CONFIG_READLINE_TABCOMPLETION=y
|
||||||
|
CONFIG_BOARDCTL_RESET=y
|
||||||
|
CONFIG_MUSL_LIBC=y
|
||||||
|
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
|
@ -39,6 +39,12 @@ menuconfig BSP_USING_TOUCH
|
||||||
bool "Using touch device"
|
bool "Using touch device"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
menuconfig BSP_USING_CAN
|
||||||
|
select K210_16550_UART
|
||||||
|
select K210_16550_UART1
|
||||||
|
bool "Using CAN device"
|
||||||
|
default n
|
||||||
|
|
||||||
menuconfig BSP_USING_CH438
|
menuconfig BSP_USING_CH438
|
||||||
bool "Using CH438 device"
|
bool "Using CH438 device"
|
||||||
default n
|
default n
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_NSH_DISABLE_LOSMART is not set
|
||||||
|
# CONFIG_STANDARD_SERIAL is not set
|
||||||
|
CONFIG_ADD_NUTTX_FETURES=y
|
||||||
|
CONFIG_ARCH="risc-v"
|
||||||
|
CONFIG_ARCH_BOARD="xidatong-riscv64"
|
||||||
|
CONFIG_ARCH_BOARD_XIDATONG_RISCV64=y
|
||||||
|
CONFIG_ARCH_CHIP="k210"
|
||||||
|
CONFIG_ARCH_CHIP_K210=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
|
CONFIG_ARCH_RISCV=y
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_BINFMT_DISABLE=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=46000
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_EXAMPLES_HELLO=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||||
|
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||||
|
CONFIG_INIT_STACKSIZE=3072
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LIBC_PERROR_STDOUT=y
|
||||||
|
CONFIG_LIBC_STRERROR=y
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_DISABLE_IFUPDOWN=y
|
||||||
|
CONFIG_NSH_DISABLE_MKDIR=y
|
||||||
|
CONFIG_NSH_DISABLE_RM=y
|
||||||
|
CONFIG_NSH_DISABLE_RMDIR=y
|
||||||
|
CONFIG_NSH_DISABLE_UMOUNT=y
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_NSH_STRERROR=y
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=2097152
|
||||||
|
CONFIG_RAM_START=0x80400000
|
||||||
|
CONFIG_RAW_BINARY=y
|
||||||
|
CONFIG_READLINE_CMD_HISTORY=y
|
||||||
|
CONFIG_READLINE_CMD_HISTORY_LEN=100
|
||||||
|
CONFIG_READLINE_CMD_HISTORY_LINELEN=120
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_STACK_COLORATION=y
|
||||||
|
CONFIG_START_DAY=28
|
||||||
|
CONFIG_START_MONTH=12
|
||||||
|
CONFIG_START_YEAR=2019
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_TASK_NAME_SIZE=20
|
||||||
|
CONFIG_TESTING_GETPRIME=y
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_READLINE_TABCOMPLETION=y
|
||||||
|
CONFIG_SCHED_HPWORK=y
|
||||||
|
CONFIG_DEV_GPIO=y
|
||||||
|
CONFIG_BOARDCTL_RESET=y
|
||||||
|
CONFIG_K210_16550_UART=y
|
||||||
|
CONFIG_K210_16550_UART1=y
|
||||||
|
CONFIG_K210_16550_UART1_BASE=0x50210000
|
||||||
|
CONFIG_K210_16550_UART1_CLOCK=195000000
|
||||||
|
CONFIG_K210_16550_UART1_IRQ=38
|
||||||
|
CONFIG_K210_16550_UART1_BAUD=115200
|
||||||
|
CONFIG_K210_16550_UART1_PARITY=0
|
||||||
|
CONFIG_K210_16550_UART1_BITS=8
|
||||||
|
CONFIG_K210_16550_UART1_2STOP=0
|
||||||
|
CONFIG_K210_16550_UART1_RXBUFSIZE=128
|
||||||
|
CONFIG_K210_16550_UART1_TXBUFSIZE=128
|
||||||
|
CONFIG_BSP_USING_CAN=y
|
||||||
|
CONFIG_SERIAL_TERMIOS=y
|
|
@ -78,8 +78,6 @@ extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*************************** GPIO define ***************************/
|
/*************************** GPIO define ***************************/
|
||||||
/* Connected to red led */
|
|
||||||
#define BOARD_LED_PAD 14
|
|
||||||
|
|
||||||
/* UART IO */
|
/* UART IO */
|
||||||
#define GPIO_WIFI_RXD 7
|
#define GPIO_WIFI_RXD 7
|
||||||
|
@ -88,6 +86,8 @@ extern "C"
|
||||||
#define GPIO_EC200T_TXD 20
|
#define GPIO_EC200T_TXD 20
|
||||||
#define GPIO_CH376T_RXD 22
|
#define GPIO_CH376T_RXD 22
|
||||||
#define GPIO_CH376T_TXD 23
|
#define GPIO_CH376T_TXD 23
|
||||||
|
#define GPIO_CAN_RXD 18
|
||||||
|
#define GPIO_CAN_TXD 19
|
||||||
|
|
||||||
/* ch438 IO */
|
/* ch438 IO */
|
||||||
#define CH438_ALE_PIN 24
|
#define CH438_ALE_PIN 24
|
||||||
|
@ -128,12 +128,12 @@ extern "C"
|
||||||
#define GPIO_E220_M1 45
|
#define GPIO_E220_M1 45
|
||||||
#define GPIO_E18_MODE 46
|
#define GPIO_E18_MODE 46
|
||||||
#define GPIO_WIFI_EN 8
|
#define GPIO_WIFI_EN 8
|
||||||
|
#define GPIO_CAN_CFG 43
|
||||||
|
|
||||||
/************************** end GPIO define **************************/
|
/************************** end GPIO define **************************/
|
||||||
|
|
||||||
|
|
||||||
/*************************** FPIOA define ***************************/
|
/*************************** FPIOA define ***************************/
|
||||||
#define BOARD_LED_IO 0
|
|
||||||
|
|
||||||
/* UART FPOA */
|
/* UART FPOA */
|
||||||
#define FPOA_USART1_RX K210_IO_FUNC_UART1_RX
|
#define FPOA_USART1_RX K210_IO_FUNC_UART1_RX
|
||||||
|
@ -182,6 +182,7 @@ extern "C"
|
||||||
#define FPIOA_E220_M1 2
|
#define FPIOA_E220_M1 2
|
||||||
#define FPIOA_E18_MODE 3
|
#define FPIOA_E18_MODE 3
|
||||||
#define FPIOA_WIFI_EN 4
|
#define FPIOA_WIFI_EN 4
|
||||||
|
#define FPIOA_CAN_NCFG 5
|
||||||
|
|
||||||
/************************** end FPIOA define **************************/
|
/************************** end FPIOA define **************************/
|
||||||
|
|
||||||
|
|
|
@ -58,4 +58,8 @@ ifeq ($(CONFIG_BSP_USING_TOUCH),y)
|
||||||
CSRCS += k210_touch.c
|
CSRCS += k210_touch.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_BSP_USING_CAN),y)
|
||||||
|
CSRCS += can_demo.c
|
||||||
|
endif
|
||||||
|
|
||||||
include $(TOPDIR)/boards/Board.mk
|
include $(TOPDIR)/boards/Board.mk
|
||||||
|
|
|
@ -0,0 +1,147 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 AIIT XUOS Lab
|
||||||
|
* XiUOS is licensed under Mulan PSL v2.
|
||||||
|
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
* You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
* http://license.coscl.org.cn/MulanPSL2
|
||||||
|
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the Mulan PSL v2 for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file can_demo.c
|
||||||
|
* @brief xidatong-riscv64 can_demo.c
|
||||||
|
* @version 1.0
|
||||||
|
* @author AIIT XUOS Lab
|
||||||
|
* @date 2022.11.10
|
||||||
|
*/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/pthread.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <nuttx/time.h>
|
||||||
|
#include <nuttx/fs/fs.h>
|
||||||
|
#include <nuttx/fs/ioctl.h>
|
||||||
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "time.h"
|
||||||
|
#include <debug.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <termios.h>
|
||||||
|
#include <nuttx/ioexpander/gpio.h>
|
||||||
|
#include "k210_uart_16550.h"
|
||||||
|
#include "k210_fpioa.h"
|
||||||
|
#include "k210_gpiohs.h"
|
||||||
|
#include "k210_gpio_common.h"
|
||||||
|
|
||||||
|
static int fd, flag=0;
|
||||||
|
|
||||||
|
static void serial_thread_entry(void)
|
||||||
|
{
|
||||||
|
uint8_t ch;
|
||||||
|
while(read(fd, &ch, 1) == 1)
|
||||||
|
{
|
||||||
|
printf("%02x ",ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void start_thread(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
pthread_t thread;
|
||||||
|
pthread_attr_t attr = PTHREAD_ATTR_INITIALIZER;
|
||||||
|
attr.priority = 20;
|
||||||
|
attr.stacksize = 2048;
|
||||||
|
|
||||||
|
ret = pthread_create(&thread, &attr, (void*)serial_thread_entry, NULL);
|
||||||
|
if (ret != 0)
|
||||||
|
{
|
||||||
|
printf("task create failed, status=%d\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
flag = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void set_baud(unsigned long speed)
|
||||||
|
{
|
||||||
|
struct termios cfg;
|
||||||
|
tcgetattr(fd, &cfg);
|
||||||
|
cfsetspeed(&cfg, speed);
|
||||||
|
tcsetattr(fd, TCSANOW, &cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void can_cfg_start(void)
|
||||||
|
{
|
||||||
|
uint8_t cmd[8];
|
||||||
|
set_baud(9600);
|
||||||
|
up_mdelay(1000);
|
||||||
|
|
||||||
|
k210_gpiohs_set_direction(FPIOA_CAN_NCFG, GPIO_DM_OUTPUT);
|
||||||
|
k210_gpiohs_set_value(FPIOA_CAN_NCFG, GPIO_PV_LOW);
|
||||||
|
up_mdelay(200);
|
||||||
|
|
||||||
|
cmd[0] = 0xAA;
|
||||||
|
cmd[1] = 0x55;
|
||||||
|
cmd[2] = 0xFD;
|
||||||
|
cmd[3] = 0x32;
|
||||||
|
cmd[4] = 0x01;
|
||||||
|
cmd[5] = 0x0B;
|
||||||
|
cmd[6] = 0xc4;
|
||||||
|
cmd[7] = 0x29;
|
||||||
|
write(fd, cmd, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void can_cfg_end(void)
|
||||||
|
{
|
||||||
|
k210_gpiohs_set_direction(FPIOA_CAN_NCFG, GPIO_DM_OUTPUT);
|
||||||
|
k210_gpiohs_set_value(FPIOA_CAN_NCFG, GPIO_PV_HIGH);
|
||||||
|
set_baud(115200);
|
||||||
|
}
|
||||||
|
|
||||||
|
void can_test(void)
|
||||||
|
{
|
||||||
|
uint8_t msg[8];
|
||||||
|
uint8_t i;
|
||||||
|
|
||||||
|
fd = open("/dev/ttyS1", O_RDWR);
|
||||||
|
if (flag == 0)
|
||||||
|
{
|
||||||
|
/* 1、start thread */
|
||||||
|
start_thread();
|
||||||
|
up_mdelay(20);
|
||||||
|
|
||||||
|
/* 2、config can prama */
|
||||||
|
can_cfg_start();
|
||||||
|
up_mdelay(20);
|
||||||
|
|
||||||
|
/* 3、exit config */
|
||||||
|
can_cfg_end();
|
||||||
|
up_mdelay(20);;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 4、send data */
|
||||||
|
for(i=0;i<10;i++)
|
||||||
|
{
|
||||||
|
msg[0] = 0x11;
|
||||||
|
msg[1] = 0x22;
|
||||||
|
msg[2] = 0x33;
|
||||||
|
msg[3] = 0x44;
|
||||||
|
msg[4] = 0x55;
|
||||||
|
msg[5] = 0x66;
|
||||||
|
msg[6] = 0x77;
|
||||||
|
msg[7] = 0x99;
|
||||||
|
write(fd, msg, 8);
|
||||||
|
up_mdelay(20);
|
||||||
|
}
|
||||||
|
}
|
|
@ -60,7 +60,7 @@ void CH376Demo(void)
|
||||||
printf( "CH376FileCreatePath:0x%02x\n",(uint16_t)s );
|
printf( "CH376FileCreatePath:0x%02x\n",(uint16_t)s );
|
||||||
|
|
||||||
printf( "Write some data to file\n" );
|
printf( "Write some data to file\n" );
|
||||||
strcpy( (char *)buf, "This is 演示数据\xd\xa" );
|
strcpy( (char *)buf, "This is test case!\xd\xa" );
|
||||||
s = CH376ByteWrite(buf, strlen((char *)buf), NULL );
|
s = CH376ByteWrite(buf, strlen((char *)buf), NULL );
|
||||||
printf( "CH376ByteWrite:0x%02x\n",(uint16_t)s );
|
printf( "CH376ByteWrite:0x%02x\n",(uint16_t)s );
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,10 @@
|
||||||
# include "k210_ch438.h"
|
# include "k210_ch438.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_BSP_USING_TOUCH
|
||||||
|
# include "k210_touch.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -87,23 +91,40 @@ int k210_bringup(void)
|
||||||
board_lcd_initialize();
|
board_lcd_initialize();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_BSP_USING_TOUCH
|
||||||
|
board_touch_initialize();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_K210_16550_UART1
|
#ifdef CONFIG_K210_16550_UART1
|
||||||
|
#ifdef CONFIG_ADAPTER_ESP8285_WIFI
|
||||||
sysctl_clock_enable(SYSCTL_CLOCK_UART1);
|
sysctl_clock_enable(SYSCTL_CLOCK_UART1);
|
||||||
sysctl_reset(SYSCTL_RESET_UART1);
|
sysctl_reset(SYSCTL_RESET_UART1);
|
||||||
|
|
||||||
fpioa_set_function(GPIO_WIFI_TXD, FPOA_USART1_RX);
|
fpioa_set_function(GPIO_WIFI_TXD, FPOA_USART1_RX);
|
||||||
fpioa_set_function(GPIO_WIFI_RXD, FPOA_USART1_TX);
|
fpioa_set_function(GPIO_WIFI_RXD, FPOA_USART1_TX);
|
||||||
|
|
||||||
fpioa_set_function(GPIO_WIFI_EN, K210_IO_FUNC_GPIOHS0 + GPIO_WIFI_EN);
|
fpioa_set_function(GPIO_WIFI_EN, K210_IO_FUNC_GPIOHS0 + FPIOA_WIFI_EN);
|
||||||
k210_gpiohs_set_direction(GPIO_WIFI_EN, GPIO_DM_OUTPUT);
|
k210_gpiohs_set_direction(FPIOA_WIFI_EN, GPIO_DM_OUTPUT);
|
||||||
k210_gpiohs_set_value(GPIO_WIFI_EN, GPIO_PV_LOW);
|
k210_gpiohs_set_value(FPIOA_WIFI_EN, GPIO_PV_LOW);
|
||||||
up_mdelay(50);
|
up_mdelay(50);
|
||||||
k210_gpiohs_set_value(GPIO_WIFI_EN, GPIO_PV_HIGH);
|
k210_gpiohs_set_value(FPIOA_WIFI_EN, GPIO_PV_HIGH);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_BSP_USING_CAN
|
||||||
|
sysctl_clock_enable(SYSCTL_CLOCK_UART1);
|
||||||
|
sysctl_reset(SYSCTL_RESET_UART1);
|
||||||
|
|
||||||
|
fpioa_set_function(GPIO_CAN_TXD, FPOA_USART1_TX);
|
||||||
|
fpioa_set_function(GPIO_CAN_RXD, FPOA_USART1_RX);
|
||||||
|
|
||||||
|
k210_fpioa_config(GPIO_CAN_CFG, HS_GPIO(FPIOA_CAN_NCFG) | K210_IOFLAG_GPIOHS);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_K210_16550_UART2
|
#ifdef CONFIG_K210_16550_UART2
|
||||||
sysctl_clock_enable(SYSCTL_CLOCK_UART2);
|
sysctl_clock_enable(SYSCTL_CLOCK_UART2);
|
||||||
sysctl_reset(SYSCTL_RESET_UART2);
|
sysctl_reset(SYSCTL_RESET_UART2);
|
||||||
|
|
||||||
fpioa_set_function(GPIO_EC200T_RXD, FPOA_USART2_RX);
|
fpioa_set_function(GPIO_EC200T_RXD, FPOA_USART2_RX);
|
||||||
fpioa_set_function(GPIO_EC200T_TXD, FPOA_USART2_TX);
|
fpioa_set_function(GPIO_EC200T_TXD, FPOA_USART2_TX);
|
||||||
#endif
|
#endif
|
||||||
|
@ -111,6 +132,7 @@ int k210_bringup(void)
|
||||||
#ifdef CONFIG_K210_16550_UART3
|
#ifdef CONFIG_K210_16550_UART3
|
||||||
sysctl_clock_enable(SYSCTL_CLOCK_UART3);
|
sysctl_clock_enable(SYSCTL_CLOCK_UART3);
|
||||||
sysctl_reset(SYSCTL_RESET_UART3);
|
sysctl_reset(SYSCTL_RESET_UART3);
|
||||||
|
|
||||||
fpioa_set_function(GPIO_CH376T_RXD, FPOA_USART3_RX);
|
fpioa_set_function(GPIO_CH376T_RXD, FPOA_USART3_RX);
|
||||||
fpioa_set_function(GPIO_CH376T_TXD, FPOA_USART3_TX);
|
fpioa_set_function(GPIO_CH376T_TXD, FPOA_USART3_TX);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
* @date 2022.04.26
|
* @date 2022.04.26
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __BOARDS_ARM_IMXRT_XIDATONG_SRC_IMXRT_CH438_H
|
#ifndef __BOARDS_XIDATONG_SRC_RISCV64_CH438_H
|
||||||
#define __BOARDS_ARM_IMXRT_XIDATONG_SRC_IMXRT_CH438_H
|
#define __BOARDS_XIDATONG_SRC_RISCV64_CH438_H
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
|
@ -322,5 +322,5 @@
|
||||||
void board_ch438_initialize(void);
|
void board_ch438_initialize(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __BOARDS_ARM_IMXRT_XIDATONG_SRC_IMXRT_CH438_H */
|
#endif /* __BOARDS_XIDATONG_SRC_RISCV64_CH438_H */
|
||||||
|
|
||||||
|
|
|
@ -22,19 +22,25 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#include <nuttx/config.h>
|
||||||
#include "k210_fpioa.h"
|
#include "k210_fpioa.h"
|
||||||
#include "k210_gpiohs.h"
|
#include "k210_gpiohs.h"
|
||||||
#include "nuttx/arch.h"
|
#include "nuttx/arch.h"
|
||||||
#include "nuttx/lcd/lt768.h"
|
#include "nuttx/lcd/lt768.h"
|
||||||
#include "nuttx/lcd/lt768_lib.h"
|
#include "nuttx/lcd/lt768_lib.h"
|
||||||
#include "nuttx/lcd/if_port.h"
|
#include "nuttx/lcd/if_port.h"
|
||||||
|
#include "nuttx/lcd/lt768_learn.h"
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
#include <arch/board/board.h>
|
#include <arch/board/board.h>
|
||||||
|
#include <nuttx/fs/fs.h>
|
||||||
|
#include <nuttx/fs/ioctl.h>
|
||||||
#ifdef CONFIG_LCD_LCDDRV_SPIIF
|
#ifdef CONFIG_LCD_LCDDRV_SPIIF
|
||||||
#include "nuttx/lcd/lcddrv_spiif.h"
|
#include "nuttx/lcd/lcddrv_spiif.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
#define NCS_H() k210_gpiohs_set_value(FPIOA_LCD_NCS, GPIO_PV_HIGH); up_udelay(20)
|
#define NCS_H() k210_gpiohs_set_value(FPIOA_LCD_NCS, GPIO_PV_HIGH); up_udelay(20)
|
||||||
#define NCS_L() k210_gpiohs_set_value(FPIOA_LCD_NCS, GPIO_PV_LOW); up_udelay(20)
|
#define NCS_L() k210_gpiohs_set_value(FPIOA_LCD_NCS, GPIO_PV_LOW); up_udelay(20)
|
||||||
#define CLK_H() k210_gpiohs_set_value(FPIOA_LCD_SCLK, GPIO_PV_HIGH); up_udelay(20)
|
#define CLK_H() k210_gpiohs_set_value(FPIOA_LCD_SCLK, GPIO_PV_HIGH); up_udelay(20)
|
||||||
|
@ -42,6 +48,25 @@
|
||||||
#define MOSI_H() k210_gpiohs_set_value(FPIOA_LCD_MOSI, GPIO_PV_HIGH)
|
#define MOSI_H() k210_gpiohs_set_value(FPIOA_LCD_MOSI, GPIO_PV_HIGH)
|
||||||
#define MOSI_L() k210_gpiohs_set_value(FPIOA_LCD_MOSI, GPIO_PV_LOW)
|
#define MOSI_L() k210_gpiohs_set_value(FPIOA_LCD_MOSI, GPIO_PV_LOW)
|
||||||
|
|
||||||
|
static int lcd_open(FAR struct file *filep);
|
||||||
|
static int lcd_close(FAR struct file *filep);
|
||||||
|
static ssize_t lcd_read(FAR struct file *filep, FAR char *buffer, size_t buflen);
|
||||||
|
static ssize_t lcd_write(FAR struct file *filep, FAR const char *buffer, size_t buflen);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
/* LCD POSIX interface */
|
||||||
|
static const struct file_operations g_lcdfops =
|
||||||
|
{
|
||||||
|
lcd_open,
|
||||||
|
lcd_close,
|
||||||
|
lcd_read,
|
||||||
|
lcd_write,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -184,23 +209,7 @@ void lcd_drv_init(void)
|
||||||
Canvas_Image_Start_address(LCD_START_ADDR);
|
Canvas_Image_Start_address(LCD_START_ADDR);
|
||||||
|
|
||||||
//fill blue background
|
//fill blue background
|
||||||
LT768_DrawSquare_Fill(0, 0, LCD_XSIZE_TFT, LCD_YSIZE_TFT, Blue);
|
LT768_DrawSquare_Fill(0, 0, LCD_XSIZE_TFT, LCD_YSIZE_TFT, WHITE);
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: k210_lcd_initialize
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Initialize the LCD. Setup backlight (initially off)
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int board_lcd_initialize(void)
|
|
||||||
{
|
|
||||||
/* Configure the LCD backlight (and turn the backlight off) */
|
|
||||||
lcd_backlight_init(true);
|
|
||||||
lcd_drv_init();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -218,3 +227,127 @@ void k210_backlight(bool blon)
|
||||||
lcd_backlight_init(blon);
|
lcd_backlight_init(blon);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: lcd_open
|
||||||
|
****************************************************************************/
|
||||||
|
static int lcd_open(FAR struct file *filep)
|
||||||
|
{
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: lcd_close
|
||||||
|
****************************************************************************/
|
||||||
|
static int lcd_close(FAR struct file *filep)
|
||||||
|
{
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: lcd_read
|
||||||
|
****************************************************************************/
|
||||||
|
static ssize_t lcd_read(FAR struct file *filep, FAR char *buffer, size_t buflen)
|
||||||
|
{
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: ch438_write
|
||||||
|
****************************************************************************/
|
||||||
|
static ssize_t lcd_write(FAR struct file *filep, FAR const char *buffer, size_t buflen)
|
||||||
|
{
|
||||||
|
ssize_t ret = buflen;
|
||||||
|
if (buffer == NULL)
|
||||||
|
{
|
||||||
|
return -ERROR;
|
||||||
|
}
|
||||||
|
LcdWriteParam * show = (LcdWriteParam *)buffer;
|
||||||
|
|
||||||
|
/* output string */
|
||||||
|
switch (show->type)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* output string */
|
||||||
|
case SHOW_STRING:
|
||||||
|
LT768_DrawSquare_Fill(0, 0, LCD_XSIZE_TFT, LCD_YSIZE_TFT, WHITE);
|
||||||
|
LT768_Select_Internal_Font_Init(show->string_info.height, 1, 1, 1, 1);
|
||||||
|
LT768_Print_Internal_Font_String(show->string_info.x_pos, show->string_info.y_pos, show->string_info.font_color,show->string_info.back_color,show->string_info.addr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* output dot */
|
||||||
|
case SHOW_WDOT:
|
||||||
|
LT768_DrawSquare_Fill(0, 0, LCD_XSIZE_TFT, LCD_YSIZE_TFT, WHITE);
|
||||||
|
LT768_DrawSquare_Fill(show->pixel_info.x_startpos,show->pixel_info.y_startpos, show->pixel_info.x_endpos, show->pixel_info.y_endpos, *(uint32_t *)(show->pixel_info.pixel_color));
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* output rgb */
|
||||||
|
case SHOW_RGB:
|
||||||
|
LT768_DrawSquare_Fill(0, 0, LCD_XSIZE_TFT, LCD_YSIZE_TFT, WHITE);
|
||||||
|
Display_RGB();
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* output pip */
|
||||||
|
case SHOW_PIP:
|
||||||
|
LT768_DrawSquare_Fill(0, 0, LCD_XSIZE_TFT, LCD_YSIZE_TFT, WHITE);
|
||||||
|
Display_PIP();
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* output Internal Font */
|
||||||
|
case SHOW_INTERNAL_FONT:
|
||||||
|
LT768_DrawSquare_Fill(0, 0, LCD_XSIZE_TFT, LCD_YSIZE_TFT, WHITE);
|
||||||
|
Display_Internal_Font();
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* output Outside Font */
|
||||||
|
case SHOW_OUTSIDE_FONT:
|
||||||
|
LT768_DrawSquare_Fill(0, 0, LCD_XSIZE_TFT, LCD_YSIZE_TFT, WHITE);
|
||||||
|
Display_Outside_Font();
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* output Triangle */
|
||||||
|
case SHOW_TRIANGLE:
|
||||||
|
LT768_DrawSquare_Fill(0, 0, LCD_XSIZE_TFT, LCD_YSIZE_TFT, WHITE);
|
||||||
|
Display_Triangle();
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* output picture */
|
||||||
|
case SHOW_PICTURE:
|
||||||
|
LT768_DrawSquare_Fill(0, 0, LCD_XSIZE_TFT, LCD_YSIZE_TFT, WHITE);
|
||||||
|
Display_Picture();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
ret = -ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: k210_lcd_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialize the LCD. Setup backlight (initially off)
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
int board_lcd_initialize(void)
|
||||||
|
{
|
||||||
|
/* Configure the LCD backlight (and turn the backlight off) */
|
||||||
|
lcd_backlight_init(true);
|
||||||
|
lcd_drv_init();
|
||||||
|
up_mdelay(10);
|
||||||
|
Main_Image_Start_Address(LCD_START_ADDR);
|
||||||
|
Main_Image_Width(LCD_XSIZE_TFT);
|
||||||
|
Main_Window_Start_XY(0, 0);
|
||||||
|
Canvas_Image_Start_address(LCD_START_ADDR);
|
||||||
|
Canvas_image_width(LCD_XSIZE_TFT);
|
||||||
|
Active_Window_XY(0, 0);
|
||||||
|
Active_Window_WH(LCD_XSIZE_TFT, LCD_YSIZE_TFT);
|
||||||
|
up_mdelay(10);
|
||||||
|
Canvas_Image_Start_address(LCD_START_ADDR);
|
||||||
|
/* register device */
|
||||||
|
register_driver("/dev/lcd_dev", &g_lcdfops, 0666, NULL);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
|
@ -36,23 +36,12 @@
|
||||||
|
|
||||||
void board_autoled_initialize(void)
|
void board_autoled_initialize(void)
|
||||||
{
|
{
|
||||||
k210_fpioa_config(BOARD_LED_PAD, BOARD_LED_IO_FUNC | K210_IOFLAG_GPIOHS);
|
|
||||||
k210_gpiohs_set_direction(BOARD_LED_IO, GPIO_DM_OUTPUT);
|
|
||||||
k210_gpiohs_set_value(BOARD_LED_IO, true); /* LED off */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void board_autoled_on(int led)
|
void board_autoled_on(int led)
|
||||||
{
|
{
|
||||||
if (led == LED_PANIC)
|
|
||||||
{
|
|
||||||
k210_gpiohs_set_value(BOARD_LED_IO, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void board_autoled_off(int led)
|
void board_autoled_off(int led)
|
||||||
{
|
{
|
||||||
if (led == LED_PANIC)
|
|
||||||
{
|
|
||||||
k210_gpiohs_set_value(BOARD_LED_IO, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,44 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "k210_touch.h"
|
#include "k210_touch.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
static void IIC_Init(void);
|
||||||
|
static void SDA_IN(void);
|
||||||
|
static void SDA_OUT(void);
|
||||||
|
static uint8_t READ_SDA(void);
|
||||||
|
static void IIC_SCL(uint8_t val);
|
||||||
|
static void IIC_SDA(uint8_t val);
|
||||||
|
static void IIC_Start(void);
|
||||||
|
static void IIC_Stop(void);
|
||||||
|
static uint8_t IIC_Wait_Ack(void);
|
||||||
|
static void IIC_Ack(void);
|
||||||
|
static void IIC_NAck(void);
|
||||||
|
static void IIC_Send_Byte(uint8_t txd);
|
||||||
|
static uint8_t IIC_Read_Byte(uint8_t ack);
|
||||||
|
static bool GT911_Scan(POINT* point);
|
||||||
|
|
||||||
|
static int touch_open(FAR struct file *filep);
|
||||||
|
static int touch_close(FAR struct file *filep);
|
||||||
|
static ssize_t touch_read(FAR struct file *filep, FAR char *buffer, size_t buflen);
|
||||||
|
static ssize_t touch_write(FAR struct file *filep, FAR const char *buffer, size_t buflen);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
/* touch POSIX interface */
|
||||||
|
static const struct file_operations g_touchfops =
|
||||||
|
{
|
||||||
|
touch_open,
|
||||||
|
touch_close,
|
||||||
|
touch_read,
|
||||||
|
touch_write,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: IIC_Init
|
* Name: IIC_Init
|
||||||
* Description: i2c pin mode configure
|
* Description: i2c pin mode configure
|
||||||
|
@ -31,7 +69,7 @@
|
||||||
* output: None
|
* output: None
|
||||||
* return:none
|
* return:none
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void IIC_Init(void)
|
static void IIC_Init(void)
|
||||||
{
|
{
|
||||||
/* config simluate IIC bus */
|
/* config simluate IIC bus */
|
||||||
k210_fpioa_config(BSP_IIC_SDA, GT911_FUNC_GPIO(FPIOA_IIC_SDA));
|
k210_fpioa_config(BSP_IIC_SDA, GT911_FUNC_GPIO(FPIOA_IIC_SDA));
|
||||||
|
@ -48,7 +86,7 @@ void IIC_Init(void)
|
||||||
* output: None
|
* output: None
|
||||||
* return:none
|
* return:none
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void SDA_IN(void)
|
static void SDA_IN(void)
|
||||||
{
|
{
|
||||||
k210_gpiohs_set_direction(FPIOA_IIC_SDA, GPIO_DM_INPUT_PULL_UP);
|
k210_gpiohs_set_direction(FPIOA_IIC_SDA, GPIO_DM_INPUT_PULL_UP);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +98,7 @@ void SDA_IN(void)
|
||||||
* output: None
|
* output: None
|
||||||
* return:none
|
* return:none
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void SDA_OUT(void)
|
static void SDA_OUT(void)
|
||||||
{
|
{
|
||||||
k210_gpiohs_set_direction(FPIOA_IIC_SDA, GPIO_DM_OUTPUT);
|
k210_gpiohs_set_direction(FPIOA_IIC_SDA, GPIO_DM_OUTPUT);
|
||||||
}
|
}
|
||||||
|
@ -72,7 +110,7 @@ void SDA_OUT(void)
|
||||||
* output: None
|
* output: None
|
||||||
* return: sda pin value
|
* return: sda pin value
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
uint8_t READ_SDA(void)
|
static uint8_t READ_SDA(void)
|
||||||
{
|
{
|
||||||
return k210_gpiohs_get_value(FPIOA_IIC_SDA);
|
return k210_gpiohs_get_value(FPIOA_IIC_SDA);
|
||||||
}
|
}
|
||||||
|
@ -84,7 +122,7 @@ uint8_t READ_SDA(void)
|
||||||
* output: None
|
* output: None
|
||||||
* return: None
|
* return: None
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void IIC_SCL(uint8_t val)
|
static void IIC_SCL(uint8_t val)
|
||||||
{
|
{
|
||||||
if (val)
|
if (val)
|
||||||
k210_gpiohs_set_value(FPIOA_IIC_SCL,GPIO_PV_HIGH);
|
k210_gpiohs_set_value(FPIOA_IIC_SCL,GPIO_PV_HIGH);
|
||||||
|
@ -101,7 +139,7 @@ void IIC_SCL(uint8_t val)
|
||||||
* output: None
|
* output: None
|
||||||
* return: None
|
* return: None
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void IIC_SDA(uint8_t val)
|
static void IIC_SDA(uint8_t val)
|
||||||
{
|
{
|
||||||
if (val)
|
if (val)
|
||||||
k210_gpiohs_set_value(FPIOA_IIC_SDA,GPIO_PV_HIGH);
|
k210_gpiohs_set_value(FPIOA_IIC_SDA,GPIO_PV_HIGH);
|
||||||
|
@ -118,7 +156,7 @@ void IIC_SDA(uint8_t val)
|
||||||
* output: None
|
* output: None
|
||||||
* return: None
|
* return: None
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void IIC_Start(void)
|
static void IIC_Start(void)
|
||||||
{
|
{
|
||||||
SDA_OUT();
|
SDA_OUT();
|
||||||
IIC_SDA(1);
|
IIC_SDA(1);
|
||||||
|
@ -136,7 +174,7 @@ void IIC_Start(void)
|
||||||
* output: None
|
* output: None
|
||||||
* return: None
|
* return: None
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void IIC_Stop(void)
|
static void IIC_Stop(void)
|
||||||
{
|
{
|
||||||
SDA_OUT();
|
SDA_OUT();
|
||||||
IIC_SCL(1);
|
IIC_SCL(1);
|
||||||
|
@ -153,7 +191,7 @@ void IIC_Stop(void)
|
||||||
* output: None
|
* output: None
|
||||||
* return: Return value: 1:failed to receive response,0:the received response is successful.
|
* return: Return value: 1:failed to receive response,0:the received response is successful.
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
uint8_t IIC_Wait_Ack(void)
|
static uint8_t IIC_Wait_Ack(void)
|
||||||
{
|
{
|
||||||
uint16_t ucErrTime=0;
|
uint16_t ucErrTime=0;
|
||||||
SDA_IN();
|
SDA_IN();
|
||||||
|
@ -181,7 +219,7 @@ uint8_t IIC_Wait_Ack(void)
|
||||||
* output: None
|
* output: None
|
||||||
* return: None
|
* return: None
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void IIC_Ack(void)
|
static void IIC_Ack(void)
|
||||||
{
|
{
|
||||||
IIC_SCL(0);
|
IIC_SCL(0);
|
||||||
SDA_OUT();
|
SDA_OUT();
|
||||||
|
@ -200,7 +238,7 @@ void IIC_Ack(void)
|
||||||
* output: None
|
* output: None
|
||||||
* return: None
|
* return: None
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void IIC_NAck(void)
|
static void IIC_NAck(void)
|
||||||
{
|
{
|
||||||
IIC_SCL(0);
|
IIC_SCL(0);
|
||||||
SDA_OUT();
|
SDA_OUT();
|
||||||
|
@ -219,7 +257,7 @@ void IIC_NAck(void)
|
||||||
* output: None
|
* output: None
|
||||||
* return: 1:there is a response,0:no response
|
* return: 1:there is a response,0:no response
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void IIC_Send_Byte(uint8_t txd)
|
static void IIC_Send_Byte(uint8_t txd)
|
||||||
{
|
{
|
||||||
uint8_t t;
|
uint8_t t;
|
||||||
SDA_OUT();
|
SDA_OUT();
|
||||||
|
@ -243,7 +281,7 @@ void IIC_Send_Byte(uint8_t txd)
|
||||||
* output: None
|
* output: None
|
||||||
* return: Returns one byte of data read
|
* return: Returns one byte of data read
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
uint8_t IIC_Read_Byte(uint8_t ack)
|
static uint8_t IIC_Read_Byte(uint8_t ack)
|
||||||
{
|
{
|
||||||
uint8_t i,receive=0;
|
uint8_t i,receive=0;
|
||||||
SDA_IN();
|
SDA_IN();
|
||||||
|
@ -322,20 +360,6 @@ static void GT911_RD_Reg(uint16_t reg,uint8_t *buf,uint8_t len)
|
||||||
IIC_Stop();
|
IIC_Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************
|
|
||||||
* Name: GT911_ReadFirmwareVersion
|
|
||||||
* Description: Get firmware version number
|
|
||||||
* input: None
|
|
||||||
* output: None
|
|
||||||
* return: version number
|
|
||||||
***********************************************************************************/
|
|
||||||
static uint16_t GT911_ReadFirmwareVersion(void)
|
|
||||||
{
|
|
||||||
uint8_t buf[2];
|
|
||||||
GT911_RD_Reg(GT911_FIRMWARE_VERSION_REG, buf, 2);
|
|
||||||
return ((uint16_t)buf[1] << 8) + buf[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************************
|
/***********************************************************************************
|
||||||
* Name: GT911_Scan
|
* Name: GT911_Scan
|
||||||
* Description: point:structure to store coordinates
|
* Description: point:structure to store coordinates
|
||||||
|
@ -343,7 +367,7 @@ static uint16_t GT911_ReadFirmwareVersion(void)
|
||||||
* output: None
|
* output: None
|
||||||
* return: Returns true for touch, false for no touch
|
* return: Returns true for touch, false for no touch
|
||||||
***********************************************************************************/
|
***********************************************************************************/
|
||||||
bool GT911_Scan(POINT* point)
|
static bool GT911_Scan(POINT* point)
|
||||||
{
|
{
|
||||||
GT911_Dev Dev_Now;
|
GT911_Dev Dev_Now;
|
||||||
uint8_t Clearbuf = 0;
|
uint8_t Clearbuf = 0;
|
||||||
|
@ -378,32 +402,74 @@ bool GT911_Scan(POINT* point)
|
||||||
if(Dev_Now.Y[i] > GT911_MAX_HEIGHT -20) Dev_Now.Y[i]=GT911_MAX_HEIGHT - 20;
|
if(Dev_Now.Y[i] > GT911_MAX_HEIGHT -20) Dev_Now.Y[i]=GT911_MAX_HEIGHT - 20;
|
||||||
if(Dev_Now.X[i] < 20) Dev_Now.X[i] = 20;
|
if(Dev_Now.X[i] < 20) Dev_Now.X[i] = 20;
|
||||||
if(Dev_Now.X[i] > GT911_MAX_WIDTH-20) Dev_Now.X[i] = GT911_MAX_WIDTH - 20;
|
if(Dev_Now.X[i] > GT911_MAX_WIDTH-20) Dev_Now.X[i] = GT911_MAX_WIDTH - 20;
|
||||||
point->X = Dev_Now.X[i];
|
point->x = Dev_Now.X[i];
|
||||||
point->Y = Dev_Now.Y[i];
|
point->y = Dev_Now.Y[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: touch_open
|
||||||
|
****************************************************************************/
|
||||||
|
static int touch_open(FAR struct file *filep)
|
||||||
|
{
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: touch_close
|
||||||
|
****************************************************************************/
|
||||||
|
static int touch_close(FAR struct file *filep)
|
||||||
|
{
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: lcd_read
|
||||||
|
****************************************************************************/
|
||||||
|
static ssize_t touch_read(FAR struct file *filep, FAR char *buffer, size_t buflen)
|
||||||
|
{
|
||||||
|
int ret = -ERROR;
|
||||||
|
POINT touch_point = {0, 0, 0};
|
||||||
|
|
||||||
|
if (buffer == NULL)
|
||||||
|
{
|
||||||
|
return -ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
POINT* data = (POINT*)buffer;
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
if(GT911_Scan(&touch_point))
|
||||||
|
{
|
||||||
|
data->x = touch_point.x;
|
||||||
|
data->y = touch_point.y;
|
||||||
|
ret = buflen;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: lcd_read
|
||||||
|
****************************************************************************/
|
||||||
|
static ssize_t touch_write(FAR struct file *filep, FAR const char *buffer, size_t buflen)
|
||||||
|
{
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************************
|
/***********************************************************************************
|
||||||
* Name: GT911_test
|
* Name: board_touch_initialize
|
||||||
* Description: gt911 test code
|
* Description: touch initialize
|
||||||
* input: None
|
* input: None
|
||||||
* output: None
|
* output: None
|
||||||
* return: Returns true for touch, false for no touch
|
* return: None
|
||||||
***********************************************************************************/
|
***********************************************************************************/
|
||||||
void GT911_test(void)
|
void board_touch_initialize(void)
|
||||||
{
|
{
|
||||||
uint16_t res;
|
|
||||||
POINT point = {0, 0};
|
|
||||||
IIC_Init();
|
IIC_Init();
|
||||||
res = GT911_ReadFirmwareVersion();
|
/* register device */
|
||||||
printf("FirmwareVersion:%2x\n",res);
|
register_driver("/dev/touch_dev", &g_touchfops, 0666, NULL);
|
||||||
while(1)
|
|
||||||
{
|
|
||||||
if(GT911_Scan(&point))
|
|
||||||
{
|
|
||||||
printf("Now touch point:(%d,%d)\n",point.X,point.Y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -63,26 +63,13 @@ typedef struct
|
||||||
uint16_t S[CT_MAX_TOUCH];
|
uint16_t S[CT_MAX_TOUCH];
|
||||||
}GT911_Dev;
|
}GT911_Dev;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint16_t X;
|
uint16_t x;
|
||||||
uint16_t Y;
|
uint16_t y;
|
||||||
|
uint16_t press;
|
||||||
}POINT;
|
}POINT;
|
||||||
|
|
||||||
void IIC_Init(void);
|
void board_touch_initialize(void);
|
||||||
void SDA_IN(void);
|
|
||||||
void SDA_OUT(void);
|
|
||||||
uint8_t READ_SDA(void);
|
|
||||||
void IIC_SCL(uint8_t val);
|
|
||||||
void IIC_SDA(uint8_t val);
|
|
||||||
void IIC_Start(void);
|
|
||||||
void IIC_Stop(void);
|
|
||||||
uint8_t IIC_Wait_Ack(void);
|
|
||||||
void IIC_Ack(void);
|
|
||||||
void IIC_NAck(void);
|
|
||||||
void IIC_Send_Byte(uint8_t txd);
|
|
||||||
uint8_t IIC_Read_Byte(uint8_t ack);
|
|
||||||
bool GT911_Scan(POINT* point);
|
|
||||||
void GT911_test(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -667,6 +667,14 @@ config NSH_DISABLE_K210_FFT
|
||||||
bool "Disable the K210 fft device."
|
bool "Disable the K210 fft device."
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config NSH_DISABLE_MUSL_TEST
|
||||||
|
bool "Disable the musl test."
|
||||||
|
default n
|
||||||
|
|
||||||
|
config NSH_NSH_DISABLE_CAN_TEST
|
||||||
|
bool "Disable the can test."
|
||||||
|
default n
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
if MMCSD
|
if MMCSD
|
||||||
|
|
|
@ -1587,6 +1587,13 @@ int nsh_foreach_var(FAR struct nsh_vtbl_s *vtbl, nsh_foreach_var_t cb,
|
||||||
int cmd_fft(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
int cmd_fft(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_MUSL_LIBC) && !defined(CONFIG_NSH_DISABLE_MUSL_TEST)
|
||||||
|
int cmd_musl(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_BSP_USING_CAN) && !defined(CONFIG_NSH_DISABLE_CAN_TEST)
|
||||||
|
int cmd_cantest(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||||
|
#endif
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -68,11 +68,11 @@ int cmd_w5500(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||||
* Name: cmd_Touch
|
* Name: cmd_Touch
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#if defined(CONFIG_BSP_USING_TOUCH) && !defined(CONFIG_NSH_DISABLE_TOUCH)
|
#if defined(CONFIG_BSP_USING_TOUCH) && !defined(CONFIG_NSH_DISABLE_TOUCH)
|
||||||
extern void GT911_test(void);
|
extern void TestTouch(void);
|
||||||
int cmd_Touch(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
int cmd_Touch(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||||
{
|
{
|
||||||
nsh_output(vtbl, "Hello, world!\n");
|
nsh_output(vtbl, "Hello, world!\n");
|
||||||
GT911_test();
|
TestTouch();
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -500,3 +500,23 @@ int cmd_fft(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_MUSL_LIBC) && !defined(CONFIG_NSH_DISABLE_MUSL_TEST)
|
||||||
|
extern void Testmusl(void);
|
||||||
|
int cmd_musl(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||||
|
{
|
||||||
|
nsh_output(vtbl, "Hello, test musl!\n");
|
||||||
|
Testmusl();
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_BSP_USING_CAN) && !defined(CONFIG_NSH_DISABLE_CAN_TEST)
|
||||||
|
extern void can_test(void);
|
||||||
|
int cmd_cantest(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||||
|
{
|
||||||
|
nsh_output(vtbl, "Hello, world!\n");
|
||||||
|
can_test();
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -732,6 +732,14 @@ static const struct cmdmap_s g_cmdmap[] =
|
||||||
{ "fft", cmd_fft, 1, 1, "[K210 fft function.]" },
|
{ "fft", cmd_fft, 1, 1, "[K210 fft function.]" },
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_MUSL_LIBC) && !defined(CONFIG_NSH_DISABLE_MUSL_TEST)
|
||||||
|
{ "testmusl", cmd_musl, 1, 1, "[test musl function.]" },
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_BSP_USING_CAN) && !defined(CONFIG_NSH_DISABLE_CAN_TEST)
|
||||||
|
{ "cantest", cmd_cantest, 1, 1, "[test can function.]" },
|
||||||
|
#endif
|
||||||
|
|
||||||
{ NULL, NULL, 1, 1, NULL }
|
{ NULL, NULL, 1, 1, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ ifeq ($(CONFIG_LCD_ILI9341),y)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_LCD_LT768),y)
|
ifeq ($(CONFIG_LCD_LT768),y)
|
||||||
CSRCS += lt768.c lt768_lib.c
|
CSRCS += lt768.c lt768_lib.c lt768_learn.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_LCD_LCDDRV_SPIIF),y)
|
ifeq ($(CONFIG_LCD_LCDDRV_SPIIF),y)
|
||||||
|
|
|
@ -6282,7 +6282,7 @@ uint8_t Read_Key_Strobe_Data_2(void)
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Show_String(char *str)
|
void Show_String(uint8_t *str)
|
||||||
{
|
{
|
||||||
Text_Mode(); //text mode
|
Text_Mode(); //text mode
|
||||||
LCD_CmdWrite(0x04);
|
LCD_CmdWrite(0x04);
|
||||||
|
|
|
@ -0,0 +1,545 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 AIIT XUOS Lab
|
||||||
|
* XiUOS is licensed under Mulan PSL v2.
|
||||||
|
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
* You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
* http://license.coscl.org.cn/MulanPSL2
|
||||||
|
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the Mulan PSL v2 for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file lt768_learn.c
|
||||||
|
* @brief lt768_learn.c
|
||||||
|
* @version 1.0
|
||||||
|
* @author AIIT XUOS Lab
|
||||||
|
* @date 2022.9.19
|
||||||
|
*/
|
||||||
|
#include <syslog.h>
|
||||||
|
#include "nuttx/arch.h"
|
||||||
|
#include "nuttx/lcd/lt768_learn.h"
|
||||||
|
|
||||||
|
const uint8_t g_Image_pen_il[256] = { /* 0X00,0X02,0X20,0X00,0X20,0X00, */
|
||||||
|
0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0X96,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X91,0X6A,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0XA4,0X15,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XA4,0X00,0X6A,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0XA9,0X01,0X1A,0XAA,0XAA,0XAA,0XAA,0XAA,0XA9,0X00,0X46,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0XAA,0X40,0X51,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X90,0X14,0X6A,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0XAA,0XA4,0X05,0X1A,0XAA,0XAA,0XAA,0XAA,0XAA,0XA9,0X01,0X46,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0X40,0X51,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X90,0X14,0X6A,0XAA,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XA4,0X05,0X1A,0XAA,0XAA,0XAA,0XAA,0XAA,0XA9,0X01,0X46,0XAA,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XAA,0X40,0X51,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X90,0X14,0X69,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XAA,0XA4,0X01,0X14,0X6A,0XAA,0XAA,0XAA,0XAA,0XA9,0X00,0X44,0X1A,0XAA,
|
||||||
|
0XAA,0XAA,0XAA,0XAA,0X40,0X11,0X06,0XAA,0XAA,0XAA,0XAA,0XAA,0X90,0X04,0X41,0XAA,
|
||||||
|
0XAA,0XAA,0XAA,0XAA,0XA4,0X01,0X10,0X6A,0XAA,0XAA,0XAA,0XAA,0XA9,0X00,0X44,0X1A,
|
||||||
|
0XAA,0XAA,0XAA,0XAA,0XAA,0X40,0X11,0X1A,0XAA,0XAA,0XAA,0XAA,0XAA,0X90,0X04,0X1A,
|
||||||
|
0XAA,0XAA,0XAA,0XAA,0XAA,0XA4,0X01,0X1A,0XAA,0XAA,0XAA,0XAA,0XAA,0XA9,0X00,0X1A,
|
||||||
|
0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X40,0X6A,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X95,0XAA,
|
||||||
|
0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t g_Image_arrow_il[256] = { /* 0X00,0X02,0X20,0X00,0X20,0X00, */
|
||||||
|
0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X6A,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0X5A,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X46,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0X41,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X40,0X6A,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0X40,0X1A,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X40,0X06,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0X40,0X01,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X40,0X00,0X6A,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0X40,0X00,0X1A,0XAA,0XAA,0XAA,0XAA,0XAA,0X40,0X00,0X06,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0X40,0X00,0X01,0XAA,0XAA,0XAA,0XAA,0XAA,0X40,0X00,0X00,0X6A,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0X40,0X00,0X00,0X1A,0XAA,0XAA,0XAA,0XAA,0X40,0X00,0X00,0X06,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0X40,0X00,0X00,0X01,0XAA,0XAA,0XAA,0XAA,0X40,0X00,0X00,0X00,0X6A,0XAA,0XAA,0XAA,
|
||||||
|
0X40,0X00,0X15,0X55,0X5A,0XAA,0XAA,0XAA,0X40,0X10,0X1A,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0X40,0X64,0X06,0XAA,0XAA,0XAA,0XAA,0XAA,0X41,0XA4,0X06,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0X46,0XA9,0X01,0XAA,0XAA,0XAA,0XAA,0XAA,0X5A,0XA9,0X01,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0X6A,0XAA,0X40,0X6A,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X40,0X6A,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0X90,0X1A,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X90,0X1A,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XA4,0X06,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XA4,0X06,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XA9,0X5A,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t g_Image_busy_im[256] = { /* 0X00,0X02,0X20,0X00,0X20,0X00, */
|
||||||
|
0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X55,0X55,0X55,0X55,0X6A,0XAA,
|
||||||
|
0XAA,0XAA,0X54,0X00,0X00,0X05,0X6A,0XAA,0XAA,0XAA,0X55,0X55,0X55,0X55,0X6A,0XAA,
|
||||||
|
0XAA,0XAA,0X94,0X00,0X00,0X05,0XAA,0XAA,0XAA,0XAA,0X94,0X00,0X00,0X05,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0X94,0X44,0X44,0X45,0XAA,0XAA,0XAA,0XAA,0X94,0X11,0X11,0X05,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0X95,0X04,0X44,0X15,0XAA,0XAA,0XAA,0XAA,0XA5,0X41,0X10,0X56,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XA9,0X50,0X41,0X5A,0XAA,0XAA,0XAA,0XAA,0XAA,0X54,0X05,0X6A,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XAA,0X94,0X05,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X94,0X05,0XAA,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XAA,0X94,0X45,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X94,0X05,0XAA,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XAA,0X50,0X01,0X6A,0XAA,0XAA,0XAA,0XAA,0XA9,0X40,0X40,0X5A,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XA5,0X00,0X10,0X16,0XAA,0XAA,0XAA,0XAA,0X94,0X00,0X00,0X05,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0X94,0X04,0X44,0X05,0XAA,0XAA,0XAA,0XAA,0X94,0X11,0X11,0X05,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0X94,0X44,0X44,0X45,0XAA,0XAA,0XAA,0XAA,0X95,0X11,0X11,0X15,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0X55,0X55,0X55,0X55,0X6A,0XAA,0XAA,0XAA,0X54,0X00,0X00,0X05,0X6A,0XAA,
|
||||||
|
0XAA,0XAA,0X55,0X55,0X55,0X55,0X6A,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t g_Image_no_im[256] = { /* 0X00,0X02,0X20,0X00,0X20,0X00, */
|
||||||
|
0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0X95,0X55,0XAA,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XA9,0X40,0X00,0X5A,0XAA,0XAA,0XAA,0XAA,0X94,0X00,0X00,0X05,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0X40,0X00,0X00,0X00,0X6A,0XAA,0XAA,0XA9,0X00,0X15,0X55,0X00,0X1A,0XAA,
|
||||||
|
0XAA,0XA4,0X00,0X6A,0XAA,0X50,0X06,0XAA,0XAA,0XA4,0X00,0X6A,0XAA,0XA4,0X06,0XAA,
|
||||||
|
0XAA,0X90,0X00,0X1A,0XAA,0XA9,0X01,0XAA,0XAA,0X90,0X10,0X06,0XAA,0XA9,0X01,0XAA,
|
||||||
|
0XAA,0X40,0X64,0X01,0XAA,0XAA,0X40,0X6A,0XAA,0X40,0X69,0X00,0X6A,0XAA,0X40,0X6A,
|
||||||
|
0XAA,0X40,0X6A,0X40,0X1A,0XAA,0X40,0X6A,0XAA,0X40,0X6A,0X90,0X06,0XAA,0X40,0X6A,
|
||||||
|
0XAA,0X40,0X6A,0XA4,0X01,0XAA,0X40,0X6A,0XAA,0X40,0X6A,0XA9,0X00,0X6A,0X40,0X6A,
|
||||||
|
0XAA,0X40,0X6A,0XAA,0X40,0X1A,0X40,0X6A,0XAA,0X90,0X1A,0XAA,0X90,0X05,0X01,0XAA,
|
||||||
|
0XAA,0X90,0X1A,0XAA,0XA4,0X00,0X01,0XAA,0XAA,0XA4,0X06,0XAA,0XA9,0X00,0X06,0XAA,
|
||||||
|
0XAA,0XA4,0X01,0X6A,0XAA,0X40,0X06,0XAA,0XAA,0XA9,0X00,0X15,0X55,0X00,0X1A,0XAA,
|
||||||
|
0XAA,0XAA,0X40,0X00,0X00,0X00,0X6A,0XAA,0XAA,0XAA,0X94,0X00,0X00,0X05,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XA9,0X40,0X00,0X5A,0XAA,0XAA,0XAA,0XAA,0XAA,0X95,0X55,0XAA,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void Display_RGB(void)
|
||||||
|
{
|
||||||
|
Select_Main_Window_16bpp();
|
||||||
|
Main_Image_Start_Address(0);
|
||||||
|
Main_Image_Width(LCD_XSIZE_TFT);
|
||||||
|
Main_Window_Start_XY(0,0);
|
||||||
|
Canvas_Image_Start_address(0);
|
||||||
|
Canvas_image_width(LCD_XSIZE_TFT);
|
||||||
|
Active_Window_XY(0,0);
|
||||||
|
Active_Window_WH(LCD_XSIZE_TFT,LCD_YSIZE_TFT);
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
BTE_Solid_Fill(0,LCD_XSIZE_TFT,0,0,RED,LCD_XSIZE_TFT,LCD_YSIZE_TFT);
|
||||||
|
up_mdelay(500);
|
||||||
|
BTE_Solid_Fill(0,LCD_XSIZE_TFT,0,0,GREEN,LCD_XSIZE_TFT,LCD_YSIZE_TFT);
|
||||||
|
up_mdelay(500);
|
||||||
|
BTE_Solid_Fill(0,LCD_XSIZE_TFT,0,0,BLUE,LCD_XSIZE_TFT,LCD_YSIZE_TFT);
|
||||||
|
up_mdelay(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define Picture_1_Addr 0
|
||||||
|
#define Picture_2_Addr (LCD_XSIZE_TFT*LCD_YSIZE_TFT*2)
|
||||||
|
#define Picture_3_Addr (LCD_XSIZE_TFT*LCD_YSIZE_TFT*4)
|
||||||
|
#define Picture_4_Addr (LCD_XSIZE_TFT*LCD_YSIZE_TFT*6)
|
||||||
|
|
||||||
|
void Display_Picture(void)
|
||||||
|
{
|
||||||
|
uint8_t i = 0;
|
||||||
|
|
||||||
|
Select_Main_Window_16bpp();
|
||||||
|
Main_Image_Start_Address(0);
|
||||||
|
Main_Image_Width(LCD_XSIZE_TFT);
|
||||||
|
Main_Window_Start_XY(0,0);
|
||||||
|
Canvas_Image_Start_address(0);
|
||||||
|
Canvas_image_width(LCD_XSIZE_TFT);
|
||||||
|
Active_Window_XY(0,0);
|
||||||
|
Active_Window_WH(LCD_XSIZE_TFT,LCD_YSIZE_TFT);
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
for(i = 0;i < 4;i++)
|
||||||
|
{
|
||||||
|
switch(i)
|
||||||
|
{
|
||||||
|
case 0:LT768_DMA_24bit_Block(1,0,0,0,LCD_XSIZE_TFT,LCD_YSIZE_TFT,LCD_XSIZE_TFT,Picture_1_Addr);break;
|
||||||
|
case 1:LT768_DMA_24bit_Block(1,0,0,0,LCD_XSIZE_TFT,LCD_YSIZE_TFT,LCD_XSIZE_TFT,Picture_2_Addr);break;
|
||||||
|
case 2:LT768_DMA_24bit_Block(1,0,0,0,LCD_XSIZE_TFT,LCD_YSIZE_TFT,LCD_XSIZE_TFT,Picture_3_Addr);break;
|
||||||
|
case 3:LT768_DMA_24bit_Block(1,0,0,0,LCD_XSIZE_TFT,LCD_YSIZE_TFT,LCD_XSIZE_TFT,Picture_4_Addr);break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
up_mdelay(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Display_PIP(void)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
Select_Main_Window_16bpp();
|
||||||
|
Main_Image_Start_Address(0);
|
||||||
|
Main_Image_Width(LCD_XSIZE_TFT);
|
||||||
|
Main_Window_Start_XY(0,0);
|
||||||
|
Canvas_Image_Start_address(0);
|
||||||
|
Canvas_image_width(LCD_XSIZE_TFT);
|
||||||
|
Active_Window_XY(0,0);
|
||||||
|
Active_Window_WH(LCD_XSIZE_TFT,LCD_YSIZE_TFT);
|
||||||
|
|
||||||
|
BTE_Solid_Fill(0,LCD_XSIZE_TFT,0,0,BLUE2,LCD_XSIZE_TFT,LCD_YSIZE_TFT); // 底图颜色
|
||||||
|
BTE_Solid_Fill(LCD_XSIZE_TFT*LCD_YSIZE_TFT*2,LCD_XSIZE_TFT,0,0,RED,LCD_XSIZE_TFT,LCD_YSIZE_TFT); // PIP1颜色
|
||||||
|
BTE_Solid_Fill(LCD_XSIZE_TFT*LCD_YSIZE_TFT*4,LCD_XSIZE_TFT,0,0,GREEN,LCD_XSIZE_TFT,LCD_YSIZE_TFT); // PIP2颜色
|
||||||
|
|
||||||
|
LT768_PIP_Init(1,1,LCD_XSIZE_TFT*LCD_YSIZE_TFT*2,250,250,1024,0,175,250,250); // 初始化PIP1
|
||||||
|
LT768_PIP_Init(1,2,LCD_XSIZE_TFT*LCD_YSIZE_TFT*4,300,300,1024,774,150,300,300); // 初始化PIP2
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
for(i=0;i<550;i=i+2)
|
||||||
|
{
|
||||||
|
LT768_Set_DisWindowPos(1,1,i,175);
|
||||||
|
LT768_Set_DisWindowPos(1,2,734-i,150);
|
||||||
|
up_mdelay(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=0;i<550;i=i+2)
|
||||||
|
{
|
||||||
|
LT768_Set_DisWindowPos(1,1,550-i,175);
|
||||||
|
LT768_Set_DisWindowPos(1,2,734-550+i,150);
|
||||||
|
up_mdelay(5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Display_Internal_Font(void)
|
||||||
|
{
|
||||||
|
char c[2] = "0";
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned int x = 0;
|
||||||
|
unsigned int y = 0;
|
||||||
|
unsigned int z = 0;
|
||||||
|
|
||||||
|
Select_Main_Window_16bpp();
|
||||||
|
Main_Image_Start_Address(0);
|
||||||
|
Main_Image_Width(LCD_XSIZE_TFT);
|
||||||
|
Main_Window_Start_XY(0,0);
|
||||||
|
Canvas_Image_Start_address(0);
|
||||||
|
Canvas_image_width(LCD_XSIZE_TFT);
|
||||||
|
Active_Window_XY(0,0);
|
||||||
|
Active_Window_WH(LCD_XSIZE_TFT,LCD_YSIZE_TFT);
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
LT768_DrawSquare_Fill(0,0,LCD_XSIZE_TFT,LCD_YSIZE_TFT,BLUE2);
|
||||||
|
|
||||||
|
LT768_Select_Internal_Font_Init(16,1,1,0,0);
|
||||||
|
LT768_Print_Internal_Font_String(0,10,BLACK,BLUE2,"Embedded 8x16 ASCII Character");
|
||||||
|
|
||||||
|
LT768_Select_Internal_Font_Init(24,1,1,0,0);
|
||||||
|
LT768_Print_Internal_Font_String(0,30,BLUE,BLUE2,"Embedded 12x24 ASCII Character");
|
||||||
|
|
||||||
|
LT768_Select_Internal_Font_Init(32,1,1,0,0);
|
||||||
|
LT768_Print_Internal_Font_String(0,55,GREEN,BLUE2,"Embedded 16x32 ASCII Character");
|
||||||
|
|
||||||
|
LT768_Print_Internal_Font_String(0,95,RED,BLUE2,"The Text Cursor");
|
||||||
|
|
||||||
|
for(i = 0 ; i < 14 ; i++)
|
||||||
|
{
|
||||||
|
up_mdelay(100);
|
||||||
|
LT768_Text_cursor_Init(1,15,1+i,15-i);
|
||||||
|
}
|
||||||
|
up_mdelay(100);
|
||||||
|
LT768_Text_cursor_Init(1,15,10,2);
|
||||||
|
|
||||||
|
|
||||||
|
c[0] = '0';
|
||||||
|
for(i = 0 ; i < 10 ; i++)
|
||||||
|
{
|
||||||
|
up_mdelay(50);
|
||||||
|
LT768_Print_Internal_Font_String(10+16*i,135,RED,BLUE2,&c[0]);
|
||||||
|
c[0]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
c[0] = 0;
|
||||||
|
x = 0;
|
||||||
|
y = 175;
|
||||||
|
z = 0;
|
||||||
|
for(i = 0 ; i < 127 ; i++)
|
||||||
|
{
|
||||||
|
up_mdelay(50);
|
||||||
|
x = z * 16;
|
||||||
|
z++;
|
||||||
|
if(x>1024)
|
||||||
|
{
|
||||||
|
y = y + 40;
|
||||||
|
x = 0;
|
||||||
|
z = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LT768_Print_Internal_Font_String(x,y,RED,BLUE2,&c[0]);
|
||||||
|
c[0]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
up_mdelay(1000);
|
||||||
|
up_mdelay(1000);
|
||||||
|
|
||||||
|
|
||||||
|
LT768_DMA_24bit_Block(1,0,200,300,600,280,1024,Picture_3_Addr);
|
||||||
|
|
||||||
|
LT768_Graphic_cursor_Init(1,0xff,0x00,0,0,(uint8_t*)g_Image_pen_il);
|
||||||
|
LT768_Graphic_cursor_Init(2,0xff,0x00,0,0,(uint8_t*)g_Image_arrow_il);
|
||||||
|
LT768_Graphic_cursor_Init(3,0xff,0x00,0,0,(uint8_t*)g_Image_busy_im);
|
||||||
|
LT768_Graphic_cursor_Init(4,0xff,0x00,0,0,(uint8_t*)g_Image_no_im);
|
||||||
|
|
||||||
|
|
||||||
|
LT768_Set_Graphic_cursor_Pos(1,100,300);
|
||||||
|
up_mdelay(500);
|
||||||
|
LT768_Set_Graphic_cursor_Pos(2,100,300);
|
||||||
|
up_mdelay(500);
|
||||||
|
LT768_Set_Graphic_cursor_Pos(3,100,300);
|
||||||
|
up_mdelay(500);
|
||||||
|
LT768_Set_Graphic_cursor_Pos(4,100,300);
|
||||||
|
up_mdelay(500);
|
||||||
|
LT768_Set_Graphic_cursor_Pos(1,100,300);
|
||||||
|
|
||||||
|
for(i = 100 ; i < 924 ; i++)
|
||||||
|
{
|
||||||
|
LT768_Set_Graphic_cursor_Pos(1,i,90);
|
||||||
|
up_mdelay(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 200 ; i < 800 ; i++)
|
||||||
|
{
|
||||||
|
LT768_Set_Graphic_cursor_Pos(2,i,i-200);
|
||||||
|
up_mdelay(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 800 ; i > 100 ; i--)
|
||||||
|
{
|
||||||
|
LT768_Set_Graphic_cursor_Pos(3,i,800-i);
|
||||||
|
up_mdelay(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 924 ; i > 100 ; i--)
|
||||||
|
{
|
||||||
|
LT768_Set_Graphic_cursor_Pos(4,i,400);
|
||||||
|
up_mdelay(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
up_mdelay(1000);
|
||||||
|
up_mdelay(1000);
|
||||||
|
|
||||||
|
LT768_Disable_Text_Cursor();
|
||||||
|
LT768_Disable_Graphic_Cursor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define MEMORY_ADDR_16 0x003E0D760
|
||||||
|
#define MEMORY_ADDR_24 0x003E537E0
|
||||||
|
#define MEMORY_ADDR_32 0x003EEBD00
|
||||||
|
|
||||||
|
#define FLASH_ADDR_16 0x00829150
|
||||||
|
#define FLASH_ADDR_24 0x0078DC20
|
||||||
|
#define FLASH_ADDR_32 0x00679A10
|
||||||
|
|
||||||
|
#define SIZE_16_NUM 0x00045080
|
||||||
|
#define SIZE_24_NUM 0x0009B520
|
||||||
|
#define SIZE_32_NUM 0x00114200
|
||||||
|
|
||||||
|
void Display_Outside_Font(void)
|
||||||
|
{
|
||||||
|
Select_Main_Window_16bpp();
|
||||||
|
Main_Image_Start_Address(0);
|
||||||
|
Main_Image_Width(LCD_XSIZE_TFT);
|
||||||
|
Main_Window_Start_XY(0,0);
|
||||||
|
Canvas_Image_Start_address(0);
|
||||||
|
Canvas_image_width(LCD_XSIZE_TFT);
|
||||||
|
Active_Window_XY(0,0);
|
||||||
|
Active_Window_WH(LCD_XSIZE_TFT,LCD_YSIZE_TFT);
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
LT768_DrawSquare_Fill(0,0,LCD_XSIZE_TFT,LCD_YSIZE_TFT,WHITE);
|
||||||
|
LT768_Select_Outside_Font_Init(1,0,FLASH_ADDR_16,MEMORY_ADDR_16,SIZE_16_NUM,16,1,1,0,0);
|
||||||
|
LT768_Print_Outside_Font_String(425,50,RED,WHITE,(uint8_t*)"16X16微软雅黑字体");
|
||||||
|
up_mdelay(500);
|
||||||
|
Font_Width_X2();
|
||||||
|
Font_Height_X2();
|
||||||
|
LT768_Print_Outside_Font_String(250,75,GREY-1200,WHITE,(uint8_t*)"16X16微软雅黑字体长宽各扩1倍");
|
||||||
|
up_mdelay(500);
|
||||||
|
Font_Width_X3();
|
||||||
|
Font_Height_X3();
|
||||||
|
LT768_Print_Outside_Font_String(150,120,BLUE,WHITE,(uint8_t*)"16X16微软雅黑字体长宽各扩2倍");
|
||||||
|
up_mdelay(500);
|
||||||
|
Font_Width_X4();
|
||||||
|
Font_Height_X4();
|
||||||
|
LT768_Print_Outside_Font_String(60,178,MAGENTA,WHITE,(uint8_t*)"16X16微软雅黑字体长宽各扩3倍");
|
||||||
|
up_mdelay(500);
|
||||||
|
|
||||||
|
LT768_Select_Outside_Font_Init(1,0,FLASH_ADDR_24,MEMORY_ADDR_24,SIZE_24_NUM,24,1,1,0,0);
|
||||||
|
LT768_Print_Outside_Font_String(445,280,RED,WHITE,(uint8_t*)"24X24楷体");
|
||||||
|
up_mdelay(500);
|
||||||
|
Font_Width_X2();
|
||||||
|
Font_Height_X2();
|
||||||
|
LT768_Print_Outside_Font_String(260,315,GREEN,WHITE,(uint8_t*)"24X24楷体长宽各扩1倍");
|
||||||
|
up_mdelay(500);
|
||||||
|
Font_Width_X3();
|
||||||
|
Font_Height_X3();
|
||||||
|
LT768_Print_Outside_Font_String(150,375,CYAN,WHITE,(uint8_t*)"24X24楷体长宽各扩2倍");
|
||||||
|
up_mdelay(500);
|
||||||
|
Font_Width_X4();
|
||||||
|
Font_Height_X4();
|
||||||
|
LT768_Print_Outside_Font_String(30,455,YELLOW,WHITE,(uint8_t*)"24X24楷体长宽各扩3倍");
|
||||||
|
up_mdelay(500);
|
||||||
|
|
||||||
|
LT768_Select_Outside_Font_Init(1,0,FLASH_ADDR_32,MEMORY_ADDR_32,SIZE_32_NUM,32,1,1,0,0);
|
||||||
|
LT768_DrawSquare_Fill(0,0,LCD_XSIZE_TFT,LCD_YSIZE_TFT,WHITE);
|
||||||
|
LT768_Print_Outside_Font_String(430,105,RED,WHITE,(uint8_t*)"32X32隶书");
|
||||||
|
up_mdelay(500);
|
||||||
|
Font_Width_X2();
|
||||||
|
Font_Height_X2();
|
||||||
|
LT768_Print_Outside_Font_String(360,165,GREEN,WHITE,(uint8_t*)"32X32隶书");
|
||||||
|
up_mdelay(500);
|
||||||
|
Font_Width_X3();
|
||||||
|
Font_Height_X3();
|
||||||
|
LT768_Print_Outside_Font_String(285,250,BLUE,WHITE,(uint8_t*)"32X32隶书");
|
||||||
|
up_mdelay(500);
|
||||||
|
Font_Width_X4();
|
||||||
|
Font_Height_X4();
|
||||||
|
LT768_Print_Outside_Font_String(220,360,YELLOW,WHITE,(uint8_t*)"32X32隶书");
|
||||||
|
up_mdelay(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Display_Triangle(void)
|
||||||
|
{
|
||||||
|
unsigned long i,j,h;
|
||||||
|
unsigned long resx1,resy1,resx2,resy2,resx3,resy3;
|
||||||
|
|
||||||
|
Select_Main_Window_16bpp();
|
||||||
|
Main_Image_Start_Address(0);
|
||||||
|
Main_Image_Width(LCD_XSIZE_TFT);
|
||||||
|
Canvas_Image_Start_address(0);
|
||||||
|
Canvas_image_width(LCD_XSIZE_TFT);
|
||||||
|
Active_Window_XY(0,0);
|
||||||
|
Active_Window_WH(LCD_XSIZE_TFT,LCD_YSIZE_TFT);
|
||||||
|
|
||||||
|
Main_Window_Start_XY(0,0);
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
LT768_DrawSquare_Fill(0,0,LCD_XSIZE_TFT,LCD_YSIZE_TFT,WHITE);
|
||||||
|
h=0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
resx1=rand()%LCD_XSIZE_TFT; // 点1的x轴
|
||||||
|
resy1=rand()%(LCD_YSIZE_TFT); // 点1的y轴
|
||||||
|
resx2=rand()%LCD_XSIZE_TFT; // 点2的x轴
|
||||||
|
resy2=rand()%(LCD_YSIZE_TFT); // 点2的y轴
|
||||||
|
resx3=rand()%LCD_XSIZE_TFT; // 点3的x轴
|
||||||
|
resy3=rand()%(LCD_YSIZE_TFT); // 点3的y轴
|
||||||
|
i=rand()%65536; // 颜色
|
||||||
|
j=rand()%3;
|
||||||
|
if(j) LT768_DrawTriangle(resx1,resy1,resx2,resy2,resx3,resy3,i); // 无填充色三角形
|
||||||
|
else LT768_DrawTriangle_Fill(resx1,resy1,resx2,resy2,resx3,resy3,i); // 填充色三角形
|
||||||
|
h++;
|
||||||
|
up_mdelay(120);
|
||||||
|
}
|
||||||
|
while(h<20);
|
||||||
|
|
||||||
|
h=0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
resx1=rand()%LCD_XSIZE_TFT; // 点1的x轴
|
||||||
|
resy1=rand()%(LCD_YSIZE_TFT); // 点1的y轴
|
||||||
|
resx2=rand()%LCD_XSIZE_TFT; // 点2的x轴
|
||||||
|
resy2=rand()%(LCD_YSIZE_TFT); // 点2的y轴
|
||||||
|
resx3=rand()%LCD_XSIZE_TFT; // 点3的x轴
|
||||||
|
resy3=rand()%(LCD_YSIZE_TFT); // 点3的y轴
|
||||||
|
i=rand()%65536; // 颜色
|
||||||
|
j=rand()%3;
|
||||||
|
if(j) LT768_DrawTriangle(resx1,resy1,resx2,resy2,resx3,resy3,i); // 无填充色三角形
|
||||||
|
else LT768_DrawTriangle_Fill(resx1,resy1,resx2,resy2,resx3,resy3,i); // 填充色三角形
|
||||||
|
h++;
|
||||||
|
up_mdelay(1);
|
||||||
|
}
|
||||||
|
while(h<2500);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Tsst(void)
|
||||||
|
{
|
||||||
|
unsigned long i,j,h;
|
||||||
|
unsigned long resx1,resy1,resx2,resy2,resx3,resy3;
|
||||||
|
|
||||||
|
Select_Main_Window_16bpp();
|
||||||
|
Main_Image_Start_Address(0);
|
||||||
|
Main_Image_Width(LCD_XSIZE_TFT);
|
||||||
|
Main_Window_Start_XY(0,0);
|
||||||
|
Canvas_Image_Start_address(0);
|
||||||
|
Canvas_image_width(LCD_XSIZE_TFT);
|
||||||
|
Active_Window_XY(0,0);
|
||||||
|
Active_Window_WH(LCD_XSIZE_TFT,LCD_YSIZE_TFT);
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
|
||||||
|
BTE_Solid_Fill(0,LCD_XSIZE_TFT,0,0,RED,LCD_XSIZE_TFT,LCD_YSIZE_TFT);
|
||||||
|
up_mdelay(600);
|
||||||
|
BTE_Solid_Fill(0,LCD_XSIZE_TFT,0,0,GREEN,LCD_XSIZE_TFT,LCD_YSIZE_TFT);
|
||||||
|
up_mdelay(600);
|
||||||
|
BTE_Solid_Fill(0,LCD_XSIZE_TFT,0,0,BLUE,LCD_XSIZE_TFT,LCD_YSIZE_TFT);
|
||||||
|
up_mdelay(600);
|
||||||
|
|
||||||
|
BTE_Solid_Fill(LCD_XSIZE_TFT*LCD_YSIZE_TFT*2,LCD_XSIZE_TFT,0,0,RED,LCD_XSIZE_TFT,LCD_YSIZE_TFT); // PIP1颜色
|
||||||
|
BTE_Solid_Fill(LCD_XSIZE_TFT*LCD_YSIZE_TFT*4,LCD_XSIZE_TFT,0,0,GREEN,LCD_XSIZE_TFT,LCD_YSIZE_TFT); // PIP2颜色
|
||||||
|
LT768_PIP_Init(1,1,LCD_XSIZE_TFT*LCD_YSIZE_TFT*2,0,0,LCD_XSIZE_TFT,0,100,50,50); // 初始化PIP1
|
||||||
|
LT768_PIP_Init(1,2,LCD_XSIZE_TFT*LCD_YSIZE_TFT*4,0,0,LCD_XSIZE_TFT,430,85,80,80); // 初始化PIP2
|
||||||
|
|
||||||
|
for(i=0;i<300;i=i+4)
|
||||||
|
{
|
||||||
|
LT768_Set_DisWindowPos(1,1,i,100);
|
||||||
|
LT768_Set_DisWindowPos(1,2,430-i,85);
|
||||||
|
up_mdelay(15);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=0;i<300;i=i+2)
|
||||||
|
{
|
||||||
|
LT768_Set_DisWindowPos(1,1,300-i,100);
|
||||||
|
LT768_Set_DisWindowPos(1,2,430-300+i,85);
|
||||||
|
up_mdelay(10);
|
||||||
|
}
|
||||||
|
Disable_PIP1();
|
||||||
|
Disable_PIP2();
|
||||||
|
|
||||||
|
|
||||||
|
LT768_DrawSquare_Fill(0,0,LCD_XSIZE_TFT,LCD_YSIZE_TFT,WHITE);
|
||||||
|
h=0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
resx1=rand()%LCD_XSIZE_TFT; // 点1的x轴
|
||||||
|
resy1=rand()%(LCD_YSIZE_TFT); // 点1的y轴
|
||||||
|
resx2=rand()%LCD_XSIZE_TFT; // 点2的x轴
|
||||||
|
resy2=rand()%(LCD_YSIZE_TFT); // 点2的y轴
|
||||||
|
resx3=rand()%LCD_XSIZE_TFT; // 点3的x轴
|
||||||
|
resy3=rand()%(LCD_YSIZE_TFT); // 点3的y轴
|
||||||
|
i=rand()%65536; // 颜色
|
||||||
|
j=rand()%3;
|
||||||
|
if(j) LT768_DrawTriangle(resx1,resy1,resx2,resy2,resx3,resy3,i); // 无填充色三角形
|
||||||
|
else LT768_DrawTriangle_Fill(resx1,resy1,resx2,resy2,resx3,resy3,i); // 填充色三角形
|
||||||
|
h++;
|
||||||
|
up_mdelay(120);
|
||||||
|
}
|
||||||
|
while(h<20);
|
||||||
|
|
||||||
|
h=0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
resx1=rand()%LCD_XSIZE_TFT; // 点1的x轴
|
||||||
|
resy1=rand()%(LCD_YSIZE_TFT); // 点1的y轴
|
||||||
|
resx2=rand()%LCD_XSIZE_TFT; // 点2的x轴
|
||||||
|
resy2=rand()%(LCD_YSIZE_TFT); // 点2的y轴
|
||||||
|
resx3=rand()%LCD_XSIZE_TFT; // 点3的x轴
|
||||||
|
resy3=rand()%(LCD_YSIZE_TFT); // 点3的y轴
|
||||||
|
i=rand()%65536; // 颜色
|
||||||
|
j=rand()%3;
|
||||||
|
if(j) LT768_DrawTriangle(resx1,resy1,resx2,resy2,resx3,resy3,i); // 无填充色三角形
|
||||||
|
else LT768_DrawTriangle_Fill(resx1,resy1,resx2,resy2,resx3,resy3,i); // 填充色三角形
|
||||||
|
h++;
|
||||||
|
up_mdelay(1);
|
||||||
|
}
|
||||||
|
while(h<2500);
|
||||||
|
|
||||||
|
up_mdelay(100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -303,7 +303,7 @@ void MPU8_24bpp_Memory_Write
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MPuint16_t_16bpp_Memory_Write
|
void MPU16_16bpp_Memory_Write
|
||||||
(
|
(
|
||||||
uint16_t x
|
uint16_t x
|
||||||
, uint16_t y
|
, uint16_t y
|
||||||
|
@ -332,7 +332,7 @@ void MPuint16_t_16bpp_Memory_Write
|
||||||
Check_Mem_WR_FIFO_Empty();
|
Check_Mem_WR_FIFO_Empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MPuint16_t_24bpp_Mode1_Memory_Write
|
void MPU16_24bpp_Mode1_Memory_Write
|
||||||
(
|
(
|
||||||
uint16_t x
|
uint16_t x
|
||||||
, uint16_t y
|
, uint16_t y
|
||||||
|
@ -368,7 +368,7 @@ void MPuint16_t_24bpp_Mode1_Memory_Write
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MPuint16_t_24bpp_Mode2_Memory_Write
|
void MPU16_24bpp_Mode2_Memory_Write
|
||||||
(
|
(
|
||||||
uint16_t x
|
uint16_t x
|
||||||
, uint16_t y
|
, uint16_t y
|
||||||
|
@ -1388,7 +1388,7 @@ void LT768_Print_Internal_Font_String
|
||||||
, uint16_t y // font start y
|
, uint16_t y // font start y
|
||||||
, uint32_t FontColor // font color
|
, uint32_t FontColor // font color
|
||||||
, uint32_t BackGroundColor // font background color(when font background is transparent, it is invalid)
|
, uint32_t BackGroundColor // font background color(when font background is transparent, it is invalid)
|
||||||
, char *c // data start address
|
, uint8_t *c // data start address
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Text_Mode();
|
Text_Mode();
|
||||||
|
|
|
@ -21,6 +21,46 @@
|
||||||
#ifndef __LT768_H_
|
#ifndef __LT768_H_
|
||||||
#define __LT768_H_
|
#define __LT768_H_
|
||||||
|
|
||||||
|
typedef enum _LcdOperation
|
||||||
|
{
|
||||||
|
SHOW_STRING = 0,
|
||||||
|
SHOW_WDOT,
|
||||||
|
SHOW_RGB,
|
||||||
|
SHOW_PIP,
|
||||||
|
SHOW_INTERNAL_FONT,
|
||||||
|
SHOW_OUTSIDE_FONT,
|
||||||
|
SHOW_TRIANGLE,
|
||||||
|
SHOW_PICTURE,
|
||||||
|
} LcdOperation;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint16_t x_pos;
|
||||||
|
uint16_t y_pos;
|
||||||
|
uint16_t width;
|
||||||
|
uint16_t height;
|
||||||
|
uint8_t font_size;
|
||||||
|
uint8_t *addr;
|
||||||
|
uint16_t font_color;
|
||||||
|
uint16_t back_color;
|
||||||
|
}LcdStringParam;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint16_t x_startpos;
|
||||||
|
uint16_t x_endpos;
|
||||||
|
uint16_t y_startpos;
|
||||||
|
uint16_t y_endpos;
|
||||||
|
void* pixel_color;
|
||||||
|
}LcdPixelParam;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
LcdOperation type;
|
||||||
|
LcdPixelParam pixel_info;
|
||||||
|
LcdStringParam string_info;
|
||||||
|
}LcdWriteParam;
|
||||||
|
|
||||||
#define cSetb0 0x01
|
#define cSetb0 0x01
|
||||||
#define cSetb1 0x02
|
#define cSetb1 0x02
|
||||||
#define cSetb2 0x04
|
#define cSetb2 0x04
|
||||||
|
@ -691,7 +731,7 @@ uint8_t Read_Key_Strobe_Data_0(void);
|
||||||
uint8_t Read_Key_Strobe_Data_1(void);
|
uint8_t Read_Key_Strobe_Data_1(void);
|
||||||
uint8_t Read_Key_Strobe_Data_2(void);
|
uint8_t Read_Key_Strobe_Data_2(void);
|
||||||
|
|
||||||
void Show_String(char *str);
|
void Show_String(uint8_t *str);
|
||||||
void Show_picture(uint32_t numbers, const uint16_t *data);
|
void Show_picture(uint32_t numbers, const uint16_t *data);
|
||||||
|
|
||||||
void PWM0_ON(void); //PWM0
|
void PWM0_ON(void); //PWM0
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 AIIT XUOS Lab
|
||||||
|
* XiUOS is licensed under Mulan PSL v2.
|
||||||
|
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
* You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
* http://license.coscl.org.cn/MulanPSL2
|
||||||
|
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the Mulan PSL v2 for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file lt768.h
|
||||||
|
* @brief lt768 register relative driver, inherit from Levetop Electronics
|
||||||
|
* @version 1.0
|
||||||
|
* @author AIIT XUOS Lab
|
||||||
|
* @date 2022.9.19
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _LT768_LEARN_H
|
||||||
|
#define _LT768_LEARN_H
|
||||||
|
#include "nuttx/lcd/if_port.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
void Display_RGB(void);
|
||||||
|
void Display_Picture(void);
|
||||||
|
void Display_PIP(void);
|
||||||
|
void Display_Internal_Font(void);
|
||||||
|
void Display_Outside_Font(void);
|
||||||
|
void Display_Triangle(void);
|
||||||
|
void Tsst(void);
|
||||||
|
|
||||||
|
#endif
|
|
@ -99,16 +99,31 @@
|
||||||
#define color16M_purple color16M_red|color16M_blue
|
#define color16M_purple color16M_red|color16M_blue
|
||||||
|
|
||||||
/* LCD color */
|
/* LCD color */
|
||||||
#define White 0xFFFF
|
#define WHITE 0xFFFF
|
||||||
#define Black 0x0000
|
#define BLACK 0x0000
|
||||||
#define Grey 0xF7DE
|
#define BLUE 0x001F
|
||||||
#define Blue 0x001F
|
#define GREY 0xF7DE
|
||||||
#define Blue2 0x051F
|
#define BRED 0xF81F
|
||||||
#define Red 0xF800
|
#define GRED 0xFFE0
|
||||||
#define Magenta 0xF81F
|
#define GBLUE 0x07FF
|
||||||
#define Green 0x07E0
|
#define BLUE2 0x051F
|
||||||
#define Cyan 0x7FFF
|
#define RED 0xF800
|
||||||
#define Yellow 0xFFE0
|
#define MAGENTA 0xF81F
|
||||||
|
#define GREEN 0x07E0
|
||||||
|
#define CYAN 0x7FFF
|
||||||
|
#define YELLOW 0xFFE0
|
||||||
|
#define BROWN 0xBC40
|
||||||
|
#define BRRED 0xFC07
|
||||||
|
#define GRAY 0x8430
|
||||||
|
|
||||||
|
#define DARKBLUE 0x01CF
|
||||||
|
#define LIGHTBLUE 0x7D7C
|
||||||
|
#define GRAYBLUE 0x5458
|
||||||
|
#define LIGHTGREEN 0x841F
|
||||||
|
#define LGRAY 0xC618
|
||||||
|
#define LGRAYBLUE 0xA651
|
||||||
|
#define LBBLUE 0x2B12
|
||||||
|
|
||||||
|
|
||||||
#define Line0 0
|
#define Line0 0
|
||||||
#define Line1 24
|
#define Line1 24
|
||||||
|
@ -140,32 +155,32 @@
|
||||||
void lt768_init(void);
|
void lt768_init(void);
|
||||||
|
|
||||||
/* write to memory */
|
/* write to memory */
|
||||||
void MPuint8_t_8bpp_Memory_Write(uint16_t x,
|
void MPU8_8bpp_Memory_Write(uint16_t x,
|
||||||
uint16_t y,
|
uint16_t y,
|
||||||
uint16_t w,
|
uint16_t w,
|
||||||
uint16_t h,
|
uint16_t h,
|
||||||
const uint8_t *data);
|
const uint8_t *data);
|
||||||
void MPuint8_t_16bpp_Memory_Write(uint16_t x,
|
void MPU8_16bpp_Memory_Write(uint16_t x,
|
||||||
uint16_t y,
|
uint16_t y,
|
||||||
uint16_t w,
|
uint16_t w,
|
||||||
uint16_t h,
|
uint16_t h,
|
||||||
const uint8_t *data);
|
const uint8_t *data);
|
||||||
void MPuint8_t_24bpp_Memory_Write(uint16_t x,
|
void MPU8_24bpp_Memory_Write(uint16_t x,
|
||||||
uint16_t y,
|
uint16_t y,
|
||||||
uint16_t w,
|
uint16_t w,
|
||||||
uint16_t h,
|
uint16_t h,
|
||||||
const uint8_t *data);
|
const uint8_t *data);
|
||||||
void MPuint16_t_16bpp_Memory_Write(uint16_t x,
|
void MPU16_16bpp_Memory_Write(uint16_t x,
|
||||||
uint16_t y,
|
uint16_t y,
|
||||||
uint16_t w,
|
uint16_t w,
|
||||||
uint16_t h,
|
uint16_t h,
|
||||||
const uint16_t *data);
|
const uint16_t *data);
|
||||||
void MPuint16_t_24bpp_Mode1_Memory_Write(uint16_t x,
|
void MPU16_24bpp_Mode1_Memory_Write(uint16_t x,
|
||||||
uint16_t y,
|
uint16_t y,
|
||||||
uint16_t w,
|
uint16_t w,
|
||||||
uint16_t h,
|
uint16_t h,
|
||||||
const uint16_t *data);
|
const uint16_t *data);
|
||||||
void MPuint16_t_24bpp_Mode2_Memory_Write(uint16_t x,
|
void MPU16_24bpp_Mode2_Memory_Write(uint16_t x,
|
||||||
uint16_t y,
|
uint16_t y,
|
||||||
uint16_t w,
|
uint16_t w,
|
||||||
uint16_t h,
|
uint16_t h,
|
||||||
|
@ -474,7 +489,7 @@ void LT768_Print_Internal_Font_String(uint16_t x,
|
||||||
uint16_t y,
|
uint16_t y,
|
||||||
uint32_t FontColor,
|
uint32_t FontColor,
|
||||||
uint32_t BackGroundColor,
|
uint32_t BackGroundColor,
|
||||||
char *c);
|
uint8_t *c);
|
||||||
|
|
||||||
/* nor flash use outside font */
|
/* nor flash use outside font */
|
||||||
/* 16*16 24*24 32*32 */
|
/* 16*16 24*24 32*32 */
|
||||||
|
|
Loading…
Reference in New Issue