mirror of
https://github.com/tsl0922/EPD-nRF5.git
synced 2025-12-06 15:42:48 +08:00
update README
This commit is contained in:
28
README.md
28
README.md
@@ -1,34 +1,34 @@
|
|||||||
# EPD-nRF5
|
# EPD-nRF5
|
||||||
|
|
||||||
墨水屏日历固件,支持农历、节气、节假日调休显示,也可以通过蓝牙传输图像到墨水屏作为相框使用。日历界面已适配常见的 4.2 寸和 7.5 寸墨水屏分辨率,且同一个固件可驱动不同尺寸屏幕(可通过上位机在线切换屏幕尺寸和驱动)。
|
E-paper display calendar firmware with support for Chinese lunar calendar, solar terms, and holiday schedules. It can also transmit images via Bluetooth to the e-paper display for use as a digital photo frame. The calendar interface is adapted for common 4.2-inch and 7.5-inch e-paper resolutions, and the same firmware can drive different screen sizes (screen size and driver can be switched online through the web interface).
|
||||||
|
|
||||||
支持的主控芯片有: `nrf51822` / `nrf51802` / `nrf52811` / `nrf52810`,墨水屏方面支持常见的 `UC81xx` / `SSD16xx` 系列驱动(黑白/三色/四色),同时还支持自定义墨水屏到 MCU 的引脚映射,支持睡眠唤醒(NFC / 无线充电器),支持蓝牙 OTA 固件升级。
|
Supported MCUs: `nrf51822` / `nrf51802` / `nrf52811` / `nrf52810`. For e-paper displays, it supports common `UC81xx` / `SSD16xx` series drivers (black & white / 3-color / 4-color). It also supports custom pin mapping from the e-paper display to the MCU, sleep/wake functionality (NFC / wireless charger), and Bluetooth OTA firmware updates.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 上位机
|
## Web Interface
|
||||||
|
|
||||||
本项目自带一个基于浏览器蓝牙接口实现的网页版上位机,可使用手机或电脑打开下面地址使用,或者在本地直接双击打开 `html/index.html` 来使用。
|
This project includes a web-based interface implemented using Web Bluetooth API. You can use it on your phone or computer by visiting the URL below, or by directly double-clicking `html/index.html` locally.
|
||||||
|
|
||||||
- 地址:https://tsl0922.github.io/EPD-nRF5
|
- URL: https://tsl0922.github.io/EPD-nRF5
|
||||||
- 演示:https://www.bilibili.com/video/BV1KWAVe1EKs
|
- Demo Video: https://www.bilibili.com/video/BV1KWAVe1EKs
|
||||||
- 交流群: [1033086563](https://qm.qq.com/q/SckzhfDxuu) (点击链接加入群聊)
|
- Discussion Group: [1033086563](https://qm.qq.com/q/SckzhfDxuu) (Click the link to join the chat group)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
上位机支持多种图片抖动算法,且可以对图片进行涂鸦、添加文字。除了显示图片作为电子相框外,还可以切换到日历模式,显示月历、农历节气、节假日、放假调休等信息。
|
The web interface supports multiple image dithering algorithms and allows you to doodle on images and add text. In addition to displaying images as a digital photo frame, it can also switch to calendar mode to display monthly calendars, Chinese lunar calendar solar terms, holidays, and work schedule adjustments.
|
||||||
|
|
||||||
## 支持设备
|
## Supported Devices
|
||||||
|
|
||||||
[查看文档](docs/devices.md)。
|
[View Documentation](docs/devices.md).
|
||||||
|
|
||||||
## 开发编译
|
## Development
|
||||||
|
|
||||||
[查看文档](docs/develop.md)。
|
[View Documentation](docs/develop.md).
|
||||||
|
|
||||||
## 致谢
|
## Acknowledgments
|
||||||
|
|
||||||
本项目使用或参考了以下项目的代码:
|
This project uses or references code from the following projects:
|
||||||
|
|
||||||
- [ZinggJM/GxEPD2](https://github.com/ZinggJM/GxEPD2)
|
- [ZinggJM/GxEPD2](https://github.com/ZinggJM/GxEPD2)
|
||||||
- [waveshareteam/e-Paper](https://github.com/waveshareteam/e-Paper)
|
- [waveshareteam/e-Paper](https://github.com/waveshareteam/e-Paper)
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
UC8176 的数据手册中不包含 LUT 相关指令的说明,但是 UC8151 的手册里有,且格式是一样的,故把 UC8151 的手册也放了上来。
|
The UC8176 datasheet does not include descriptions of LUT-related instructions, but the UC8151 manual does, and the format is the same, so the UC8151 manual has also been included.
|
||||||
|
|
||||||
OTP 目录为从屏幕中读取出的 OTP 数据:
|
The OTP directory contains OTP data read from the screens:
|
||||||
|
|
||||||
- `bw.txt`: 黑白屏
|
- `bw.txt`: Black & white screen
|
||||||
- `3c.txt`: 黑白红三色屏
|
- `3c.txt`: Black, white, and red 3-color screen
|
||||||
|
|
||||||
可从 OTP 数据中提取屏幕内置的 LUT 波形作为参考,以方便自定义 LUT 波形。
|
You can extract the built-in LUT waveforms from the OTP data as a reference to facilitate custom LUT waveforms.
|
||||||
|
|
||||||
以下是从 OTP 中提取出的 LUT 波形例子(均已测试和本项目支持的 2 个屏幕不加载外部 LUT 时在 20 度左右室温下显示效果一致):
|
The following are examples of LUT waveforms extracted from OTP (all tested to match the display effect at room temperature around 20°C when the 2 screens supported by this project do not load external LUTs):
|
||||||
|
|
||||||
**黑白屏:**
|
**Black & White Screen:**
|
||||||
|
|
||||||
```c
|
```c
|
||||||
// OTP location: 0x300
|
// OTP location: 0x300
|
||||||
@@ -65,7 +65,7 @@ static const unsigned char LUTBB[] = {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
**三色屏:**
|
**3-Color Screen:**
|
||||||
|
|
||||||
```c
|
```c
|
||||||
// OTP location: 0x400
|
// OTP location: 0x400
|
||||||
@@ -121,9 +121,9 @@ static const unsigned char LUTB[] = {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
使用以下 LUT 且把驱动设置为 BW 模式可把三色屏当作黑白屏使用,刷新时间能从 15s 降到 2-3s 左右:
|
Using the following LUT and setting the driver to BW mode allows the 3-color screen to be used as a black & white screen, reducing refresh time from 15s to around 2-3s:
|
||||||
> - 有待继续优化,显示效果比默认三色的 LUT 淡一些
|
> - Further optimization is needed; the display effect is slightly lighter than the default 3-color LUT
|
||||||
> - 刷新时间应该还有优化的空间,理论上来说应该还可以做一个支持局刷的 LUT
|
> - There should be room for optimization of refresh time; theoretically, a LUT supporting partial refresh could also be created
|
||||||
|
|
||||||
```c
|
```c
|
||||||
// OTP location: 0x200, from bw.txt
|
// OTP location: 0x200, from bw.txt
|
||||||
|
|||||||
@@ -1,32 +1,30 @@
|
|||||||
## 开发
|
## Development
|
||||||
|
|
||||||
> **注意:**
|
> **Note:**
|
||||||
> - 推荐使用 [Keil 5.36](https://img.anfulai.cn/bbs/96992/MDK536.EXE) 或以下版本(如遇到 pack 无法下载,可到群文件下载)
|
> - Recommended to use [Keil 5.36](https://img.anfulai.cn/bbs/96992/MDK536.EXE) or lower versions (if pack downloads fail, you can download from the group files)
|
||||||
> - `sdk10` 分支为旧版 SDK 代码,蓝牙协议栈占用的空间小一些,用于支持 128K Flash 芯片(不再更新)
|
> - The `sdk10` branch contains the legacy SDK code with a smaller Bluetooth protocol stack footprint, used to support 128K Flash chips (no longer updated)
|
||||||
|
|
||||||
这里以 nRF51 版本项目为例 (`Keil/EPD-nRF51.uvprojx`),项目配置有几个 `Target`:
|
Using the nRF51 version project as an example (`Keil/EPD-nRF51.uvprojx`), the project configuration has several `Targets`:
|
||||||
|
|
||||||
- `nRF51822_xxAA`: 用于编译 256K Flash 固件
|
- `nRF51822_xxAA`: Used to compile 256K Flash firmware
|
||||||
- `flash_softdevice`: 刷蓝牙协议栈用(只需刷一次)
|
- `flash_softdevice`: Used to flash the Bluetooth protocol stack (only needs to be flashed once)
|
||||||
|
|
||||||
烧录器可以使用 J-Link 或者 DAPLink(可使用 [RTTView](https://github.com/XIVN1987/RTTView) 查看 RTT 日志)。
|
For programmers, you can use J-Link or DAPLink (you can use [RTTView](https://github.com/XIVN1987/RTTView) to view RTT logs).
|
||||||
|
|
||||||
**刷机流程:**
|
**Flashing:**
|
||||||
|
|
||||||
> **注意:** 这是自己编译代码的刷机流程。如不改代码,强烈建议到 [Releases](https://github.com/tsl0922/EPD-nRF5/releases) 下载编译好的固件,**不需要单独下载蓝牙协议栈**,且有 [刷机教程](https://b23.tv/AaphIZp) (没有 Keil 开发经验的,请不要给自己找麻烦去编译)
|
1. Erase all (if you can't flash after erasing in Keil, try using the programmer's host software to erase)
|
||||||
|
2. Switch to `flash_softdevice`, download the Bluetooth protocol stack, **download directly without compiling** (only needs to be flashed once)
|
||||||
|
3. Switch to `nRF51822_xxAA`, compile first then download
|
||||||
|
|
||||||
1. 全部擦除 (Keil 擦除后刷不了的话,使用烧录器的上位机软件擦除试试)
|
### Crystal Oscillator Configuration
|
||||||
2. 切换到 `flash_softdevice`,下载蓝牙协议栈,**不要编译直接下载**(只需刷一次)
|
|
||||||
3. 切换到 `nRF51822_xxAA`,先编译再下载
|
|
||||||
|
|
||||||
### 晶振配置
|
By default, this project does not use an external low-speed crystal oscillator (frequency: `32.768kHz`), because not all boards have this oscillator. Boards without a low-speed oscillator cannot run firmware that enables the low-speed oscillator.
|
||||||
|
If your board has an external low-speed crystal oscillator, it's recommended to modify it to use the external oscillator, as this will make the clock timing more accurate. Here's how to modify it:
|
||||||
本项目默认都没有使用外部低速晶振 (频率: `32.768kHz`),因为不是所有的板子都有这个晶振,没有低速晶振的板子刷了开启低速晶振的固件是运行不起来的。
|
|
||||||
如果你的板子有外部低速晶振,建议修改为使用外部晶振,这样时钟走时会更准确一些。以下是修改方法:
|
|
||||||
|
|
||||||
**nRF51**
|
**nRF51**
|
||||||
|
|
||||||
修改 `main.c`:
|
Modify `main.c`:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_XTAL, \
|
#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_XTAL, \
|
||||||
@@ -36,7 +34,7 @@
|
|||||||
```
|
```
|
||||||
**nRF52**
|
**nRF52**
|
||||||
|
|
||||||
修改 `sdk_config.h`:
|
Modify `sdk_config.h`:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
#define NRF_SDH_CLOCK_LF_SRC 1
|
#define NRF_SDH_CLOCK_LF_SRC 1
|
||||||
@@ -45,28 +43,28 @@
|
|||||||
#define NRF_SDH_CLOCK_LF_ACCURACY 7
|
#define NRF_SDH_CLOCK_LF_ACCURACY 7
|
||||||
```
|
```
|
||||||
|
|
||||||
### 模拟器
|
### Emulator
|
||||||
|
|
||||||
本项目提供了一个可在 Windows 下运行界面代码的模拟器,修改了界面代码后无需下载到单片机即可查看效果。
|
This project provides an emulator that can run GUI code on Windows, allowing you to view the effects after modifying the GUI code without downloading to the microcontroller.
|
||||||
|
|
||||||
仿真效果图:
|
Emulation screenshot:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
**编译方法:**
|
**Compiling:**
|
||||||
|
|
||||||
下载并安装 [MSYS2](https://www.msys2.org) 后,打开 `MSYS2 MINGW64` 命令窗口执行以下命令安装依赖:
|
After downloading and installing [MSYS2](https://www.msys2.org), open the `MSYS2 MINGW64` command window and execute the following commands to install dependencies:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pacman -Syu
|
pacman -Syu
|
||||||
pacman -S make mingw-w64-x86_64-gcc
|
pacman -S make mingw-w64-x86_64-gcc
|
||||||
```
|
```
|
||||||
|
|
||||||
然后 cd 到项目目录,执行 `make -f Makefile.win32` 即可编译出模拟器的可执行文件。
|
Then `cd` to the project directory and execute `make -f Makefile.win32` to compile the emulator executable.
|
||||||
|
|
||||||
**修改界面:**
|
**Modifying the GUI:**
|
||||||
|
|
||||||
修改 GUI 目录下的代码后,重新执行上面的 make 命令编译即可。
|
After modifying the code in the GUI directory, simply re-execute the make command above to compile.
|
||||||
|
|
||||||
> **注意:** GUI 目录下的代码不可依赖平台相关的东西,比如单片机特有的 API 接口,否则在 Windows 下编译会失败。正确的做法是:在调用 `DrawGUI` 函数前就把数据算好并放到 `gui_data_t` 里,然后通过 `data` 参数传进去。
|
> **Note:** Code in the GUI directory must not depend on platform-specific things, such as microcontroller-specific API interfaces, otherwise compilation on Windows will fail. The correct approach is: calculate the data and put it in `gui_data_t` before calling the `DrawGUI` function, then pass it in through the `data` parameter.
|
||||||
|
|||||||
@@ -1,45 +1,45 @@
|
|||||||
## 支持设备
|
## Supported Devices
|
||||||
|
|
||||||
只要是基于 `nrf51822` / `nrf51802` / `nrf52811` / `nrf52810` 的价签,理论上都支持。
|
Theoretically, all electronic shelf labels (ESL) based on `nrf51822` / `nrf51802` / `nrf52811` / `nrf52810` are supported.
|
||||||
|
|
||||||
下面列举几个适配了的价签驱动板。
|
Below are several adapted ESL driver boards.
|
||||||
|
|
||||||
### 老五 4.2 寸价签,黑白双色版本
|
### Laowu 4.2-inch ESL, Black & White Version
|
||||||
|
|
||||||
- MCU:nrf51822
|
- MCU: nrf51822
|
||||||
- RAM:16K
|
- RAM: 16K
|
||||||
- ROM:128K
|
- ROM: 128K
|
||||||
- 驱动:UC8176
|
- Driver: UC8176
|
||||||
- 屏幕引脚:0508090A0B0C0D
|
- Pin Config: `0508090A0B0C0D`
|
||||||
- 线圈引脚:07
|
- Wakeup Pin: `07`
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 老五 4.2 寸价签,黑白红三色版本
|
### Laowu 4.2-inch ESL, Black White Red 3-Color Version
|
||||||
|
|
||||||
- MCU:nrf51802
|
- MCU: nrf51802
|
||||||
- RAM:16K
|
- RAM: 16K
|
||||||
- ROM:256K
|
- ROM: 256K
|
||||||
- 驱动:UC8176
|
- Driver: UC8176
|
||||||
- 屏幕引脚:0A0B0C0D0E0F10
|
- Pin Config: `0A0B0C0D0E0F10`
|
||||||
- 线圈引脚:09
|
- Wakeup Pin: `09`
|
||||||
- LED引脚:03/04/05 (有三个 LED,任选一个使用)
|
- LED Pins: `03/04/05` (Three LEDs available, choose one to use)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 思飞 52810
|
### Sifei 52810
|
||||||
|
|
||||||
- MCU:nrf52810
|
- MCU: nrf52810
|
||||||
- RAM:24K
|
- RAM: 24K
|
||||||
- ROM:192K
|
- ROM: 192K
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
### 盒马/阿里 52811
|
### Hema/Alibaba 52811
|
||||||
|
|
||||||
- MCU:nrf52811
|
- MCU: nrf52811
|
||||||
- RAM:24K
|
- RAM: 24K
|
||||||
- ROM:192K
|
- ROM: 192K
|
||||||
|
|
||||||

|

|
||||||
Reference in New Issue
Block a user