MMI.c File Reference


Detailed Description

Control Panel MMI module.

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file MMI.c.

#include <stdlib.h>
#include <string.h>
#include "board.h"
#include "gpio.h"
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "ctrl_access.h"
#include "conf_access.h"
#include "navigation.h"
#include "tracedump.h"
#include "shell.h"
#include "fscmds.h"
#include "supervisor.h"
#include "MMI.h"
#include "dip204.h"
#include "spi.h"
#include "cptime.h"

Go to the source code of this file.

Defines

#define ATMEL_BANNER   " ATMEL AVR32 UC3 "
#define DATE_LINE   LINE_1
#define LINE_1   0x01
#define LINE_2   0x02
#define LINE_3   0x03
#define LINE_4   0x04
#define MMI_IDLE_MENU_MAX_ITEM   7
#define MMI_LINE_LENGTH   20
#define MMI_NB_LINE   4
#define MMI_QUEUE_SIZE   MMI_NB_LINE
#define MMI_SPACE   0x20
#define MMI_USB_CONNECTED   0xB7
#define MMI_USB_DEVICE_MENU_MAX_ITEM   1
#define MMI_USB_HOST_MENU_MAX_ITEM   4
#define MMI_WAIT_MENU_MAX_ITEM   1
#define PARAM_LINE   LINE_2
#define USER_MENU_LINE   LINE_3
#define USER_MESS_LINE   LINE_4

Typedefs

typedef Bool(* pfUserAction )(void)

Functions

Bool b_MMI_do_nothing (void)
 function to do nothing upon user action
static Bool b_mmi_format_a (void)
 Format the a drive.
static Bool b_mmi_format_b (void)
 Format the b drive.
static Bool b_mmi_mkdir_aLOG (void)
 Create the /LOG directory under a.
static Bool b_mmi_mkdir_bLOG (void)
 Create the /LOG directory under b.
Bool bMMI_start (void)
 Init MMI, for Man to Macine Interface management.
static void prvMMI_Init (void)
 MMI function for initialisation.
void vMMI_DisplayDateAndTime (portCHAR *pcDateTime)
 display Date in Date space
void vMMI_DisplayIP (portCHAR *IPAddress)
 display IP in Param space
void vMMI_DisplayUSBState (Bool bConnected)
 display USB connection status.
void vMMI_Manage (void)
 MMI function for Man to Macine Interface management.
void vMMI_SetUserMenuMode (eUserMenu UserMenu, Bool ResetCurrentState)
 set MMI current Menu
void vMMI_UserMenuDisplay (portCHAR *Message)
 display message in User Menu space
void vMMI_UserMenuDisplayNextItem (Bool UnderIT)
 display next screen in User Menu space
void vMMI_UserMenuDisplayPreviousItem (Bool UnderIT)
 display previous screen in User Menu space
void vMMI_UserMenuValidateItem (Bool UnderIT)
 Validate the current item in User Menu.
void vMMI_UserMessDisplay (portCHAR *Message)
 display message in User Mess space

Variables

portCHAR cMMI_SubMenu_CurrentItem = 0
portCHAR * DateScreen = Line[DATE_LINE - 1]
eUserMenu eCurrentUserMenu = eUserMenuIdle
portCHAR Line [MMI_NB_LINE][MMI_LINE_LENGTH+1]
const portCHAR *const MMI_IdleActingMenu [MMI_IDLE_MENU_MAX_ITEM]
const portCHAR *const MMI_IdleMenu [MMI_IDLE_MENU_MAX_ITEM]
const portCHAR *const MMI_USBDeviceMenu [MMI_USB_DEVICE_MENU_MAX_ITEM]
const portCHAR *const MMI_USBHostActingMenu [MMI_USB_HOST_MENU_MAX_ITEM]
const portCHAR *const MMI_USBHostMenu [MMI_USB_HOST_MENU_MAX_ITEM]
const portCHAR *const MMI_WaitHostMenu [MMI_WAIT_MENU_MAX_ITEM]
portCHAR * ParamScreen = Line[PARAM_LINE - 1]
const signed portCHAR *const pcStringLogDirectoryNameA
const signed portCHAR *const pcStringLogDirectoryNameB
const signed portCHAR *const pcStringLogDirName = (signed portCHAR *)"LOG"
static char pcTempoDate [17]
pfUserAction const pfIdleUserAction [MMI_IDLE_MENU_MAX_ITEM]
pfUserAction const pfUSBDeviceUserAction [MMI_USB_DEVICE_MENU_MAX_ITEM]
pfUserAction const pfUSBHostUserAction [MMI_USB_HOST_MENU_MAX_ITEM]
pfUserAction const pfWaitHostUserAction [MMI_WAIT_MENU_MAX_ITEM]
signed short sMmiNavId
portCHAR * UserMenuScreen = Line[USER_MENU_LINE - 1]
portCHAR * UserMessScreen = Line[USER_MESS_LINE - 1]
static xQueueHandle xMMIQueue = 0
xQueueHandle xSUPERVISORQueue


Define Documentation

#define ATMEL_BANNER   " ATMEL AVR32 UC3 "

Banner for ATMEL product

Definition at line 125 of file MMI.c.

Referenced by bMMI_start().

#define DATE_LINE   LINE_1

Link date line to the first one

Definition at line 93 of file MMI.c.

Referenced by vMMI_Manage().

#define LINE_1   0x01

this is the first line

Definition at line 85 of file MMI.c.

#define LINE_2   0x02

this is the second line

Definition at line 87 of file MMI.c.

#define LINE_3   0x03

this is the third line

