Nano-X GUI Library and TNKernel


Description



    This project provides a "lite" version of the Nano-X (Microwindows) GUI library (www.microwindows.org) that works with TNKernel Real-Time kernel.

    The Nano-X port for TNKernel has been created for the using in the embedded systems without a mouse supporting. All the GUI windows is processed as a single application. A GUI application runs as separate task. This approach works well in the most embedded devices but is not optimal for PDA-like devices (where many independent GUI application are running).

1. Source Files Directory Structure

   The Nano-X port for TNKernel has own source files directories structure (not the same as original Nano-X library):

  • /core        - core Nano-X files and file mwtn_malloc.c - memory allocation functions for TNKernel

  • /drivers   - screen, keyboard, mouse driver for Samsung S3C44B0X microprocessor (test project)

  • /fonts       - embedded fonts source code files

  • /include   - header files

  • /mwin      - Win32 API support files; Win32 widgets library; TNKernel's specific files

2. GUI Message Queue

    The Nano-X port for TNKernel supports the Win32 GUI message handling.

    This is a GUI application message loop processing code:

   A GUI message queue internally is a TNKernel's data queue with the Nano-X MSG structure as the data element. The message queue has a very simple messages priority - the message WM_TIMER always is placed at the end of the queue. When the message queue is empty (it checks automatically by TNKernel's data queue timeout), the WM_PAINT message is processed.

   The PostMessage() function puts the message into the message queue, the SendMessage() function  calls window's callback function immediately. To support real-time operations, use the PostMessage()function to send messages and reduce using of the SendMessage() function.

3. Fonts

   The  Nano-X port for TNKernel uses only an embedded fonts. To add the font to the project, include a font source file into the file core_font.c and add a record about the font into the gen_fonts structure (see a file core_font.c)

4. Keyboard and shaft encoder

   TNKernel processes a keyboard in the separate task (see an example file main_test1.c). A keyboard messages (WM_KEYDOWN,WM_KEYUP,etc) are placed in the message queue by the PostMessage() function calling.

    A shaft encoder events are processed in the encoder interrupt. An encoder rotation (after decimation) is processed as the sequence of the WM_KEYDOWN messages  with the VK_PRIOR/VK_NEXT parameter .

5. Device Drivers

    The Nano-X port for TNKernel contains a drivers for the Samsung S3C44B0X microprocessor. A keyboard and a mouse drivers are actually NULL drivers (a keyboard is processed in the special TNKernel task). A display driver works with B/W LCD display only. An optimized the BitBlt() function increases speed of the bits transfer operation in 30 (!) times in the comparison with the generic BitBlt() function (read and copy each pixel).

6. Memory Management

   A  Nano-X port for TNKernel uses the own memory allocation functions (see file mwtn_malloc.c). A memory allocation system have to be initialized by the tn_malloc_init() function before the Nano-X initialization (see an example file main_test1.c).



Downloads



mwtn-1-0.zip  - A Nano-X (Microwindows) GUI library (subset) source code, adapted for TNKernel.
 - The TNKernel + Nano-X example source code (with TNKernel v.2.2) with the drivers for the Samsung S3C44B0X ARM MCU
  The file also contains a projects for the Rowley CrossWorks Studio(GCC) 1.5, IAR ARM v.4.39, GCC 4.1 ARM ADS 1.2, ARM RealView 2.2, Keil RVC v.3