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

📄 buxx_adrt.c

📁 bu1566dsp芯片用来处理ov7660或其他30万摄像模组的图像预览.图像拍照(jpeg压缩)
💻 C
📖 第 1 页 / 共 4 页
字号:
    case sC666B8A3:
        write_count = xsize * ysize;
        for (wcnt = 0; wcnt < write_count; wcnt++)
        {
            *LCD_PDAT_WRITE = (*rgb_data & 0xf800) >> 8;        //RGB Data are written
            *LCD_PDAT_WRITE = (*rgb_data & 0x07e0) >> 3;
            *LCD_PDAT_WRITE = (*rgb_data & 0x001f) << 3;
            rgb_data++;
        }
        break;
    case sC666B8A3B:
        write_count = xsize * ysize;
        for (wcnt = 0; wcnt < write_count; wcnt++)
        {
            *LCD_PDAT_WRITE = ((*rgb_data & 0xf800) >> 8) | ((*rgb_data & 0x0600) >> 9);        //RGB Data are written
            *LCD_PDAT_WRITE =
                ((*rgb_data & 0x01e0) >> 1) | ((*rgb_data & 0x001e) >> 1);
            *LCD_PDAT_WRITE = (*rgb_data & 0x0001) << 7;
            rgb_data++;
        }
        break;
#if defined sC666B9a2
    case sC666B9A2:
        write_count = xsize * ysize;
        for (wcnt = 0; wcnt < write_count; wcnt++)
        {
            *LCD_PDAT_WRITE = ((*rgb_data & 0xf800) >> 7) | (*rgb_data & 0x0700) >> 8;  //RGB Data are written
            *LCD_PDAT_WRITE =
                ((*rgb_data & 0x00e0) << 1) | ((*rgb_data & 0x001f) << 1);
            rgb_data++;
        }
        break;
#endif


    }

    if (bit_read(LCDCNT, bLCD_SEL) == sMAIN_ACS)
    {
        column_page_set(0, M_LCD_WSIZE - 1, 0, M_LCD_HSIZE - 1);
    }
    else
    {
        column_page_set(0, S_LCD_WSIZE - 1, 0, S_LCD_HSIZE - 1);
    }
}


//-----------------------------------------------------------------------------
//                      string data write (LCD direct write)
//-----------------------------------------------------------------------------
void aDRT_transparent_write_rgb565(const UINT16 * rgb_data,
                                   const UINT16 st_x, const UINT16 st_y,
                                   const UINT16 c_mask)
{
    UINT16 /*UINT8 */ mcdata[] =
    {
    M_CMD_DATA1, M_CMD_DATA2, M_CMD_DATA3, M_CMD_DATA4, M_CMD_DATA5,
            M_CMD_DATA6, M_CMD_DATA7};
    UINT16 /*UINT8 */ scdata[] =
    {
    S_CMD_DATA1, S_CMD_DATA2, S_CMD_DATA3, S_CMD_DATA4, S_CMD_DATA5,
            S_CMD_DATA6, S_CMD_DATA7};
    int i;
    int width, height;
    UINT16 colortype;
    UINT16 xsize, ysize;

    xsize = *rgb_data;
    rgb_data++;
    ysize = *rgb_data;
    rgb_data++;

    for (height = 0; height < ysize; height++)
    {
        for (width = 0; width < xsize; width++)
        {

            //A setup of a LCD indication area
            column_page_set(st_x + width, st_x + width + 2, st_y + height,
                            st_y + height);

            if (bit_read(LCDCNT, bLCD_SEL) == sMAIN_ACS)
            {
                for (i = 0; i < M_EXCMD; i++)
                {
                    *LCD_CMD_WRITE = mcdata[i]; //
                }
                colortype = M_LCD_CTYPE;
            }
            else
            {
                for (i = 0; i < S_EXCMD; i++)
                {
                    *LCD_CMD_WRITE = scdata[i]; //
                }
                colortype = S_LCD_CTYPE;
            }

            //data write
            switch (colortype)
            {
            case sC444B8A2:
                if (*rgb_data != c_mask)
                {
                    *LCD_PDAT_WRITE = (*rgb_data & 0xf000) >> 8 | (*rgb_data & 0x0780) >> 7;    //RGB Data are written
                    *LCD_PDAT_WRITE = (*rgb_data & 0x001e) << 3;
                }
                break;
            case sC444B8A2B:
                if (*rgb_data != c_mask)
                {
                    *LCD_PDAT_WRITE = (*rgb_data & 0xf000) >> 12;       //RGB Data are written
                    *LCD_PDAT_WRITE =
                        (*rgb_data & 0x0780) >> 3 | (*rgb_data & 0x001e) >>
                        1;
                }
                break;
            case sC444B8A15:
                if (*rgb_data != c_mask)
                {
                    *LCD_PDAT_WRITE = ((*rgb_data & 0xf000) >> 8) | ((*rgb_data & 0x0780) >> 7);        //RGB Data are written
                    *LCD_PDAT_WRITE = (*rgb_data & 0x001e) << 3;
                }
                break;
            case sC565B16A1:
                if (*rgb_data != c_mask)
                {
                    *LCD_PDAT_WRITE = *rgb_data;        //RGB Data are written
                }
                break;
            case sC565B8A2:
                if (*rgb_data != c_mask)
                {
                    *LCD_PDAT_WRITE = (*rgb_data & 0xff00) >> 8;        //RGB Data are written
                    *LCD_PDAT_WRITE = *rgb_data & 0x00ff;
                }
                break;
            case sC666B8A3:
                if (*rgb_data != c_mask)
                {
                    *LCD_PDAT_WRITE = (*rgb_data & 0xf800) >> 8;        //RGB Data are written
                    *LCD_PDAT_WRITE = (*rgb_data & 0x07e0) >> 3;
                    *LCD_PDAT_WRITE = (*rgb_data & 0x001f) << 3;
                }
                break;
            case sC666B8A3B:
                if (*rgb_data != c_mask)
                {
                    *LCD_PDAT_WRITE = ((*rgb_data & 0xf800) >> 8) | ((*rgb_data & 0x0600) >> 9);        //RGB Data are written
                    *LCD_PDAT_WRITE =
                        ((*rgb_data & 0x01e0) >> 1) | ((*rgb_data & 0x001e)
                                                       >> 1);
                    *LCD_PDAT_WRITE = (*rgb_data & 0x0001) << 7;
                }
                break;
#if defined sC666B9a2
            case sC666B9A2:
                if (*rgb_data != c_mask)
                {
                    *LCD_PDAT_WRITE = ((*rgb_data & 0xf800) >> 7) | (*rgb_data & 0x0700) >> 8;  //RGB Data are written
                    *LCD_PDAT_WRITE =
                        ((*rgb_data & 0x00e0) << 1) | ((*rgb_data & 0x001f)
                                                       << 1);
                }
                break;
#endif

            }
            rgb_data++;
        }                       //
    }                           //


    if (bit_read(LCDCNT, bLCD_SEL) == sMAIN_ACS)
    {
        column_page_set(0, M_LCD_WSIZE - 1, 0, M_LCD_HSIZE - 1);
    }
    else
    {
        column_page_set(0, S_LCD_WSIZE - 1, 0, S_LCD_HSIZE - 1);
    }

}