Definition at line 89 of file MMI.c.

#define LINE_4   0x04

this is the fourth line

Definition at line 91 of file MMI.c.

#define MMI_IDLE_MENU_MAX_ITEM   7

number of items in Idle Menu

Definition at line 114 of file MMI.c.

Referenced by vMMI_UserMenuDisplayNextItem().

#define MMI_LINE_LENGTH   20

number of chars per line

Definition at line 79 of file MMI.c.

Referenced by bMMI_start(), vMMI_DisplayIP(), vMMI_DisplayUSBState(), vMMI_UserMenuDisplay(), and vMMI_UserMessDisplay().

#define MMI_NB_LINE   4

number of lines on display

Definition at line 81 of file MMI.c.

Referenced by bMMI_start().

#define MMI_QUEUE_SIZE   MMI_NB_LINE

definition of the MMI queue size

Definition at line 83 of file MMI.c.

Referenced by bMMI_start().

#define MMI_SPACE   0x20

define the White space char

Definition at line 104 of file MMI.c.

Referenced by bMMI_start(), vMMI_DisplayIP(), vMMI_DisplayUSBState(), vMMI_UserMenuDisplay(), and vMMI_UserMessDisplay().

#define MMI_USB_CONNECTED   0xB7

define the char used upon USB connection

Definition at line 102 of file MMI.c.

Referenced by vMMI_DisplayUSBState().

#define MMI_USB_DEVICE_MENU_MAX_ITEM   1

number of items in USB Device Menu

Definition at line 109 of file MMI.c.

Referenced by vMMI_UserMenuDisplayNextItem().

#define MMI_USB_HOST_MENU_MAX_ITEM   4

number of items in USB host Menu

Definition at line 107 of file MMI.c.

Referenced by vMMI_UserMenuDisplayNextItem().

#define MMI_WAIT_MENU_MAX_ITEM   1

number of items in Waiting-for-host Menu

Definition at line 122 of file MMI.c.

#define PARAM_LINE   LINE_2

Link param line to the second one

Definition at line 95 of file MMI.c.

Referenced by vMMI_Manage().

#define USER_MENU_LINE   LINE_3

Link User Menu line to the third one

Definition at line 97 of file MMI.c.

Referenced by vMMI_Manage().

#define USER_MESS_LINE   LINE_4

Link User Mess line to the fourth one

Definition at line 99 of file MMI.c.

Referenced by vMMI_Manage().


Typedef Documentation

typedef Bool(* pfUserAction)(void)

definition of the User action function pointer

Definition at line 128 of file MMI.c.


Function Documentation

Bool b_MMI_do_nothing ( void   ) 

function to do nothing upon user action

Definition at line 805 of file MMI.c.

References NAKED_TRACE_COM2.

00806 {
00807   NAKED_TRACE_COM2( "Nothing to do for this action" );
00808   return (pdTRUE);
00809 }

static Bool b_mmi_format_a ( void   )  [static]

Format the a drive.

Definition at line 815 of file MMI.c.

References e_fscmds_format(), eUserMenuIdle, eUserMenuIdleActing, FSCMDS_STATUS_OK, LUN_ID_AT45DBX_MEM, sMmiNavId, and vMMI_SetUserMenuMode().

00816 {
00817   Bool bRet = pdTRUE;
00818 
00819 
00820   // Display User Menu Acting
00821   vMMI_SetUserMenuMode(eUserMenuIdleActing, pdFALSE);
00822   vTaskDelay( 3 ); // So that the supervisor task gets the focus to update the
00823                     // LCD screen.
00824   // WARNING : we assume LUN_ID_AT45DBX_MEM <-> a
00825   if( FSCMDS_STATUS_OK != e_fscmds_format( sMmiNavId, LUN_ID_AT45DBX_MEM ) )
00826     bRet = pdFALSE;
00827   // Back to display User Menu
00828   vMMI_SetUserMenuMode(eUserMenuIdle, pdFALSE);
00829   return( bRet );
00830 }

static Bool b_mmi_format_b ( void   )  [static]

Format the b drive.

Definition at line 837 of file MMI.c.

References e_fscmds_format(), eUserMenuIdle, eUserMenuIdleActing, FSCMDS_STATUS_OK, LUN_ID_SD_MMC_SPI_MEM, sMmiNavId, and vMMI_SetUserMenuMode().

00838 {
00839   Bool bRet = pdTRUE;
00840 
00841 
00842   // Display User Menu Acting
00843   vMMI_SetUserMenuMode(eUserMenuIdleActing, pdFALSE);
00844   vTaskDelay( 3 ); // So that the supervisor task gets the focus to update the
00845                     // LCD screen.
00846   // WARNING : we assume LUN_ID_SD_MMC_MEM <-> b
00847   if( FSCMDS_STATUS_OK != e_fscmds_format( sMmiNavId, LUN_ID_SD_MMC_SPI_MEM ) )
00848     bRet = pdFALSE;
00849   // Back to display User Menu
00850   vMMI_SetUserMenuMode(eUserMenuIdle, pdFALSE);
00851   return( bRet );
00852 }

static Bool b_mmi_mkdir_aLOG ( void   )  [static]

Create the /LOG directory under a.

Definition at line 859 of file MMI.c.

References e_fscmds_shell_mkdir(), eUserMenuIdle, eUserMenuIdleActing, LUN_ID_AT45DBX_MEM, pcStringLogDirName, pcTempoDate, SHELL_EXECSTATUS_OK, sMmiNavId, SYS_MODID_MMI, v_cptime_GetDateInFatStringFormat(), and vMMI_SetUserMenuMode().

