memdev_autodev.c

来自「ucOS 的商业版本源代码及相关开发的一些资料」· C语言 代码 · 共 266 行 · 第 1/4 页

C
266
字号
*
********************************************************************
*/

#define MAG 3

static const GUI_POINT aNeedle[] = {
  { MAG * ( 0), MAG * (  0 + 125)},
  { MAG * (-3), MAG * (-15 + 125)},
  { MAG * (-3), MAG * (-65 + 125)},
  { MAG * ( 3), MAG * (-65 + 125)},
  { MAG * ( 3), MAG * (-15 + 125)},
};

/*******************************************************************
*
*      Structure containing information for drawing routine
*
*******************************************************************
*/

typedef struct {
  /* Information about what has to be displayed */
  GUI_AUTODEV_INFO AutoDevInfo;
  /* Polygon data */
  GUI_POINT aPoints[7];
  float Angle;
} PARAM;

/*******************************************************************
*
*                     GetAngle
*
********************************************************************

This routine returns the value value to indicate. In a real application,
this value would somehow be measured.
*/

static float GetAngle(int tDiff) {
  if (tDiff < 15000) {
    return  225 - 0.006 * tDiff ;
  }
  tDiff -= 15000;
  if (tDiff < 7500) {
    return  225 - 90 + 0.012 * tDiff ;
  }
  tDiff -= 7000;
  return 225;
}

/*******************************************************************
*
*                     Drawing routine
*
********************************************************************
*/

static void Draw(void * p) {
  PARAM * pParam = (PARAM *)p;
  /* Fixed background */
  if (pParam->AutoDevInfo.DrawFixed) {
    GUI_ClearRect (60, 50 + bmScaleR140.YSize, 60 + bmScaleR140.XSize - 1, 150);
    GUI_DrawBitmap(&bmScaleR140, 60, 50);
  }
  /* Moving needle */
  GUI_SetColor(GUI_WHITE);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?