I am writing a "digital sampling scope" application for Primer 2. The application receives a signal from the outside primer 2, A/D convert it, then display it on the screen in the DMA handler. I have done with the primary functions, and I could observe signal waveforms with the primer2. It's really handy.
BTW, I want to use a Menu and the toolbar to control the application, e.g. changing the time scale or the amplitude scale, but I am stacking with both of them. I checked "dictaphone" project but it was not enough for me. Could someone help me?
OK, I want to use a menu consisting of 2 menu-items as follows;
With the above code, I could see the menu and it disappeared when I chose "Item1" with the menu. However, when I moved the joystick up and down, a part of the menu was displayed again and I could choose every item on the menu.
My first question is, "How can I disable the Menu after selecting one item on the menu?" I could not find any hint from the "dictaphone" application.
When I moved the line "TIM_Cmd(TIM1, ENABLE);" from Item1_Ini() to Item1_Handler(), my application did not restart refreshing the screen.
My second question is, "What is the division of roles between xx_Ini() function (enum MENU_code (*Fct_Init)(), I mean) and xx_Handler() (Fct_Manage) regarding the menu handling?". I am reading "menu.c" but it is too tough for me...
On TOOLBAR... I will struggle with it by myself...
Hi, First, you code seems to be correct, except the "MENU_CONTINUE" does your menu always be called by the system (see below).
$1 : at the end of the "Item1_Handler handler function, you have to return "MENU_RESTORE_COMMAND", and then the application handler will be called again, which has first to refresh the screen, in order to delete (graphically) the menu.
$1 : the function "Fct_Init" is called only one time for initialization or screen background display, when "Fct_Manage" is continously called by the menu handler, after the "Fct_Init", and until the code "MENU_RESTORE_COMMAND" is returned. Remark : the items of an application menu are managed with the same way that application itself (which are menu items). The only difference is the return code ("MENU_QUIT" for application vs "MENU_RESTORE_COMMAND" for application menus.
$1 : the declaration of a toolbar is about the same thing that menu : declare your toolbar structure with addresses of item icons, and associated functions. Then call "TOOLBAR_Set(&myToolbar)", and the system will manage you own toolbar. Finaly, call "TOOLBAR_SetDefaultToolbar()" if you want to restore the system toolbar.
Thank you very much yrt! I had waited long that the stm32circle.com recovers from its maintenace to read your reply. This is just a reply to say thank you. After I check it tonight, I will reply again. Thanks again.
It has worked at last. There were three mistakes in the above code.
1) Item1_Ini() and Item1_Handler() were defined as "void". It must be defined as "enum MENU_code". 2) Item1_Ini() returned "MENU_CONTINUE". It must return "MENU_CONTINUE_COMMAND". 3) Item1_Handler() did not call DRAW_Clear(). Because of that the menu did not be cleared.
enum MENU_code Item1_Handler(void) { // some lines to do some tasks BUZZER_SetMode( BUZZER_SHORTBEEP ); BUTTON_SetMode( BUTTON_ONOFF ); // CurrentMenu = 0; DRAW_Clear(); return MENU_RESTORE_COMMAND; }
In addition, I added a call "BUTTON_SetMode(BUTTON_ONOFF)" in the Item1_Handler(). I am not sure it is required, but without it, I could not recall the menu again.
On TOOLBAR... I could not test it even with "TOUCHSCREEN CALIBRATION" in the config menu. Any help?