00860 {
00861   Bool             bRet = pdFALSE;
00862 
00863 
00864   // Display User Menu Acting
00865   vMMI_SetUserMenuMode(eUserMenuIdleActing, pdFALSE);
00866   vTaskDelay( 3 ); // So that the supervisor task gets the focus to update the
00867                     // LCD screen.
00868   nav_select( sMmiNavId );
00869   // WARNING : we assume LUN_ID_AT45DBX_MEM <-> a
00870   if( !nav_drive_set( LUN_ID_AT45DBX_MEM ))
00871   {
00872     // Back to display User Menu
00873     vMMI_SetUserMenuMode(eUserMenuIdle, pdFALSE);
00874     return( bRet );
00875   }
00876   if( !nav_partition_mount() )
00877   {
00878     // Back to display User Menu
00879     vMMI_SetUserMenuMode(eUserMenuIdle, pdFALSE);
00880     return( bRet );
00881   }
00882   // Here, Pwd == a:
00883   if( SHELL_EXECSTATUS_OK == e_fscmds_shell_mkdir( SYS_MODID_MMI, sMmiNavId, 1,
00884                                                    (signed portCHAR **)&pcStringLogDirName, NULL ) )
00885     bRet = pdTRUE;
00886   // Get the current time in the "YYYYMMDDHHMMSSMS" string format.
00887   v_cptime_GetDateInFatStringFormat( pcTempoDate );
00888   // Set the directory date.
00889   nav_file_dateset( (FS_STRING)pcTempoDate, FS_DATE_LAST_WRITE );
00890   // Back to display User Menu
00891   vMMI_SetUserMenuMode(eUserMenuIdle, pdFALSE);
00892   return( bRet );
00893 }

static Bool b_mmi_mkdir_bLOG ( void   )  [static]

Create the /LOG directory under b.

Definition at line 900 of file MMI.c.

References e_fscmds_shell_mkdir(), eUserMenuIdle, eUserMenuIdleActing, LUN_ID_SD_MMC_SPI_MEM, pcStringLogDirName, pcTempoDate, SHELL_EXECSTATUS_OK, sMmiNavId, SYS_MODID_MMI, v_cptime_GetDateInFatStringFormat(), and vMMI_SetUserMenuMode().

00901 {
00902   Bool             bRet = pdFALSE;
00903 
00904 
00905   // Display User Menu Acting
00906   vMMI_SetUserMenuMode(eUserMenuIdleActing, pdFALSE);
00907   vTaskDelay( 3 ); // So that the supervisor task gets the focus to update the
00908                     // LCD screen.
00909   nav_select( sMmiNavId );
00910   // WARNING : we assume LUN_ID_SD_MMC_MEM <-> b
00911   if( !nav_drive_set( LUN_ID_SD_MMC_SPI_MEM ))
00912   {
00913     // Back to display User Menu
00914     vMMI_SetUserMenuMode(eUserMenuIdle, pdFALSE);
00915     return( bRet );
00916   }
00917   if( !nav_partition_mount() )
00918   {
00919     // Back to display User Menu
00920     vMMI_SetUserMenuMode(eUserMenuIdle, pdFALSE);
00921     return( bRet );
00922   }
00923   // Here, Pwd == a:
00924   if( SHELL_EXECSTATUS_OK == e_fscmds_shell_mkdir( SYS_MODID_MMI, sMmiNavId, 1,
00925                                                    (signed portCHAR **)&pcStringLogDirName, NULL ) )
00926     bRet = pdTRUE;
00927   // Get the current time in the "YYYYMMDDHHMMSSMS" string format.
00928   v_cptime_GetDateInFatStringFormat( pcTempoDate );
00929   // Set the directory date.
00930   nav_file_dateset( (FS_STRING)pcTempoDate, FS_DATE_LAST_WRITE );
00931   // Back to display User Menu
00932   vMMI_SetUserMenuMode(eUserMenuIdle, pdFALSE);
00933   return( bRet );
00934 }

Bool bMMI_start ( void   ) 

Init MMI, for Man to Macine Interface management.

Definition at line 315 of file MMI.c.

References ATMEL_BANNER, eUserMenuIdle, Line, MMI_LINE_LENGTH, MMI_NB_LINE, MMI_QUEUE_SIZE, MMI_SPACE, prvMMI_Init(), vMMI_SetUserMenuMode(), vMMI_UserMessDisplay(), and xMMIQueue.

Referenced by portTASK_FUNCTION().

00316 {
00317 unsigned short i;
00318 
00319   for (i = 0 ; i < MMI_NB_LINE ; i++)
00320   {
00321     memset(Line[i], MMI_SPACE, MMI_LINE_LENGTH);
00322     Line[i][MMI_LINE_LENGTH] = '\0';
00323   }
00324 
00325   xMMIQueue = xQueueCreate( MMI_QUEUE_SIZE, sizeof(portCHAR *) );
00326 
00327   if( 0 == xMMIQueue )
00328   {
00329      return pdFALSE;
00330   }
00331 
00332   // Init MMI
00333   prvMMI_Init();
00334 
00335   /* go to Idle state */
00336   vMMI_SetUserMenuMode(eUserMenuIdle, pdTRUE);
00337   vMMI_UserMessDisplay(ATMEL_BANNER);
00338   return pdTRUE;
00339 }

static void prvMMI_Init ( void   )  [static]

MMI function for initialisation.

Definition at line 750 of file MMI.c.

References CP_PBA_SPEED.

Referenced by bMMI_start().

