Matrix - 0.96' 128x64 OLED

From FriendlyELEC WiKi
Revision as of 07:21, 3 August 2015 by Yftan (Talk | contribs)

Jump to: navigation, search

查看中文

1 Introduction

0.96inch 128x64 OLED

This is a tiny single color OLED. It is 0.96" and its resolution is 128 x 64. It can display text and graphics.因为OLED是自发光的,所以无需背光,对比度高,功耗低。此配件5V供电,PCB上的电源转换芯片输出3.3V给OLED,通讯接口是SPI或I2C,信号电平为3.3V。默认通讯方式是SPI,如果需要改为I2C,您可以通过修改PCB上的配置电阻实现。

2 特性

  • 精致小巧
  • 高对比度,低功耗
  • SPI/I2C
  • 2.54mm排针接口,接线方便,通用性强

3 使用方法

3.1 连接

  • 连接到Tiny4412 SDK (1506)
GND针脚: 接地
VCC: 接5V
CLK针脚: 连接SPI CLK
MOSI针脚:连接SPI MOSI
RES针脚: 连接GPIO PIN1
DC针脚: 连接GPIO PIN2
CS针脚: 连接SPI CS

3.2 Linux下的C示例

#include <stdio.h>
#include "libfahw.h"
 
int display(int x, int y, char* str)
{
    int devFD;
    if ((devFD = OLEDInit(TINY4412_GPIO_PIN1, TINY4412_GPIO_PIN2)) == -1) {
        printf("Fail to init OLED\n");
        return -1;
    }
    // Char bitmap: 8x16
    OLEDDisp8x16Str(devFD, x, y, str);
    OLEDDeInit(devFD);
    return 0;
}
 
int main(int argc, char *argv[]) {
    display(0, 0, "1234567890");
    display(0, 16, "ABCDEFGHIJK");
    return 0;
}

3.3 编译并运行示例

git clone http://github.com/friendlyarm/fa-hardware.git
cd fa-hardware
cd demo
cd matrix-0.96inch_128x64_oled
make

将编译生成的OLED通过ftp上传到开发板上运行即可测试。

4 相关资料