Atmel Software Framework

common/services/wtk/example3_plot/example3.c File Reference

Graphic Widget Toolkit library example 3 application.

Copyright (c) 2012-2015 Atmel Corporation. All rights reserved.

#include <asf.h>
#include "widget_gui.h"
#include "atmel_logo_small.h"

Macros

#define MAXTOUCH_TWI_ADDRESS   0x4a
 Address of the mXT143E on TWI bus. More...
 

Functions

int main (void)
 main example code More...
 
static void mxt_init (struct mxt_device *device)
 Set maXTouch configuration. More...
 
static bool read_touch_event (struct mxt_device *device, struct win_pointer_event *win_touch_event)
 Convert touch events from the touchscreen into window pointer events. More...
 
static void setup_gui_root_window (void)
 Configure the root GUI window. More...
 
static void show_out_of_memory_error (void)
 Show an out of memory error on the display. More...
 

#define MAXTOUCH_TWI_ADDRESS   0x4a

Address of the mXT143E on TWI bus.

Referenced by mxt_init().

int main ( void  )

main example code

The main function will draw all the graphic primitives from the graphic library on a line from left to right (incrementing x) and repeat this from bottom to top with varying colors (incrementing y). Below the figures it draws the Atmel logo centered on the screen.

References app_widget_launch(), board_init(), gfx_init, membag_init(), mxt_init(), read_touch_event(), setup_gui_root_window(), show_out_of_memory_error(), sysclk_init, win_init(), win_process_events(), and win_queue_pointer_event().

static void mxt_init ( struct mxt_device device)
static
static bool read_touch_event ( struct mxt_device device,
struct win_pointer_event win_touch_event 
)
static

Convert touch events from the touchscreen into window pointer events.

Reads touch events in from the touchscreen and converts them into a Window Manager pointer event, for enqueuing into the window event queue.

Returns
Boolean true if a touch event was read, false if no touch event or a corrupt touch event was received

References win_pointer_event::buttons, gfx_get_height(), gfx_get_width(), win_pointer_event::is_relative, mxt_is_message_pending(), MXT_MOVE_EVENT, MXT_PRESS_EVENT, mxt_read_touch_event(), MXT_RELEASE_EVENT, win_pointer_event::pos, mxt_touch_event::status, STATUS_OK, win_pointer_event::type, WIN_POINTER_MOVE, WIN_POINTER_PRESS, WIN_POINTER_RELEASE, WIN_TOUCH_BUTTON, mxt_touch_event::x, win_point::x, mxt_touch_event::y, and win_point::y.

Referenced by main().

static void setup_gui_root_window ( void  )
static

Configure the root GUI window.

Configures the root window background to be a tiled version of the Atmel company logo, and sets it as being visible.

References atmel_logo_small, win_attributes::background, WIN_ATTR_BACKGROUND, win_get_attributes(), win_get_root(), win_root, win_set_attributes(), and win_show().

Referenced by main().

static void show_out_of_memory_error ( void  )
static

Show an out of memory error on the display.

Shows a full screen error when called, signaling that the system ran out of memory when initializing a WTK application.

References GFX_COLOR_BLACK, GFX_COLOR_RED, GFX_COLOR_TRANSPARENT, gfx_draw_filled_rect, gfx_draw_string_aligned(), gfx_get_height(), gfx_get_width(), gfx_set_clipping(), sysfont, TEXT_ALIGN_CENTER, and TEXT_POS_CENTER.

Referenced by main().