00751 {
00752   spi_options_t spiOptions =
00753   {
00754     .reg          = DIP204_SPI_NPCS,
00755     .baudrate     = 1000000,
00756     .bits         = 8,
00757     .spck_delay   = 0,
00758     .trans_delay  = 0,
00759     .stay_act     = 1,
00760     .spi_mode     = 0,
00761     .modfdis      = 1
00762   };
00763 
00764 #if BOARD == EVK1100
00765 #warning DIP204 and AT45DBX are sharing the same SPI
00766   // Only assign CS I/Os to SPI
00767   gpio_enable_module_pin(DIP204_SPI_NPCS_PIN,  DIP204_SPI_NPCS_FUNCTION); // Chip Select NPCS
00768 
00769 #else
00770   static const gpio_map_t DIP204_SPI_GPIO_MAP =
00771   {
00772     {DIP204_SPI_SCK_PIN,  DIP204_SPI_SCK_FUNCTION },  // SPI Clock.
00773     {DIP204_SPI_MISO_PIN, DIP204_SPI_MISO_FUNCTION},  // MISO.
00774     {DIP204_SPI_MOSI_PIN, DIP204_SPI_MOSI_FUNCTION},  // MOSI.
00775     {DIP204_SPI_NPCS_PIN, DIP204_SPI_NPCS_FUNCTION}   // Chip Select NPCS.
00776   };
00777 
00778   // Assign I/Os to SPI
00779   gpio_enable_module(DIP204_SPI_GPIO_MAP,
00780                      sizeof(DIP204_SPI_GPIO_MAP) / sizeof(DIP204_SPI_GPIO_MAP[0]));
00781 
00782   // Initialise as master
00783   spi_initMaster(DIP204_SPI, &spiOptions);
00784 
00785   // Set selection mode: variable_ps, pcs_decode, delay
00786   spi_selectionMode(DIP204_SPI, 0, 0, 0);
00787 
00788   // Enable SPI
00789   spi_enable(DIP204_SPI);
00790 #endif
00791 
00792   // setup chip registers
00793   spi_setupChipReg(DIP204_SPI, &spiOptions, CP_PBA_SPEED);
00794 
00795   /* initialise LCD */
00796   dip204_init( backlight_PWM, TRUE ); // Use the PWM to control the LCD backlight pin.
00797 
00798   /* hide the cursor for the rest of application */
00799   dip204_hide_cursor();
00800 }

void vMMI_DisplayDateAndTime ( portCHAR *  pcDateTime  ) 

display Date in Date space

Parameters:
pcDateTime Input. date to display

Definition at line 386 of file MMI.c.

References DateScreen, and xMMIQueue.

Referenced by portTASK_FUNCTION().

00387 {
00388   strcpy(DateScreen, pcDateTime);
00389   // Add the refresh need to the xMMIQueue.
00390   xQueueSend( xMMIQueue, (void *)&DateScreen, 0 );
00391 }

void vMMI_DisplayIP ( portCHAR *  IPAddress  ) 

display IP in Param space

Parameters:
IPAddress Input. IP to display

Definition at line 346 of file MMI.c.

References MMI_LINE_LENGTH, MMI_SPACE, ParamScreen, UserMenuScreen, and xMMIQueue.

Referenced by prvEthernetConfigureInterface().

00347 {
00348 unsigned short i = 0;
00349   // clear previous line but not the last char (we sould be connected)
00350   memset(UserMenuScreen, MMI_SPACE, MMI_LINE_LENGTH - 1);
00351   // set new value
00352   do
00353   {
00354     ParamScreen[i++] = *IPAddress++;
00355   }while (*IPAddress != '\0' || i >= 15);
00356   // Add the refresh need to the xMMIQueue.
00357   xQueueSend( xMMIQueue, (void *)&ParamScreen, 0 );
00358 }

void vMMI_DisplayUSBState ( Bool  bConnected  ) 

display USB connection status.

Parameters:
bConnected Input. USB connection status.

Definition at line 366 of file MMI.c.

References MMI_LINE_LENGTH, MMI_SPACE, MMI_USB_CONNECTED, ParamScreen, and xMMIQueue.

Referenced by portTASK_FUNCTION().

00367 {
00368   if (bConnected == pdTRUE)
00369   {
00370     ParamScreen[MMI_LINE_LENGTH - 1] = MMI_USB_CONNECTED;
00371   }
00372   else
00373   {
00374     ParamScreen[MMI_LINE_LENGTH - 1] = MMI_SPACE;
00375   }
00376   // Add the refresh need to the xMMIQueue.
00377   xQueueSend( xMMIQueue, (void *)&ParamScreen, 0 );
00378 }

void vMMI_Manage ( void   ) 

MMI function for Man to Macine Interface management.

Definition at line 711 of file MMI.c.

References DATE_LINE, DateScreen, Line, PARAM_LINE, ParamScreen, USER_MENU_LINE, USER_MESS_LINE, UserMenuScreen, UserMessScreen, and xMMIQueue.

Referenced by portTASK_FUNCTION().

00712 {
00713 portCHAR * Line;
00714 
00715   // get queue information
00716   while ( pdTRUE == xQueueReceive( xMMIQueue, &Line, ( portTickType ) 0 ) )
00717   {
00718     // refresh line Param
00719     if (Line == ParamScreen)
00720     {
00721       dip204_set_cursor_position(1,PARAM_LINE);
00722       dip204_write_string(ParamScreen);
00723     }
00724     // refresh line Date
00725     else if (Line == DateScreen)
00726     {
00727       dip204_set_cursor_position(1,DATE_LINE);
00728       dip204_write_string(DateScreen);
00729     }
00730     // refresh line User Menu
00731     else if (Line == UserMenuScreen)
00732     {
00733       dip204_set_cursor_position(1,USER_MENU_LINE);
00734       dip204_write_string(UserMenuScreen);
00735     }
00736     // refresh line User Mess
00737     else if (Line == UserMessScreen)
00738     {
00739       dip204_set_cursor_position(1,USER_MESS_LINE);
00740       dip204_write_string(UserMessScreen);
00741     }
00742   }
00743 }

