Display

>w## Notice > * please include the header file "mmi_display.h" first when you want to show text on the device screen using display module `#include "mmi_display.h"` >i## data structure ``` /** * @brief screen display biggest character */ #if defined(QR100) #define SCREEN_WIDTH (20) #else #define SCREEN_WIDTH (26) #endif /** * @brief enum definition of display vertical alignment */ typedef enum { DISP_Line1 = 1, /*!< line 1 */ DISP_Line2 = 2, /*!< line 2 */ DISP_Line3 = 3, /*!< line 3 */ DISP_Line4 = 4, /*!< line 4 */ DISP_Line5 = 5, /*!< line 5 */ DISP_Line6 = 6, /*!< line 6 */ #if defined(QR100) DISP_Line7 = 7, /*!< line 7 */ DISP_Line8 = 8, /*!< line 8 */ DISP_Line9 = 9, /*!< line 9 */ #endif DISP_Top = 0xE0, /*!< to top */ DISP_Bottom = 0xE1, /*!< to buttom */ DISP_Bottom2 = 0xE2, /*!< to buttom 2 */ DISP_VCenter = 0xE3 /*!< to vertical center */ } DISP_VAlign; /** * @brief clear the screen */ #define DISP_ClearALL 255 /** * @brief enum definition of display horizontal alignment */ typedef enum { DISP_Left = 0xE0, /*!< to left */ DISP_Right = 0xE1, /*!< to right */ DISP_HCenter = 0xE2 /*!< to horizontal center */ } DISP_HAlign; /** * @brief struct definition of display param */ typedef struct { unsigned int alignL; /*!< horizontal center */ int backgroundColor; /*!< background color */ int color; /*!< font color */ int fontBackgroundColor; /*!< font background color */ } tsDispParam; ``` >i## mmi_clearLine ### Prototype `void mmi_clearLine(unsigned int line);` ### Function * clear screen ### Parameter |Name|Type|description| |-|-|-| |line|unsigned int|value of DISP_VAlign or DISP_ClearALL| ### Retval |Value|Type|Description| |-|-|-| |none||| >i## mmi_display ### Prototype `int mmi_display(DISP_VAlign line, unsigned int column, char *pszFmt, ...);` ### Function * show text on screen ### Parameter |Name|Type|description| |-|-|-| |line|DISP_VAlign|value of DISP_VAlign| |column|unsigned int|horizon position in line| |pszFmt|char *|text want to show, support format print| ### Retval |Value|Type|Description| |-|-|-| |> 0|int|next line| >i## mmi_displayEx ### Prototype `int mmi_displayEx(tsDispParam *pDispParam, DISP_VAlign line, const char *text);` ### Function * show format text on screen ### Parameter |Name|Type|description| |-|-|-| |pDispParam|tsDispParam *|show format| |line|DISP_VAlign|value of DISP_VAlign| |text|const char *|show content| ### Retval |Value|Type|Description| |-|-|-| |> 0|int|next line| >i## mmi_displayOfBlackBg ### Prototype `int mmi_displayOfBlackBg(DISP_VAlign line, unsigned int column, char *pszFmt, ...);` ### Function * show text on the black background of screen ### Parameter |Name|Type|description| |-|-|-| |line|DISP_VAlign|value of DISP_VAlign| |column|unsigned int|horizon position in line| |pszFmt|char *|text want to show, support format print| ### Retval |Value|Type|Description| |-|-|-| |> 0|int|next line| >i## mmi_displayQrCode ### Prototype `int mmi_displayQrCode(DISP_VAlign line, unsigned int column, unsigned char *qrcode, unsigned short width, unsigned short height);` ### Function * show QR code on screen ### Parameter |Name|Type|description| |-|-|-| |line|DISP_VAlign|value of DISP_VAlign| |column|unsigned int|horizon position in line| |qrcode|unsigned char *|QR code string| |width|unsigned short|QR code width| |height|unsigned short|QR code height| ### Retval |Value|Type|Description| |-|-|-| |> 0|int|next line| >i## mmi_displayBMP ### Prototype `int mmi_displayBMP(DISP_VAlign line, unsigned int column, unsigned char *bmpData, unsigned short width, unsigned short height);` ### Function * show BMP picture on screen ### Parameter |Name|Type|description| |-|-|-| |line|DISP_VAlign|value of DISP_VAlign| |column|unsigned int|horizon position in line| |bmpData|unsigned char *|bmp data string| |width|unsigned short|bmp picture width| |height|unsigned short|bmp picture height| ### Retval |Value|Type|Description| |-|-|-| |> 0|int|next line| >i## mmi_displayProgressbar ### Prototype `void mmi_displayProgressbar(DISP_VAlign line, int borderColor, int backgroundColor, unsigned int percent);` ### Function * show progress bar on screen ### Parameter |Name|Type|description| |-|-|-| |line|DISP_VAlign|value of DISP_VAlign| |borderColor|int|border color of the progress bar| |backgroundColor|int|progress bar color| |percent|unsigned int|progress percent| ### Retval |Value|Type|Description| |-|-|-| |none||| >i## mmi_displayTimerStart ### Prototype `void mmi_displayTimerStart(DISP_VAlign line, unsigned int column, unsigned char flipEnable, int timeout);` ### Function * show timer on screen ### Parameter |Name|Type|description| |-|-|-| |line|DISP_VAlign|value of DISP_VAlign| |column|unsigned int|horizon position in line| |flipEnable|unsigned char|enable countdown or not| |timeout|int|timeout setting| ### Retval |Value|Type|Description| |-|-|-| |none||| >i## mmi_displayTimerStop ### Prototype `void mmi_displayTimerStop(void);` ### Function * stop showing progress bar on screen ### Parameter |Name|Type|description| |-|-|-| |none||| ### Retval |Value|Type|Description| |-|-|-| |none||| >s## Example ``` ///<clear the entire screen mmi_clearLine(DISP_ClearALL); ///<show text in the center of the second line of screen char model[4] = "P90"; mmi_display(DISP_Line2, DISP_HCenter, "SmartPeak %s", model); ///<show red text in the left of the second line of screen tsDispParam dispParam = {DISP_Left, MERCURY_WHITE, MERCURY_RED, MERCURY_WHITE}; mmi_displayEx(&dispParam, DISP_Line2, "SmartPeak"); ///<show title in the center of the first line of screen char model[4] = "P90"; mmi_displayOfBlackBg(DISP_Line1, DISP_HCenter, "SmartPeak %s", model); ///<show QR code in the center of screen mmi_displayQrCode(DISP_Line2, DISP_HCenter, "SmartPeak P90", 150, 150); ///<show BMP picture in the center of screen mmi_displayBMP(DISP_Line2, DISP_HCenter, imgData, 300, 150); ///<show progress bar in second line of screen mmi_displayProgressbar(DISP_Line2, MERCURY_BLACK, MERCURY_GREEN, 100); ///<show progress bar in second line of screen mmi_displayProgressbar(DISP_Line2, MERCURY_BLACK, MERCURY_GREEN, 100); ///<show count down timer in the center of screen mmi_displayTimerStart(DISP_VCenter, DISP_HCenter, 1, 60); ///<stop timer mmi_displayTimerStop(); ```