support lcd test on xidatong-arm32 support wifi test on xidatong-arm32 support ethernet test on xidatong-arm32 on nuttx from Wang_linyu

it is OK
This commit is contained in:
xuedongliang 2022-10-20 16:13:50 +08:00
commit a11ff29402
24 changed files with 12677 additions and 11312 deletions

View File

@ -29,5 +29,9 @@ menu "test app"
config USER_TEST_SEMC
bool "Config test semc sdram"
default n
config USER_TEST_LCD
bool "Config test lcd device"
default n
endif
endmenu

View File

@ -12,6 +12,10 @@ ifeq ($(CONFIG_USER_TEST_SEMC),y)
SRC_FILES += test_extsram.c
endif
ifeq ($(CONFIG_USER_TEST_LCD),y)
SRC_FILES +=
endif
ifeq ($(CONFIG_ADD_XIZI_FETURES),y)
include $(KERNEL_ROOT)/compiler.mk
endif
@ -19,7 +23,7 @@ endif
include $(KERNEL_ROOT)/.config
ifeq ($(CONFIG_ADD_NUTTX_FETURES),y)
include $(APPDIR)/Make.defs
CSRCS += test_extsram.c
CSRCS += test_extsram.c test_lcd.c
include $(APPDIR)/Application.mk
endif

View File

