MMI.h 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.h.

Go to the source code of this file.

Defines

#define MMI_MAINTAINER_MODE   "Waiting for Host "

Enumerations

enum  eUserMenu {
  eUserMenuIdle = 0, eUserMenuIdleActing, eUserMenuWaitHost, eUserMenuUSBHost,
  eUserMenuUSBHostActing, eUserMenuUSBDevice
}

Functions

Bool bMMI_start (void)
 Init MMI, for Man to Macine Interface management.
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


Define Documentation

#define MMI_MAINTAINER_MODE   "Waiting for Host "

Definition at line 67 of file MMI.h.


Enumeration Type Documentation

enum eUserMenu

types for User Menu screen

Enumerator:
eUserMenuIdle 
eUserMenuIdleActing 
eUserMenuWaitHost 
eUserMenuUSBHost 
eUserMenuUSBHostActing 
eUserMenuUSBDevice 

Definition at line 58 of file MMI.h.


Function Documentation

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 }

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 }


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