交叉开发 在一个有编辑/编译功能的PC机上进行编辑/编译,生成的可执行文件通过 交叉开发工具下载到目标机(GEC-6818) 开发板 --- Linux内核 --- Linux指令 首先创建自己的工作目录 mkdir xxx 下载交叉编译生成的可执行文件: rx 可执行文件名 传输 --- 发送xmodem --- 浏览到我们所要发送的文件 --- 选中 --- 发送 如果发送的是一个可执行文件,没有可执行的权限 chmod +x 可执行文件名 --- 再去运行 !!! 下载可执行文件必须是交叉编译生成的 arm-linux-gcc 源文件名 -o 可执行文件名
2 屏幕操作 屏幕分辨率:800*480 800 一行有800个像素点 480行 像素点:显示颜色的最小单位 颜色:ARGB --- 每个分量一个字节 A:透明度 R:红色分量 0 - ff G:绿色分量 B:蓝色分量 绿色:0x0000ff00 如果我们想要绿屏: 每个像素点全部显示绿色:0x0000ff00 打开屏幕 int lcd_fd = open("/dev/fb0",O_RDWR); if(lcd_fd == -1) {
perror("open lcd fail"); return -1; } 操作屏幕 //写入数据 int color[800*480]={0}; for(int i=0;i color[i*800+j]=0x0000ff00; } } write(lcd_fd,color,800*480*4); 关闭屏幕 close(lcd_fd);
因为引用了 #include
切记 切记 Liunx 编译时 要加 -lm
类似 arm-linux-gcc 1.c -lm
画太极图
#include
#include
#include
#include
#include
#include
#include
int *plcd = NULL;
#define WHITE 0x00FFFFFF
#define BLAK 0x00000000
void draw_point(int x, int y, int color)
{
if (x >= 0 && x= 0 && y= 0 && x= 0 && yfc)
{
draw_point(j, i, color);
// printf("fc=%lf\n",fc);
}
}
}
}
}
void draw_circle_b(int x, int y,double r ,int color)
{
if (x >= 0 && x= 0 && yfc)
{
draw_point(j, i, color);
// printf("fc=%lf\n",fc);
}
}
}
}
}
}
void clear(int color)
{
int x,y;
for(y=0;yfc)
{
draw_point(j, i, color);
// printf("fc=%lf\n",fc);
}
}
}
}
}
}
void clear(int color)
{
int x,y;
for(y=0;y |