/* Main application function. 
All the processing for the calculator is done by the calculator widget's event handler function app_calc_handler(). This function is called by the window system when it maps a user input event to an interaction with the calculator, i.e., a button press.  */
int main(void)
/* Main application function. 
All the processing for the calculator is done by the calculator widget's event handler function app_calc_handler(). This function is called by the window system when it maps a user input event to an interaction with the calculator, i.e., a button press.  */
int main(void)
{
	static struct mxt_device device;
	board_init();
	sysclk_init();
	membag_init();
	gfx_init();
	mxt_init(&device);
	win_init();
	setup_gui_root_window();
	win_reset_root_geometry();
	if (app_widget_launch() == false) {
		show_out_of_memory_error();
		for (;;);
	}
	while (true) {
		struct win_pointer_event win_touch_event;
		while (read_touch_event(&device, &win_touch_event)) {
			win_queue_pointer_event(&win_touch_event);
		}
		win_process_events();
	}
}