SUNROC1 发表于 2013-8-8 16:07:01

cubie 驱动 诺基亚5110LCD屏幕

本帖最后由 SUNROC1 于 2014-12-19 23:08 编辑

操作系统: 使用的是官方网站上的ubuntu sd card 1.1

1. 安装python的库和cubie的gpio库sudo apt-get install python-dev
wget http://dl.linux-sunxi.org/users/tom/pySUNXI-0.1.12.tar.gz
tar zxf pySUNXI-0.1.12.tar.gz
sudo python setup.py install参考:http://forum.cubietech.com/forum.php?mod=viewthread&tid=464&extra=page%3D1

2. 用Python GPIO里面的GPIO C库文件直接编写 C应用程序

在/home/cubie/pySUNXI-0.1.12/source目录下编写:
pyinclude.h文件(见附件)
no5110.c文件(见附件)
no5110.h文件 (见附件)
test5110.c文件如下:/*
*                func: no5110 drivertest using c++ based on python IO driver
*                author : SUNROC1
*                date: 8/8/2013
*       qq: 1083380935
*                all rights reserved !
*/

#include <stdlib.h>
#include <stdio.h>

#include "no5110.h"


int main()
{
    if(SETUP_OK!=sunxi_gpio_init())
      {
      printf("Failed to initialize GPIO\n");
      return -1;
    }

      LCD_init();
      LCD_clear();

    LCD_write_shu(2,4,9);
    LCD_write_shu(2,4,20);
      
      while(1)
      {
                LCD_write_tuxiang();
                delay_ms(500);

      }

    sunxi_gpio_cleanup();

    return 0;
   
}
3.硬件连接:
cubie    5110LCD
PD1      Res
PD2      CE
PD3      DC
PD4      Din
PD5      clk

4. 编译运行:gcc no5110.c -c
gcc gpio_lib.c -c
gcc test5110.c -c
gcc test5110.o gpio_lib.o no5110.o -o test5110
./test5110
附件:

上图:









欢迎访问俺的网站:{:soso_e157:}{:soso_e121:}{:soso_e157:}http://www.heartiot.com/ {:soso_e157:}{:soso_e182:}{:soso_e157:}

tll 发表于 2013-10-4 11:20:14

你这个是C还是C++啊,gcc编译c文件应该是C,然后你上面写using C++……

tll 发表于 2013-10-4 11:21:27

另外你有中文字库吗?是哪来的?我的是系统生成的。

SUNROC1 发表于 2013-10-4 13:00:03

本帖最后由 SUNROC1 于 2013-10-4 13:08 编辑

tll 发表于 2013-10-4 11:20 static/image/common/back.gif
你这个是C还是C++啊,gcc编译c文件应该是C,然后你上面写using C++……
gcc可以编译,稍带点c++,都是我编译好的

SUNROC1 发表于 2013-10-4 13:08:10

tll 发表于 2013-10-4 11:21 static/image/common/back.gif
另外你有中文字库吗?是哪来的?我的是系统生成的。

中文字库是取模软件取的几个汉字,用时得现取,12x16的,不过可以加GB2312-80取好模的16x16字库,但是这个屏太小,显示不了几个汉字,都对不起这么大的字库

tll 发表于 2013-10-4 14:39:51

SUNROC1 发表于 2013-10-4 13:08 static/image/common/back.gif
中文字库是取模软件取的几个汉字,用时得现取,12x16的,不过可以加GB2312-80取好模的16x16字库,但是这 ...

我用的是阿古的字模软件,字库是程序自动提取,你这种直接取汉字的很简单,我的这个我弄了半天……主要是字模排序问题

tll 发表于 2013-10-4 14:41:01

另外顺便问下,你的pcb板子上的2.0mm的针的插槽在哪里买的,我怎么找不到

SUNROC1 发表于 2013-10-4 15:59:22

tll 发表于 2013-10-4 14:41 static/image/common/back.gif
另外顺便问下,你的pcb板子上的2.0mm的针的插槽在哪里买的,我怎么找不到

在淘宝输入 “2.0 母座”一堆一堆的

duke_cb 发表于 2014-2-26 15:48:32

本帖最后由 duke_cb 于 2014-2-26 16:01 编辑

我cb2 系統是,安裝了gcc4.6
編譯時:gcc no5110.c -c
no5110.c:212:1: warning: excess elements in scalar initializer
no5110.c:212:1: warning: (near initialization for &tuxiang*)
no5110.c:214:1: error: expected &=*, &,*, &;*, &asm* or &__attribute__* before &{* token
no5110.c:176:21: error: declaration for parameter &tuxiang* but no such parameter
no5110.c:119:15: error: declaration for parameter &hanzi* but no such parameter

網上找方法應該是格式問題.但有些說環境問題.
研究了一下發現抽取一部份可以編譯呢
這個http://www.tonylianlong.com/?p=16和Python GPIO库:用C直接操作GPIO.
都可以正常編譯喔..
大家有方法解決嗎?

嗚嗚~~~
原來no5110.h 最後的"extern void LCD_write_tuxiang()˙"錯了.
正確是"extern void LCD_write_tuxiang();"

不是吧 http://imgstore04.cdn.sogou.com/app/a/100520032/3669389859068460655

SUNROC1 发表于 2014-2-28 14:23:35

duke_cb 发表于 2014-2-26 15:48 static/image/common/back.gif
我cb2 系統是,安裝了gcc4.6
編譯時:gcc no5110.c -c
no5110.c:212:1: warning: excess elements in scalar...

我明白了,是我的最后面的分号是用汉字输入法输入的,不识别,应该切换成英文输入的分号
页: [1]
查看完整版本: cubie 驱动 诺基亚5110LCD屏幕