Replies: 4 comments 10 replies
-
This is a great review.I had already started experimenting with some ideas a few weeks ago. Having written the original ILI9341 and OTM8009a(MIPI) as embedded firmware drivers, this worked fine as a start. From my experience building the OTM8009A(Mipi interface) and the RK043FN48H driver using the LTDC interface with DMA, I have found that these drivers require a greater understanding and integration of the hardware/memory involved. My only other experience is with the SPI displays.
Finding the issues can be frustrating, for example the 240x135 display required offsets of 40 pixels in x and 53 pixels in y. One of the disadvantages suggested was that the C# programmer would require more knowledge. I see that the MDP can exclude classes for deploying to the MCU, but I'm not sure how that could work with an already built library. A modified Graphics approach%%{init: {'theme':'forest'}}%%
graph TD
A[C# graphics application] == Initialization codes/settings === G[Display Controller]
Z[C# Display Initialization codes</br>for Native Flexible drivers</br>Multiple display drivers available]-->A
G === H
H{Bus type?} -- SPI Configuration --- B[SPI]
H -- I2C Configuration --- C[I2C]
A === D[Video Driver]
A === E[MIPI Driver]
A === F[Parallel Driver]
subgraph "nanoFramework</br>_______________________</br>"
A
Z
subgraph Native[Native code]
subgraph Generalised[Initialized at CLR startup from C# ]
B
C
G
H
end
subgraph Specific["Specific to MCU"]
D
E
F
end
end
end
classDef green fill:#9f6,stroke:#333,stroke-width:4px;
class Specific green
class Generalised green
|
Beta Was this translation helpful? Give feedback.
-
We've keep revisiting this UI matter which proves that's a complicated one. To be clear: I'm not diminishing the huge efforts and work hours poured into this by Laurent and specially Terry who keeps working on this. Relentlessly! 😃 Unlike pretty much all the other APIs (and native drivers) that we've modernized (and even replaced) inherited from .NETMF, we keep stuck on the old UI API and namespace. JPEG code dates from 20 years ago! We keep using bitmaps for MCUs with limited RAM. Bitmaps are inefficient, complicated and a terrible waste of RAM. JPEG and PNG are the go to in our MCU world. Displays and UI are hard! I get that. That's why we should rely on a robust and well maintained library. LVGL comes to mind. It's probably the most popular, well maintained and supported library for this. Includes desktop tool to design interfaces. It supports hundreds of different displays. I2C. SPI. Has support for hardware acceleration when that's available on the MCU running it. We have the mechanism in place to build a C# wrapper over the primitive functions offered by the library so this can easily be used by developers coding for nanoFramework. Relying on a modern and well maintained UI library will make a total difference and will bring serious UI capabilities to .NET nanoFramework! |
Beta Was this translation helpful? Give feedback.
-
I get the goal of being able to have a generic init for the driver, controlled by the C# application. Something that strikes me against the initialization of the display from the C# application is that we'll miss display support until a C# application is properly loaded and executing. This prevents the display from being used for boot information, progress report on IFU and such. It may not be necessary or a determent in all situations but it's something to consider. |
Beta Was this translation helpful? Give feedback.
-
Closing this discussion as now implementation is done! |
Beta Was this translation helpful? Give feedback.
-
.NET nanoFramework graphics improvement proposition
Today the graphics library from .NET nanoFramework is available and mainly implemented in native. Over the last year, we've added multiple graphic drivers. We've been adding the ability to specify the screen size and memory buffers independently of the graphic driver.
Here is a summary of the situation:
Some of the challenges discussed on Discord:
Proposed approach for compatible layer
A discussion to extract common elements is present on Discord.
To summarize the discussion:
For the graphics lib, ok for 3 different ones:
This design has some short term and most impactful implications:
As a second step, splitting the rest of the graphic libraries in 2 parts with:
This second step can be improved after the first step. IT will give us a better understanding of what will have to be done. This second step can also have an impact on the unified native graphic driver implementation.
Unified native graphic drivers
Over time, with the addition of multiple drivers based on files, 1 image can only contains 1 driver. See the graphics directory on the nf-interpreter.
All graphics follows the same interface and in the Preset, one file is selected for the build. It's using the existing SPI abstraction layer for this purpose. Today only SPI drivers are natively implemented. While this discussion applies to SPI native based drivers, if some I2C native ones will be implemented, this discussion will apply the same way.
Challenges that need to be overcome:
Here are few propositions to overcome those challenges and advantages/disadvantages
Move all drivers initialization and management into managed code
In this proposition, the idea is to move all the drivers logic in managed code, so the initialization sequence, the rotation, brightness adjustment, etc. The lower native part would only contains the basic logic.
Advantages
Disadvantages
Allow to select the driver from the managed side
In this approach, rather than having one unified driver, we'll keep all the drivers natively and just select the driver during the initialization of the graphic library.
Advantages
Disadvantages
A mix solution with native drivers and possibility to pass managed code
See this proposition as a mix of the previous ones. So you'll get native drivers available and the possibility to pass specific initialization components from the managed side.
While this can seems a good approach it will complexify even more the code and won't help bringing more native drivers. It's still possible to have this one done with the all available native driver approach.
Proposed approach
The proposed approach is to allow to select the driver from the managed side. It offers more advantages and for sure will keep the performance which in this case is the most important. The mix solution with ability to pass more commands or initialization elements should be investigated during this development. It can offer some more flexibility for developers who want to unlock some specific elements of a driver.
Beta Was this translation helpful? Give feedback.
All reactions