@ -20,6 +20,7 @@
*/
#include <transform.h>
#include "stdio.h"
/* parameters for sram peripheral */
// /* stm32f4 Bank3:0X68000000 */
@ -52,7 +53,7 @@ int ExtsramTest(void)
#endif
/* write data */
printf("Writing the %ld bytes data, waiting....", SRAM_SIZE);
printf("Writing the %ld bytes data, waiting....\n", SRAM_SIZE);
start_time = PrivGetTickTime();
for (i = 0; i < SRAM_SIZE / data_width; i++)
{
@ -90,7 +91,7 @@ int ExtsramTest(void)
data = *(volatile uint32_t *)(SRAM_BANK_ADDR + i * data_width);
if (data != 0x55555555)
{
printf("SRAM test failed!");
printf("SRAM test failed!\n");
break;
}
#endif

View File

@ -0,0 +1,522 @@
/****************************************************************************
* 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 <nuttx/config.h>
#ifdef ADD_NUTTX_FETURES
#ifdef CONFIG_K210_LCD
#include "nuttx/arch.h"
#include "nuttx/lcd/lt768.h"
#include "nuttx/lcd/lt768_lib.h"
#include "nuttx/lcd/k210_lcd.h"
void LcdDemo(void)
{
int x1 = 50, y1 = 50, x2 = LCD_XSIZE_TFT - 50, y2 = LCD_YSIZE_TFT - 50;
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);
for(int i = 0; i < 3; i++)
{
x1 = 50;
y1 = 50;
x2 = LCD_XSIZE_TFT - 50;
y2 = LCD_YSIZE_TFT - 50;
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);
x1 += 20;
y1 += 20;
x2 -= 20;
y2 -= 20;
LT768_DrawSquare_Fill(x1, y1, x2, y2, Green);
up_mdelay(2000);
x1 += 20;
y1 += 20;
x2 -= 20;
y2 -= 20;
LT768_DrawSquare_Fill(x1, y1, x2, y2, Blue);
up_mdelay(2000);
}
}
#else
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <nuttx/video/fb.h>
#include <nuttx/video/rgbcolors.h>
/****************************************************************************
* Preprocessor Definitions
****************************************************************************/
#define NCOLORS 6
#define TEST_FB_DEV "/dev/fb0"
/****************************************************************************
* Private Types
****************************************************************************/
struct fb_state_s
{
int fd;
struct fb_videoinfo_s vinfo;
struct fb_planeinfo_s pinfo;
#ifdef CONFIG_FB_OVERLAY
struct fb_overlayinfo_s oinfo;
#endif
FAR void *fbmem;
};
/****************************************************************************
* Private Data
****************************************************************************/
static const char g_default_fbdev[] = TEST_FB_DEV;
/* Violet-Blue-Green-Yellow-Orange-Red */
static const uint32_t g_rgb24[NCOLORS] =
{
RGB24_VIOLET, RGB24_BLUE, RGB24_GREEN,
RGB24_YELLOW, RGB24_ORANGE, RGB24_RED
};
static const uint16_t g_rgb16[NCOLORS] =
{
RGB16_VIOLET, RGB16_BLUE, RGB16_GREEN,
RGB16_YELLOW, RGB16_ORANGE, RGB16_RED
};
static const uint8_t g_rgb8[NCOLORS] =
{
RGB8_VIOLET, RGB8_BLUE, RGB8_GREEN,
RGB8_YELLOW, RGB8_ORANGE, RGB8_RED
};
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* draw_rect
****************************************************************************/
static void draw_rect32(FAR struct fb_state_s *state,
FAR struct fb_area_s *area, int color)
{
FAR uint32_t *dest;
FAR uint8_t *row;
int x;
int y;
row = (FAR uint8_t *)state->fbmem + state->pinfo.stride * area->y;
for (y = 0; y < area->h; y++)
{
dest = ((FAR uint32_t *)row) + area->x;
for (x = 0; x < area->w; x++)
{
*dest++ = g_rgb24[color];
}
row += state->pinfo.stride;
}
}
static void draw_rect16(FAR struct fb_state_s *state,
FAR struct fb_area_s *area, int color)
{
FAR uint16_t *dest;
FAR uint8_t *row;
int x;
int y;
row = (FAR uint8_t *)state->fbmem + state->pinfo.stride * area->y;
for (y = 0; y < area->h; y++)
{
dest = ((FAR uint16_t *)row) + area->x;
for (x = 0; x < area->w; x++)
{
*dest++ = g_rgb16[color];
}
row += state->pinfo.stride;
}
}
static void draw_rect8(FAR struct fb_state_s *state,
FAR struct fb_area_s *area, int color)
{
FAR uint8_t *dest;
FAR uint8_t *row;
int x;
int y;
row = (FAR uint8_t *)state->fbmem + state->pinfo.stride * area->y;
for (y = 0; y < area->h; y++)
{
dest = row + area->x;
for (x = 0; x < area->w; x++)
{
*dest++ = g_rgb8[color];
}
row += state->pinfo.stride;
}
}
static void draw_rect1(FAR struct fb_state_s *state,
FAR struct fb_area_s *area, int color)
{
FAR uint8_t *pixel;
FAR uint8_t *row;
uint8_t color8 = (color & 1) == 0 ? 0 : 0xff;
uint8_t lmask;
uint8_t rmask;
int startx;
int endx;
int x;
int y;
/* Calculate the framebuffer address of the first row to draw on */
row = (FAR uint8_t *)state->fbmem + state->pinfo.stride * area->y;
/* Calculate the start byte position rounding down so that we get the
* first byte containing any part of the pixel sequence. Then calculate
* the last byte position with a ceil() operation so it includes any final
* final pixels of the sequence.
*/
startx = (area->x >> 3);
endx = ((area->x + area->w + 6) >> 3);
/* Calculate a mask on the first and last bytes of the sequence that may
* not be completely filled with pixel.
*/
lmask = 0xff << (8 - (area->x & 7));
rmask = 0xff >> ((area->x + area->w - 1) & 7);
/* Now draw each row, one-at-a-time */
for (y = 0; y < area->h; y++)
{
/* 'pixel' points to the 1st pixel the next row */
pixel = row + startx;
/* Special case: The row is less no more than one byte wide */
if (startx == endx)
{
uint8_t mask = lmask | rmask;
*pixel = (*pixel & mask) | (color8 & ~mask);
}
else
{
/* Special case the first byte of the row */
*pixel = (*pixel & lmask) | (color8 & ~lmask);
pixel++;
/* Handle all middle bytes in the row */
for (x = startx + 1; x < endx; x++)
{
*pixel++ = color8;
}
/* Handle the final byte of the row */
*pixel = (*pixel & rmask) | (color8 & ~rmask);
}
row += state->pinfo.stride;
}
}
static void draw_rect(FAR struct fb_state_s *state,
FAR struct fb_area_s *area, int color)
{
#ifdef CONFIG_FB_UPDATE
int ret;
#endif
switch (state->pinfo.bpp)
{
case 32:
draw_rect32(state, area, color);
break;
case 16:
draw_rect16(state, area, color);
break;
case 8:
default:
draw_rect8(state, area, color);
break;
case 1:
draw_rect1(state, area, color);
break;
}
#ifdef CONFIG_FB_UPDATE
ret = ioctl(state->fd, FBIO_UPDATE,
(unsigned long)((uintptr_t)area));
if (ret < 0)
{
int errcode = errno;
fprintf(stderr, "ERROR: ioctl(FBIO_UPDATE) failed: %d\n",
errcode);
}
#endif
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* fb_main
****************************************************************************/
int test_lcd(int argc, FAR char *argv[])
{
FAR const char *fbdev = g_default_fbdev;
struct fb_state_s state;
struct fb_area_s area;
int nsteps;
int xstep;
int ystep;
int width;
int height;
int color;
int x;
int y;
int ret;
/* There is a single required argument: The path to the framebuffer
* driver.
*/
if (argc == 2)
{
fbdev = argv[1];
}
else if (argc != 1)
{
fprintf(stderr, "ERROR: Single argument required\n");
fprintf(stderr, "USAGE: %s [<fb-driver-path>]\n", argv[0]);
return EXIT_FAILURE;
}
/* Open the framebuffer driver */
state.fd = open(fbdev, O_RDWR);
if (state.fd < 0)
{
int errcode = errno;
fprintf(stderr, "ERROR: Failed to open %s: %d\n", fbdev, errcode);
return EXIT_FAILURE;
}
/* Get the characteristics of the framebuffer */
ret = ioctl(state.fd, FBIOGET_VIDEOINFO,
(unsigned long)((uintptr_t)&state.vinfo));
if (ret < 0)
{
int errcode = errno;
fprintf(stderr, "ERROR: ioctl(FBIOGET_VIDEOINFO) failed: %d\n",
errcode);
close(state.fd);
return EXIT_FAILURE;
}
printf("2022-10-14 Mr. Wang commit LCD\n");
printf("VideoInfo:\n");
printf(" fmt: %u\n", state.vinfo.fmt);
printf(" xres: %u\n", state.vinfo.xres);
printf(" yres: %u\n", state.vinfo.yres);
printf(" nplanes: %u\n", state.vinfo.nplanes);
#ifdef CONFIG_FB_OVERLAY
printf("noverlays: %u\n", state.vinfo.noverlays);
/* Select the first overlay, which should be the composed framebuffer */
ret = ioctl(state.fd, FBIO_SELECT_OVERLAY, 0);
if (ret < 0)
{
int errcode = errno;
fprintf(stderr, "ERROR: ioctl(FBIO_SELECT_OVERLAY) failed: %d\n",
errcode);
close(state.fd);
return EXIT_FAILURE;
}
/* Get the first overlay information */
state.oinfo.overlay = 0;
ret = ioctl(state.fd, FBIOGET_OVERLAYINFO,
(unsigned long)((uintptr_t)&state.oinfo));
if (ret < 0)
{
int errcode = errno;
fprintf(stderr, "ERROR: ioctl(FBIOGET_OVERLAYINFO) failed: %d\n",
errcode);
close(state.fd);
return EXIT_FAILURE;
}
printf("OverlayInfo (overlay 0):\n");
printf(" fbmem: %p\n", state.oinfo.fbmem);
printf(" fblen: %lu\n", (unsigned long)state.oinfo.fblen);
printf(" stride: %u\n", state.oinfo.stride);
printf(" overlay: %u\n", state.oinfo.overlay);
printf(" bpp: %u\n", state.oinfo.bpp);
printf(" blank: %u\n", state.oinfo.blank);
printf("chromakey: 0x%08" PRIx32 "\n", state.oinfo.chromakey);
printf(" color: 0x%08" PRIx32 "\n", state.oinfo.color);
printf(" transp: 0x%02x\n", state.oinfo.transp.transp);
printf(" mode: %u\n", state.oinfo.transp.transp_mode);
printf(" area: (%u,%u) => (%u,%u)\n",
state.oinfo.sarea.x, state.oinfo.sarea.y,
state.oinfo.sarea.w, state.oinfo.sarea.h);
printf(" accl: %" PRIu32 "\n", state.oinfo.accl);
#endif
ret = ioctl(state.fd, FBIOGET_PLANEINFO,
(unsigned long)((uintptr_t)&state.pinfo));
if (ret < 0)
{
int errcode = errno;
fprintf(stderr, "ERROR: ioctl(FBIOGET_PLANEINFO) failed: %d\n",
errcode);
close(state.fd);
return EXIT_FAILURE;
}
printf("PlaneInfo (plane 0):\n");
printf(" fbmem: %p\n", state.pinfo.fbmem);
printf(" fblen: %lu\n", (unsigned long)state.pinfo.fblen);
printf(" stride: %u\n", state.pinfo.stride);
printf(" display: %u\n", state.pinfo.display);
printf(" bpp: %u\n", state.pinfo.bpp);
/* Only these pixel depths are supported. viinfo.fmt is ignored, only
* certain color formats are supported.
*/
if (state.pinfo.bpp != 32 && state.pinfo.bpp != 16 &&
state.pinfo.bpp != 8 && state.pinfo.bpp != 1)
{
fprintf(stderr, "ERROR: bpp=%u not supported\n", state.pinfo.bpp);
close(state.fd);
return EXIT_FAILURE;
}
/* mmap() the framebuffer.
*
* NOTE: In the FLAT build the frame buffer address returned by the
* FBIOGET_PLANEINFO IOCTL command will be the same as the framebuffer
* address. mmap(), however, is the preferred way to get the framebuffer
* address because in the KERNEL build, it will perform the necessary
* address mapping to make the memory accessible to the application.
*/
state.fbmem = mmap(NULL, state.pinfo.fblen, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_FILE, state.fd, 0);
if (state.fbmem == MAP_FAILED)
{
int errcode = errno;
fprintf(stderr, "ERROR: ioctl(FBIOGET_PLANEINFO) failed: %d\n",
errcode);
close(state.fd);
return EXIT_FAILURE;
}
printf("Mapped FB: %p\n", state.fbmem);
/* Draw some rectangles */
nsteps = 2 * (NCOLORS - 1) + 1;
xstep = state.vinfo.xres / nsteps;
ystep = state.vinfo.yres / nsteps;
width = state.vinfo.xres;
height = state.vinfo.yres;
for (x = 0, y = 0, color = 0;
color < NCOLORS;
x += xstep, y += ystep, color++)
{
area.x = x;
area.y = y;
area.w = width;
area.h = height;
printf("%2d: (%3d,%3d) (%3d,%3d)\n",
color, area.x, area.y, area.w, area.h);
draw_rect(&state, &area, color);
usleep(500 * 1000);
width -= (2 * xstep);
height -= (2 * ystep);
}
printf("Test finished\n");
munmap(state.fbmem, state.pinfo.fblen);
close(state.fd);
return EXIT_SUCCESS;
}
void LcdDemo(void)
{
test_lcd(1, NULL);
}
#endif
#endif

View File

@ -29,6 +29,7 @@
#ifdef ADD_NUTTX_FETURES
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "stdio.h"
#endif
@ -42,21 +43,47 @@ char tcp_socket_ip[] = {192, 168, 250, 252};
#define lw_error printf
#define LWIP_DEMO_TIMES 3
/** Create u32_t value from bytes */
#define LWIP_MAKEU32(a,b,c,d) (((uint32_t)((a) & 0xff) << 24) | \
((uint32_t)((b) & 0xff) << 16) | \
((uint32_t)((c) & 0xff) << 8) | \
(uint32_t)((d) & 0xff))
#define PP_HTONL(x) ((uint32_t)(x))
#define LWIP_TARGET_PORT 6000
#define LWIP_TARGET_PORT 4840
#endif
uint16_t tcp_socket_port = LWIP_TARGET_PORT;
char tcp_ip_str[128] = {0};
/******************************************************************************/
static void TCPSocketRecvTask(void *arg)
void TcpSocketConfigParam(char *ip_str)
{
int ip1, ip2, ip3, ip4, port = 0;
if(ip_str == NULL)
{
return;
}
if(sscanf(ip_str, "%d.%d.%d.%d:%d", &ip1, &ip2, &ip3, &ip4, &port))
{
printf("config ip %s port %d\n", ip_str, port);
strcpy(tcp_ip_str, ip_str);
tcp_socket_ip[0] = ip1;
tcp_socket_ip[1] = ip2;
tcp_socket_ip[2] = ip3;
tcp_socket_ip[3] = ip4;
if(port)
tcp_socket_port = port;
return;
}
if(sscanf(ip_str, "%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4))
{
printf("config ip %s\n", ip_str);
tcp_socket_ip[0] = ip1;
tcp_socket_ip[1] = ip2;
tcp_socket_ip[2] = ip3;
tcp_socket_ip[3] = ip4;
strcpy(tcp_ip_str, ip_str);
}
}
static void TcpSocketRecvTask(void *arg)
{
int fd = -1, clientfd;
int recv_len;
@ -64,15 +91,18 @@ static void TCPSocketRecvTask(void *arg)
struct sockaddr_in tcp_addr;
socklen_t addr_len;
while(1) {
while(1)
{
recv_buf = (char *)malloc(TCP_DEMO_BUF_SIZE);
if (recv_buf == NULL) {
if (recv_buf == NULL)
{
lw_error("No memory\n");
continue;
}
fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd < 0) {
if (fd < 0)
{
lw_error("Socket error\n");
free(recv_buf);
continue;
@ -83,7 +113,8 @@ static void TCPSocketRecvTask(void *arg)
tcp_addr.sin_port = htons(tcp_socket_port);
memset(&(tcp_addr.sin_zero), 0, sizeof(tcp_addr.sin_zero));
if (bind(fd, (struct sockaddr *)&tcp_addr, sizeof(struct sockaddr)) == -1) {
if (bind(fd, (struct sockaddr *)&tcp_addr, sizeof(struct sockaddr)) == -1)
{
lw_error("Unable to bind\n");
close(fd);
free(recv_buf);
@ -91,10 +122,11 @@ static void TCPSocketRecvTask(void *arg)
}
lw_print("tcp bind success, start to receive.\n");
lw_notice("\n\nLocal Port:%d\n\n", tcp_socket_port);
lw_notice("\nLocal Port:%d\n", tcp_socket_port);
// setup socket fd as listening mode
if (listen(fd, 5) != 0 ) {
if (listen(fd, 5) != 0 )
{
lw_error("Unable to listen\n");
close(fd);
free(recv_buf);
@ -105,10 +137,13 @@ static void TCPSocketRecvTask(void *arg)
clientfd = accept(fd, (struct sockaddr *)&tcp_addr, (socklen_t*)&addr_len);
lw_notice("client %s connected\n", inet_ntoa(tcp_addr.sin_addr));
while(1) {
while(1)
{
memset(recv_buf, 0, TCP_DEMO_BUF_SIZE);
recv_len = recvfrom(clientfd, recv_buf, TCP_DEMO_BUF_SIZE, 0, (struct sockaddr *)&tcp_addr, &addr_len);
if(recv_len > 0) {
recv_len = recvfrom(clientfd, recv_buf, TCP_DEMO_BUF_SIZE, 0,
(struct sockaddr *)&tcp_addr, &addr_len);
if(recv_len > 0)
{
lw_notice("Receive from : %s\n", inet_ntoa(tcp_addr.sin_addr));
lw_notice("Receive data : %d - %s\n\n", recv_len, recv_buf);
}
@ -120,35 +155,39 @@ static void TCPSocketRecvTask(void *arg)
free(recv_buf);
}
#ifdef ADD_XIZI_FETURES
void TCPSocketRecvTest(int argc, char *argv[])
void TcpSocketRecvTest(int argc, char *argv[])
{
if(argc >= 2)
{
int result = 0;
if(argc >= 2) {
lw_print("lw: [%s] target ip %s\n", __func__, argv[1]);
if(sscanf(argv[1], "%d.%d.%d.%d:%d", &tcp_socket_ip[0], &tcp_socket_ip[1], &tcp_socket_ip[2], &tcp_socket_ip[3], &tcp_socket_port) == 0) {
sscanf(argv[1], "%d.%d.%d.%d", &tcp_socket_ip[0], &tcp_socket_ip[1], &tcp_socket_ip[2], &tcp_socket_ip[3]);
}
TcpSocketConfigParam(argv[1]);
}
#ifdef ADD_XIZI_FETURES
lwip_config_tcp(lwip_ipaddr, lwip_netmask, tcp_socket_ip);
sys_thread_new("TCPSocketRecvTask", TCPSocketRecvTask, NULL, LWIP_TASK_STACK_SIZE, LWIP_DEMO_TASK_PRIO);
}
PRIV_SHELL_CMD_FUNCTION(TCPSocketRecvTest, a tcp receive sample, PRIV_SHELL_CMD_MAIN_ATTR);
sys_thread_new("TcpSocketRecvTask", TcpSocketRecvTask, NULL, LWIP_TASK_STACK_SIZE, LWIP_DEMO_TASK_PRIO);
#endif
static void TCPSocketSendTask(void *arg)
#ifdef ADD_NUTTX_FETURES
TcpSocketRecvTask(NULL);
#endif
}
PRIV_SHELL_CMD_FUNCTION(TcpSocketRecvTest, a tcp receive sample, PRIV_SHELL_CMD_MAIN_ATTR);
static void TcpSocketSendTask(void *arg)
{
int cnt = LWIP_DEMO_TIMES;
int fd = -1;
int ret;
char send_msg[128];
lw_print("2022-10-14 Mr. Wang commit TCP\n");
lw_print("%s start\n", __func__);
memset(send_msg, 0, sizeof(send_msg));
fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd < 0) {
if (fd < 0)
{
lw_print("Socket error\n");
return;
}
@ -156,21 +195,25 @@ static void TCPSocketSendTask(void *arg)
struct sockaddr_in tcp_sock;
tcp_sock.sin_family = AF_INET;
tcp_sock.sin_port = htons(tcp_socket_port);
tcp_sock.sin_addr.s_addr = PP_HTONL(LWIP_MAKEU32(tcp_socket_ip[0], tcp_socket_ip[1], tcp_socket_ip[2], tcp_socket_ip[3]));
tcp_sock.sin_addr.s_addr = inet_addr(tcp_ip_str);
memset(&(tcp_sock.sin_zero), 0, sizeof(tcp_sock.sin_zero));
if (connect(fd, (struct sockaddr *)&tcp_sock, sizeof(struct sockaddr))) {
lw_print("Unable to connect\n");
ret = connect(fd, (struct sockaddr *)&tcp_sock, sizeof(struct sockaddr));
if (ret)
{
lw_print("Unable to connect %s = %d\n", tcp_ip_str, ret);
close(fd);
return;
}
lw_notice("\n\nTarget Port:%d\n\n", tcp_socket_port);
lw_print("TCP connect %s:%d success, start to send.\n", tcp_ip_str, tcp_socket_port);
while (cnt --) {
while (cnt --)
{
lw_print("Lwip client is running.\n");
snprintf(send_msg, sizeof(send_msg), "TCP test package times %d\r\n", cnt);
sendto(fd, send_msg, strlen(send_msg), 0, (struct sockaddr*)&tcp_sock, sizeof(struct sockaddr));
send(fd, send_msg, strlen(send_msg), 0);
lw_notice("Send tcp msg: %s ", send_msg);
PrivTaskDelay(1000);
}
@ -179,32 +222,21 @@ static void TCPSocketSendTask(void *arg)
return;
}
#ifdef ADD_XIZI_FETURES
void TCPSocketSendTest(int argc, char *argv[])
void TcpSocketSendTest(int argc, char *argv[])
{
if(argc >= 2)
{
if(argc >= 2) {
lw_print("lw: [%s] target ip %s\n", __func__, argv[1]);
if(sscanf(argv[1], "%d.%d.%d.%d:%d", &tcp_socket_ip[0], &tcp_socket_ip[1], &tcp_socket_ip[2], &tcp_socket_ip[3], &tcp_socket_port) == 0)
{
sscanf(argv[1], "%d.%d.%d.%d", &tcp_socket_ip[0], &tcp_socket_ip[1], &tcp_socket_ip[2], &tcp_socket_ip[3]);
}
TcpSocketConfigParam(argv[1]);
}
#ifdef ADD_XIZI_FETURES
lwip_config_tcp(lwip_ipaddr, lwip_netmask, tcp_socket_ip);
sys_thread_new("TCP Socket Send", TCPSocketSendTask, NULL, LWIP_TASK_STACK_SIZE, LWIP_DEMO_TASK_PRIO);
}
PRIV_SHELL_CMD_FUNCTION(TCPSocketSendTest, a tcp send sample, PRIV_SHELL_CMD_MAIN_ATTR);
sys_thread_new("Tcp Socket Send", TcpSocketSendTask, NULL, LWIP_TASK_STACK_SIZE, LWIP_DEMO_TASK_PRIO);
#endif
#ifdef ADD_NUTTX_FETURES
void tcp_recv_demo(void)
{
TCPSocketRecvTask(NULL);
}
void tcp_send_demo(void)
{
TCPSocketSendTask(NULL);
}
TcpSocketSendTask(NULL);
#endif
}
PRIV_SHELL_CMD_FUNCTION(TcpSocketSendTest, a tcp send sample, PRIV_SHELL_CMD_MAIN_ATTR);

View File

@ -31,45 +31,72 @@
#include <stdio.h>
#define LWIP_DEMO_TIMES 3
#define LWIP_LOCAL_PORT 6000
#define LWIP_LOCAL_PORT 4840
#define lw_error printf
#define lw_notice printf
#define lw_print printf
/** Create u32_t value from bytes */
#define LWIP_MAKEU32(a,b,c,d) (((uint32_t)((a) & 0xff) << 24) | \
((uint32_t)((b) & 0xff) << 16) | \
((uint32_t)((c) & 0xff) << 8) | \
(uint32_t)((d) & 0xff))
#define PP_HTONL(x) ((uint32_t)(x))
#endif
#define UDP_BUF_SIZE 65536
char udp_socket_ip[] = {192, 168, 250, 252};
char udp_ip_str[128] = {0};
uint16_t udp_socket_port = LWIP_LOCAL_PORT;
/*****************************************************************************/
void UdpSocketConfigParam(char *ip_str)
{
int ip1, ip2, ip3, ip4, port = 0;
if(ip_str == NULL)
{
return;
}
if(sscanf(ip_str, "%d.%d.%d.%d:%d", &ip1, &ip2, &ip3, &ip4, &port))
{
printf("config ip %s port %d\n", ip_str, port);
strcpy(udp_ip_str, ip_str);
udp_socket_ip[0] = ip1;
udp_socket_ip[1] = ip2;
udp_socket_ip[2] = ip3;
udp_socket_ip[3] = ip4;
if(port)
udp_socket_port = port;
return;
}
if(sscanf(ip_str, "%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4))
{
printf("config ip %s\n", ip_str);
udp_socket_ip[0] = ip1;
udp_socket_ip[1] = ip2;
udp_socket_ip[2] = ip3;
udp_socket_ip[3] = ip4;
strcpy(udp_ip_str, ip_str);
}
}
static void UdpSocketRecvTask(void *arg)
{
int fd = -1;
char *recv_buf;
struct sockaddr_in udp_addr, server_addr;
int recv_len;
socklen_t addr_len;
while(1) {
while(1)
{
recv_buf = (char *)malloc(UDP_BUF_SIZE);
if(recv_buf == NULL) {
if(recv_buf == NULL)
{
lw_error("No memory\n");
continue;
}
fd = socket(AF_INET, SOCK_DGRAM, 0);
if(fd < 0) {
if(fd < 0)
{
lw_error("Socket error\n");
free(recv_buf);
continue;
@ -80,25 +107,27 @@ static void UdpSocketRecvTask(void *arg)
udp_addr.sin_port = htons(udp_socket_port);
memset(&(udp_addr.sin_zero), 0, sizeof(udp_addr.sin_zero));
if(bind(fd, (struct sockaddr *)&udp_addr, sizeof(struct sockaddr)) == -1) {
if(bind(fd, (struct sockaddr *)&udp_addr, sizeof(struct sockaddr)) == -1)
{
lw_error("Unable to bind\n");
close(fd);
free(recv_buf);
continue;
}
lw_notice("UDP bind sucess, start to receive.\n");
lw_notice("UDP bind success, start to receive.\n");
lw_notice("\n\nLocal Port:%d\n\n", udp_socket_port);
while(1) {
while(1)
{
memset(recv_buf, 0, UDP_BUF_SIZE);
recv_len = recvfrom(fd, recv_buf, UDP_BUF_SIZE, 0, (struct sockaddr *)&server_addr, &addr_len);
recv_len = recv(fd, recv_buf, UDP_BUF_SIZE, 0);
if(recv_len > 0)
{
lw_notice("Receive from : %s\n", inet_ntoa(server_addr.sin_addr));
lw_notice("Receive data : %s\n\n", recv_buf);
}
sendto(fd, recv_buf, recv_len, 0, (struct sockaddr*)&server_addr, addr_len);
send(fd, recv_buf, recv_len, 0);
}
close(fd);
@ -106,21 +135,24 @@ static void UdpSocketRecvTask(void *arg)
}
}
#ifdef ADD_XIZI_FETURES
void UdpSocketRecvTest(int argc, char *argv[])
{
if(argc >= 2) {
if(argc >= 2)
{
lw_notice("lw: [%s] target ip %s\n", __func__, argv[1]);
if(sscanf(argv[1], "%d.%d.%d.%d:%d", &udp_socket_ip[0], &udp_socket_ip[1], &udp_socket_ip[2], &udp_socket_ip[3], &udp_socket_port) == 0) {
sscanf(argv[1], "%d.%d.%d.%d", &udp_socket_ip[0], &udp_socket_ip[1], &udp_socket_ip[2], &udp_socket_ip[3]);
}
UdpSocketConfigParam(argv[1]);
}
#ifdef ADD_XIZI_FETURES
lwip_config_tcp(lwip_ipaddr, lwip_netmask, udp_socket_ip);
sys_thread_new("UdpSocketRecvTask", UdpSocketRecvTask, NULL, LWIP_TASK_STACK_SIZE, LWIP_DEMO_TASK_PRIO);
sys_thread_new("UdpSocketRecvTask", UdpSocketRecvTask, NULL,
LWIP_TASK_STACK_SIZE, LWIP_DEMO_TASK_PRIO);
#endif
#ifdef ADD_NUTTX_FETURES
UdpSocketRecvTask(NULL);
#endif
}
PRIV_SHELL_CMD_FUNCTION(UdpSocketRecvTest, a udp receive sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif
static void UdpSocketSendTask(void *arg)
{
@ -131,7 +163,8 @@ static void UdpSocketSendTask(void *arg)
memset(send_str, 0, sizeof(send_str));
fd = socket(AF_INET, SOCK_DGRAM, 0);
if(fd < 0) {
if(fd < 0)
{
lw_error("Socket error\n");
return;
}
@ -139,21 +172,24 @@ static void UdpSocketSendTask(void *arg)
struct sockaddr_in udp_sock;
udp_sock.sin_family = AF_INET;
udp_sock.sin_port = htons(udp_socket_port);
udp_sock.sin_addr.s_addr = PP_HTONL(LWIP_MAKEU32(udp_socket_ip[0], udp_socket_ip[1], udp_socket_ip[2], udp_socket_ip[3]));
udp_sock.sin_addr.s_addr = inet_addr(udp_ip_str);
memset(&(udp_sock.sin_zero), 0, sizeof(udp_sock.sin_zero));
if(connect(fd, (struct sockaddr *)&udp_sock, sizeof(struct sockaddr))) {
if(connect(fd, (struct sockaddr *)&udp_sock, sizeof(struct sockaddr)))
{
lw_error("Unable to connect\n");
close(fd);
return;
}
lw_print("UDP connect success, start to send.\n");
lw_notice("\n\nTarget Port:%d\n\n", udp_sock.sin_port);
lw_print("UDP connect %s:%d success, start to send.\n",
udp_ip_str,
udp_socket_port);
while (cnt --) {
while(cnt --)
{
snprintf(send_str, sizeof(send_str), "UDP test package times %d\r\n", cnt);
sendto(fd, send_str, strlen(send_str), 0, (struct sockaddr*)&udp_sock, sizeof(struct sockaddr));
send(fd, send_str, strlen(send_str), 0);
lw_notice("Send UDP msg: %s ", send_str);
PrivTaskDelay(1000);
}
@ -162,30 +198,22 @@ static void UdpSocketSendTask(void *arg)
return;
}
#ifdef ADD_XIZI_FETURES
void UdpSocketSendTest(int argc, char *argv[])
{
if(argc >= 2) {
if(argc >= 2)
{
lw_notice("lw: [%s] target ip %s\n", __func__, argv[1]);
if(sscanf(argv[1], "%d.%d.%d.%d:%d", &udp_socket_ip[0], &udp_socket_ip[1], &udp_socket_ip[2], &udp_socket_ip[3], &udp_socket_port) == 0) {
sscanf(argv[1], "%d.%d.%d.%d", &udp_socket_ip[0], &udp_socket_ip[1], &udp_socket_ip[2], &udp_socket_ip[3]);
}
UdpSocketConfigParam(argv[1]);
}
#ifdef ADD_XIZI_FETURES
lwip_config_tcp(lwip_ipaddr, lwip_netmask, udp_socket_ip);
sys_thread_new("UdpSocketSendTask", UdpSocketSendTask, NULL, LWIP_TASK_STACK_SIZE, LWIP_DEMO_TASK_PRIO);
sys_thread_new("UdpSocketSendTask", UdpSocketSendTask, NULL, LWIP_TASK_STACK_SIZE,
LWIP_DEMO_TASK_PRIO);
#endif
#ifdef ADD_NUTTX_FETURES
UdpSocketSendTask(NULL);
#endif
}
PRIV_SHELL_CMD_FUNCTION(UdpSocketSendTest, a udp send sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif
#ifdef ADD_NUTTX_FETURES
void udp_recv_demo(void)
{
UdpSocketRecvTask(NULL);
}
void udp_send_demo(void)
{
UdpSocketSendTask(NULL);
}
#endif

View File

@ -169,7 +169,7 @@ int AdapterDeviceOpen(struct Adapter *adapter)
result = priv_done->open(adapter);
if (0 == result) {
printf("Device %s open success.\n", adapter->name);
printf("Device %s %p open success.\n", adapter->name, adapter->adapter_param);
adapter->adapter_status = INSTALL;
} else {
if (adapter->fd) {
@ -187,7 +187,7 @@ int AdapterDeviceOpen(struct Adapter *adapter)
result = ip_done->open(adapter);
if (0 == result) {
printf("Device %s open success.\n", adapter->name);
printf("Device %s param %p open success.\n", adapter->name, adapter->adapter_param);
adapter->adapter_status = INSTALL;
} else {
if (adapter->fd) {

View File

@ -211,8 +211,7 @@ int AtCmdConfigAndCheck(ATAgentType agent, char *cmd, char *check)
ret = -1;
goto __exit;
}
printf("[reply result :\n");
printf("%s]\n", result);
printf("[reply result: %s]\n", result);
if(!strstr(result, check)) {
printf("%s %d check[%s] reply[%s] failed.\n",__func__,__LINE__,check,result);
ret = -1;
@ -369,11 +368,12 @@ static int GetCompleteATReply(ATAgentType agent)
}
} else {
printf("maintain_len is_full ...\n");
printf("maintain_len is_full %d ...\n", read_len);
is_full = true;
}
if (((ch == '\n') && (last_ch == '\r') && (agent->reply_lr_end)) ||
if (((ch == '\n') && (agent->reply_lr_end)) ||
((ch == '\n') && (last_ch == '\r') && (agent->reply_lr_end)) ||
((ch == agent->reply_end_char) && (agent->reply_end_char) &&
(last_ch == agent->reply_end_last_char) && (agent->reply_end_last_char)) ||
((read_len == agent->reply_char_num) && (agent->reply_char_num))) {
@ -521,7 +521,7 @@ static int ATAgentInit(ATAgentType agent)
#ifdef ADD_NUTTX_FETURES
pthread_attr_t attr = PTHREAD_ATTR_INITIALIZER;
attr.priority = 18;
attr.stacksize = 4096;
attr.stacksize = 8192;
#else
pthread_attr_t attr;

View File

@ -99,8 +99,8 @@ int AdapterWifiInit(void)
/******************wifi TEST*********************/
int AdapterWifiTest(void)
{
char cmd[64];
int baud_rate = BAUD_RATE_57600;
// char cmd[64];
// int baud_rate = BAUD_RATE_57600;
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME);
@ -198,7 +198,7 @@ PRIV_SHELL_CMD_FUNCTION(WifiClose, a WiFi close sample, PRIV_SHELL_CMD_MAIN_ATTR
int WifiSetup(int argc, char *argv[])
{
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME);
struct WifiParam param;
static struct WifiParam param;
memset(&param,0,sizeof(struct WifiParam));
strncpy((char *)param.wifi_ssid, argv[1], strlen(argv[1]));
strncpy((char *)param.wifi_pwd, argv[2], strlen(argv[2]));
@ -292,7 +292,7 @@ enum
APT_WIFI_PARAM_NUM
};
#define APT_WIFI_PARAM_LEN 20
#define APT_WIFI_PARAM_LEN 128
char wifi_param[APT_WIFI_PARAM_NUM][APT_WIFI_PARAM_LEN] = {0};
@ -301,6 +301,7 @@ ret = __func; \
if(ret != 0){ \
printf("%s %d failed\n", __func__, __LINE__); \
AdapterDeviceClose(adapter); \
free(adapter->adapter_param); \
return ret; \
};
@ -309,7 +310,16 @@ void AdapterWifiGetParam(int argc, char *argv[])
int i, j;
char *param_str[] = {"ip", "port", "ssid", "pwd", "gw", "server", "mask", "ping"};
char *default_str[] =
{"192.168.137.34", "12345", "test", "tttttttt", "192.168.137.71", "192.168.137.1", "255.255.255.0", "220.181.38.251"};
{
"192.168.137.34",
"12345",
"test",
"tttttttt",
"192.168.137.71",
"192.168.137.1",
"255.255.255.0",
"220.181.38.251"
};
for(i = 0; i < APT_WIFI_PARAM_NUM; i ++)
{
@ -338,7 +348,7 @@ void AdapterWifiGetParam(int argc, char *argv[])
}
int AdapterWifiTest(int argc, char *argv[])
int AdapterWifiTestWithParam(int argc, char *argv[])
{
int i, ret;
@ -347,12 +357,15 @@ int AdapterWifiTest(int argc, char *argv[])
enum NetRoleType net_role = CLIENT;
enum IpType ip_type = IPV4;
struct WifiParam param;
memset(&param, 0, sizeof(struct WifiParam));
strncpy((char *)param.wifi_ssid, wifi_param[APT_WIFI_PARAM_SSID], strlen(wifi_param[APT_WIFI_PARAM_SSID]));
strncpy((char *)param.wifi_pwd, wifi_param[APT_WIFI_PARAM_PWD], strlen(wifi_param[APT_WIFI_PARAM_PWD]));
adapter->adapter_param = &param;
adapter->adapter_param = malloc(sizeof(struct WifiParam));
memset(adapter->adapter_param, 0, sizeof(struct WifiParam));
struct WifiParam *apt_param = (struct WifiParam *)adapter->adapter_param;
strcpy(apt_param->wifi_ssid, wifi_param[APT_WIFI_PARAM_SSID]);
strcpy(apt_param->wifi_pwd, wifi_param[APT_WIFI_PARAM_PWD]);
printf("2022-10-14 Mr. Wang commit Wifi\n");
printf("apt %p ssid %p %s\n", apt_param, apt_param->wifi_ssid);
CHECK_RET(AdapterDeviceOpen(adapter));
CHECK_RET(AdapterDeviceSetUp(adapter));
@ -373,8 +386,9 @@ int AdapterWifiTest(int argc, char *argv[])
PrivTaskDelay(4000);
}
char wifi_recv_msg[128];
for(i = 0; i < 10; i ++)
char wifi_recv_msg[APT_WIFI_PARAM_LEN];
memset(wifi_recv_msg, 0, APT_WIFI_PARAM_LEN);
for(i = 0; i < APT_WIFI_PARAM_NUM; i ++)
{
AdapterDeviceRecv(adapter, wifi_recv_msg, 128);
PrivTaskDelay(1000);
@ -385,6 +399,7 @@ int AdapterWifiTest(int argc, char *argv[])
// CHECK_RET(AdapterDevicePing(adapter, wifi_param[APT_WIFI_PARAM_PING]));
// AdapterDeviceDisconnect(adapter, NULL);
ret = AdapterDeviceClose(adapter);
free(adapter->adapter_param);
return ret;
}

View File

@ -31,8 +31,8 @@
struct WifiParam
{
uint8_t wifi_ssid[128];
uint8_t wifi_pwd[128];
char wifi_ssid[128];
char wifi_pwd[128];
};

View File

@ -196,39 +196,59 @@ static int Esp07sWifiSetUp(struct Adapter *adapter)
return -1;
}
PrivTaskDelay(2000);
printf("%s check %d adapter %p wifi %p param %p\n", __func__, __LINE__, adapter, param,
adapter->adapter_param);
/* config as softAP+station mode */
ret = AtCmdConfigAndCheck(agent, "AT+CWMODE=3\r\n", "OK");
if(ret < 0) {
printf("%s %d cmd[AT+CWMODE=3] config failed!\n",__func__,__LINE__);
return -1;
}
// printf("%s check %d pwd %s\n", __func__, __LINE__, param->wifi_pwd);
PrivTaskDelay(2000);
/* connect the router */
memset(cmd,0,sizeof(cmd));
strncpy(cmd,"AT+CWJAP=",strlen("AT+CWJAP="));
strcpy(cmd,"AT+CWJAP=");//strlen("AT+CWJAP="));
strncat(cmd,"\"",1);
strncat(cmd,param->wifi_ssid,strlen(param->wifi_ssid));
// printf("%s check %d len %d\n", __func__, __LINE__, strlen(param->wifi_pwd));
strncat(cmd,param->wifi_ssid,128);
strncat(cmd,"\"",1);
strncat(cmd,",",1);
strncat(cmd,"\"",1);
// printf("%s check %d len %d\n", __func__, __LINE__, strlen(param->wifi_pwd));
strncat(cmd,param->wifi_pwd,strlen(param->wifi_pwd));
strncat(cmd,"\"",1);
strcat(cmd,"\r\n");
printf("%s check %d\n", __func__, __LINE__);
ret = AtCmdConfigAndCheck(agent, cmd, "OK");
if(ret < 0) {
printf("%s %d cmd[%s] connect[%s] failed!\n",__func__,__LINE__,cmd,param->wifi_ssid);
return -1;
}
printf("%s check %d\n", __func__, __LINE__);
/* check the wifi ip address */
ATReplyType reply = CreateATReply(256);
if (NULL == reply) {
printf("%s %d at_create_resp failed!\n",__func__,__LINE__);
return -1;
}
printf("%s check %d\n", __func__, __LINE__);
ret = ATOrderSend(agent, REPLY_TIME_OUT, reply, "AT+CIFSR\r\n");
if(ret < 0){
printf("%s %d ATOrderSend AT+CIFSR failed.\n",__func__,__LINE__);
@ -238,7 +258,7 @@ static int Esp07sWifiSetUp(struct Adapter *adapter)
result = GetReplyText(reply);
if (!result) {
printf("%s %n get reply failed.\n",__func__,__LINE__);
printf("%s %d get reply failed.\n",__func__,__LINE__);
ret = -1;
goto __exit;
}
@ -355,7 +375,7 @@ static int Esp07sWifiNetstat(struct Adapter *adapter)
result = GetReplyText(reply);
if (!result) {
printf("%s %n get reply failed.\n",__func__,__LINE__);
printf("%s %d get reply failed.\n",__func__,__LINE__);
ret = -1;
goto __exit;
}

View File

@ -47,10 +47,20 @@ if ADD_XIZI_FETURES
endif
if ADD_NUTTX_FETURES
if ARCH_BOARD_XIDATONG_ARM32
config ADAPTER_E18_MODEPIN
int "E18 MODE pin number"
default "61"
config ADAPTER_E18_PIN_DRIVER
string "E18 device pin driver path"
default "/dev/gpio0"
endif
if ARCH_BOARD_XIDATONG_ARM32
config ADAPTER_E18_MODE_PATH
string "E18 MODE pin device"
default "/dev/gpio2"
endif
config ADAPTER_E18_DRIVER_EXTUART
bool "Using extra uart to support zigbee"
default y

View File

@ -40,10 +40,35 @@ char *cmd_set_ch = "AT+CH=11"; /*set channel as 11*/
#define E18_AS_HEX_MODE 0
#define E18_AS_AT_MODE 1
static int E18HardwareModeGet()
{
#ifdef ADD_NUTTX_FETURES
#ifdef CONFIG_ARCH_BOARD_XIDATONG_ARM32
int ret = 0;
int pin_fd;
pin_fd = PrivOpen(ADAPTER_E18_PIN_DRIVER, O_RDWR);
struct PinStat pin_stat;
pin_stat.pin = ADAPTER_E18_MODEPIN;
ret = PrivRead(pin_fd, &pin_stat, 1);
PrivTaskDelay(200);
PrivClose(pin_fd);
if(pin_stat.val == GPIO_HIGH) {
printf(" E18 as AT mode\n");
return E18_AS_AT_MODE;
} else {
printf(" E18 as HEX mode\n");
return E18_AS_HEX_MODE;
}
#else
return E18_AS_HEX_MODE;
#endif
#else
int ret = 0;
int pin_fd;
@ -69,6 +94,40 @@ static int E18HardwareModeGet()
#endif
}
static int E18HardwareModeSet(void)
{
#ifdef ADD_NUTTX_FETURES
#ifdef CONFIG_ARCH_BOARD_XIDATONG_ARM32
int ret = 0;
int pin_fd;
pin_fd = PrivOpen(ADAPTER_E18_PIN_DRIVER, O_RDWR);
struct PinStat pin_stat;
pin_stat.pin = ADAPTER_E18_MODEPIN;
pin_stat.val = GPIO_HIGH;
// ret = PrivWrite(pin_fd, &pin_stat, 1);
ioctl(pin_fd, GPIOC_WRITE, (unsigned long)0);
PrivTaskDelay(200);
ret = PrivRead(pin_fd, &pin_stat, 1);
PrivClose(pin_fd);
if(pin_stat.val == GPIO_HIGH) {
printf(" E18 set AT mode\n");
return E18_AS_AT_MODE;
} else {
printf(" E18 set HEX mode\n");
return E18_AS_HEX_MODE;
}
#endif
#endif
}
static int E18UartOpen(struct Adapter *adapter)
{
if (NULL == adapter) {
@ -186,6 +245,8 @@ static int E18NetRoleConfig(struct Adapter *adapter)
int ret = 0;
int mode = -1;
printf("start %s\n", __func__);
// E18HardwareModeSet();
if (NULL == adapter) {
printf("%s %d adapter is null!\n",__func__,__LINE__);

View File

@ -107,3 +107,6 @@ CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=0
CONFIG_USER_TEST=y
CONFIG_USER_TEST_LCD=y

View File

@ -23,6 +23,7 @@ CONFIG_BOARD_LOOPSPERMSEC=104926
CONFIG_BUILTIN=y
CONFIG_CLOCK_MONOTONIC=y
CONFIG_ETH0_PHY_LAN8720=y
CONFIG_FS_PROCFS=y
CONFIG_IMXRT_ENET_PHYINIT=y
CONFIG_IMXRT_GPIO_IRQ=y
CONFIG_IMXRT_GPIO3_0_15_IRQ=y
@ -72,8 +73,8 @@ CONFIG_READLINE_CMD_HISTORY=y
CONFIG_READLINE_CMD_HISTORY_LEN=100
CONFIG_READLINE_CMD_HISTORY_LINELEN=120
CONFIG_READLINE_TABCOMPLETION=y
CONFIG_FS_ROMFS=y
CONFIG_NSH_ROMFSETC=y
CONFIG_NSH_ARCHROMFS=y
CONFIG_BOARDCTL_RESET=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_APPLICATION_CONNECTION=y
CONFIG_SOCKET_DEMO=y

View File

@ -47,15 +47,17 @@ CONFIG_SYSTEM_NSH=y
CONFIG_DEV_GPIO=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_READLINE_CMD_HISTORY_LEN=100
CONFIG_READLINE_CMD_HISTORY_LINELEN=120
CONFIG_READLINE_TABCOMPLETION=y
CONFIG_FS_ROMFS=y
CONFIG_NSH_ROMFSETC=y
CONFIG_NSH_ARCHROMFS=y
CONFIG_BOARDCTL_RESET=y
CONFIG_CONNECTION_FRAMEWORK_DEBUG=y
CONFIG_CONNECTION_ADAPTER_WIFI=y
CONFIG_ADAPTER_ESP07S_WIFI=y
CONFIG_ADAPTER_WIFI_ESP07S="esp07s_wifi"
CONFIG_ADAPTER_ESP07S_DRIVER="/dev/ttyS2"
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_SUPPORT_CONNECTION_FRAMEWORK=y

View File

@ -63,3 +63,6 @@ CONFIG_K210_LCD=y
CONFIG_K210_LCD_BACKLIGHT=y
CONFIG_LCD=y
CONFIG_LCD_LT768=y
CONFIG_USER_TEST=y
CONFIG_USER_TEST_LCD=y

View File

@ -1454,7 +1454,7 @@ int nsh_foreach_var(FAR struct nsh_vtbl_s *vtbl, nsh_foreach_var_t cb,
int cmd_Ch438(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if defined(CONFIG_K210_LCD) && !defined(CONFIG_NSH_DISABLE_LCD)
#if defined(CONFIG_USER_TEST_LCD) && !defined(CONFIG_NSH_DISABLE_USER_TEST_LCD)
int cmd_Lcd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
@ -1462,6 +1462,13 @@ int nsh_foreach_var(FAR struct nsh_vtbl_s *vtbl, nsh_foreach_var_t cb,
int cmd_Extsram(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if defined(CONFIG_SOCKET_DEMO) && !defined(CONFIG_NSH_DISABLE_SOCKET_DEMO)
int cmd_Udpsend(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_Udprecv(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_Tcpsend(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_Tcprecv(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if defined(CONFIG_APPLICATION_SENSOR_HCHO_TB600B_WQ_HCHO1OS) && !defined(CONFIG_NSH_DISABLE_HCHO_TB600B_WQ_HCHO1OS)
int cmd_Hcho1os(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif

View File

@ -54,7 +54,7 @@ int cmd_Ch438(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
/****************************************************************************
* Name: cmd_lcd
****************************************************************************/
#if defined(CONFIG_K210_LCD) && !defined(CONFIG_NSH_DISABLE_LCD)
#if defined(CONFIG_USER_TEST_LCD) && !defined(CONFIG_NSH_DISABLE_USER_TEST_LCD)
extern void LcdDemo(void);
int cmd_Lcd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
@ -68,11 +68,48 @@ int cmd_Lcd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_Extsram
****************************************************************************/
#if defined(CONFIG_USER_TEST_SEMC) && !defined(CONFIG_NSH_DISABLE_USER_TEST_SEMC)
extern int extsram_test(void);
extern int ExtsramTest(void);
int cmd_Extsram(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, extra sdram!\n");
extsram_test();
ExtsramTest();
return OK;
}
#endif
/****************************************************************************
* Name: socket test
****************************************************************************/
#if defined(CONFIG_SOCKET_DEMO) && !defined(CONFIG_NSH_DISABLE_SOCKET_DEMO)
void UdpSocketRecvTest(int argc, char *argv[]);
int cmd_Udprecv(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, UDP receive!\n");
UdpSocketRecvTest(argc, argv);
return OK;
}
void UdpSocketSendTest(int argc, char *argv[]);
int cmd_Udpsend(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, UDP send!\n");
UdpSocketSendTest(argc, argv);
return OK;
}
void TcpSocketRecvTest(int argc, char *argv[]);
int cmd_Tcprecv(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, TCP receive!\n");
TcpSocketRecvTest(argc, argv);
return OK;
}
void TcpSocketSendTest(int argc, char *argv[]);
int cmd_Tcpsend(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, TCP send!\n");
TcpSocketSendTest(argc, argv);
return OK;
}
#endif
@ -293,46 +330,46 @@ int cmd_WindSpeedQsFs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
****************************************************************************/
#if defined(CONFIG_CONNECTION_ADAPTER_ZIGBEE) && !defined(CONFIG_NSH_DISABLE_OPENZIGBEE)
extern int openzigbee(void);
extern int OpenZigbee(void);
int cmd_openzigbee(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
openzigbee();
OpenZigbee();
return OK;
}
#endif
#if defined(CONFIG_CONNECTION_ADAPTER_ZIGBEE) && !defined(CONFIG_NSH_DISABLE_SENDZIGBEE)
extern int sendzigbee(int argc, char *argv[]);
extern int SendZigbee(int argc, char *argv[]);
int cmd_sendzigbee(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
sendzigbee(argc,argv);
SendZigbee(argc,argv);
return OK;
}
#endif
#if defined(CONFIG_CONNECTION_ADAPTER_ZIGBEE) && !defined(CONFIG_NSH_DISABLE_RECVZIGBEE)
extern int recvzigbee(void);
extern int RecvZigbee(void);
int cmd_recvzigbee(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
recvzigbee();
RecvZigbee();
return OK;
}
#endif
#if defined(CONFIG_ADAPTER_ESP07S_WIFI) && !defined(CONFIG_NSH_DISABLE_ADAPTER_WIFI_TEST)
extern int AdapterWifiTest(int argc, char *argv[]);
extern int AdapterWifiTestWithParam(int argc, char *argv[]);
int cmd_AdapterWifiTest(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
AdapterWifiTest(argc, argv);
AdapterWifiTestWithParam(argc, argv);
return OK;
}
#endif

View File

@ -600,7 +600,7 @@ static const struct cmdmap_s g_cmdmap[] =
{ "ch438", cmd_Ch438, 1, 1, "[ch438 demo cmd.]" },
#endif
#if defined(CONFIG_K210_LCD) && !defined(CONFIG_NSH_DISABLE_LCD)
#if defined(CONFIG_USER_TEST_LCD) && !defined(CONFIG_NSH_DISABLE_USER_TEST_LCD)
{ "lcd", cmd_Lcd, 1, 1, "[LCD demo cmd.]" },
#endif
@ -608,6 +608,13 @@ static const struct cmdmap_s g_cmdmap[] =
{ "sram", cmd_Extsram, 1, 1, "[Extra sdram demo cmd.]" },
#endif
#if defined(CONFIG_SOCKET_DEMO) && !defined(CONFIG_NSH_DISABLE_SOCKET_DEMO)
{ "udpsend", cmd_Udpsend, 1, 2, "[Udp send demo cmd.]" },
{ "udprecv", cmd_Udprecv, 1, 2, "[Udp recv demo cmd.]" },
{ "tcpsend", cmd_Tcpsend, 1, 2, "[Tcp send demo cmd.]" },
{ "tcprecv", cmd_Tcprecv, 1, 2, "[Tcp recv demo cmd.]" },
#endif
#if defined(CONFIG_APPLICATION_SENSOR_HCHO_TB600B_WQ_HCHO1OS) && !defined(CONFIG_NSH_DISABLE_HCHO_TB600B_WQ_HCHO1OS)
{ "hcho1os", cmd_Hcho1os, 1, 1, "[get the concentration of formaldehyde with sensor tb600b_wq_hcho1os.]" },
#endif

View File

@ -1,13 +1,25 @@
/******************** COPYRIGHT ********************
* File Name : LT768.h
* Author : Levetop Electronics
* Version : V1.0
* Date : 2017-8-25
* Description : ²Ù×÷LT768µÄ¼Ä´æÆ÷º¯Êý
****************************************************/
/*
* 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.
*/
#ifndef _LT768_h
#define _LT768_h
/**
* @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_H_
#define __LT768_H_
#define cSetb0 0x01
#define cSetb1 0x02
@ -28,17 +40,24 @@
#define cClrb7 0x7f
void LCD_RegisterWrite(unsigned char Cmd,unsigned char Data);
unsigned char LCD_RegisterRead(unsigned char Cmd);
#define STM32_FSMC_8 0 //16bits bus
void LCD_CmdWrite(uint8_t cmd);
void LCD_DataWrite(uint8_t data);
uint8_t LCD_StatusRead(void);
uint8_t LCD_DataRead(void);
void LCD_DataWrite_Pixel(uint8_t data);
void LCD_RegisterWrite(uint8_t Cmd, uint8_t Data);
uint8_t LCD_RegisterRead(uint8_t Cmd);
//**Staus**//
void Check_Mem_WR_FIFO_not_Full(void);
void Check_Mem_WR_FIFO_Empty(void);
void Check_Mem_RD_FIFO_not_Full(void);
void Check_Mem_RD_FIFO_not_Empty(void);
void Check_2D_Busy(void);
void Check_SDRAM_Ready(void);
unsigned char Power_Saving_Status(void);
uint8_t Power_Saving_Status(void);
void Check_Power_is_Normal(void);
void Check_Power_is_Saving(void);
void Check_NO_Interrupt(void);
@ -124,7 +143,7 @@ void Disable_PWM1_Interrupt(void);
void Enable_PWM0_Interrupt(void);
void Disable_PWM0_Interrupt(void);
//**[0Ch]**//
unsigned char Read_Interrupt_status(void);
uint8_t Read_Interrupt_status(void);
void Clear_Resume_Interrupt_Flag(void);
void Clear_ExtInterrupt_Input_Flag(void);
void Clear_I2CM_Interrupt_Flag(void);
@ -237,35 +256,35 @@ void Idle_HSYNC_High(void);
void Idle_VSYNC_Low(void);
void Idle_VSYNC_High(void);
//**[14h][15h][1Ah][1Bh]**//
void LCD_HorizontalWidth_VerticalHeight(unsigned short WX,unsigned short HY);
void LCD_HorizontalWidth_VerticalHeight(uint16_t WX, uint16_t HY);
//**[16h][17h]**//
void LCD_Horizontal_Non_Display(unsigned short WX);
void LCD_Horizontal_Non_Display(uint16_t WX);
//**[18h]**//
void LCD_HSYNC_Start_Position(unsigned short WX);
void LCD_HSYNC_Start_Position(uint16_t WX);
//**[19h]**//
void LCD_HSYNC_Pulse_Width(unsigned short WX);
void LCD_HSYNC_Pulse_Width(uint16_t WX);
//**[1Ch][1Dh]**//
void LCD_Vertical_Non_Display(unsigned short HY);
void LCD_Vertical_Non_Display(uint16_t HY);
//**[1Eh]**//
void LCD_VSYNC_Start_Position(unsigned short HY);
void LCD_VSYNC_Start_Position(uint16_t HY);
//**[1Fh]**//
void LCD_VSYNC_Pulse_Width(unsigned short HY);
void LCD_VSYNC_Pulse_Width(uint16_t HY);
//**[20h][21h][22h][23h]**//
void Main_Image_Start_Address(unsigned long Addr);
void Main_Image_Start_Address(uint32_t Addr);
//**[24h][25h]**//
void Main_Image_Width(unsigned short WX);
void Main_Image_Width(uint16_t WX);
//**[26h][27h][28h][29h]**//
void Main_Window_Start_XY(unsigned short WX,unsigned short HY);
void Main_Window_Start_XY(uint16_t WX, uint16_t HY);
//**[2Ah][2Bh][2Ch][2Dh]**//
void PIP_Display_Start_XY(unsigned short WX,unsigned short HY);
void PIP_Display_Start_XY(uint16_t WX, uint16_t HY);
//**[2Eh][2Fh][30h][31h]**//
void PIP_Image_Start_Address(unsigned long Addr);
void PIP_Image_Start_Address(uint32_t Addr);
//**[32h][33h]**//
void PIP_Image_Width(unsigned short WX);
void PIP_Image_Width(uint16_t WX);
//**[34h][35h][36h][37h]**//
void PIP_Window_Image_Start_XY(unsigned short WX,unsigned short HY);
void PIP_Window_Image_Start_XY(uint16_t WX, uint16_t HY);
//**[38h][39h][3Ah][3Bh]**//
void PIP_Window_Width_Height(unsigned short WX,unsigned short HY);
void PIP_Window_Width_Height(uint16_t WX, uint16_t HY);
//**[3C]**//
void Enable_Graphic_Cursor(void);
void Disable_Graphic_Cursor(void);
@ -278,23 +297,23 @@ void Disable_Text_Cursor(void);
void Enable_Text_Cursor_Blinking(void);
void Disable_Text_Cursor_Blinking(void);
//**[3D]**//
void Blinking_Time_Frames(unsigned char temp);
void Blinking_Time_Frames(uint8_t temp);
//**[3E][3Fh]**//
void Text_Cursor_H_V(unsigned short WX,unsigned short HY);
void Text_Cursor_H_V(uint16_t WX, uint16_t HY);
//**[40h][41h][42h][43h]**//
void Graphic_Cursor_XY(unsigned short WX,unsigned short HY);
void Graphic_Cursor_XY(uint16_t WX, uint16_t HY);
//**[44]**//
void Set_Graphic_Cursor_Color_1(unsigned char temp);
void Set_Graphic_Cursor_Color_1(uint8_t temp);
//**[45]**//
void Set_Graphic_Cursor_Color_2(unsigned char temp);
void Set_Graphic_Cursor_Color_2(uint8_t temp);
//**[50h][51h][52h][53h]**//
void Canvas_Image_Start_address(unsigned long Addr);
void Canvas_Image_Start_address(uint32_t Addr);
//**[54h][55h]**//
void Canvas_image_width(unsigned short WX);
void Canvas_image_width(uint16_t WX);
//**[56h][57h][58h][59h]**//
void Active_Window_XY(unsigned short WX,unsigned short HY);
void Active_Window_XY(uint16_t WX, uint16_t HY);
//**[5Ah][5Bh][5Ch][5Dh]**//
void Active_Window_WH(unsigned short WX,unsigned short HY);
void Active_Window_WH(uint16_t WX, uint16_t HY);
//**[5E]**//
void Select_Write_Data_Position(void);
void Select_Read_Data_Position(void);
@ -304,10 +323,10 @@ void Memory_8bpp_Mode(void);
void Memory_16bpp_Mode(void);
void Memory_24bpp_Mode(void);
//**[5Fh][60h][61h][62h]**//
void Goto_Pixel_XY(unsigned short WX,unsigned short HY);
void Goto_Linear_Addr(unsigned long Addr);
void Goto_Pixel_XY(uint16_t WX, uint16_t HY);
void Goto_Linear_Addr(uint32_t Addr);
//**[63h][64h][65h][66h]**//
void Goto_Text_XY(unsigned short WX,unsigned short HY);
void Goto_Text_XY(uint16_t WX, uint16_t HY);
////////////////////////////////////////////////////////////////////////
////**** [ Function : Draw ] ****////
@ -316,13 +335,13 @@ void Start_Line(void);
void Start_Triangle(void);
void Start_Triangle_Fill(void);
//**[68h]~[73h]**//
void Line_Start_XY(unsigned short WX,unsigned short HY);
void Line_End_XY(unsigned short WX,unsigned short HY);
void Triangle_Point1_XY(unsigned short WX,unsigned short HY);
void Triangle_Point2_XY(unsigned short WX,unsigned short HY);
void Triangle_Point3_XY (unsigned short WX,unsigned short HY);
void Square_Start_XY(unsigned short WX,unsigned short HY);
void Square_End_XY(unsigned short WX,unsigned short HY);
void Line_Start_XY(uint16_t WX, uint16_t HY);
void Line_End_XY(uint16_t WX, uint16_t HY);
void Triangle_Point1_XY(uint16_t WX, uint16_t HY);
void Triangle_Point2_XY(uint16_t WX, uint16_t HY);
void Triangle_Point3_XY (uint16_t WX, uint16_t HY);
void Square_Start_XY(uint16_t WX, uint16_t HY);
void Square_End_XY(uint16_t WX, uint16_t HY);
//**[76h]**//
void Start_Circle_or_Ellipse(void);
void Start_Circle_or_Ellipse_Fill(void);
@ -339,16 +358,16 @@ void Start_Square_Fill(void);
void Start_Circle_Square(void);
void Start_Circle_Square_Fill(void);
//**[77h]~[7Eh]**//
void Circle_Center_XY(unsigned short WX,unsigned short HY);
void Ellipse_Center_XY(unsigned short WX,unsigned short HY);
void Circle_Radius_R(unsigned short WX);
void Ellipse_Radius_RxRy(unsigned short WX,unsigned short HY);
void Circle_Square_Radius_RxRy(unsigned short WX,unsigned short HY);
void Circle_Center_XY(uint16_t WX, uint16_t HY);
void Ellipse_Center_XY(uint16_t WX, uint16_t HY);
void Circle_Radius_R(uint16_t WX);
void Ellipse_Radius_RxRy(uint16_t WX, uint16_t HY);
void Circle_Square_Radius_RxRy(uint16_t WX, uint16_t HY);
////////////////////////////////////////////////////////////////////////
////**** [ Function : PWM ] ****////
//**[84h]**//
void Set_PWM_Prescaler_1_to_256(unsigned short WX);
void Set_PWM_Prescaler_1_to_256(uint16_t WX);
//**[85h]**//
void Select_PWM1_Clock_Divided_By_1(void);
void Select_PWM1_Clock_Divided_By_2(void);
@ -384,15 +403,15 @@ void One_Shot_PWM0(void);
void Start_PWM0(void);
void Stop_PWM0(void);
//**[87h]**//
void Set_Timer0_Dead_Zone_Length(unsigned char temp);
void Set_Timer0_Dead_Zone_Length(uint8_t temp);
//**[88h][89h]**//
void Set_Timer0_Compare_Buffer(unsigned short WX);
void Set_Timer0_Compare_Buffer(uint16_t WX);
//**[8Ah][8Bh]**//
void Set_Timer0_Count_Buffer(unsigned short WX);
void Set_Timer0_Count_Buffer(uint16_t WX);
//**[8Ch][8Dh]**//
void Set_Timer1_Compare_Buffer(unsigned short WX);
void Set_Timer1_Compare_Buffer(uint16_t WX);
//**[8Eh][8Fh]**//
void Set_Timer1_Count_Buffer(unsigned short WX);
void Set_Timer1_Count_Buffer(uint16_t WX);
////////////////////////////////////////////////////////////////////////
////**** [ Function : BTE ] ****////
@ -408,8 +427,8 @@ void Pattern_Format_8X8(void);
void Pattern_Format_16X16(void);
//[91h]=========================================================================
void BTE_ROP_Code(unsigned char setx);
void BTE_Operation_Code(unsigned char setx);
void BTE_ROP_Code(uint8_t setx);
void BTE_Operation_Code(uint8_t setx);
//[92h]=========================================================================
void BTE_S0_Color_8bpp(void);
@ -428,40 +447,40 @@ void BTE_Destination_Color_16bpp(void);
void BTE_Destination_Color_24bpp(void);
//[93h][94h][95h][96h]=========================================================================
void BTE_S0_Memory_Start_Address(unsigned long Addr);
void BTE_S0_Memory_Start_Address(uint32_t Addr);
//[97h][98h]=========================================================================
void BTE_S0_Image_Width(unsigned short WX);
void BTE_S0_Image_Width(uint16_t WX);
//[99h][9Ah][9Bh][9Ch]=========================================================================
void BTE_S0_Window_Start_XY(unsigned short WX,unsigned short HY);
void BTE_S0_Window_Start_XY(uint16_t WX, uint16_t HY);
//[9Dh][9Eh][9Fh][A0h]=========================================================================
void BTE_S1_Memory_Start_Address(unsigned long Addr);
void S1_Constant_color_256(unsigned char temp);
void S1_Constant_color_65k(unsigned short temp);
void S1_Constant_color_16M(unsigned long temp);
void BTE_S1_Memory_Start_Address(uint32_t Addr);
void S1_Constant_color_256(uint8_t temp);
void S1_Constant_color_65k(uint16_t temp);
void S1_Constant_color_16M(uint32_t temp);
//[A1h][A2h]=========================================================================
void BTE_S1_Image_Width(unsigned short WX);
void BTE_S1_Image_Width(uint16_t WX);
//[A3h][A4h][A5h][A6h]=========================================================================
void BTE_S1_Window_Start_XY(unsigned short WX,unsigned short HY);
void BTE_S1_Window_Start_XY(uint16_t WX, uint16_t HY);
//[A7h][A8h][A9h][AAh]=========================================================================
void BTE_Destination_Memory_Start_Address(unsigned long Addr);
void BTE_Destination_Memory_Start_Address(uint32_t Addr);
//[ABh][ACh]=========================================================================
void BTE_Destination_Image_Width(unsigned short WX);
void BTE_Destination_Image_Width(uint16_t WX);
//[ADh][AEh][AFh][B0h]=========================================================================
void BTE_Destination_Window_Start_XY(unsigned short WX,unsigned short HY);
void BTE_Destination_Window_Start_XY(uint16_t WX, uint16_t HY);
//[B1h][B2h][B3h][B4h]=========================================================================
void BTE_Window_Size(unsigned short WX, unsigned short WY);
void BTE_Window_Size(uint16_t WX, uint16_t WY);
//[B5h]=========================================================================
void BTE_Alpha_Blending_Effect(unsigned char temp);
void BTE_Alpha_Blending_Effect(uint8_t temp);
//**[B5h]**//
@ -492,8 +511,8 @@ void Select_SFI_Dual_Mode0(void);
void Select_SFI_Dual_Mode1(void);
//REG[B8h] SPI master Tx /Rx FIFO Data Register (SPIDR)
unsigned char SPI_Master_FIFO_Data_Put(unsigned char Data);
unsigned char SPI_Master_FIFO_Data_Get(void);
uint8_t SPI_Master_FIFO_Data_Put(uint8_t Data);
uint8_t SPI_Master_FIFO_Data_Get(void);
//REG[B9h] SPI master Control Register (SPIMCR2)
void Mask_SPI_Master_Interrupt_Flag(void);
@ -509,31 +528,31 @@ void Reset_CPHA(void);
void Set_CPHA(void);
//REG[BAh] SPI master Status Register (SPIMSR)
unsigned char Tx_FIFO_Empty_Flag(void);
unsigned char Tx_FIFO_Full_Flag(void);
unsigned char Rx_FIFO_Empty_Flag(void);
unsigned char Rx_FIFO_full_flag(void);
unsigned char OVFI_Flag(void);
uint8_t Tx_FIFO_Empty_Flag(void);
uint8_t Tx_FIFO_Full_Flag(void);
uint8_t Rx_FIFO_Empty_Flag(void);
uint8_t Rx_FIFO_full_flag(void);
uint8_t OVFI_Flag(void);
void Clear_OVFI_Flag(void);
unsigned char EMTI_Flag(void);
uint8_t EMTI_Flag(void);
void Clear_EMTI_Flag(void);
//REG[BB] SPI Clock period (SPIDIV)
void SPI_Clock_Period(unsigned char temp);
void SPI_Clock_Period(uint8_t temp);
//**[BCh][BDh][BEh][BFh]**//
void SFI_DMA_Source_Start_Address(unsigned long Addr);
void SFI_DMA_Source_Start_Address(uint32_t Addr);
//**[C0h][C1h][C2h][C3h]**//
void SFI_DMA_Destination_Start_Address(unsigned long Addr);
void SFI_DMA_Destination_Upper_Left_Corner(unsigned short WX,unsigned short HY);
void SFI_DMA_Destination_Start_Address(uint32_t Addr);
void SFI_DMA_Destination_Upper_Left_Corner(uint16_t WX, uint16_t HY);
//**[C4h][C5h]**//
void SFI_DMA_Destination_Width(unsigned short WX);
void SFI_DMA_Destination_Width(uint16_t WX);
//**[C6h][C7h][C8h][C9h]**//
void SFI_DMA_Transfer_Number(unsigned long Addr);
void SFI_DMA_Transfer_Width_Height(unsigned short WX,unsigned short HY);
void SFI_DMA_Transfer_Number(uint32_t Addr);
void SFI_DMA_Transfer_Width_Height(uint16_t WX, uint16_t HY);
//**[CAh][CBh]**//
void SFI_DMA_Source_Width(unsigned short WX);
void SFI_DMA_Source_Width(uint16_t WX);
////////////////////////////////////////////////////////////////////////
////**** [ Function : Font ] ****////
@ -574,23 +593,23 @@ void GTFont_Select_GT20L24F6Y(void);
void GTFont_Select_GT21L24S1W(void);
void GTFont_Select_GT22L16A1Y(void);
//**[CFh]**//
void Set_GTFont_Decoder(unsigned char temp);
void Set_GTFont_Decoder(uint8_t temp);
//**[D0h]**//
void Font_Line_Distance(unsigned char temp);
void Font_Line_Distance(uint8_t temp);
//**[D1h]**//
void Set_Font_to_Font_Width(unsigned char temp);
void Set_Font_to_Font_Width(uint8_t temp);
//**[D2h]~[D4h]**//
void Foreground_RGB(unsigned char RED,unsigned char GREEN,unsigned char BLUE);
void Foreground_color_256(unsigned char temp);
void Foreground_color_65k(unsigned short temp);
void Foreground_color_16M(unsigned long temp);
void Foreground_RGB(uint8_t RED, uint8_t GREEN, uint8_t BLUE);
void Foreground_color_256(uint8_t temp);
void Foreground_color_65k(uint16_t temp);
void Foreground_color_16M(uint32_t temp);
//**[D5h]~[D7h]**//
void Background_RGB(unsigned char RED,unsigned char GREEN,unsigned char BLUE);
void Background_color_256(unsigned char temp);
void Background_color_65k(unsigned short temp);
void Background_color_16M(unsigned long temp);
void Background_RGB(uint8_t RED, uint8_t GREEN, uint8_t BLUE);
void Background_color_256(uint8_t temp);
void Background_color_65k(uint16_t temp);
void Background_color_16M(uint32_t temp);
//**[DBh]~[DEh]**//
void CGRAM_Start_address(unsigned long Addr);
void CGRAM_Start_address(uint32_t Addr);
//**[DFh]**//
void Power_Normal_Mode(void);
void Power_Saving_Standby_Mode(void);
@ -606,11 +625,11 @@ void Power_Saving_Sleep_Mode(void);
////////////////////////////////////////////////////////////////////////
////**** [ Function : I2C ] ****////
//**[E5h]~[EAh]**//
void LT768_I2CM_Clock_Prescale(unsigned short WX);
void LT768_I2CM_Clock_Prescale(uint16_t WX);
//**[E7h]**//
void LT768_I2CM_Transmit_Data(unsigned char temp);
void LT768_I2CM_Transmit_Data(uint8_t temp);
//**[E8h]**//
unsigned char LT768_I2CM_Receiver_Data(void);
uint8_t LT768_I2CM_Receiver_Data(void);
//**[E9h]**//
void LT768_I2CM_Read_With_Ack(void);
@ -621,38 +640,38 @@ void LT768_I2CM_Stop(void);
//**[EAh]**//
unsigned char LT768_I2CM_Check_Slave_ACK(void);
unsigned char LT768_I2CM_Bus_Busy(void);
unsigned char LT768_I2CM_transmit_Progress(void);
unsigned char LT768_I2CM_Arbitration(void);
uint8_t LT768_I2CM_Check_Slave_ACK(void);
uint8_t LT768_I2CM_Bus_Busy(void);
uint8_t LT768_I2CM_transmit_Progress(void);
uint8_t LT768_I2CM_Arbitration(void);
////////////////////////////////////////////////////////////////////////
////**** [ Function : GPIO ] ****////
//[F0h][F1h]
void Set_GPIO_A_In_Out(unsigned char temp);
void Write_GPIO_A_7_0(unsigned char temp);
unsigned char Read_GPIO_A_7_0(void);
void Set_GPIO_A_In_Out(uint8_t temp);
void Write_GPIO_A_7_0(uint8_t temp);
uint8_t Read_GPIO_A_7_0(void);
//[F2h]
void Write_GPIO_B_7_4(unsigned char temp);
unsigned char Read_GPIO_B_7_0(void);
void Write_GPIO_B_7_4(uint8_t temp);
uint8_t Read_GPIO_B_7_0(void);
//[F3h][F4h]
void Set_GPIO_C_In_Out(unsigned char temp);
void Write_GPIO_C_7_0(unsigned char temp);
unsigned char Read_GPIO_C_7_0(void);
void Set_GPIO_C_In_Out(uint8_t temp);
void Write_GPIO_C_7_0(uint8_t temp);
uint8_t Read_GPIO_C_7_0(void);
//[F5h][F6h]
void Set_GPIO_D_In_Out(unsigned char temp);
void Write_GPIO_D_7_0(unsigned char temp);
unsigned char Read_GPIO_D_7_0(void);
void Set_GPIO_D_In_Out(uint8_t temp);
void Write_GPIO_D_7_0(uint8_t temp);
uint8_t Read_GPIO_D_7_0(void);
//[F7h][F8h]
void Set_GPIO_E_In_Out(unsigned char temp);
void Write_GPIO_E_7_0(unsigned char temp);
unsigned char Read_GPIO_E_7_0(void);
void Set_GPIO_E_In_Out(uint8_t temp);
void Write_GPIO_E_7_0(uint8_t temp);
uint8_t Read_GPIO_E_7_0(void);
//[F9h][FAh]
void Set_GPIO_F_In_Out(unsigned char temp);
void Write_GPIO_F_7_0(unsigned char temp);
unsigned char Read_GPIO_F_7_0(void);
void Set_GPIO_F_In_Out(uint8_t temp);
void Write_GPIO_F_7_0(uint8_t temp);
uint8_t Read_GPIO_F_7_0(void);
////////////////////////////////////////////////////////////////////////
@ -660,26 +679,26 @@ unsigned char Read_GPIO_F_7_0(void);
//**[FBh]~[FFh]**//
//[FBh]
void Long_Key_enable(void);
void Key_Scan_Freg(unsigned char temp); //set bit2~0
void Key_Scan_Freg(uint8_t temp); //set bit2~0
//[FCh]
void Key_Scan_Wakeup_Function_Enable(void);
void Long_Key_Timing_Adjustment(unsigned char setx);//set bit5~3
unsigned char Numbers_of_Key_Hit(void);
void Long_Key_Timing_Adjustment(uint8_t setx);//set bit5~3
uint8_t Numbers_of_Key_Hit(void);
//[FDh][FEh][FFh]
unsigned char Read_Key_Strobe_Data_0(void);
unsigned char Read_Key_Strobe_Data_1(void);
unsigned char Read_Key_Strobe_Data_2(void);
uint8_t Read_Key_Strobe_Data_0(void);
uint8_t Read_Key_Strobe_Data_1(void);
uint8_t Read_Key_Strobe_Data_2(void);
void Show_String(char *str);
void Show_picture(unsigned long numbers,const unsigned short *data);
void Show_picture(uint32_t numbers, const uint16_t *data);
void PWM0_ON(void); //¿ªPWM0
void PWM0_ON(void); //PWM0
void lt768_hw_reset(void);
void System_Check_Temp(void);
void Enable_SPI_Flash_DMA(unsigned char val);
void Enable_SPI_Flash_DMA(uint8_t val);
#endif

View File

@ -1,26 +1,38 @@
/********************* COPYRIGHT **********************
* File Name : lt768_lib.h
* Author : Levetop Electronics
* Version : V1.3
* Date : 2019-5-14
* Description : LT768x所有功能函数
********************************************************/
/*
* 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.
*/
#ifndef _LT768_Lib_H
#define _LT768_Lib_H
/**
* @file lt768_lib.h
* @brief lt768 register relative driver, inherit from Levetop Electronics
* @version 1.0
* @author AIIT XUOS Lab
* @date 2022.9.19
*/
#ifndef __LT768_LIB_H_
#define __LT768_LIB_H_
#include "lt768.h"
//外部晶振
//external OSC
#define XI_4M 0
#define XI_8M 1
#define XI_10M 0
#define XI_12M 0
//分辨率
//resolution
#define LCD_XSIZE_TFT 480
#define LCD_YSIZE_TFT 272
//参数
//parameter
#define LCD_VBPD 20
#define LCD_VFPD 12
#define LCD_VSPW 3
@ -127,138 +139,641 @@
void lt768_init(void);
/* 写数据到内存 */
void MPuint8_t_8bpp_Memory_Write(unsigned short x,unsigned short y,unsigned short w,unsigned short h,const unsigned char *data);
void MPuint8_t_16bpp_Memory_Write(unsigned short x,unsigned short y,unsigned short w,unsigned short h,const unsigned char *data);
void MPuint8_t_24bpp_Memory_Write(unsigned short x,unsigned short y,unsigned short w,unsigned short h,const unsigned char *data);
void MPuint16_t_16bpp_Memory_Write(unsigned short x,unsigned short y,unsigned short w,unsigned short h,const unsigned short *data);
void MPuint16_t_24bpp_Mode1_Memory_Write(unsigned short x,unsigned short y,unsigned short w,unsigned short h,const unsigned short *data);
void MPuint16_t_24bpp_Mode2_Memory_Write(unsigned short x,unsigned short y,unsigned short w,unsigned short h,const unsigned short *data);
/* write to memory */
void MPuint8_t_8bpp_Memory_Write(uint16_t x,
uint16_t y,
uint16_t w,
uint16_t h,
const uint8_t *data);
void MPuint8_t_16bpp_Memory_Write(uint16_t x,
uint16_t y,
uint16_t w,
uint16_t h,
const uint8_t *data);
void MPuint8_t_24bpp_Memory_Write(uint16_t x,
uint16_t y,
uint16_t w,
uint16_t h,
const uint8_t *data);
void MPuint16_t_16bpp_Memory_Write(uint16_t x,
uint16_t y,
uint16_t w,
uint16_t h,
const uint16_t *data);
void MPuint16_t_24bpp_Mode1_Memory_Write(uint16_t x,
uint16_t y,
uint16_t w,
uint16_t h,
const uint16_t *data);
void MPuint16_t_24bpp_Mode2_Memory_Write(uint16_t x,
uint16_t y,
uint16_t w,
uint16_t h,
const uint16_t *data);
/* 硬件画线段 */
void LT768_DrawLine(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned long LineColor);
void LT768_DrawLine_Width(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned long LineColor,unsigned short Width);
/* draw line */
void LT768_DrawLine(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint32_t LineColor);
void LT768_DrawLine_Width(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint32_t LineColor,
uint16_t Width);
/* 硬件画圆 */
void LT768_DrawCircle(unsigned short XCenter,unsigned short YCenter,unsigned short R,unsigned long CircleColor);
void LT768_DrawCircle_Fill(unsigned short XCenter,unsigned short YCenter,unsigned short R,unsigned long ForegroundColor);
void LT768_DrawCircle_Width(unsigned short XCenter,unsigned short YCenter,unsigned short R,unsigned long CircleColor,unsigned long ForegroundColor,unsigned short Width);
/* draw circle */
void LT768_DrawCircle(uint16_t XCenter,
uint16_t YCenter,
uint16_t R,
uint32_t CircleColor);
void LT768_DrawCircle_Fill(uint16_t XCenter,
uint16_t YCenter,
uint16_t R,
uint32_t ForegroundColor);
void LT768_DrawCircle_Width(uint16_t XCenter,
uint16_t YCenter,
uint16_t R,
uint32_t CircleColor,
uint32_t ForegroundColor,
uint16_t Width);
/* 硬件画椭圆 */
void LT768_DrawEllipse(unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R,unsigned long EllipseColor);
void LT768_DrawEllipse_Fill(unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R,unsigned long ForegroundColor);
void LT768_DrawEllipse_Width(unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R,unsigned long EllipseColor,unsigned long ForegroundColor,unsigned short Width);
/* draw elipse */
void LT768_DrawEllipse(uint16_t XCenter,
uint16_t YCenter,
uint16_t X_R,
uint16_t Y_R,
uint32_t EllipseColor);
void LT768_DrawEllipse_Fill(uint16_t XCenter,
uint16_t YCenter,
uint16_t X_R,
uint16_t Y_R,
uint32_t ForegroundColor);
void LT768_DrawEllipse_Width(uint16_t XCenter,
uint16_t YCenter,
uint16_t X_R,
uint16_t Y_R,
uint32_t EllipseColor,
uint32_t ForegroundColor,
uint16_t Width);
/* 硬件画矩形 */
void LT768_DrawSquare(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned long SquareColor);
void LT768_DrawSquare_Fill(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned long ForegroundColor);
void LT768_DrawSquare_Width(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned long SquareColor,unsigned long ForegroundColor,unsigned short Width);
/* draw square */
void LT768_DrawSquare(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint32_t SquareColor);
void LT768_DrawSquare_Fill(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint32_t ForegroundColor);
void LT768_DrawSquare_Width(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint32_t SquareColor,
uint32_t ForegroundColor,
uint16_t Width);
/* 硬件画圆角矩形 */
void LT768_DrawCircleSquare(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X_R,unsigned short Y_R,unsigned long CircleSquareColor);
void LT768_DrawCircleSquare_Fill(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X_R,unsigned short Y_R,unsigned long ForegroundColor);
void LT768_DrawCircleSquare_Width(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X_R,unsigned short Y_R,unsigned long CircleSquareColor,unsigned long ForegroundColor,unsigned short Width);
/* draw circle square */
void LT768_DrawCircleSquare(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint16_t X_R,
uint16_t Y_R,
uint32_t CircleSquareColor);
void LT768_DrawCircleSquare_Fill(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint16_t X_R,
uint16_t Y_R,
uint32_t ForegroundColor);
void LT768_DrawCircleSquare_Width(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint16_t X_R,
uint16_t Y_R,
uint32_t CircleSquareColor,
uint32_t ForegroundColor,
uint16_t Width);
/* 硬件画三角形 */
void LT768_DrawTriangle(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X3,unsigned short Y3,unsigned long TriangleColor);
void LT768_DrawTriangle_Fill(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X3,unsigned short Y3,unsigned long ForegroundColor);
void LT768_DrawTriangle_Frame(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X3,unsigned short Y3,unsigned long TriangleColor,unsigned long ForegroundColor);
/* draw triangle */
void LT768_DrawTriangle(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint16_t X3,
uint16_t Y3,
uint32_t TriangleColor);
void LT768_DrawTriangle_Fill(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint16_t X3,
uint16_t Y3,
uint32_t ForegroundColor);
void LT768_DrawTriangle_Frame(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint16_t X3,
uint16_t Y3,
uint32_t TriangleColor,
uint32_t ForegroundColor);
/* 硬件画四边形 */
void LT768_DrawQuadrilateral(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X3,unsigned short Y3,unsigned short X4,unsigned short Y4,unsigned long ForegroundColor);
void LT768_DrawQuadrilateral_Fill(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X3,unsigned short Y3,unsigned short X4,unsigned short Y4,unsigned long ForegroundColor);
void LT768_DrawTriangle_Frame(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X3,unsigned short Y3,unsigned long TriangleColor ,unsigned long ForegroundColor);
/* draw quadrilateral */
void LT768_DrawQuadrilateral(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint16_t X3,
uint16_t Y3,
uint16_t X4,
uint16_t Y4,
uint32_t ForegroundColor);
void LT768_DrawQuadrilateral_Fill(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint16_t X3,
uint16_t Y3,
uint16_t X4,
uint16_t Y4,
uint32_t ForegroundColor);
void LT768_DrawTriangle_Frame(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint16_t X3,
uint16_t Y3,
uint32_t TriangleColor,
uint32_t ForegroundColor);
/* 硬件画五边形 */
void LT768_DrawPentagon(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X3,unsigned short Y3,unsigned short X4,unsigned short Y4,unsigned short X5,unsigned short Y5,unsigned long ForegroundColor);
void LT768_DrawPentagon_Fill(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X3,unsigned short Y3,unsigned short X4,unsigned short Y4,unsigned short X5,unsigned short Y5,unsigned long ForegroundColor);
/* draw pentagon */
void LT768_DrawPentagon(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint16_t X3,
uint16_t Y3,
uint16_t X4,
uint16_t Y4,
uint16_t X5,
uint16_t Y5,
uint32_t ForegroundColor);
void LT768_DrawPentagon_Fill(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint16_t X3,
uint16_t Y3,
uint16_t X4,
uint16_t Y4,
uint16_t X5,
uint16_t Y5,
uint32_t ForegroundColor);
/* 硬件画曲线 */
void LT768_DrawLeftUpCurve(unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R,unsigned long CurveColor);
void LT768_DrawLeftDownCurve(unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R,unsigned long CurveColor);
void LT768_DrawRightUpCurve(unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R,unsigned long CurveColor);
void LT768_DrawRightDownCurve(unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R,unsigned long CurveColor);
void LT768_SelectDrawCurve(unsigned short XCenter ,unsigned short YCenter,unsigned short X_R,unsigned short Y_R,unsigned long CurveColor,unsigned short Dir);
/* draw curve */
void LT768_DrawLeftUpCurve(uint16_t XCenter,
uint16_t YCenter,
uint16_t X_R,
uint16_t Y_R,
uint32_t CurveColor);
void LT768_DrawLeftDownCurve(uint16_t XCenter,
uint16_t YCenter,
uint16_t X_R,
uint16_t Y_R,
uint32_t CurveColor);
void LT768_DrawRightUpCurve(uint16_t XCenter,
uint16_t YCenter,
uint16_t X_R,
uint16_t Y_R,
uint32_t CurveColor);
void LT768_DrawRightDownCurve(uint16_t XCenter,
uint16_t YCenter,
uint16_t X_R,
uint16_t Y_R,
uint32_t CurveColor);
void LT768_SelectDrawCurve(uint16_t XCenter,
uint16_t YCenter,
uint16_t X_R,
uint16_t Y_R,
uint32_t CurveColor,
uint16_t Dir);
/* 硬件画1/4椭圆 */
void LT768_DrawLeftUpCurve_Fill(unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R,unsigned long ForegroundColor);
void LT768_DrawLeftDownCurve_Fill(unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R,unsigned long ForegroundColor);
void LT768_DrawRightUpCurve_Fill(unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R,unsigned long ForegroundColor);
void LT768_DrawRightDownCurve_Fill(unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R,unsigned long ForegroundColor);
void LT768_SelectDrawCurve_Fill(unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R,unsigned long CurveColor,unsigned short Dir);
/* draw 1/4 filled curve */
void LT768_DrawLeftUpCurve_Fill(uint16_t XCenter,
uint16_t YCenter,
uint16_t X_R,
uint16_t Y_R,
uint32_t ForegroundColor);
void LT768_DrawLeftDownCurve_Fill(uint16_t XCenter,
uint16_t YCenter,
uint16_t X_R,
uint16_t Y_R,
uint32_t ForegroundColor);
void LT768_DrawRightUpCurve_Fill(uint16_t XCenter,
uint16_t YCenter,
uint16_t X_R,
uint16_t Y_R,
uint32_t ForegroundColor);
void LT768_DrawRightDownCurve_Fill(uint16_t XCenter,
uint16_t YCenter,
uint16_t X_R,
uint16_t Y_R,
uint32_t ForegroundColor);
void LT768_SelectDrawCurve_Fill(uint16_t XCenter,
uint16_t YCenter,
uint16_t X_R,
uint16_t Y_R,
uint32_t CurveColor,
uint16_t Dir);
/* 硬件画圆柱 */
unsigned char LT768_DrawCylinder(unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R,unsigned short H,unsigned long CylinderColor,unsigned long ForegroundColor);
/* draw cylinders */
uint8_t LT768_DrawCylinder(uint16_t XCenter,
uint16_t YCenter,
uint16_t X_R,
uint16_t Y_R,
uint16_t H,
uint32_t CylinderColor,
uint32_t ForegroundColor);
/* 硬件画四棱柱 */
void LT768_DrawQuadrangular(unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X3,unsigned short Y3,unsigned short X4,unsigned short Y4,unsigned short X5,unsigned short Y5,unsigned short X6,unsigned short Y6,unsigned long QuadrangularColor,unsigned long ForegroundColor);
/* draw quadrangular */
void LT768_DrawQuadrangular(uint16_t X1,
uint16_t Y1,
uint16_t X2,
uint16_t Y2,
uint16_t X3,
uint16_t Y3,
uint16_t X4,
uint16_t Y4,
uint16_t X5,
uint16_t Y5,
uint16_t X6,
uint16_t Y6,
uint32_t QuadrangularColor,
uint32_t ForegroundColor);
/* 表格 */
void LT768_MakeTable(unsigned short X1,unsigned short Y1,unsigned short W,unsigned short H,unsigned short Line,unsigned short Row,unsigned long TableColor,unsigned long ItemColor,unsigned long ForegroundColor,unsigned short width1,unsigned short width2,unsigned char mode);
/* table */
void LT768_MakeTable(uint16_t X1,
uint16_t Y1,
uint16_t W,
uint16_t H,
uint16_t Line,
uint16_t Row,
uint32_t TableColor,
uint32_t ItemColor,
uint32_t ForegroundColor,
uint16_t width1,
uint16_t width2,
uint8_t mode);
/* 线性模式下DMA传输数据到SDRAM中 */
void LT768_DMA_24bit_Linear(unsigned char SCS,unsigned char Clk,unsigned long flash_addr,unsigned long memory_ad,unsigned long data_num);
void LT768_DMA_32bit_Linear(unsigned char SCS,unsigned char Clk,unsigned long flash_addr,unsigned long memory_ad,unsigned long data_num);
/* linear DMA transport to SDRAM */
void LT768_DMA_24bit_Linear(uint8_t SCS,
uint8_t Clk,
uint32_t flash_addr,
uint32_t memory_ad,
uint32_t data_num);
void LT768_DMA_32bit_Linear(uint8_t SCS,
uint8_t Clk,
uint32_t flash_addr,
uint32_t memory_ad,
uint32_t data_num);
/* 区块模式下DMA传输数据到SDRAM中 */
void LT768_DMA_24bit_Block(unsigned char SCS,unsigned char Clk,unsigned short X1,unsigned short Y1 ,unsigned short X_W,unsigned short Y_H,unsigned short P_W,unsigned long Addr);
void LT768_DMA_32bit_Block(unsigned char SCS,unsigned char Clk,unsigned short X1,unsigned short Y1 ,unsigned short X_W,unsigned short Y_H,unsigned short P_W,unsigned long Addr);
/* DMA transport to SDRAM */
void LT768_DMA_24bit_Block(uint8_t SCS,
uint8_t Clk,
uint16_t X1,
uint16_t Y1,
uint16_t X_W,
uint16_t Y_H,
uint16_t P_W,
uint32_t Addr);
void LT768_DMA_32bit_Block(uint8_t SCS,
uint8_t Clk,
uint16_t X1,
uint16_t Y1,
uint16_t X_W,
uint16_t Y_H,
uint16_t P_W,
uint32_t Addr);
/* 使用内建字库 */
void LT768_Select_Internal_Font_Init(unsigned char Size,unsigned char XxN,unsigned char YxN,unsigned char ChromaKey,unsigned char Alignment);
void LT768_Print_Internal_Font_String(unsigned short x,unsigned short y,unsigned long FontColor,unsigned long BackGroundColor ,char *c);
/* use internal font */
void LT768_Select_Internal_Font_Init(uint8_t Size,
uint8_t XxN,
uint8_t YxN,
uint8_t ChromaKey,
uint8_t Alignment);
void LT768_Print_Internal_Font_String(uint16_t x,
uint16_t y,
uint32_t FontColor,
uint32_t BackGroundColor,
char *c);
/* nor flash使用外建字库 */
/* nor flash use outside font */
/* 16*16 24*24 32*32 */
void LT768_Select_Outside_Font_Init(unsigned char SCS,unsigned char Clk,unsigned long FlashAddr,unsigned long MemoryAddr,unsigned long Num,unsigned char Size,unsigned char XxN,unsigned char YxN,unsigned char ChromaKey,unsigned char Alignment);
void LT768_Print_Outside_Font_String(unsigned short x,unsigned short y,unsigned long FontColor,unsigned long BackGroundColor,unsigned char *c);
void LT768_Print_Outside_Font_GBK_String(unsigned short x,unsigned short y,unsigned long FontColor,unsigned long BackGroundColor,unsigned char *c);
/* 48*48 72*72全角 */
void LT768_BTE_Memory_Copy_ColorExpansion_8(unsigned long S0_Addr,unsigned short YS0,unsigned long Des_Addr,unsigned short Des_W,unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned long Foreground_color,unsigned long Background_color);
void LT768_BTE_Memory_Copy_ColorExpansion_Chroma_key_8(unsigned long S0_Addr,unsigned short YS0,unsigned long Des_Addr,unsigned short Des_W,unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned long Foreground_color);
void LT768_Print_Outside_Font_GB2312_48_72(unsigned char SCS,unsigned char Clk,unsigned long FlashAddr,unsigned long MemoryAddr,unsigned long ShowAddr,unsigned short width,unsigned char Size,unsigned char ChromaKey,unsigned short x,unsigned short y,unsigned long FontColor,unsigned long BackGroundColor,unsigned short w,unsigned short s,unsigned char *c);
void LT768_Print_Outside_Font_BIG5_48_72(unsigned char SCS,unsigned char Clk,unsigned long FlashAddr,unsigned long MemoryAddr,unsigned long ShowAddr,unsigned short width,unsigned char Size,unsigned char ChromaKey,unsigned short x,unsigned short y,unsigned long FontColor,unsigned long BackGroundColor,unsigned short w,unsigned short s,unsigned char *c);
void LT768_Print_Outside_Font_GBK_48_72(unsigned char SCS,unsigned char Clk,unsigned long FlashAddr,unsigned long MemoryAddr,unsigned long ShowAddr,unsigned short width,unsigned char Size,unsigned char ChromaKey,unsigned short x,unsigned short y,unsigned long FontColor,unsigned long BackGroundColor,unsigned short w,unsigned short s,unsigned char *c);
void LT768_Select_Outside_Font_Init(uint8_t SCS,
uint8_t Clk,
uint32_t FlashAddr,
uint32_t MemoryAddr,
uint32_t Num,
uint8_t Size,
uint8_t XxN,
uint8_t YxN,
uint8_t ChromaKey,
uint8_t Alignment);
void LT768_Print_Outside_Font_String(uint16_t x,
uint16_t y,
uint32_t FontColor,
uint32_t BackGroundColor,
uint8_t *c);
void LT768_Print_Outside_Font_GBK_String(uint16_t x,
uint16_t y,
uint32_t FontColor,
uint32_t BackGroundColor,
uint8_t *c);
/* 48*48 72*72 SBC case */
void LT768_BTE_Memory_Copy_ColorExpansion_8(uint32_t S0_Addr,
uint16_t YS0,
uint32_t Des_Addr,
uint16_t Des_W,
uint16_t XDes,
uint16_t YDes,
uint16_t X_W,
uint16_t Y_H,
uint32_t Foreground_color,
uint32_t Background_color);
void LT768_BTE_Memory_Copy_ColorExpansion_Chroma_key_8(uint32_t S0_Addr,
uint16_t YS0,
uint32_t Des_Addr,
uint16_t Des_W,
uint16_t XDes,
uint16_t YDes,
uint16_t X_W,
uint16_t Y_H,
uint32_t Foreground_color);
void LT768_Print_Outside_Font_GB2312_48_72(uint8_t SCS,
uint8_t Clk,
uint32_t FlashAddr,
uint32_t MemoryAddr,
uint32_t ShowAddr,
uint16_t width,
uint8_t Size,
uint8_t ChromaKey,
uint16_t x,
uint16_t y,
uint32_t FontColor,
uint32_t BackGroundColor,
uint16_t w,
uint16_t s,
uint8_t *c);
void LT768_Print_Outside_Font_BIG5_48_72(uint8_t SCS,
uint8_t Clk,
uint32_t FlashAddr,
uint32_t MemoryAddr,
uint32_t ShowAddr,
uint16_t width,
uint8_t Size,
uint8_t ChromaKey,
uint16_t x,
uint16_t y,
uint32_t FontColor,
uint32_t BackGroundColor,
uint16_t w,
uint16_t s,
uint8_t *c);
void LT768_Print_Outside_Font_GBK_48_72(uint8_t SCS,
uint8_t Clk,
uint32_t FlashAddr,
uint32_t MemoryAddr,
uint32_t ShowAddr,
uint16_t width,
uint8_t Size,
uint8_t ChromaKey,
uint16_t x,
uint16_t y,
uint32_t FontColor,
uint32_t BackGroundColor,
uint16_t w,
uint16_t s,
uint8_t *c);
/* nor flash使用自定义字库 */
/* 16*16 24*24 32*32 48*48 72*72全角 */
int Get_User_Font_P(char chH,char chL);
void LT768_Print_Outside_UserDefineFont_GB2312(unsigned char SCS,unsigned char Clk,unsigned long FlashAddr,unsigned long MemoryAddr,unsigned long ShowAddr,unsigned short width,unsigned char Size,unsigned char ChromaKey,unsigned short x,unsigned short y,unsigned long FontColor,unsigned long BackGroundColor,unsigned short w,unsigned short s,unsigned char *c);
/* nor flash used define font */
/* 16*16 24*24 32*32 48*48 72*72 SBC case */
int Get_User_Font_P(char chH,
char chL);
void LT768_Print_Outside_UserDefineFont_GB2312(uint8_t SCS,
uint8_t Clk,
uint32_t FlashAddr,
uint32_t MemoryAddr,
uint32_t ShowAddr,
uint16_t width,
uint8_t Size,
uint8_t ChromaKey,
uint16_t x,
uint16_t y,
uint32_t FontColor,
uint32_t BackGroundColor,
uint16_t w,
uint16_t s,
uint8_t *c);
/* 文字光标 */
void LT768_Text_cursor_Init(unsigned char On_Off_Blinking,unsigned short Blinking_Time,unsigned short X_W,unsigned short Y_W);
/* text cursor */
void LT768_Text_cursor_Init(uint8_t On_Off_Blinking,
uint16_t Blinking_Time,
uint16_t X_W,
uint16_t Y_W);
void LT768_Enable_Text_Cursor(void);
void LT768_Disable_Text_Cursor(void);
/* 图像光标 */
void LT768_Graphic_cursor_Init(unsigned char Cursor_N,unsigned char Color1,unsigned char Color2,unsigned short X_Pos,unsigned short Y_Pos,unsigned char *Cursor_Buf);
void LT768_Set_Graphic_cursor_Pos(unsigned char Cursor_N,unsigned short X_Pos,unsigned short Y_Pos);
/* graphic cursor */
void LT768_Graphic_cursor_Init(uint8_t Cursor_N,
uint8_t Color1,
uint8_t Color2,
uint16_t X_Pos,
uint16_t Y_Pos,
uint8_t *Cursor_Buf);
void LT768_Set_Graphic_cursor_Pos(uint8_t Cursor_N,
uint16_t X_Pos,
uint16_t Y_Pos);
void LT768_Enable_Graphic_Cursor(void);
void LT768_Disable_Graphic_Cursor(void);
/* 区块传输引擎BitBLT */
void BTE_Solid_Fill(unsigned long Des_Addr,unsigned short Des_W,unsigned short XDes,unsigned short YDes,unsigned short color,unsigned short X_W,unsigned short Y_H);
void LT768_BTE_Memory_Copy(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W,unsigned short XDes,unsigned short YDes,unsigned int ROP_Code,unsigned short X_W,unsigned short Y_H);
void LT768_BTE_Memory_Copy_Chroma_key(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long Des_Addr,unsigned short Des_W,unsigned short XDes,unsigned short YDes,unsigned long Background_color,unsigned short X_W,unsigned short Y_H);
void LT768_BTE_Pattern_Fill(unsigned char P_8x8_or_16x16,unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned int ROP_Code ,unsigned short X_W,unsigned short Y_H);
void LT768_BTE_Pattern_Fill_With_Chroma_key(unsigned char P_8x8_or_16x16,unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long Des_Addr,unsigned short Des_W,unsigned short XDes,unsigned short YDes,unsigned int ROP_Code,unsigned long Background_color,unsigned short X_W,unsigned short Y_H);
void LT768_BTE_MCU_Write_MCU_16bit(unsigned long S1_Addr,unsigned short S1_W,unsigned short XS,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W,unsigned short XDes,unsigned short YDes,unsigned int ROP_Code,unsigned short X_W,unsigned short Y_H ,const unsigned short *data);
void LT768_BTE_MCU_Write_Chroma_key_MCU_16bit(unsigned long Des_Addr,unsigned short Des_W,unsigned short XDes,unsigned short YDes,unsigned long Background_color,unsigned short X_W,unsigned short Y_H,const unsigned short *data);
void LT768_BTE_MCU_Write_ColorExpansion_MCU_16bit(unsigned long Des_Addr,unsigned short Des_W,unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned long Foreground_color ,unsigned long Background_color ,const unsigned short *data);
void LT768_BTE_MCU_Write_ColorExpansion_Chroma_key_MCU_16bit(unsigned long Des_Addr,unsigned short Des_W,unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned long Foreground_color,const unsigned short *data);
void BTE_Alpha_Blending(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W,unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned char alpha);
void BTE_Pixel_8bpp_Alpha_Blending(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W,unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H);
void BTE_Pixel_16bpp_Alpha_Blending(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W,unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H);
/* block transport enginer (BitBLT) */
void BTE_Solid_Fill(uint32_t Des_Addr,
uint16_t Des_W,
uint16_t XDes,
uint16_t YDes,
uint16_t color,
uint16_t X_W,
uint16_t Y_H);
void LT768_BTE_Memory_Copy(uint32_t S0_Addr,
uint16_t S0_W,
uint16_t XS0,
uint16_t YS0,
uint32_t S1_Addr,
uint16_t S1_W,
uint16_t XS1,
uint16_t YS1,
uint32_t Des_Addr,
uint16_t Des_W,
uint16_t XDes,
uint16_t YDes,
unsigned int ROP_Code,
uint16_t X_W,
uint16_t Y_H);
void LT768_BTE_Memory_Copy_Chroma_key(uint32_t S0_Addr,
uint16_t S0_W,
uint16_t XS0,
uint16_t YS0,
uint32_t Des_Addr,
uint16_t Des_W,
uint16_t XDes,
uint16_t YDes,
uint32_t Background_color,
uint16_t X_W,
uint16_t Y_H);
void LT768_BTE_Pattern_Fill(uint8_t P_8x8_or_16x16,
uint32_t S0_Addr,
uint16_t S0_W,
uint16_t XS0,
uint16_t YS0,
uint32_t Des_Addr,
uint16_t Des_W,
uint16_t XDes,
uint16_t YDes,
unsigned int ROP_Code,
uint16_t X_W,
uint16_t Y_H);
void LT768_BTE_Pattern_Fill_With_Chroma_key(uint8_t P_8x8_or_16x16,
uint32_t S0_Addr,
uint16_t S0_W,
uint16_t XS0,
uint16_t YS0,
uint32_t Des_Addr,
uint16_t Des_W,
uint16_t XDes,
uint16_t YDes,
unsigned int ROP_Code,
uint32_t Background_color,
uint16_t X_W,
uint16_t Y_H);
void LT768_BTE_MCU_Write_MCU_16bit(uint32_t S1_Addr,
uint16_t S1_W,
uint16_t XS,
uint16_t YS1,
uint32_t Des_Addr,
uint16_t Des_W,
uint16_t XDes,
uint16_t YDes,
unsigned int ROP_Code,
uint16_t X_W,
uint16_t Y_H,
const uint16_t *data);
void LT768_BTE_MCU_Write_Chroma_key_MCU_16bit(uint32_t Des_Addr,
uint16_t Des_W,
uint16_t XDes,
uint16_t YDes,
uint32_t Background_color,
uint16_t X_W,
uint16_t Y_H,
const uint16_t *data);
void LT768_BTE_MCU_Write_ColorExpansion_MCU_16bit(uint32_t Des_Addr,
uint16_t Des_W,
uint16_t XDes,
uint16_t YDes,
uint16_t X_W,
uint16_t Y_H,
uint32_t Foreground_color,
uint32_t Background_color,
const uint16_t *data);
void LT768_BTE_MCU_Write_ColorExpansion_Chroma_key_MCU_16bit(uint32_t Des_Addr,
uint16_t Des_W,
uint16_t XDes,
uint16_t YDes,
uint16_t X_W,
uint16_t Y_H,
uint32_t Foreground_color,
const uint16_t *data);
void BTE_Alpha_Blending(uint32_t S0_Addr,
uint16_t S0_W,
uint16_t XS0,
uint16_t YS0,
uint32_t S1_Addr,
uint16_t S1_W,
uint16_t XS1,
uint16_t YS1,
uint32_t Des_Addr,
uint16_t Des_W,
uint16_t XDes,
uint16_t YDes,
uint16_t X_W,
uint16_t Y_H,
uint8_t alpha);
void BTE_Pixel_8bpp_Alpha_Blending(uint32_t S0_Addr,
uint16_t S0_W,
uint16_t XS0,
uint16_t YS0,
uint32_t S1_Addr,
uint16_t S1_W,
uint16_t XS1,
uint16_t YS1,
uint32_t Des_Addr,
uint16_t Des_W,
uint16_t XDes,
uint16_t YDes,
uint16_t X_W,
uint16_t Y_H);
void BTE_Pixel_16bpp_Alpha_Blending(uint32_t S0_Addr,
uint16_t S0_W,
uint16_t XS0,
uint16_t YS0,
uint32_t S1_Addr,
uint16_t S1_W,
uint16_t XS1,
uint16_t YS1,
uint32_t Des_Addr,
uint16_t Des_W,
uint16_t XDes,
uint16_t YDes,
uint16_t X_W,
uint16_t Y_H);
/* PIP */
void LT768_PIP_Init(unsigned char On_Off,unsigned char Select_PIP,unsigned long PAddr,unsigned short XP,unsigned short YP,unsigned long ImageWidth,unsigned short X_Dis,unsigned short Y_Dis,unsigned short X_W,unsigned short Y_H);
void LT768_Set_DisWindowPos(unsigned char On_Off,unsigned char Select_PIP,unsigned short X_Dis,unsigned short Y_Dis);
void LT768_PIP_Init(uint8_t On_Off,
uint8_t Select_PIP,
uint32_t PAddr,
uint16_t XP,
uint16_t YP,
uint32_t ImageWidth,
uint16_t X_Dis,
uint16_t Y_Dis,
uint16_t X_W,
uint16_t Y_H);
void LT768_Set_DisWindowPos(uint8_t On_Off,
uint8_t Select_PIP,
uint16_t X_Dis,
uint16_t Y_Dis);
/* PWM */
void LT768_PWM0_Init(unsigned char on_off,unsigned char Clock_Divided,unsigned char Prescalar,unsigned short Count_Buffer,unsigned short Compare_Buffer);
void LT768_PWM1_Init(unsigned char on_off,unsigned char Clock_Divided,unsigned char Prescalar,unsigned short Count_Buffer,unsigned short Compare_Buffer);
void LT768_PWM0_Duty(unsigned short Compare_Buffer);
void LT768_PWM1_Duty(unsigned short Compare_Buffer);
void LT768_PWM0_Init(uint8_t on_off,
uint8_t Clock_Divided,
uint8_t Prescalar,
uint16_t Count_Buffer,
uint16_t Compare_Buffer);
void LT768_PWM1_Init(uint8_t on_off,
uint8_t Clock_Divided,
uint8_t Prescalar,
uint16_t Count_Buffer,
uint16_t Compare_Buffer);
void LT768_PWM0_Duty(uint16_t Compare_Buffer);
void LT768_PWM1_Duty(uint16_t Compare_Buffer);
/* Standby Mode */
void LT768_Standby(void);
@ -273,34 +788,126 @@ void LT768_SleepMode(void);
void LT768_Wkup_Sleep(void);
/* W25QXX */
void LT768_SPI_Init(uint8_t cs,uint8_t div);
void LT768_SPI_Init(uint8_t cs,
uint8_t div);
void W25QXX_Enter_4Byte_AddressMode(void);
void LT_W25QXX_Read(uint8_t* pBuffer,uint32_t ReadAddr,uint16_t NumByteToRead);
void LT_W25QXX_Read(uint8_t *pBuffer,
uint32_t ReadAddr,
uint16_t NumByteToRead);
/* nand flash W25N01GV */
uint8_t W25N01GV_ReadSR(uint8_t reg);
void W25N01GV_Write_SR(uint8_t reg,uint8_t val);
void W25N01GV_Write_SR(uint8_t reg,
uint8_t val);
void W25N01GV_Wait_Busy(void);
void W25N01GV_ContinuousRead_Mode(void);
void W25N01GV_Write_Page(uint16_t page);
void W25N01GV_ReadPageAddr_Data(uint8_t* pBuffer,uint32_t PageNum,uint32_t PageAddr,uint16_t NumByteToRead);
void LT_W25N01GV_Read(uint8_t* pBuffer,uint32_t ReadAddr,uint16_t NumByteToRead);
void W25N01GV_ReadPageAddr_Data(uint8_t *pBuffer,
uint32_t PageNum,
uint32_t PageAddr,
uint16_t NumByteToRead);
void LT_W25N01GV_Read(uint8_t *pBuffer,
uint32_t ReadAddr,
uint16_t NumByteToRead);
/* nand flash显示图片 */
void LT768_Nand_Pic(unsigned char SCS,unsigned short X1,unsigned short Y1,unsigned short X_W,unsigned short Y_H,unsigned long Addr,unsigned long lay0,unsigned long lay1);
/* nand flash draw picture */
void LT768_Nand_Pic(uint8_t SCS,
uint16_t X1,
uint16_t Y1,
uint16_t X_W,
uint16_t Y_H,
uint32_t Addr,
uint32_t lay0,
uint32_t lay1);
/* nand flash使用外建字库初始化 */
/* nand flash use outside font */
/* 16*16 24*24 32*32 */
void NandFlash_Select_Outside_Font_Init(unsigned char SCS,unsigned char Clk,unsigned long FlashAddr,unsigned long MemoryAddr,unsigned long Num,unsigned char Size,unsigned char XxN,unsigned char YxN,unsigned char ChromaKey,unsigned char Alignment);
void NandFlash_Select_Outside_Font_Init(uint8_t SCS,
uint8_t Clk,
uint32_t FlashAddr,
uint32_t MemoryAddr,
uint32_t Num,
uint8_t Size,
uint8_t XxN,
uint8_t YxN,
uint8_t ChromaKey,
uint8_t Alignment);
/* nand flash使用外建字库 */
/* 48*48 72*72全角 */
void LT768_BTE_Memory_Copy_8(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W,unsigned short XDes,unsigned short YDes,unsigned int ROP_Code,unsigned short X_W,unsigned short Y_H);
void LT768_Nand_8bpp_font(unsigned char SCS,unsigned char Clk,unsigned short X1,unsigned short Y1,unsigned short X_W,unsigned short Y_H,unsigned long Addr,unsigned long lay1,unsigned long lay2);
void LT768_Print_Outside_Font_GB2312_48_72_Nand(unsigned char SCS,unsigned char Clk,unsigned long FlashAddr,unsigned long MemoryAddr1,unsigned long MemoryAddr2,unsigned long ShowAddr,unsigned short width,unsigned char Size,unsigned char ChromaKey,unsigned short x,unsigned short y,unsigned long FontColor,unsigned long BackGroundColor,unsigned short w,unsigned short s,unsigned char *c);
void LT768_Print_Outside_Font_GBK_48_72_Nand(unsigned char SCS,unsigned char Clk,unsigned long FlashAddr,unsigned long MemoryAddr1,unsigned long MemoryAddr2,unsigned long ShowAddr,unsigned short width,unsigned char Size,unsigned char ChromaKey,unsigned short x,unsigned short y,unsigned long FontColor,unsigned long BackGroundColor,unsigned short w,unsigned short s,unsigned char *c);
/* nand flash use outside font */
/* 48*48 72*72 SBC case */
void LT768_BTE_Memory_Copy_8(uint32_t S0_Addr,
uint16_t S0_W,
uint16_t XS0,
uint16_t YS0,
uint32_t S1_Addr,
uint16_t S1_W,
uint16_t XS1,
uint16_t YS1,
uint32_t Des_Addr,
uint16_t Des_W,
uint16_t XDes,
uint16_t YDes,
unsigned int ROP_Code,
uint16_t X_W,
uint16_t Y_H);
void LT768_Nand_8bpp_font(uint8_t SCS,
uint8_t Clk,
uint16_t X1,
uint16_t Y1,
uint16_t X_W,
uint16_t Y_H,
uint32_t Addr,
uint32_t lay1,
uint32_t lay2);
void LT768_Print_Outside_Font_GB2312_48_72_Nand(uint8_t SCS,
uint8_t Clk,
uint32_t FlashAddr,
uint32_t MemoryAddr1,
uint32_t MemoryAddr2,
uint32_t ShowAddr,
uint16_t width,
uint8_t Size,
uint8_t ChromaKey,
uint16_t x,
uint16_t y,
uint32_t FontColor,
uint32_t BackGroundColor,
uint16_t w,
uint16_t s,
uint8_t *c);
void LT768_Print_Outside_Font_GBK_48_72_Nand(uint8_t SCS,
uint8_t Clk,
uint32_t FlashAddr,
uint32_t MemoryAddr1,
uint32_t MemoryAddr2,
uint32_t ShowAddr,
uint16_t width,
uint8_t Size,
uint8_t ChromaKey,
uint16_t x,
uint16_t y,
uint32_t FontColor,
uint32_t BackGroundColor,
uint16_t w,
uint16_t s,
uint8_t *c);
/* nand flash使用自定义字库 */
/* 16*16 24*24 32*32 48*48 72*72全角 */
void LT768_Print_Outside_UserDefineFont_GB2312_Nand(unsigned char SCS,unsigned char Clk,unsigned long FlashAddr,unsigned long MemoryAddr1,unsigned long MemoryAddr2,unsigned long ShowAddr,unsigned short width,unsigned char Size,unsigned char ChromaKey,unsigned short x,unsigned short y,unsigned long FontColor,unsigned long BackGroundColor,unsigned short w,unsigned short s,unsigned char *c);
/* nand flash user defined font */
/* 16*16 24*24 32*32 48*48 72*72 SBC case */
void LT768_Print_Outside_UserDefineFont_GB2312_Nand(uint8_t SCS,
uint8_t Clk,
uint32_t FlashAddr,
uint32_t MemoryAddr1,
uint32_t MemoryAddr2,
uint32_t ShowAddr,
uint16_t width,
uint8_t Size,
uint8_t ChromaKey,
uint16_t x,
uint16_t y,
uint32_t FontColor,
uint32_t BackGroundColor,
uint16_t w,
uint16_t s,
uint8_t *c);
#endif