EMWIN Demo
单片机源程序如下:
- /*********************************************************************
- * SEGGER Microcontroller GmbH & Co. KG *
- * Solutions for real time microcontroller applications *
- **********************************************************************
- * *
- * (c) 1996 - 2017 SEGGER Microcontroller GmbH & Co. KG *
- * *
- * *
- **********************************************************************
- ** emWin V5.42 - Graphical user interface for embedded applications **
- emWin is protected by international copyright laws. Knowledge of the
- source code may not be used to write a similar product. This file may
- only be used in accordance with a license and should not be re-
- distributed in any way. We appreciate your understanding and fairness.
- ----------------------------------------------------------------------
- File : MainTask_WashingMachine.c
- Purpose : Multilayer-WashingMachine-Demo 800x480
- ---------------------------END-OF-HEADER------------------------------
- */
- #include "LCDConf.h"
- #include "WM.h"
- #include "DIALOG.h"
- #include "Resource.h"
- #include "stdio.h"
- /*********************************************************************
- *
- * Configuration
- *
- * Set this define to one if using a configuration for softlayer.
- *
- **********************************************************************
- */
- #define USE_SOFTLAYER 0
- /*********************************************************************
- *
- * Defines
- *
- **********************************************************************
- */
- #define IMAGE_FRAME_Y 6 // y-frame within bmBar_776x173
- #define IMAGE_SIZE_Y 157 // y-size (opaque part) within bmBar_776x173
- #define LAYER_BACKGROUND 0
- #define LAYER_SLIDER 1
- #define LAYER_BAR 2
- #define LAYER_START 3
- #define PERIOD_FADE 150
- #define PERIOD_STAY 3000
- #define PERIOD_ANIM 250
- #define PERIOD_SNAP 150
- #define INDEX_PROGRAM 0
- #define INDEX_HOUR 4
- #define INDEX_MINUTE 5
- #define FONT_DURATION &GUI_Font23SL_AA4
- #define FONT_LABEL &GUI_Font27SL_AA4
- #define FONT_SCROLLW &GUI_Font32SL_AA4
- #define FONT_MAG &GUI_Font39SL_AA4
- #define FONT_MAG_TIME &GUI_Font60SL_AA4
- #define FONT_START &GUI_Font39SL_AA4
- #define MARGIN_LEFT 16
- #define MARGIN_LEFT_MAG 8
- #define YPOS_LABEL 10
- #define YPOS_DURATION 110
- #define ANIM_START_LAYER_DIST 110
- #define COLOR_GREEN 0x0014b6a9
- #define COLOR_BLUE 0x00623700
- #define COLOR_RED 0x000000ff
- #define COLOR_WHITE 0x00F2F2F2
- #define ALPHA_ACTIVE 0x10000000
- #define ALPHA_BAR 0x0D000000
- #define APP_SET_INTENS (WM_USER + 0)
- /*********************************************************************
- *
- * Types
- *
- **********************************************************************
- */
- typedef struct {
- //
- // Initialized at the beginning, not changed later on
- //
- int Index; // Index # of parameters
- int Start; // Initially selected value
- int n; // Number of items
- int xPos; // X-position of window
- int xSize; // X-size of window
- const char ** apTextSingle; // Single line text for scroll window
- const char ** apTextDouble; // Optional double line text for bar
- const char * pLabel; // Label
- //
- // Dynamically calculated values
- //
- int yPos; // Value changed by motion support
- int Active; // If set to 1 labels should not be drawn
- //
- // Used in animation...
- //
- int PosStart;
- int PosDiff;
- } PARA;
- /*********************************************************************
- *
- * Static data
- *
- **********************************************************************
- */
- //
- // Duration text for different programs
- //
- static const char * _apDuration[] = { "2h 32min", "1h 45min", "2h 15min", "1h 20min", "1h 10min", "15min" };
- //
- // Text to be used in slider layer
- //
- static const char * _apText0_Single[] = { "Eco Wash", "Synthetics", "Cotton", "Wool", "Silk", "Spin" };
- static const char * _apText1_Single[] = { "90?", "60?", "40?", "30?", "COLD" };
- static const char * _apText2_Single[] = { "1600", "1400", "1200", "800", "400", "none" };
- static const char * _apText3_Single[] = { "None", "Short", "Extra Spinning", "Pre-Washing", "Extra Rinsing", "Wrinkle Resitance" };
- static const char * _apText3_Double[] = { NULL, NULL, NULL, NULL, "Extra", "Spinning", "Pre-","Washing", "Extra", "Rinsing", "Wrinkle", "Resitance" };
- static const char * _apText4_Single[] = { "00", "01", "02", "03", "04", "05", "06", "07", "08", "09",
- "10", "11", "12", "13", "14", "15", "16", "17", "18", "19",
- "20", "21", "22", "23" };
- static const char * _apText5_Single[] = { "00", "01", "02", "03", "04", "05", "06", "07", "08", "09",
- "10", "11", "12", "13", "14", "15", "16", "17", "18", "19",
- "20", "21", "22", "23", "24", "25", "26", "27", "28", "29",
- "30", "31", "32", "33", "34", "35", "36", "37", "38", "39",
- "40", "41", "42", "43", "44", "45", "46", "47", "48", "49",
- "50", "51", "52", "53", "54", "55", "56", "57", "58", "59" };
- //
- // Bar segment definitions to be shown in slider layer
- //
- static PARA _aPara[] = {
- { 0, 0, GUI_COUNTOF(_apText0_Single), 5, 165, _apText0_Single, NULL, "Program"},
- { 1, 3, GUI_COUNTOF(_apText1_Single), 171, 105, _apText1_Single, NULL, "Temp."},
- { 2, 0, GUI_COUNTOF(_apText2_Single), 277, 90, _apText2_Single, NULL, "U/min"},
- { 3, 2, GUI_COUNTOF(_apText3_Single), 368, 225, _apText3_Single, _apText3_Double, "Options"},
- { 4, 19, GUI_COUNTOF(_apText4_Single), 594, 75, _apText4_Single, NULL, "Start"},
- { 5, 15, GUI_COUNTOF(_apText5_Single), 670, 75, _apText5_Single, NULL, ""}
- };
- //
- // Pointers to be attached to the bar segment windows
- //
- static PARA * _apPara[GUI_COUNTOF(_aPara)];
- //
- // Handles of bar segment windows
- //
- static WM_HWIN _ahWinBarSegment[GUI_COUNTOF(_aPara)];
- //
- // Image index to be shown in the background
- //
- static int _IndexImage;
- //
- // Array of background images
- //
- static const GUI_BITMAP * _apBitmapBk[] = {
- &bmBkEco_800x480,
- &bmBkSynthetic_800x480,
- &bmBkCotton_800x480,
- &bmBkWoll_800x480,
- &bmBkSilk_800x480,
- &bmBkSpin_800x480,
- };
- //
- // Common...
- //
- static int _Fading;
- static int _IndexActive;
- static WM_HWIN _hWinActive;
- /*********************************************************************
- *
- * Static code
- *
- **********************************************************************
- */
- /*********************************************************************
- *
- * _cbRefresh
- */
- static int _cbRefresh(int TimeRem, void * pVoid) {
-
- ……………………
- …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码
所有资料51hei提供下载:
WashingMachine_800x480_SRC.zip
(350.93 KB, 下载次数: 19)
|