#if defined DEBUG
//-----------------------------------------------------------------------------
//                      string data write (LCD direct write)
//-----------------------------------------------------------------------------
void aDRT_write_string(const char *string, const int space,
                       const UINT16 st_x, const UINT16 st_y)
{

    int font_cnt;
    const UINT16 *font_data;

    for (font_cnt = 0; (font_cnt < 10) || (*string != '\0'); font_cnt++)
    {
        if (*string != '\0')
        {
            font_data = fonttable[*string];
            aDRT_transparent_write_rgb565(font_data,
                                          st_x + (space + 6) * font_cnt,
                                          st_y, 0xffff);

            string++;
        }                       //if (*string != '\0')
    }                           //for (font_cnt = 0; (font_cnt < 10) || (*string != '\0');font_cnt++)

    if (bit_read(LCDCNT, bLCD_SEL) == sMAIN_ACS)
    {
        column_page_set(0, M_LCD_WSIZE - 1, 0, M_LCD_HSIZE - 1);
    }
    else
    {
        column_page_set(0, S_LCD_WSIZE - 1, 0, S_LCD_HSIZE - 1);
    }

}




//-----------------------------------------------------------------------------
//                 string write for debug (LCD direct write)                     
//-----------------------------------------------------------------------------
void debug_write(const UINT16 st_x, const UINT16 st_y, const char *format,
                 ...)
{
    int i, y, cnt = 0, check = 0;
    va_list ap;
    char string[] = { "000000000000000000000000000000" };
    int arg_x;
    int value;

    va_start(ap, format);

    aDSC_Quit_Preview();

    if (bit_read(LCDCNT, bLCD_SEL) == sMAIN_ACS)
    {
        aDRT_clear(0, 0, M_LCD_WSIZE, M_LCD_HSIZE, 0xffffffff);
    }
    else
    {
        aDRT_clear(0, 0, S_LCD_WSIZE, S_LCD_HSIZE, 0xffffffff);
    }


    for (i = 0; format[i] != '\0'; i++)
    {
        switch (format[i])
        {
        case '%':
            check = 1;
            break;
        case 's':
            if (check)
            {

            }
            else
            {
                string[cnt] = format[i];
                cnt++;
                if (cnt >= 29)
                    goto DW_END;
            }
            break;
        case 'd':
            if (check)
            {

            }
            else
            {
                string[cnt] = format[i];
                cnt++;
                if (cnt >= 29)
                    goto DW_END;
            }
            break;
        case 'x':
            if (check)
            {
                check = 0;
                arg_x = va_arg(ap, int);
                for (y = 0; y < 8; y++)
                {
                    value =
                        (arg_x & (0xf0000000 >> y * 4)) >> (28 - y * 4);
                    if ((value >= 0 && value <= 9))
                    {
                        string[cnt] = value + 0x30;
                        cnt++;
                    }
                    else if (value >= 0xa && value <= 0xf)
                    {
                        string[cnt] = value + 0x37;
                        cnt++;
                    }
                    if (cnt >= 29)
                        goto DW_END;
                }
            }
            else
            {
                string[cnt] = format[i];
                cnt++;
                if (cnt >= 29)
                    goto DW_END;
            }
            break;
        default:
            string[cnt] = format[i];
            cnt++;
            if (cnt >= 29)
                goto DW_END;
            check = 0;
            break;
        }
    }

  DW_END:
    string[cnt] = '\0';
    aDRT_write_string(string, 0, st_x, st_y);

    va_end(ap);

  //  while (1);
}

#endif

⌨️ 快捷键说明

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