LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
emWin graphics dual core example using emWin library

Macros

#define ID_FRAMEWIN_0   (GUI_ID_USER + 0x0A)
 
#define ID_TEXT_0   (GUI_ID_USER + 0x0B)
 
#define ID_BUTTON_0   (GUI_ID_USER + 0x0C)
 
#define ID_BUTTON_1   (GUI_ID_USER + 0x0D)
 
#define ID_BUTTON_2   (GUI_ID_USER + 0x0E)
 
#define ID_TEXT_1   (GUI_ID_USER + 0x10)
 
#define ID_TEXT_2   (GUI_ID_USER + 0x11)
 
#define ID_TEXT_3   (GUI_ID_USER + 0x12)
 
#define ID_TEXT_4   (GUI_ID_USER + 0x13)
 
#define ID_TEXT_5   (GUI_ID_USER + 0x14)
 
#define ID_EDIT_0   (GUI_ID_USER + 0x15)
 
#define ID_EDIT_1   (GUI_ID_USER + 0x16)
 
#define TSC_CHECK_DELAY   (20)
 
#define GUI_BUF_ADDR   0x28050000
 GUI buffers required for emwin library.
 
#define GUI_NUMBYTES   ((1024 * 1024) * 2)
 
#define GUI_BLOCKSIZE   (0x128)
 
#define GUI_BUF   LOCATE_AT(GUI_BUF_ADDR)
 
#define TSC_CHECK_DELAY   (20)
 

Functions

static char * ipaddr_ntoa_r (uint32_t addr, char *buf, int buflen)
 
static void lcd_update_values (WM_HWIN hWin_up)
 
static void lcd_update_remoteip (uint32_t new_remote_ip)
 
static void lcd_update_hostip (uint32_t host_ip)
 
void SysTick_Enable (uint32_t period)
 System Tick enable function.
 
void EMWIN_Init (void)
 emWin dual core example initialisation function
 
void emwin_tasks (void)
 emWin dual core example task
 
void SysTick_Disable (void)
 System Tick disable function.
 
void SysTick_Handler (void)
 System Tick module IRQ handler function.
 

Variables

static volatile uint32_t host_ip_addr
 
static volatile uint32_t remote_ip_addr
 
static volatile int start = 0
 
static volatile short counter = 0
 
static WM_HWIN hWin
 
volatile int tsc_init_done = 0
 Touch screen initialisation done flag.
 
GUI_BUF U32 GUI_Memory [GUI_NUMBYTES/sizeof(U32)]
 
U32 GUI_Memory_Size = GUI_NUMBYTES
 
U32 GUI_Block_Size = GUI_BLOCKSIZE
 
static uint32_t saved_period
 
static int16_t old_tmp_x = -1
 
static int16_t old_tmp_y = -1
 
volatile uint32_t systick_timems
 System Tick count value.
 
volatile int tsc_init_done
 Touch screen initialisation done flag.
 
uint32_t SystemCoreClock
 Current system clock rate, mainly used for sysTick.
 

Detailed Description

This example demonstartes the graphics example using emWin library. The example has 2 modules. The emWin graphics module implements the grpahics GUI for the application. This module also integrates touch screen driver. The graphics application can be run on M4/M0 core of LPC43xx. The SysTick module provides the system ticks functionality in stand-alone configuration.

Build procedure: LPCOpen 18xx/43xx build instructions

Submit bug reports for LPCOpen code here.

The System tick module implements the system tick functionality for LPC43XX cores in stand-alone configuration. The system tick functions are used in emWin graphics module. For Cortex-M4 core, it will use the SysTick timer module. For Cortex-M0 core, it uses the RITimer module.

Macro Definition Documentation

#define GUI_BLOCKSIZE   (0x128)

GUI block size

Definition at line 140 of file example_emWin.c.

#define GUI_BUF   LOCATE_AT(GUI_BUF_ADDR)

Macro to locate the GUI buffer

Definition at line 141 of file example_emWin.c.

#define GUI_BUF_ADDR   0x28050000

GUI buffers required for emwin library.

Start address of GUI buffer in SDRAM

Definition at line 138 of file example_emWin.c.

#define GUI_NUMBYTES   ((1024 * 1024) * 2)

Size of GUI buffer in No. of bytes

Definition at line 139 of file example_emWin.c.

#define ID_BUTTON_0   (GUI_ID_USER + 0x0C)

Definition at line 98 of file example_emWin.c.

#define ID_BUTTON_1   (GUI_ID_USER + 0x0D)

Definition at line 99 of file example_emWin.c.

#define ID_BUTTON_2   (GUI_ID_USER + 0x0E)

Definition at line 100 of file example_emWin.c.

#define ID_EDIT_0   (GUI_ID_USER + 0x15)

Definition at line 106 of file example_emWin.c.

#define ID_EDIT_1   (GUI_ID_USER + 0x16)

Definition at line 107 of file example_emWin.c.

#define ID_FRAMEWIN_0   (GUI_ID_USER + 0x0A)

Widget IDs used in Frame window

Definition at line 96 of file example_emWin.c.

#define ID_TEXT_0   (GUI_ID_USER + 0x0B)

Definition at line 97 of file example_emWin.c.

