To enble LCD on BRD4001A Wireless Starter Kit Mainboards:
1.
A. Open efr32mg1p232f256gm48.hwconf
B. Select "DefaultMode Peripherals" tab
C. Check "SPI Display"
2.
B. Go to "Plugin" tab
C. Enable "Graphics Library"
D. Generate code
To create a periodic event
1.
A. Open Z3LightSoc.isc
B. Go to "Includes" tab
C. Press New button of "Custom Events"
D. Naming your own periodic event to periodicEventControl/periodicEventFunction
E. Generate Code
2. Open Z3LightSoc_callbacks.c and add the following codes:
A. Add "#include "glib.h"", "EmberEventControl periodicEventControl;", and "extern GLIB_Context_t glibContext;"
B. Add "GRAPHICS_Init();" in emberAfMainInitCallback() to initialize LCD graphics.
C. Call "emberEventControlSetDelayMS(periodicEventControl, 1000);" in emberAfMainInitCallback() to initialize first call to periodicEventControl.
D. Add the following periodicEventFunction to be called every seconds and redraw "EFR32 Hello App!" message from top to bottom on LCD.
uint8_t y=5;
void periodicEventFunction(void)
{
emberEventControlSetInactive(periodicEventControl);
GLIB_clear(&glibContext);
GLIB_drawString(&glibContext, "EFR32 Hello App!", 17, 5, y, 0);
y+=5;
if(y>120)
y=5;
DMD_updateDisplay();
emberEventControlSetDelayMS(periodicEventControl, 1000);
}
Build and download FW to EFR32 and you can see "EFR32 Hello App!" move from top to bottom of LCD on BRD4001A Wireless Starter Kit Mainboards.
No comments:
Post a Comment