This example illustrates how to propagate custom events from the hardware to MicroUI. MicroUI already supports generic events like touch, button and joystick. Hardware events (e.g. sensors movement) can be used for specific display action upon occurrence.
See the Device Developer's Guide at section Inputs (13.5) for more information.
-
Create a platform with at least the UI module.
-
Before building this platform, some configuration is required. In the xxx-configuration project in the microui/microui.xml file, add the following xml element as the first eventgenerator.
<eventgenerator name="CUSTOM" class="com.microej.example.customevent.CustomEventGenerator"/>
-
Build your platform.
-
In the /com.microej.example.customevent/src/main/c folder
- Choose the file corresponding to the board/RTOS used
- Replace the application entry point in the /xxx-bsp project by the file selected in the previous step
-
In MicroEJ, create a launch configuration for the Java application
- Set the name to "CustomEvent_Build"
- In the Main tab
- Set the Project field to "com.microej.example.customevent"
- Set the Main type field to "CustomEventExample"
- In the Execution tab
- In the Target frame, set the JPF to the one built in step #3
- In the Execution frame, select the Execute on EmbJPF radio button
-
Run the launch configuration.
-
Compile, link and flash the xxx-bsp project.
- JRE 7 (or later) x86.
- MicroEJ 4.0 or later.
- Java platform with (at least) EDC-1.2, MICROUI-2.0.
- src/main/java
- Java sources
- src/main/c
- Entry points (main.c) examples for the given board/RTOS that generates custom events.
All dependencies are retrieved transitively by Ivy resolver.
N/A
None.