#define ID_TEXT_1   (GUI_ID_USER + 0x10)

Definition at line 101 of file example_emWin.c.

#define ID_TEXT_2   (GUI_ID_USER + 0x11)

Definition at line 102 of file example_emWin.c.

#define ID_TEXT_3   (GUI_ID_USER + 0x12)

Definition at line 103 of file example_emWin.c.

#define ID_TEXT_4   (GUI_ID_USER + 0x13)

Definition at line 104 of file example_emWin.c.

#define ID_TEXT_5   (GUI_ID_USER + 0x14)

Definition at line 105 of file example_emWin.c.

#define TSC_CHECK_DELAY   (20)

Definition at line 59 of file lpc43xx_systick.c.

#define TSC_CHECK_DELAY   (20)

TSC status check delay

Definition at line 112 of file example_emWin.c.

Function Documentation

void EMWIN_Init ( void  )

emWin dual core example initialisation function

The function initialises the LCD controller & Touch screen controller. It will register the IPC callbacks to receive graphics information from other processor core. In stand-alone configuration, it will also create the emWin Widget framewindow of the graphics application. This function is called by main() only when EXAMPLE_EMWIN is defined.

Returns
None

Definition at line 463 of file example_emWin.c.

void emwin_tasks ( void  )

emWin dual core example task

In stand-alone configuration, it will update the fields on LCD screen. In FreeRTOS/uCOS-III configurations, this will create the LCD & Touch Screen application tasks. Called by dual core main() only when EXAMPLE_EMWIN is defined.

Returns
None

Definition at line 551 of file example_emWin.c.

static char* ipaddr_ntoa_r ( uint32_t  addr,
char *  buf,
int  buflen 
)
static

Convert hexadecimal No. to ASCII string function

Definition at line 153 of file example_emWin.c.

static void lcd_update_hostip ( uint32_t  host_ip)
static

Update Host IP address IP callback function

Definition at line 318 of file example_emWin.c.

static void lcd_update_remoteip ( uint32_t  new_remote_ip)
static

Update Remote IP address IP callback function

Definition at line 308 of file example_emWin.c.

static void lcd_update_values ( WM_HWIN  hWin_up)
static

Update EDIT boxes on LCD function

Definition at line 193 of file example_emWin.c.

void SysTick_Disable ( void  )

System Tick disable function.

Returns
None The function will disbale the system ticks

Definition at line 213 of file lpc43xx_systick.c.

void SysTick_Enable ( uint32_t  period)

System Tick enable function.

LCD appplication task function for FreeRTOS & uCOS-III

Parameters
period: System Tick period
Returns
None This function will configure the system ticks as per mentioned period value. For Cortex-M4 core, it will configure & enable the SysTick timer module. For Cortex-M0 core it will configure & enable the the RITimer module.

Definition at line 202 of file lpc43xx_systick.c.

void SysTick_Handler ( void  )

System Tick module IRQ handler function.

Returns
None The function will handle the System Tick module interrupt events. It will update the system tick count value. If Touch screen is enabled, it will also check for the Touch screen events at periodic intervals (interval specified by TSC_CHECK_DELAY)

Definition at line 226 of file lpc43xx_systick.c.

Variable Documentation

volatile short counter = 0
static

Definition at line 83 of file example_emWin.c.

U32 GUI_Block_Size = GUI_BLOCKSIZE

GUI block size

Definition at line 145 of file example_emWin.c.

GUI_BUF U32 GUI_Memory[GUI_NUMBYTES/sizeof(U32)]

GUI buffer

Definition at line 143 of file example_emWin.c.

U32 GUI_Memory_Size = GUI_NUMBYTES

GUI buffer size

Definition at line 144 of file example_emWin.c.

volatile uint32_t host_ip_addr
static

Global variables used by emWin application

Definition at line 80 of file example_emWin.c.

WM_HWIN hWin
static

Definition at line 84 of file example_emWin.c.

int16_t old_tmp_x = -1
static

Definition at line 56 of file lpc43xx_systick.c.

int16_t old_tmp_y = -1
static

Definition at line 56 of file lpc43xx_systick.c.

volatile uint32_t remote_ip_addr
static

Definition at line 81 of file example_emWin.c.

uint32_t saved_period
static

Definition at line 55 of file lpc43xx_systick.c.

volatile int start = 0
static

Definition at line 82 of file example_emWin.c.

uint32_t SystemCoreClock

Current system clock rate, mainly used for sysTick.

System Core rate (defined in LPC_BOARD library module)

System Clock Frequency (Core Clock)

< System Clock Frequency (Core Clock)

System Clock Frequency (Core Clock)

< System Clock Frequency (Core Clock)

Definition at line 618 of file board_hitex_eva_18504350.c.

volatile uint32_t systick_timems

System Tick count value.

Definition at line 77 of file lpc43xx_systick.c.

volatile int tsc_init_done

Touch screen initialisation done flag.

Touch screen initialisation done flag (defined in emWin module)

TSC Initiliation done flag

Definition at line 133 of file example_emWin.c.

volatile int tsc_init_done = 0

Touch screen initialisation done flag.

TSC Initiliation done flag

Definition at line 133 of file example_emWin.c.