Code Monkey home page Code Monkey logo

orsoeric / 2020-07-26-longan-screen-class-demo Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 0.0 2.79 MB

Demo to test the Longan Nano screen driver. Display class interfaces with low level hardware. Screen class provide a sprite based frame buffer meant to reduce CPU use by not redrawing sprites already on screen. Demo uses boot button to cycle between five demos.

Home Page: https://orsoeric.github.io/2020-07-26-Longan-Screen-Class-Demo/main_8cpp.html

License: BSD 3-Clause "New" or "Revised" License

C++ 100.00%
longan-nano gd32vf103 gd32 st7735 display driver 80x160 spi dma gd32v platformio

2020-07-26-longan-screen-class-demo's Introduction

DOXYGEN Documentation

https://orsoeric.github.io/2020-07-26-Longan-Screen-Class-Demo/main_8cpp.html

Blog

Blog Post
Blog Project Page

Longan-Screen-Class-Demo

My objective for this project is to develop drivers for the Longan Nano evaluation board
I need a lightweight LCD screen driver that uses little CPU and print characters on the screen asynchronously
I need a time class to profile execution times and schedule tasks for the hardwired scheduler
I added a LED class to practice with C++ scoping and use of combined header and implementation since I use lots of inline, and inline functions and template functions need to be declared alongside the header anyway
With the latest update I added support for 10x8 "Courier Now" ascii sprites and 16x8 "NSimSun" ascii sprites as well with bug fixes and optimization
With 10x8 sprites there are 8x20 sprites on screen. With 16x8 sprites there are 5x20 sprites on screen
The Screen driver uses between 1.1% to 2.4% of the CPU when scheduled every 100us depending on workload

Demos

1 - clear screen to random color every 500ms
2 - print a character every 1ms
3 - print a colored character every 1ms
4 - print a string every 25ms
5 - print a colored string every 25ms
6 - print number on screen with reserved space and left/right adjust
7 - profiler with engineering number format, four significant digits and si suffix and time profiling and cpu usage of the demos
8 - Profiler with sprites pending counter
9 - Profiler with colors
10 - Constant workload demo with CPU profiler

Gif of the demo in action
2020-07-31 Longan Nano Demo

Youtube video of the demo in action with brief explaination
VID

Conclusions

The interrupts, clock system and DMA are more or less figured out

The driver for the LCD is divided in a Display class that handles the HAL, and a Screen class that handles the sprite based abstraction layer. This allows to massively reduce the bandwidth by not updating sprites already on screen and allow to hopefully change screen in the future without much trouble thanks to the ABI interface
The Chrono class allows to measure time using the integrated 64bit 27MHz SysTick timer, and allow to build an hardwired scheduler for my tasks
For the next step I'm going to build a template application I can start with for a fresh project
My first application will be the development of the motor controller for my OrangeBot robotic platform, with the aim of increasing the precision of the controls, and give an healthy amount of feedback on the screen, including voltage, power, currents, encoders, errors and more

2020-07-26-longan-screen-class-demo's People

Contributors

orsoeric avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

2020-07-26-longan-screen-class-demo's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.