void vMMI_SetUserMenuMode ( eUserMenu  UserMenu,
Bool  ResetCurrentState 
)

set MMI current Menu

Parameters:
UserMenu Input. User Menu to handle
ResetCurrentState Input. pdFALSE if no need to reset MMI current screen number

Definition at line 483 of file MMI.c.

References cMMI_SubMenu_CurrentItem, eCurrentUserMenu, eUserMenuIdle, eUserMenuIdleActing, eUserMenuUSBDevice, eUserMenuUSBHost, eUserMenuUSBHostActing, eUserMenuWaitHost, MMI_IdleActingMenu, MMI_IdleMenu, MMI_USBDeviceMenu, MMI_USBHostActingMenu, MMI_USBHostMenu, MMI_WaitHostMenu, UserMenuScreen, and xMMIQueue.

Referenced by b_mmi_format_a(), b_mmi_format_b(), b_mmi_mkdir_aLOG(), b_mmi_mkdir_bLOG(), b_USBHostCopyCfg(), b_USBHostCopyLogs(), b_USBHostCopyWeb(), b_USBHostMoveLogs(), bMMI_start(), e_supervisor_switch_to_maintenance_mode(), portTASK_FUNCTION(), prv_v_common_leave_UsbDevice_mode(), and x_supervisor_SemaphoreGive().

