Microchip® Advanced Software Framework

mmi.c File Reference
#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"

Macros

#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   6
 
#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 More...
 
static bool b_mmi_format_a (void)
 Format the a drive. More...
 
static bool b_mmi_format_b (void)
 Format the b drive. More...
 
static bool b_mmi_mkdir_aLOG (void)
 Create the /LOG directory under a. More...
 
static bool b_mmi_mkdir_bLOG (void)
 Create the /LOG directory under b. More...
 
bool bMMI_start (void)
 Init MMI, for Man to Machine Interface management. More...
 
static void prvMMI_Init (void)
 MMI function for initialisation. More...
 
void vMMI_DisplayDateAndTime (portCHAR *pcDateTime)
 display Date in Date space More...
 
void vMMI_DisplayIP (portCHAR *IPAddress)
 display IP in Param space More...
 
void vMMI_DisplayUSBState (bool bConnected)
 display USB connection status. More...
 
void vMMI_Manage (void)
 MMI function for Man to Machine Interface management. More...
 
void vMMI_SetUserMenuMode (eUserMenu UserMenu, bool ResetCurrentState)
 set MMI current Menu More...
 
void vMMI_UserMenuDisplay (portCHAR *Message)
 display message in User Menu space More...
 
void vMMI_UserMenuDisplayNextItem (bool UnderIT)
 display next screen in User Menu space More...
 
void vMMI_UserMenuDisplayPreviousItem (bool UnderIT)
 display previous screen in User Menu space More...
 
void vMMI_UserMenuValidateItem (bool UnderIT)
 Validate the current item in User Menu. More...
 
void vMMI_UserMessDisplay (portCHAR *Message)
 display message in User Mess space More...
 

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]
 
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]
 
signed short sMmiNavId
 
portCHAR * UserMenuScreen = Line[USER_MENU_LINE - 1]
 
portCHAR * UserMessScreen = Line[USER_MESS_LINE - 1]
 
static xQueueHandle xMMIQueue = 0
 
xQueueHandle xSUPERVISORQueue
 

#define ATMEL_BANNER   " ATMEL AVR32 UC3 "

Banner for ATMEL product

Referenced by bMMI_start().

#define DATE_LINE   LINE_1

Link date line to the first one

Referenced by vMMI_Manage().

#define LINE_1   0x01

this is the first line

#define LINE_2   0x02

this is the second line

#define LINE_3   0x03

this is the third line

#define LINE_4   0x04

this is the fourth line

#define MMI_IDLE_MENU_MAX_ITEM   6

number of items in Idle Menu

Referenced by vMMI_UserMenuDisplayNextItem().

#define MMI_LINE_LENGTH   20
#define MMI_NB_LINE   4

number of lines on display

Referenced by bMMI_start().

#define MMI_QUEUE_SIZE   MMI_NB_LINE

definition of the MMI queue size

Referenced by bMMI_start().

#define MMI_SPACE   0x20
#define MMI_USB_CONNECTED   0xB7

define the char used upon USB connection

Referenced by vMMI_DisplayUSBState().

#define MMI_USB_DEVICE_MENU_MAX_ITEM   1

number of items in USB Device Menu

Referenced by vMMI_UserMenuDisplayNextItem().

#define MMI_USB_HOST_MENU_MAX_ITEM   4

number of items in USB host Menu

Referenced by vMMI_UserMenuDisplayNextItem().

#define MMI_WAIT_MENU_MAX_ITEM   1

number of items in Waiting-for-host Menu

#define PARAM_LINE   LINE_2

Link param line to the second one

Referenced by vMMI_Manage().

#define USER_MENU_LINE   LINE_3

Link User Menu line to the third one

Referenced by vMMI_Manage().

#define USER_MESS_LINE   LINE_4

Link User Mess line to the fourth one

Referenced by vMMI_Manage().

typedef bool(* pfUserAction)(void)

definition of the User action function pointer

bool b_MMI_do_nothing ( void  )

function to do nothing upon user action

Function to do nothing

References NAKED_TRACE_COM2, and pdTRUE.

static bool b_mmi_format_a ( void  )
static
bool bMMI_start ( void  )
void vMMI_DisplayDateAndTime ( portCHAR *  pcDateTime)

display Date in Date space

Parameters
pcDateTimeInput. date to display

References DateScreen, and xQueueSend.

Referenced by portTASK_FUNCTION().

void vMMI_DisplayIP ( portCHAR *  IPAddress)

