⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smi_lcd.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 3 页
字号:
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 215 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 216 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 217 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 218 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 219 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 220 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 221 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 222 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 223 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 224 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 225 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 226 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 227 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 228 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 229 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 230 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 231 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 232 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 233 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 234 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 235 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 236 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 237 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 238 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 239 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 240 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 241 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 242 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 243 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 244 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 245 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 246 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 247 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 248 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 249 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 250 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 251 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 252 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 253 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 254 */
    { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x00, } , /* 255 */
};

#if 0
static char lng1 [] [32] =
{
    "asdjhsdjkh",
    "jhjhjhjkh"
};

static char *cl = lng1[0];
#endif

/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417)        MODULE  : ti1_scr            |
| STATE   : code                        ROUTINE : scrMobUpdate       |
+--------------------------------------------------------------------+

  PURPOSE : Shadow display to mobile simulation

*/

void scrMobUpdate (void)
{
    if (mobEnabled)
    {
        sprintf(scratch,"%s%s %d",scrHeader,"disp",LCD_COL_B);
        xIndex = 0;
/*
        mfwExtOut(scratch);
*/
    }
}


/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417)        MODULE  : ti1_scr            |
| STATE   : code                        ROUTINE : scrLCDUpdate       |
+--------------------------------------------------------------------+

  PURPOSE : Shadow display to LCD

*/

void scrLCDUpdate (void)
{
    int i;

    /* work around limitations of TI driver !                       */
    for (i = 0; i < LCD_ROW; i++)
    {
        display[i][LCD_COL_B-1] &= 0xF0;
        display[i][LCD_COL_B-1] |= (display[i][6] >> 2) & 0x0F;
    }
    LCD_PixBlt(0,0,LCD_COL_B*8,8,(char*)display);
    LCD_PixBlt(0,8,LCD_COL_B*8,8,(char*)(&(display[8][0])));
    LCD_PixBlt(0,16,LCD_COL_B*8,8,(char*)(&(display[16][0])));
    LCD_PixBlt(0,24,LCD_COL_B*8,8,(char*)(&(display[24][0])));
}


/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417)        MODULE  : ti1_scr            |
| STATE   : code                        ROUTINE : scrMobCommand      |
+--------------------------------------------------------------------+

  PURPOSE : Command string from mobile simulation

*/

void scrMobCommand (char *s)
{
    char *p;
    unsigned char *q;
    int i;

    if (strstr(s,"ena") == s)
    {
        mobEnabled = 1;
        return;
    }
    if (strstr(s,"dis") == s)
    {
        mobEnabled = 0;
        return;
    }
    if (strstr(s,"ok") == s)
    {
        if (xIndex < 0)
            return;
        strcpy(scratch,scrHeader);
        if (xIndex >= sizeof(display))
        {
            strcat(scratch,"done");
/*
            mfwExtOut(scratch);
*/
            return;
        }
        strcat(scratch,"data ");
        p = scratch + strlen(scratch);
        sprintf(p,"%04d %04d ",xIndex,LCD_COL_B*LCD_ROW/2);
        p = scratch + strlen(scratch);
        q = (U8 *) display;
        for (i = 0; i < LCD_COL_B * LCD_ROW / 2; i++)
        {
            sprintf(p,"%02x",q[xIndex++]);
            p += 2;
        }
        *p = '\0';
/*
        mfwExtOut(scratch);
*/
        return;
    }
}


/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417)        MODULE  : ti1_scr            |
| STATE   : code                        ROUTINE : scrInit            |
+--------------------------------------------------------------------+

  PURPOSE : initialize screen driver

*/

void scrInit (void)
{
    LCD_SetPower ();
    LCD_Reset ();
    LCD_Enable(1);
    LCD_Clear ();

    memset(display,0,sizeof(display));
    mobEnabled = 0;
    internal = 0;
    scrX = LCD_COL;
    scrY = LCD_ROW;
    xIndex = -1;
}


/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417)        MODULE  : ti1_scr            |
| STATE   : code                        ROUTINE : scrExit            |
+--------------------------------------------------------------------+

  PURPOSE : finalize screen driver

*/

void scrExit (void)
{
    LCD_Enable(0);
    mobEnabled = 0;
    xIndex = -1;
}


/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417)        MODULE  : ti1_scr            |
| STATE   : code                        ROUTINE : scrSize            |
+--------------------------------------------------------------------+

  PURPOSE : retrieve display size

*/

void scrSize (int *x, int *y)
{
    *x = scrX;
    *y = scrY;
}


/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417)        MODULE  : ti1_scr            |
| STATE   : code                        ROUTINE : scrClear           |
+--------------------------------------------------------------------+

  PURPOSE : clear display

*/

void scrClear (void)
{
    memset(display,0,sizeof(display));  /* clear shadow display     */
    LCD_Clear();                        /* TI driver function       */
    scrMobUpdate();                     /* update mobile simulation */
}


/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417)        MODULE  : ti1_scr            |
| STATE   : code                        ROUTINE : scrClearRect       |
+--------------------------------------------------------------------+

  PURPOSE : clear display area

*/

void scrClearRect (int px, int py, int sx, int sy)
{
    int x1, x2, i, j;
    U8 m1, m2;

    if (px < 0 || py < 0 || px >= scrX || py >= scrY
                                       || sx < 0 || sy < 0)
        return;
    if (px + sx > scrX)
        sx = scrX - px;
    if (py + sy > scrY)
        sy = scrY - py;

    x1 = px / 8;                        /* first x offset           */
    x2 = (px + sx) / 8;                 /* last x offset            */
    m1 = m2 = 0xff;
    m1 = (U8) ~(m1 >> (px & 7));        /* left mask                */
    m2 = (U8) (m2 >> ((px + sx) & 7));  /* right mask               */
    if (x1 == x2)
        m1 = m2 = m1 | m2;              /* combined masks           */
    for (j = py; j < py + sy; j++)
    {
        display[j][x1] &= m1;
        for (i = x1 + 1; i < x2; i++)
            display[j][i] = '\0';
        display[j][x2] &= m2;
    }

    scrLCDUpdate();                     /* update LCD               */
    scrMobUpdate();                     /* update mobile simulation */
}


/*

⌨️ 快捷键说明

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