Difference between revisions of "NanoHat OLED/zh"
From FriendlyELEC WiKi
(→特性) |
(→特性) |
||
Line 15: | Line 15: | ||
[[File:NanoHat OLED.png|frameless|400px|NanoHat OLEDPCB]] | [[File:NanoHat OLED.png|frameless|400px|NanoHat OLEDPCB]] | ||
− | * | + | * '''GPIO管脚定义''' |
− | {| class="wikitable" | + | ::{| class="wikitable" |
|- | |- | ||
− | | | + | |Pin# || Name || Linux gpio ||Pin# || Name || Linux gpio |
|- | |- | ||
− | | | + | |1 || SYS_3.3V || ||2 || VDD_5V || |
|- | |- | ||
− | | | + | |3 || I2C0_SDA || ||4 || VDD_5V || |
|- | |- | ||
− | | | + | |5 || I2C0_SCL || ||6 || GND || |
|- | |- | ||
− | | | + | |7 || NC || ||8 || NC || |
|- | |- | ||
− | | | + | |9 || GND || ||10 || NC || |
|- | |- | ||
− | | | + | |11 || K1 || 0 ||12 || NC || |
|- | |- | ||
− | |GND || | + | |13 || K2 || 2 ||14 || GND || |
+ | |- | ||
+ | |15 || K3 || 3 ||16 || NC || | ||
+ | |- | ||
+ | |17 || SYS_3.3V || ||18 || NC || | ||
+ | |- | ||
+ | |19 || NC || ||20 || GND || | ||
+ | |- | ||
+ | |21 || NC || ||22 || NC || | ||
+ | |- | ||
+ | |23 || NC || ||24 || NC || | ||
|} | |} | ||
Revision as of 08:21, 18 April 2017
1 介绍
- NanoHat OLED是一款精致小巧的单色OLED显示屏,只有0.96英寸,分辨率是128x64,对比度高,功耗低,可以用来显示文字或图案。
- NanoHat OLED和NanoPi NEO/Air/NEO2的外形尺寸和接口完全相同,可直接堆叠在NanoPi NEO/Air/NEO2上。通过I2C和NanoPi NEO/Air/NEO2通讯。
- 板载了3个按键,用户可以自定义按键功能。
2 特性
- 尺寸:0.96英寸
- 分辨率:128x64
- 高对比度,低功耗
- 板载3个按键
- PCB尺寸(mm):40x40
- GPIO管脚定义
Pin# Name Linux gpio Pin# Name Linux gpio 1 SYS_3.3V 2 VDD_5V 3 I2C0_SDA 4 VDD_5V 5 I2C0_SCL 6 GND 7 NC 8 NC 9 GND 10 NC 11 K1 0 12 NC 13 K2 2 14 GND 15 K3 3 16 NC 17 SYS_3.3V 18 NC 19 NC 20 GND 21 NC 22 NC 23 NC 24 NC
3 工作原理
4 硬件连接
4.1 连接NanoPi M1
参考下图连接模块:
Matrix-0.96'_128x64_OLED_nanopi_m1
连接说明:
Matrix-0.96'_128x64_OLED | NanoPi M1 |
CS | Pin24 |
DC | Pin7 |
RES | Pin11 |
MOSI | Pin19 |
CLK | Pin23 |
5V | Pin2 |
GND | Pin6 |
4.2 连接NanoPi 2
参考下图连接模块:
Matrix-0.96'_128x64_OLED_nanopi_2
连接说明:
Matrix-0.96'_128x64_OLED | NanoPi 2 |
CS | Pin24 |
DC | Pin7 |
RES | Pin11 |
MOSI | Pin19 |
CLK | Pin23 |
5V | Pin2 |
GND | Pin6 |
5 编译运行测试程序
启动开发板并运行Debian系统,进入系统后克隆Matrix代码仓库:
$ apt-get update && apt-get install git $ git clone https://github.com/friendlyarm/matrix.git
克隆完成后会得到一个名为matrix的目录。
编译并安装Matrix:
$ cd matrix $ make && make install
运行测试程序:
$ matrix-oled
运行效果如下:
matrix-oled_result
OLED上会显示下列2行字符:
"ABCDEFGHIJKLMN"
"123456789"
6 代码说明
所有的开发板都共用一套Matrix代码,本模块的测试示例代码为matrix-0.96_128x64_oled,内容如下:
int main(int argc, char *argv[]) { int devFD; if (boardInit() < 0) { printf("Fail to init board\n"); return -1; } if ((devFD = OLEDInit(GPIO_PIN(7), GPIO_PIN(11))) == -1) { printf("Fail to init OLED\n"); return -1; } OLEDCleanScreen(devFD); // Char bitmap: 8x16 OLEDDisp8x16Str(devFD, 0, 0, "ABCDEFGHIJKLMN"); OLEDDisp8x16Str(devFD, 0, 16, "123456789"); OLEDDeInit(devFD); return 0; }
API说明参考维基:Matrix API reference manual