/* * Copyright (C) 2005 BLADOX, s.r.o. All rights reserved. * * This file is part of an example program for Turbo. This example * program may be used, distributed and modified without limitation. * */ #include <config.h> #include <turbo/turbo.h> #include <stdlib.h> #define MY_SHMEM_KEY 0x44 u8 PROGMEM t_Foo_en[] = "Shared memory"; u8 PROGMEM t_Value[] = "Value: "; typedef struct _sh_mem { u8 some_value; } Shared_memory; Shared_memory *shared_memory; void action_menu (void *data) { u8 *r = buf_B (); dbsp ("SHMEM "); dbih (shared_memory); dbc ('\n'); r = sprints (r, t_Value); r = sprinti (r, shared_memory->some_value); r = sprintc (r, '\0'); display_text_raw (buf_B (), Q_DISPLAY_TEXT_USER_CLEAR); shared_memory->some_value++; } void turbo_handler (u8 action, void *data) { switch (action) { case ACTION_APP_INIT: shared_memory = shmem_key (MY_SHMEM_KEY); dbsp ("INIT SHMEM "); dbih (shared_memory); dbc ('\n'); if (shared_memory == NULL) { shared_memory = malloc (sizeof (Shared_memory)); shmem_reg_key (MY_SHMEM_KEY, shared_memory); shared_memory->some_value = 0x00; dbsp ("SHMEM "); dbih (shared_memory); dbc ('\n'); } break; case ACTION_INSERT_MENU: insert_menu (t_Foo_en); break; case ACTION_MENU_SELECTION: stk_thread (action_menu, data); break; default: break; } }
Copyright © 2004-2006 BLADOX | Turbo version 1.2
|