00484 {
00485   if (ResetCurrentState)
00486   {
00487     // reset the screen number to display
00488     cMMI_SubMenu_CurrentItem = 0;
00489   }
00490 #ifdef USB_ENABLE
00491   // HOST menu
00492   if (UserMenu == eUserMenuUSBHost)
00493   {
00494     // set current user menu
00495     eCurrentUserMenu = eUserMenuUSBHost;
00496     // prepare the line for the display
00497     strcpy(UserMenuScreen, MMI_USBHostMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00498   }
00499   // HOST Acting menu
00500   else if (UserMenu == eUserMenuUSBHostActing)
00501   {
00502     // set current user menu
00503     eCurrentUserMenu = eUserMenuUSBHostActing;
00504     // prepare the line for the display
00505     strcpy(UserMenuScreen, MMI_USBHostActingMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00506   }
00507   // DEVICE menu
00508 #if USB_DEVICE_FEATURE == ENABLED
00509   else if (UserMenu == eUserMenuUSBDevice)
00510   {
00511     // set current user menu
00512     eCurrentUserMenu = eUserMenuUSBDevice;
00513     // prepare the line for the display
00514     strcpy(UserMenuScreen, MMI_USBDeviceMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00515   }
00516   else if (UserMenu == eUserMenuWaitHost)
00517   {
00518     // set current user menu
00519     eCurrentUserMenu = eUserMenuWaitHost;
00520     // prepare the line for the display
00521     strcpy(UserMenuScreen, MMI_WaitHostMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00522   }
00523 #endif
00524   else if( UserMenu == eUserMenuIdle )
00525 #endif
00526   {
00527     // reset current user menu
00528     eCurrentUserMenu = eUserMenuIdle;
00529     // prepare the line for the display
00530     strcpy(UserMenuScreen, MMI_IdleMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00531   }
00532   else // eUserMenuIdleActing
00533   {
00534     // reset current user menu
00535     eCurrentUserMenu = eUserMenuIdleActing;
00536     // prepare the line for the display
00537     strcpy(UserMenuScreen, MMI_IdleActingMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00538   }
00539   // Add the refresh need to the xMMIQueue.
00540   xQueueSend( xMMIQueue, (void *)&UserMenuScreen, 0 );
00541 }

void vMMI_UserMenuDisplay ( portCHAR *  Message  ) 

display message in User Menu space

Parameters:
Message Input. Message to display

Definition at line 657 of file MMI.c.

References eCurrentUserMenu, eUserMenuIdle, MMI_LINE_LENGTH, MMI_SPACE, UserMenuScreen, and xMMIQueue.

00658 {
00659 unsigned short i = 0;
00660 
00661   // if MMI is ini IDLE state, display the message
00662   if (eCurrentUserMenu == eUserMenuIdle)
00663   {
00664     // add the received data to the line
00665     do
00666     {
00667       UserMenuScreen[i++] = *Message++;
00668     }while (*Message != '\0' && i < MMI_LINE_LENGTH);
00669     // fill in with white spaces to clear older data
00670     do
00671     {
00672       UserMenuScreen[i++] = MMI_SPACE;
00673     }while (i < MMI_LINE_LENGTH);
00674     // add EOL
00675     UserMenuScreen[MMI_LINE_LENGTH] = '\0';
00676      // Add the refresh need to the xMMIQueue.
00677     xQueueSend( xMMIQueue, (void *)&UserMenuScreen, 0 );
00678   }
00679 }

void vMMI_UserMenuDisplayNextItem ( Bool  UnderIT  ) 

display next screen in User Menu space

Parameters:
UnderIT Input. True if calling from IT

Definition at line 549 of file MMI.c.

References cMMI_SubMenu_CurrentItem, eCurrentUserMenu, eUserMenuIdle, eUserMenuUSBDevice, eUserMenuUSBHost, MMI_IDLE_MENU_MAX_ITEM, MMI_IdleMenu, MMI_USB_DEVICE_MENU_MAX_ITEM, MMI_USB_HOST_MENU_MAX_ITEM, MMI_USBDeviceMenu, MMI_USBHostMenu, UserMenuScreen, and xMMIQueue.

Referenced by prvjoystick_ISR_NonNakedBehaviour().

00550 {
00551 #ifdef USB_ENABLE
00552   // HOST menu
00553   if (eCurrentUserMenu == eUserMenuUSBHost)
00554   {
00555     // set the value for the screen number to display
00556     cMMI_SubMenu_CurrentItem = Min(cMMI_SubMenu_CurrentItem + 1, MMI_USB_HOST_MENU_MAX_ITEM - 1);
00557     // prepare the line for the display
00558     strcpy(UserMenuScreen, MMI_USBHostMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00559   }
00560 #if USB_DEVICE_FEATURE == ENABLED
00561   // DEVICE menu
00562   else if (eCurrentUserMenu == eUserMenuUSBDevice)
00563   {
00564     // set the value for the screen number to display
00565     cMMI_SubMenu_CurrentItem = Min(cMMI_SubMenu_CurrentItem + 1, MMI_USB_DEVICE_MENU_MAX_ITEM - 1);
00566     // prepare the line for the display
00567     strcpy(UserMenuScreen, MMI_USBDeviceMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00568   }
00569 #endif
00570   else
00571 #endif
00572   if( eCurrentUserMenu == eUserMenuIdle )
00573   {
00574     // set the value for the screen number to display
00575     cMMI_SubMenu_CurrentItem = Min(cMMI_SubMenu_CurrentItem + 1, MMI_IDLE_MENU_MAX_ITEM - 1);
00576     // prepare the line for the display
00577     strcpy(UserMenuScreen, MMI_IdleMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00578   }
00579 #ifdef USB_ENABLE
00580   // caller is under IT
00581   if (UnderIT)
00582   {
00583     portBASE_TYPE xYieldRequired = pdFALSE;
00584     portENTER_CRITICAL();
00585     // Add the refresh need to the xMMIQueue.
00586     xQueueSendFromISR( xMMIQueue, (void *)&UserMenuScreen, &xYieldRequired );
00587     portEXIT_CRITICAL();
00588   }
00589   else
00590   {
00591     // Add the refresh need to the xMMIQueue.
00592     xQueueSend( xMMIQueue, (void *)&UserMenuScreen, 0 );
00593   }
00594 #endif
00595 }

void vMMI_UserMenuDisplayPreviousItem ( Bool  UnderIT  ) 

display previous screen in User Menu space

Parameters:
UnderIT Input. True if calling from IT

Definition at line 603 of file MMI.c.

References cMMI_SubMenu_CurrentItem, eCurrentUserMenu, eUserMenuIdle, eUserMenuUSBDevice, eUserMenuUSBHost, MMI_IdleMenu, MMI_USBDeviceMenu, MMI_USBHostMenu, UserMenuScreen, and xMMIQueue.

Referenced by prvjoystick_ISR_NonNakedBehaviour().

00604 {
00605 #ifdef USB_ENABLE
00606   // HOST menu
00607   if (eCurrentUserMenu == eUserMenuUSBHost)
00608   {
00609     // set the value for the screen number to display
00610     cMMI_SubMenu_CurrentItem = Max(cMMI_SubMenu_CurrentItem - 1, 0);
00611     // prepare the line for the display
00612     strcpy(UserMenuScreen, MMI_USBHostMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00613   }
00614   // DEVICE menu
00615 #if USB_DEVICE_FEATURE == ENABLED
00616   else if (eCurrentUserMenu == eUserMenuUSBDevice)
00617   {
00618     // set the value for the screen number to display
00619     cMMI_SubMenu_CurrentItem = Max(cMMI_SubMenu_CurrentItem - 1, 0);
00620     // prepare the line for the display
00621     strcpy(UserMenuScreen, MMI_USBDeviceMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00622   }
00623 #endif
00624   else
00625 #endif
00626   if( eCurrentUserMenu == eUserMenuIdle )
00627   {
00628     // set the value for the screen number to display
00629     cMMI_SubMenu_CurrentItem = Max(cMMI_SubMenu_CurrentItem - 1, 0);
00630     // prepare the line for the display
00631     strcpy(UserMenuScreen, MMI_IdleMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00632   }
00633 #ifdef USB_ENABLE
00634   // caller is under IT
00635   if (UnderIT)
00636   {
00637     portBASE_TYPE xYieldRequired = pdFALSE;
00638     portENTER_CRITICAL();
00639     // Add the refresh need to the xMMIQueue.
00640     xQueueSendFromISR( xMMIQueue, (void *)&UserMenuScreen, &xYieldRequired );
00641     portEXIT_CRITICAL();
00642   }
00643   else
00644   {
00645     // Add the refresh need to the xMMIQueue.
00646     xQueueSend( xMMIQueue, (void *)&UserMenuScreen, 0 );
00647   }
00648 #endif
00649 }

void vMMI_UserMenuValidateItem ( Bool  UnderIT  ) 

Validate the current item in User Menu.

Parameters:
UnderIT Input. True if calling from IT

Definition at line 399 of file MMI.c.

References cMMI_SubMenu_CurrentItem, eCurrentUserMenu, eUserMenuIdle, eUserMenuUSBDevice, eUserMenuUSBHost, eUserMenuWaitHost, pfIdleUserAction, pfUSBDeviceUserAction, pfUSBHostUserAction, pfWaitHostUserAction, and xSUPERVISORQueue.

Referenced by prvjoystick_ISR_NonNakedBehaviour().

00400 {
00401   portBASE_TYPE xYieldRequired = pdFALSE;
00402 #ifdef USB_ENABLE
00403   // HOST mode : we have something to do
00404   if (eCurrentUserMenu == eUserMenuUSBHost)
00405   {
00406     // caller is under IT
00407     if (UnderIT)
00408     {
00409       portENTER_CRITICAL();
00410       // Add the function need to the xSUPERVISORQueue.
00411       xQueueSendFromISR( xSUPERVISORQueue, (void *)&(pfUSBHostUserAction[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]), &xYieldRequired );
00412       portEXIT_CRITICAL();
00413     }
00414     else
00415     {
00416       // Add the function need to the xSUPERVISORQueue.
00417       xQueueSend( xSUPERVISORQueue, (void *)&(pfUSBHostUserAction[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]), 0 );
00418     }
00419   }
00420   // USB Mass Storage mode
00421   else if (eCurrentUserMenu == eUserMenuUSBDevice)
00422   {
00423     // Caller is under IT (joystick press)
00424     if (UnderIT)
00425     {
00426       portENTER_CRITICAL();
00427       // Add the function need to the xSUPERVISORQueue.
00428       xQueueSendFromISR( xSUPERVISORQueue, (void *)&(pfUSBDeviceUserAction[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]), &xYieldRequired );
00429       portEXIT_CRITICAL();
00430     }
00431   }
00432   // Waiting-for-host mode
00433   else if (eCurrentUserMenu == eUserMenuWaitHost)
00434   {
00435     // caller is under IT
00436     if (UnderIT)
00437     {
00438       portENTER_CRITICAL();
00439       // Add the function need to the xSUPERVISORQueue.
00440       xQueueSendFromISR( xSUPERVISORQueue, (void *)&(pfWaitHostUserAction[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]), &xYieldRequired );
00441       portEXIT_CRITICAL();
00442     }
00443     else
00444     {
00445       // Add the function need to the xSUPERVISORQueue.
00446       xQueueSend( xSUPERVISORQueue, (void *)&(pfWaitHostUserAction[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]), 0 );
00447     }
00448   }
00449   // Idle mode : we have something to do
00450   else if (eCurrentUserMenu == eUserMenuIdle)
00451 #else
00452   // Idle mode : we have something to do
00453   if (eCurrentUserMenu == eUserMenuIdle)
00454 #endif
00455   {
00456     // caller is under IT
00457     if (UnderIT)
00458     {
00459       portENTER_CRITICAL();
00460       // Add the function need to the xSUPERVISORQueue.
00461       xQueueSendFromISR( xSUPERVISORQueue, (void *)&(pfIdleUserAction[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]), &xYieldRequired );
00462       portEXIT_CRITICAL();
00463     }
00464     else
00465     {
00466       // Add the function need to the xSUPERVISORQueue.
00467       xQueueSend( xSUPERVISORQueue, (void *)&(pfIdleUserAction[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]), 0 );
00468     }
00469   }
00470   // other mode : nothing to do...
00471   else
00472   {
00473     return;
00474   }
00475 }

void vMMI_UserMessDisplay ( portCHAR *  Message  ) 

display message in User Mess space

Parameters:
Message Input. Message to display

Definition at line 687 of file MMI.c.

References MMI_LINE_LENGTH, MMI_SPACE, UserMessScreen, and xMMIQueue.

Referenced by bMMI_start(), and e_lcd_set_value().

00688 {
00689 unsigned short i = 0;
00690 
00691   // add the received data to the line
00692   do
00693   {
00694     UserMessScreen[i++] = *Message++;
00695   }while (*Message != '\0' && i < MMI_LINE_LENGTH);
00696   // fill in with white spaces to clear older data
00697   do
00698   {
00699     UserMessScreen[i++] = MMI_SPACE;
00700   }while (i < MMI_LINE_LENGTH);
00701   // add EOL
00702   UserMessScreen[MMI_LINE_LENGTH] = '\0';
00703   // Add the refresh need to the xMMIQueue.
00704   xQueueSend( xMMIQueue, (void *)&UserMessScreen, 0 );
00705 }


Variable Documentation

current item in user menu

Definition at line 288 of file MMI.c.

Referenced by vMMI_SetUserMenuMode(), vMMI_UserMenuDisplayNextItem(), vMMI_UserMenuDisplayPreviousItem(), and vMMI_UserMenuValidateItem().

portCHAR* DateScreen = Line[DATE_LINE - 1]

pointer to the memory image of the date line

Definition at line 278 of file MMI.c.

Referenced by vMMI_DisplayDateAndTime(), and vMMI_Manage().

eUserMenu eCurrentUserMenu = eUserMenuIdle

portCHAR Line[MMI_NB_LINE][MMI_LINE_LENGTH+1]

memory image of the display

Definition at line 273 of file MMI.c.

Referenced by bMMI_start(), and vMMI_Manage().

const portCHAR* const MMI_IdleActingMenu[MMI_IDLE_MENU_MAX_ITEM]

Initial value:

 {


"", 
"Formating a:        ",
"Creating a:/LOG     ",
"LOGS set to DF      ",
"Formating b:        ",
"Creating b:/LOG     ",
"LOGS set to SDMMC   "
















}
lines to display in Idle menu when an action is performed.

Definition at line 215 of file MMI.c.

Referenced by vMMI_SetUserMenuMode().

const portCHAR* const MMI_IdleMenu[MMI_IDLE_MENU_MAX_ITEM]

Initial value:

 {


"\x20 Set as USB key   \x10",
"\x11 Format a:(DF)    \x10",
"\x11 Create a:/LOG    \x10",
"\x11 Log to a:(DF)    \x10",
"\x11 Format b:(SDMMC) \x10",
"\x11 Create b:/LOG    \x10",
"\x11 Log to b:(SDMMC) \x20"
















}
lines to display in Idle menu

Definition at line 186 of file MMI.c.

Referenced by vMMI_SetUserMenuMode(), vMMI_UserMenuDisplayNextItem(), and vMMI_UserMenuDisplayPreviousItem().

const portCHAR* const MMI_USBDeviceMenu[MMI_USB_DEVICE_MENU_MAX_ITEM]

Initial value:

 {
"USB Mass Storage    "
}
lines to display in USB Device menu

Definition at line 173 of file MMI.c.

Referenced by vMMI_SetUserMenuMode(), vMMI_UserMenuDisplayNextItem(), and vMMI_UserMenuDisplayPreviousItem().

const portCHAR* const MMI_USBHostActingMenu[MMI_USB_HOST_MENU_MAX_ITEM]

Initial value:

 {
"Copying Logs        ",
"Moving Logs         ",
"Uploading WEB Files ",
"Uploading CFG Files "
}
lines to display in USB Host menu

Definition at line 156 of file MMI.c.

Referenced by vMMI_SetUserMenuMode().

const portCHAR* const MMI_USBHostMenu[MMI_USB_HOST_MENU_MAX_ITEM]

Initial value:

 {
"\x20 Copy Logs        \x10",
"\x11 Move Logs        \x10",
"\x11 Upload WEB Files \x10",
"\x11 Upload CFG Files \x20"
}
lines to display in USB Host menu

Definition at line 148 of file MMI.c.

Referenced by vMMI_SetUserMenuMode(), vMMI_UserMenuDisplayNextItem(), and vMMI_UserMenuDisplayPreviousItem().

const portCHAR* const MMI_WaitHostMenu[MMI_WAIT_MENU_MAX_ITEM]

Initial value:

lines to display in Waiting-for-host menu

Definition at line 261 of file MMI.c.

Referenced by vMMI_SetUserMenuMode().

portCHAR* ParamScreen = Line[PARAM_LINE - 1]

pointer to the memory image of the param line

Definition at line 276 of file MMI.c.

Referenced by vMMI_DisplayIP(), vMMI_DisplayUSBState(), and vMMI_Manage().

const signed portCHAR* const pcStringLogDirectoryNameA

The <drive letter>:/LOG strings.

"\<drive letter>:/LOG" strings.

Definition at line 116 of file datalog.c.

Referenced by b_datalog_set_current_log_drive_toDF(), and bdatalog_start().

const signed portCHAR* const pcStringLogDirectoryNameB

Definition at line 117 of file datalog.c.

Referenced by b_datalog_set_current_log_drive_toSDMMC().

const signed portCHAR* const pcStringLogDirName = (signed portCHAR *)"LOG"

The "LOG" string.

Definition at line 305 of file MMI.c.

Referenced by b_mmi_mkdir_aLOG(), and b_mmi_mkdir_bLOG().

char pcTempoDate[17] [static]

Temporary array to set the creation date of the LOG directory.

Definition at line 294 of file MMI.c.

pfUserAction const pfIdleUserAction[MMI_IDLE_MENU_MAX_ITEM]

pfUserAction const pfUSBDeviceUserAction[MMI_USB_DEVICE_MENU_MAX_ITEM]

Initial value:

functions to call in USB Device menu

Definition at line 178 of file MMI.c.

Referenced by vMMI_UserMenuValidateItem().

pfUserAction const pfUSBHostUserAction[MMI_USB_HOST_MENU_MAX_ITEM]

Initial value:

functions to call in USB Host menu

Definition at line 164 of file MMI.c.

Referenced by vMMI_UserMenuValidateItem().

pfUserAction const pfWaitHostUserAction[MMI_WAIT_MENU_MAX_ITEM]

Initial value:

functions to call in Waiting-for-host menu

Definition at line 266 of file MMI.c.

Referenced by vMMI_UserMenuValidateItem().

signed short sMmiNavId

portCHAR* UserMenuScreen = Line[USER_MENU_LINE - 1]

pointer to the memory image of the User Menu line

Definition at line 280 of file MMI.c.

Referenced by vMMI_DisplayIP(), vMMI_Manage(), vMMI_SetUserMenuMode(), vMMI_UserMenuDisplay(), vMMI_UserMenuDisplayNextItem(), and vMMI_UserMenuDisplayPreviousItem().

portCHAR* UserMessScreen = Line[USER_MESS_LINE - 1]

pointer to the memory image of the User Mess line

Definition at line 282 of file MMI.c.

Referenced by vMMI_Manage(), and vMMI_UserMessDisplay().

xQueueHandle xMMIQueue = 0 [static]

xQueueHandle xSUPERVISORQueue

The handle of the queue of SUPERVISOR.

The handle of the queue of SUPERVISOR, holding user actions to perform.

Definition at line 228 of file supervisor.c.

Referenced by portTASK_FUNCTION(), prv_v_manage_user_action(), and vMMI_UserMenuValidateItem().


Generated on Fri Feb 19 02:22:46 2010 for AVR32 - Control Panel demonstration. by  doxygen 1.5.5