630 views
in Platform Packages by
Hi EmWi,

We would like to deploy our single EmWi application to targets that can have different screen resolution, specifically an LCD with 800x480 and another target using 1024x600 but both with RGB565. There will be the same STM32F7 LTDC display controller involved to drive the different size LCDs but with different Touch drivers needed to capture input events.

We would like to support both device targets in a single executable, where at runtime we can detect which LCD is present, then install the correct drivers and bring up EmWi main loop with the correct resolution.

One approach would be to generate different code with a unque profile for each target device in the EWP, but this pushes us into managing two flavours of executable - is there any way to avoid this scenario?

Thanks - Niall.

1 Answer

+1 vote
by
 
Best answer

Hi Niall,

you can manage in your EmWi project several Application components - every designed with different resolution or even different functionality. At the start time of your device (e.g. in the main() function) you decide depending on the available LCD which of the Application components should be instantiated.

In this approach your project should contain a single Profile member configured with the max. screen size (e.g. 1024x600). During the initialization of the Application component and initialization of the viewport you use the actually real screen size instead of the EwScreenSize variable. This could be the adapted initialization sequence:

XPoint screenSize;

[...]

/* Create the applications root object ... */
if ( LCD1 )
{
  rootObject   = (CoreRoot)EwNewObject( YourUnitApplication1, 0 );
  screenSize.X = 1024;
  screenSize.Y = 600;
}
else
{
  rootObject = (CoreRoot)EwNewObject( YourUnitApplication2, 0 );
  screenSize.X = 800;
  screenSize.Y = 480;
}

EwLockObject( rootObject );

/* ... and initialize the application object. */
CoreRoot__Initialize( rootObject, screenSize );

/* Create the viewport object to provide access to the framebuffer */
viewport = EwInitViewport( screenSize, EwNewRect( 0, 0, screenSize.X, screenSize.Y ),
                           0, 255, framebuffer, 0, 0, 0 );

Once the application is instantiated, the remaining main-loop code should be the same as when working with single Application component. The advantage of this approach is, all common components in your project are not duplicated. For example, you can use one and the same Push Button component in every Application, you don't need to have two copies of the Push Button.

Other approach is to use the variants (See Managing variants). With the concept of variants you can create from every GUI component in your project several versions. Which variant is used, can be controlled at the runtime. In your particular case: in the first step develop your GUI components for the biggest resolution. Then create from every component a variant. In the variant you adjust the arrangement, the size and evtl. other attributes like the used fonts or bitmaps so that the resulting variant looks well in the smaller resolution. At the startime, when you are using the small LCD you enable the variant selection. If you are using the big LCD you leave the variant deactivated. Accordingly the GUI components will appear big as designed originally or small as adapted in the variant.

Best regards

Paul Banach

 

by
Very clear - thanks!

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...