|
1 | | -## 开发 |
| 1 | +## Development |
2 | 2 |
|
3 | | -> **注意:** |
4 | | -> - 推荐使用 [Keil 5.36](https://img.anfulai.cn/bbs/96992/MDK536.EXE) 或以下版本(如遇到 pack 无法下载,可到群文件下载) |
5 | | -> - `sdk10` 分支为旧版 SDK 代码,蓝牙协议栈占用的空间小一些,用于支持 128K Flash 芯片(不再更新) |
| 3 | +> **Note:** |
| 4 | +> - 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) |
| 5 | +> - The `sdk10` branch contains the legacy SDK code with a smaller Bluetooth protocol stack footprint, used to support 128K Flash chips (no longer updated) |
6 | 6 |
|
7 | | -这里以 nRF51 版本项目为例 (`Keil/EPD-nRF51.uvprojx`),项目配置有几个 `Target`: |
| 7 | +Using the nRF51 version project as an example (`Keil/EPD-nRF51.uvprojx`), the project configuration has several `Targets`: |
8 | 8 |
|
9 | | -- `nRF51822_xxAA`: 用于编译 256K Flash 固件 |
10 | | -- `flash_softdevice`: 刷蓝牙协议栈用(只需刷一次) |
| 9 | +- `nRF51822_xxAA`: Used to compile 256K Flash firmware |
| 10 | +- `flash_softdevice`: Used to flash the Bluetooth protocol stack (only needs to be flashed once) |
11 | 11 |
|
12 | | -烧录器可以使用 J-Link 或者 DAPLink(可使用 [RTTView](https://github.com/XIVN1987/RTTView) 查看 RTT 日志)。 |
| 12 | +For programmers, you can use J-Link or DAPLink (you can use [RTTView](https://github.com/XIVN1987/RTTView) to view RTT logs). |
13 | 13 |
|
14 | | -**刷机流程:** |
| 14 | +**Flashing Process:** |
15 | 15 |
|
16 | | -> **注意:** 这是自己编译代码的刷机流程。如不改代码,强烈建议到 [Releases](https://github.com/tsl0922/EPD-nRF5/releases) 下载编译好的固件,**不需要单独下载蓝牙协议栈**,且有 [刷机教程](https://b23.tv/AaphIZp) (没有 Keil 开发经验的,请不要给自己找麻烦去编译) |
| 16 | +> **Note:** This is the flashing process for self-compiled code. If you're not modifying the code, it's strongly recommended to download pre-compiled firmware from [Releases](https://github.com/tsl0922/EPD-nRF5/releases), which **does not require separately downloading the Bluetooth protocol stack**, and there's a [flashing tutorial](https://b23.tv/AaphIZp) available (if you don't have Keil development experience, don't create trouble for yourself by compiling) |
17 | 17 |
|
18 | | -1. 全部擦除 (Keil 擦除后刷不了的话,使用烧录器的上位机软件擦除试试) |
19 | | -2. 切换到 `flash_softdevice`,下载蓝牙协议栈,**不要编译直接下载**(只需刷一次) |
20 | | -3. 切换到 `nRF51822_xxAA`,先编译再下载 |
| 18 | +1. Erase all (if you can't flash after erasing in Keil, try using the programmer's host software to erase) |
| 19 | +2. Switch to `flash_softdevice`, download the Bluetooth protocol stack, **download directly without compiling** (only needs to be flashed once) |
| 20 | +3. Switch to `nRF51822_xxAA`, compile first then download |
21 | 21 |
|
22 | | -### 晶振配置 |
| 22 | +### Crystal Oscillator Configuration |
23 | 23 |
|
24 | | -本项目默认都没有使用外部低速晶振 (频率: `32.768kHz`),因为不是所有的板子都有这个晶振,没有低速晶振的板子刷了开启低速晶振的固件是运行不起来的。 |
25 | | -如果你的板子有外部低速晶振,建议修改为使用外部晶振,这样时钟走时会更准确一些。以下是修改方法: |
| 24 | +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. |
| 25 | +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: |
26 | 26 |
|
27 | 27 | **nRF51** |
28 | 28 |
|
29 | | -修改 `main.c`: |
| 29 | +Modify `main.c`: |
30 | 30 |
|
31 | 31 | ```c |
32 | 32 | #define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_XTAL, \ |
|
36 | 36 | ``` |
37 | 37 | **nRF52** |
38 | 38 |
|
39 | | -修改 `sdk_config.h`: |
| 39 | +Modify `sdk_config.h`: |
40 | 40 |
|
41 | 41 | ```c |
42 | 42 | #define NRF_SDH_CLOCK_LF_SRC 1 |
|
45 | 45 | #define NRF_SDH_CLOCK_LF_ACCURACY 7 |
46 | 46 | ``` |
47 | 47 |
|
48 | | -### 模拟器 |
| 48 | +### Emulator |
49 | 49 |
|
50 | | -本项目提供了一个可在 Windows 下运行界面代码的模拟器,修改了界面代码后无需下载到单片机即可查看效果。 |
| 50 | +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. |
51 | 51 |
|
52 | | -仿真效果图: |
| 52 | +Emulation screenshot: |
53 | 53 |
|
54 | 54 |  |
55 | 55 |
|
56 | 56 |
|
57 | | -**编译方法:** |
| 57 | +**Compiling:** |
58 | 58 |
|
59 | | -下载并安装 [MSYS2](https://www.msys2.org) 后,打开 `MSYS2 MINGW64` 命令窗口执行以下命令安装依赖: |
| 59 | +After downloading and installing [MSYS2](https://www.msys2.org), open the `MSYS2 MINGW64` command window and execute the following commands to install dependencies: |
60 | 60 |
|
61 | 61 | ```bash |
62 | 62 | pacman -Syu |
63 | 63 | pacman -S make mingw-w64-x86_64-gcc |
64 | 64 | ``` |
65 | 65 |
|
66 | | -然后 cd 到项目目录,执行 `make -f Makefile.win32` 即可编译出模拟器的可执行文件。 |
| 66 | +Then `cd` to the project directory and execute `make -f Makefile.win32` to compile the emulator executable. |
67 | 67 |
|
68 | | -**修改界面:** |
| 68 | +**Modifying the GUI:** |
69 | 69 |
|
70 | | -修改 GUI 目录下的代码后,重新执行上面的 make 命令编译即可。 |
| 70 | +After modifying the code in the GUI directory, simply re-execute the make command above to compile. |
71 | 71 |
|
72 | | -> **注意:** GUI 目录下的代码不可依赖平台相关的东西,比如单片机特有的 API 接口,否则在 Windows 下编译会失败。正确的做法是:在调用 `DrawGUI` 函数前就把数据算好并放到 `gui_data_t` 里,然后通过 `data` 参数传进去。 |
| 72 | +> **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. |
0 commit comments