display IP in Param space

Parameters
IPAddressInput. IP to display

References i, MMI_LINE_LENGTH, MMI_SPACE, ParamScreen, UserMenuScreen, and xQueueSend.

Referenced by prvEthernetConfigureInterface().

void vMMI_DisplayUSBState ( bool  bConnected)

display USB connection status.

Parameters
bConnectedInput. USB connection status.

References MMI_LINE_LENGTH, MMI_SPACE, MMI_USB_CONNECTED, ParamScreen, pdTRUE, and xQueueSend.

Referenced by portTASK_FUNCTION().

void vMMI_Manage ( void  )
void vMMI_SetUserMenuMode ( eUserMenu  UserMenu,
bool  ResetCurrentState 
)
void vMMI_UserMenuDisplay ( portCHAR *  Message)

display message in User Menu space

Parameters
MessageInput. Message to display

References eCurrentUserMenu, eUserMenuIdle, i, MMI_LINE_LENGTH, MMI_SPACE, UserMenuScreen, and xQueueSend.

void vMMI_UserMenuDisplayNextItem ( bool  UnderIT)
void vMMI_UserMenuDisplayPreviousItem ( bool  UnderIT)

display previous screen in User Menu space

Parameters
UnderITInput. True if calling from IT

References cMMI_SubMenu_CurrentItem, eCurrentUserMenu, eUserMenuIdle, eUserMenuUSBDevice, eUserMenuUSBHost, Max, MMI_IdleMenu, pdFALSE, portENTER_CRITICAL, portEXIT_CRITICAL, UserMenuScreen, xQueueSend, and xQueueSendFromISR.

Referenced by prvjoystick_ISR_NonNakedBehaviour().

void vMMI_UserMenuValidateItem ( bool  UnderIT)
void vMMI_UserMessDisplay ( portCHAR *  Message)

display message in User Mess space

Parameters
MessageInput. Message to display

References i, MMI_LINE_LENGTH, MMI_SPACE, UserMessScreen, and xQueueSend.

Referenced by bMMI_start(), and e_lcd_set_value().

portCHAR cMMI_SubMenu_CurrentItem = 0
portCHAR* DateScreen = Line[DATE_LINE - 1]

pointer to the memory image of the date line

Referenced by vMMI_DisplayDateAndTime(), and vMMI_Manage().

portCHAR Line[MMI_NB_LINE][MMI_LINE_LENGTH+1]

memory image of the display

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.

Referenced by vMMI_SetUserMenuMode().

const portCHAR* const MMI_IdleMenu[MMI_IDLE_MENU_MAX_ITEM]
Initial value:
= {
"\x20 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

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

portCHAR* ParamScreen = Line[PARAM_LINE - 1]

pointer to the memory image of the param line

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

const signed portCHAR* const pcStringLogDirectoryNameA

The <drive letter>:/LOG strings.

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

Referenced by b_datalog_set_current_log_drive_toDF(), and bdatalog_start().

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

The "LOG" string.

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.

Referenced by b_mmi_mkdir_aLOG(), and b_mmi_mkdir_bLOG().

pfUserAction const pfIdleUserAction[MMI_IDLE_MENU_MAX_ITEM]
Initial value:
= {
}
static bool b_mmi_mkdir_bLOG(void)
Create the /LOG directory under b.
Definition: mmi.c:895
static bool b_mmi_format_b(void)
Format the b drive.
Definition: mmi.c:832
bool b_datalog_set_current_log_drive_toSDMMC(void)
Set the current logs to be stored to the SDMMC card.
Definition: datalog.c:738
bool b_datalog_set_current_log_drive_toDF(void)
Set the current logs to be stored to the DataFlash.
Definition: datalog.c:720
static bool b_mmi_format_a(void)
Format the a drive.
Definition: mmi.c:810
static bool b_mmi_mkdir_aLOG(void)
Create the /LOG directory under a.
Definition: mmi.c:854

functions to call in Idle menu

Referenced by vMMI_UserMenuValidateItem().

signed short sMmiNavId
portCHAR* UserMenuScreen = Line[USER_MENU_LINE - 1]
portCHAR* UserMessScreen = Line[USER_MESS_LINE - 1]

pointer to the memory image of the User Mess line

xQueueHandle xMMIQueue = 0
static

The handle of the queue of MMI.

xQueueHandle xSUPERVISORQueue

The handle of the queue of SUPERVISOR.