Skip to content

Commit 4303c58

Browse files
committed
update documents
1 parent 1fae627 commit 4303c58

File tree

4 files changed

+175
-15
lines changed

4 files changed

+175
-15
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
- A **CMSIS-Pack** for ease of use
1919
- Examples and Documents
2020

21-
![PositionInEcosystem](./documentation/pictures/ReadmeOverview.png)
21+
<img src="./documentation/pictures/ReadmeOverview.png" alt="PositionInEcosystem" style="zoom:67%;" />
2222

2323
**Position in Ecosystem:**
2424

@@ -81,7 +81,7 @@ Potential users of Arm-2D may have different backgrounds and purposes. Whether y
8181
- [Where to Get Started](#where-to-get-started)
8282
- [Table of Content](#table-of-content)
8383
- [Features](#features)
84-
- [In this version (ver1.1.3-dev)](#in-this-version-ver113-dev)
84+
- [In this version (ver1.1.3)](#in-this-version-ver113-dev)
8585
- [New Features Planned in the Future](#new-features-planned-in-the-future)
8686
- [1 Introduction](#1-introduction)
8787
- [1.1 The Background](#11-the-background)
@@ -101,7 +101,7 @@ Potential users of Arm-2D may have different backgrounds and purposes. Whether y
101101

102102
## Features
103103

104-
### In this version (ver1.1.3-dev)
104+
### In this version (ver1.1.3)
105105

106106
The Arm-2D library provides **Low-Level 2D Image Processing Services** mainly used in **Deep Embedded Display system**. The supported features include but not limited to:
107107

@@ -376,4 +376,4 @@ Thank you for your time.
376376

377377
***Arm-2D Development Team.***
378378

379-
27 April 2023
379+
13 May 2023

documentation/how_to_deploy_the_arm_2d_library.md

Lines changed: 171 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
This document describes how to deploy the **Arm-2D** library to your existing MDK projects. If you are not familiar with **Arm-2D**, please start from the **[README](../README.md)** first.
44

55
### Table of Contents
6+
67
- [1 How to get the Arm-2D](#1-how-to-get-the-arm-2d)
78
- [2 How to Deploy Arm-2D](#2-how-to-deploy-arm-2d)
89
- [2.1 Deploy Using CMSIS-Pack in MDK](#21-deploy-using-cmsis-pack-in-mdk)
910
- [3 Helper Services and Extras](#3-helper-services-and-extras)
1011
- [3.1 Preparation](#31-preparation)
11-
- [3.2 Display Adapter Service](#32-display-adapter-service)
12+
- [3.2 Add Display Adapter Service](#32-add-display-adapter-service)
13+
- [3.3 Configue the Display Adapter Service](#33-configue-the-display-adapter-service)
14+
- [3.4 Implement the External Reference Timer](#34-implement-the-external-reference-timer)
15+
- [3.5 Verifying The Porting Result](#35-verifying-the-porting-result)
1216
- [4 Example Projects](#4-example-projects)
1317

1418

@@ -40,8 +44,6 @@ There are three methods to get Arm-2D:
4044

4145
## 2 How to Deploy Arm-2D
4246

43-
44-
4547
### 2.1 Deploy Using CMSIS-Pack in MDK
4648

4749
1. Open the Run-Time Environment configuration dialog using menu "Project->Manage->Run-Time Environment" as shown in **Figure 2-6**.
@@ -155,13 +157,171 @@ int32_t Disp0_DrawBitmap (uint32_t x, uint32_t y, uint32_t width, uint32_t heigh
155157

156158
Here, `disp_ram` points to the memory space reserved for the LCD display RAM.
157159

158-
**IMPORTANT**: When exiting the `Disp0_DrawBitmap()`, Arm-2D assumes that the target frame buffer has already been flushed to the target screen.
160+
**IMPORTANT**:
161+
162+
1. When exiting the `Disp0_DrawBitmap()`, Arm-2D assumes that the target frame buffer has already been flushed to the target screen.
163+
2. **Please verify the `Disp0_DrawBitmap()` functional correctness without Arm-2d before moving to the next steps.**
164+
165+
166+
167+
### 3.2 Add Display Adapter Service
168+
169+
Deploying Display Adatper service in MDK is simple:
170+
171+
1. Open RTE dialog (as shown in **Figure 3-2**)
172+
2. Expand `Acceleration::Arm-2D Helper`
173+
3. Select the **PFB** and increase the number of **Display Adapter** to `1`.
174+
**NOTE**: If you have multiple screens, please set the number accordingly.
175+
176+
4. If you see any warning message in yellow, please click the Resolve button. The warning should disappear.
177+
178+
5. Click **OK** button to close the RTE dialog.
179+
180+
181+
182+
**Figure 3-2 Selecting Display Adapter Service in RTE**
183+
184+
![AddDisplayAdapter](E:\git\Arm-2D\documentation\pictures\DisplayAdapter.png)
185+
186+
After that, you will see two files, i.e. `arm_2d_disp_adapter_0.c` and `arm_2d_disp_adapter_0.h` have been added to the project manager under the **Acceleration** group.
187+
188+
**IMPORTANT**: unless necessary, please do **NOT** modify the content of the `arm_2d_disp_adapter_0.c`, as new versions of Arm-2D often introduce new features to the Display Adatper Service, as long as you haven't modified anything in the `arm_2d_disp_adapter_0.c`, updating to the latest version would be an easy task nothing more than right-clicking the file in the project manager and updating to the latest version in the pop-up menu.
189+
190+
**You have to initalise the Display Adapter service before using it**.
191+
192+
Include `arm_2d_disp_adapters.h` in your c source code and add the following code to the `main()` function:
193+
194+
```c
195+
#include "arm_2d_helper.h"
196+
#include "arm_2d_disp_adapters.h"
197+
#include "arm_2d_scenes.h"
198+
199+
int main (void)
200+
{
201+
...
202+
arm_irq_safe {
203+
arm_2d_init();
204+
}
205+
206+
/* initialize the display adapter 0 service */
207+
disp_adapter0_init();
208+
209+
while (1) {
210+
/* the task function of the display adapter 0 service */
211+
disp_adapter0_task();
212+
}
213+
}
214+
```
215+
216+
Or the thread function if you want to run Arm-2d in an RTOS environment:
217+
218+
```c
219+
#include "arm_2d_helper.h"
220+
#include "arm_2d_disp_adapters.h"
221+
#include "arm_2d_scenes.h"
222+
223+
#ifndef LCD_TARGET_FPS
224+
# define LCD_TARGET_FPS 30
225+
#endif
226+
227+
__NO_RETURN
228+
void app_2d_main_thread (void *argument)
229+
{
230+
arm_irq_safe {
231+
arm_2d_init();
232+
}
233+
234+
/* initialize the display adapter 0 service */
235+
disp_adapter0_init();
236+
237+
while(1) {
238+
//! retrieve the number of system ticks
239+
uint32_t wTick = osKernelGetTickCount();
240+
while(arm_fsm_rt_cpl != disp_adapter0_task());
241+
242+
//! lock frame rate
243+
osDelayUntil(wTick + (1000 / LCD_TARGET_FPS));
244+
}
245+
246+
//osThreadExit();
247+
}
248+
```
249+
250+
251+
252+
### 3.3 Configue the Display Adapter Service
253+
254+
You should configure the Display Adapter service before using it. All the configurations of a Display Adapter service are stored in the corresponding header file, e.g. `arm_2d_disp_adapter_0.h`. In MDK, all configuration work can be done through the GUI wizard, as shown in **Figure 3-3**.
255+
256+
**Figure 3-3 Configure the Display Adapter Using the Wizard**
257+
258+
![ConfigureTheDisplayAdapter](./pictures/ConfigureDisplayAdapter.png)
259+
260+
261+
262+
There are many options available in the list, and we only explain those important and commonly used ones here:
263+
264+
**Table 3-1 The Important and Commonly Used Options of the Display Adapter Service**
265+
266+
| Options | Value | Default | Description |
267+
| --------------------------------------------------- | ------------------------ | --------------- | ------------------------------------------------------------ |
268+
| Select the screen colour depth | 8bits/16bits/32bits | 16bits | The number of bits per pixel. For monochrome LCD and e-ink LCD, please select the 8bits. |
269+
| Width of the screen | 8...32767 | 320 | The width of the target screen |
270+
| Height of the screen | 8...32767 | 240 | The height of the target screen |
271+
| Width of the PFB block | 1...32767 | 320 | The width of a partial frame buffer (PFB). If possible, please use the screen width here. |
272+
| Height of the PFB block | 1...32767 | 240 | The height of a partial frame buffer (PFB). It is recommended to start from 1/10 of the height of the screen. If possible, do not use a value smaller than 8. |
273+
| Width Alignment of generated PFBs | 1/2/4...128 pixels | 1 pixel | The horizontal pixel alignment of the PFBs sending to the `DispN_DrawBitmap()` for flushing. It is important for LCDs that have certain pixel alignment requirements. For example, 8 pixel alignment for monochrome LCDs and 4 pixel alignment for e-inks. |
274+
| Height Alignment of generated PFBs | 1/2/4...128 pixels | 1 pixel | The vertical pixel alignment of the PFBs sending to the `DispN_DrawBitmap()` for flushing. It is important for LCDs that have certain pixel alignment requirements. For example, 8 pixel alignment for some 12864 monochrome LCDs. |
275+
| PFB Block Count | 1...32767 | 1 | The number of PFB blocks in the pool. Please set it to `2` or more when using Asynchornose flushing mode; otherwise, keep it as `1`. |
276+
| Number of iterations | 0...32767 | 30 | Calculate the real-time FPS for every specified number of frames. Set it to `0` to disable the real-time FPS calculation. |
277+
| FPS Calculation Mode | Render-Only FPS/Real FPS | Render-Only FPS | **Render-Only FPS**: record the time used by the renderer and use it to calculate the FPS without taking LCD latency into consideration. <br />**Real FPS**: calculate the real FPS people actually see on the screen. |
278+
| Swap the high and low bytes | Select/Unselect | Unselect | Some RGB565 LCDs require swapping the high and the low bytes for each pixel. Please **ONLY** enable this option when there is no hardware solution to swap the high and low bytes. |
279+
| Enable the helper service for Asynchronous Flushing | Select/Unselect | Unselect | By selecting this option, a dedicated helper service will be provided for asynchronous flushing mode. For more, please read the guidance in the header file. |
280+
| Disable the default Scene | Select/Unselect | Unselect | A Display Adapter brings a default scene for indicating successful porting. You can disable it by selecting this option. |
281+
| Disable the navigation layer | Select/Unselect | Unselect | A Display Adapter uses the navigation layer (which is floating above the content created by users) to show real-time FPS and version info. You should disable it before the product releasing or disable it to add your own navigation layer. |
282+
283+
284+
285+
**NOTE**:
286+
287+
- If the target device cannot afford the full frame buffer, please set the PFB size (i.e. width and/or height) to a smaller value. **We recommend you start with a 1/10 full frame buffer**, as it actually isn't 10x slower than using a full frame buffer.
288+
- For **monochrome LCDs**, you should use 8-bit colour depth and pack every 8 pixels into one byte in the `Disp0_DrawBitmap()`. Don't forget to set the PFB alignment to 8 horizontally or vertically depending on the monochrome LCD pixel layout.
289+
- For **2-bit e-ink LCDs**, you should use 8-bit colour depth and pack every 4 pixels into one byte in the `Disp0_DrawBitmap()`. Don't forget to set the PFB alignment to 4 horizontally or vertically depending on the e-ink LCD pixel layout.
290+
- For **4-bit e-ink LCDs**, you should use 8-bit colour depth and pack every 2 pixels into one byte in the `Disp0_DrawBitmap()`. Don't forget to set the PFB alignment to 2 horizontally or vertically depending on the e-ink LCD pixel layout.
291+
- Please make sure the stack size is no less than 3K Bytes.
292+
293+
294+
295+
### 3.4 Implement the External Reference Timer
296+
297+
Arm-2D helper service relies on an external reference timer which we should implement:
298+
299+
**Table 3-2 The Interface for Accessing the External Timer**
300+
301+
| Interface Prototype | Description |
302+
| ---------------------------------------------------------- | ------------------------------------------------------------ |
303+
| int64_t arm_2d_helper_get_system_timestamp(void) | a function that returns the number of ticks (timestamp) of the reference timer since reset. |
304+
| uint32_t arm_2d_helper_get_reference_clock_frequency(void) | the frequency of the reference timer. |
305+
306+
307+
308+
**We highly recommand you to install perf_counter from Pack-Installer, [Keil Website](https://www.keil.arm.com/packs/) or [its Github repo](https://github.com/GorgonMeducer/perf_counter/releases) to simplify this process.** You have to initialize the perf_counter before using Arm-2D. For more, please read the [guidance here](https://github.com/GorgonMeducer/perf_counter/blob/main/README.md).
309+
310+
311+
312+
### 3.5 Verifying The Porting Result
313+
314+
After finished steps above, if everything goes well, you should see a screen as shown in **Figure 3-4**. If the colour doesn't look right and the LCD uses RGB565, try to swap the high and low bytes for each pixel.
315+
316+
**Figure 3-4 The Look of The Default Scene In A Succsessuf Porting**
159317

318+
![](./pictures/DispAdapterDefaultScene.gif)
160319

161320

162-
### 3.2 Display Adapter Service
163321

322+
If you encounter any problems, please feel free to raise an issue.
164323

324+
Enjoy.
165325

166326

167327

@@ -170,9 +330,9 @@ Here, `disp_ram` points to the memory space reserved for the LCD display RAM.
170330
**Table 3-1 Summary**
171331

172332

173-
| Projects | Description | Folder | Note |
174-
| ---------------------------------- | ------------------------------------------------------------ | ------------------------------------------- | ------------------------- |
175-
| benchmark | It is an **ALL-IN-ONE** example that demonstrates almost all features provided by Arm-2D. By setting different PFB sizes, you can evaluate the 2D image processing capability for the target system. | examples/benchmark | Can be used as benchmark. |
176-
| watch_panel | It is a dedicated example of a smart-watch-like panel. A pointer and two gears rotate at different angular velocities on a translucent watch panel with a dynamic background. | examples/watch_panel | Can be used as benchmark |
177-
| \[template\]\[bare-metal\]\[pfb\] | It is a project template for the bare-metal environment. | examples/\[template\]\[bare-metal\]\[pfb\] | Project Template |
178-
| \[template\]\[cmsis-rtos2\]\[pfb\] | It is a project template for the RTOS environment, which use CMSIS-RTO2 as an example to show how Arm-2D can work with an RTOS. | examples/\[template\]\[cmsis-rtos2\]\[pfb\] | Project Template |
333+
| Projects | Description | Folder | Note |
334+
| ---------------------------------- | ------------------------------------------------------------ | ------------------------------------------- | ---------------------- |
335+
| benchmark | It is an **ALL-IN-ONE** example that demonstrates almost all features provided by Arm-2D. By setting different PFB sizes, you can evaluate the 2D image processing capability for the target system. | examples/benchmark | **Used as benchmark.** |
336+
| watch_panel | It is a dedicated example of a smart-watch-like panel. A pointer and two gears rotate at different angular velocities on a translucent watch panel with a dynamic background. | examples/watch_panel | **Used as benchmark** |
337+
| \[template\]\[bare-metal\]\[pfb\] | It is a project template for the bare-metal environment. | examples/\[template\]\[bare-metal\]\[pfb\] | Project Template |
338+
| \[template\]\[cmsis-rtos2\]\[pfb\] | It is a project template for the RTOS environment, which use CMSIS-RTOS2 as an example to show how Arm-2D can work with an RTOS. | examples/\[template\]\[cmsis-rtos2\]\[pfb\] | Project Template |
Loading
44.2 KB
Loading

0 commit comments

Comments
 (0)