老熟妇,老熟女chese老熟女,亚洲AV中文无码字幕色三,超碰欧美

Ultimaker2Malin函數(shù)詳解——lcd_lib_draw_gfx(0, 22, ultimakerTextGfx); 

2016-12-05 10:16
Ultimaker2Marlin函數(shù)詳解.webp

位置:UltiLCD2_low_lib.c函數(shù)引用:lcd_lib_draw_gfx(0, 22, ultimakerTextGfx);
函數(shù)功能:開(kāi)機(jī)顯示Ultimaker logo
              顯示位置是第22行第0列開(kāi)始
             該函數(shù)把ultimakerTextGfx數(shù)組里面的logo數(shù)據(jù)寫(xiě)進(jìn)lcd_buffer數(shù)組里面,然后在一直在lcd_update函數(shù)里面更新顯示。
函數(shù)原型:
void lcd_lib_draw_gfx(uint8_t x, uint8_t y,const uint8_t* gfx)
{
    uint8_tw = pgm_read_byte(gfx++); //w=128
    uint8_th = (pgm_read_byte(gfx++) + 7) / 8; //h=3
    uint8_tshift = y % 8; //shift=6
    uint8_tshift2 = 8 - shift; //shift2=2
    y /= 8;//y=2
                                        //x=0


    for(;h; h--)
   {
       if (y >= LCD_GFX_HEIGHT /8) break;


       uint8_t* dst0 = lcd_buffer +x + y * LCD_GFX_WIDTH;
       uint8_t* dst1 = lcd_buffer +x + y * LCD_GFX_WIDTH + LCD_GFX_WIDTH;
       for(uint8_t _w = w; _w;_w--)
       {
          uint8_t c = pgm_read_byte(gfx++);
          *dst0++ |= c << shift;
          if (shift && y < 7)
              *dst1++ |=c >> shift2;
       }
       y++;
   }
}


測(cè)試代碼:
環(huán)境:vc++6.0 EasyX 庫(kù)


//ultimakerTextGfx轉(zhuǎn)成lcd_buffer數(shù)據(jù)格式
#include
#include
#include
#include "common.h"

const uint8_t ultimakerTextGfx[]= {
    128, 21, //size
   0x6,0x6,0x6,0x6,0xfe,0xfe,0xfe,0xfe,0xfc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
   0xfc,0xfe,0xfe,0xfe,0xfc,0x0,0x0,0x0,0xe,0xfe,0xfe,0xfe,0xfe,0x0,0x0,0xe0,
   0xf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f,0xf,0xf,0xf,0xf,0xf,0xf,
   0x7,0x7,0x7,0xf,0xf,0x6,0x0,0x0,0x0,0x7,0xf,0xf,0x7,0x0,0x0,0x0,
   0x7,0xf,0xf,0x7,0x0,0x0,0x0,0x0,0x0,0xf,0xf,0xf,0x0,0x0,0x6,0xf,
   0xf,0x7,0x1,0x0,0x0,0x0,0x1,0x7,0xf,0xf,0x7,0x1,0x0,0x0,0x0,0x1,
   0x7,0xf,0xf,0x6,0x0,0x0,0x3,0x7,0xf,0xf,0xe,0xe,0x6,0x7,0x3,0x7,
   0xf,0xf,0x7,0x0,0x0,0x0,0x7,0xf,0xf,0x7,0x0,0x0,0x0,0x0,0x3,0xf,
   0xf,0xf,0x6,0x0,0x0,0x0,0x3,0x7,0x7,0xf,0xe,0xe,0xe,0xe,0xe,0xe,
   0x6,0x0,0x0,0x0,0x0,0xf,0xf,0xf,0xf,0x0,0x0,0x0,0x0,0x0,0x0,0x0
};

#define LCD_GFX_WIDTH 128
#define LCD_GFX_HEIGHT 64
uint8_t lcd_buffer[LCD_GFX_WIDTH * LCD_GFX_HEIGHT / 8];

static inline uint8_t pgm_read_byte(const void* ptr)
{
    return *(constuint8_t*)ptr;
}

//lcd_lib_draw_gfx(0, 22, ultimakerTextGfx);
void lcd_lib_draw_gfx(uint8_t x, uint8_t y, const uint8_t*gfx)
{
    uint8_t w =pgm_read_byte(gfx++); // w=128 總列數(shù) X
    uint8_t h =(pgm_read_byte(gfx++) + 7) / 8; //(21+7)/8 h=3 總行數(shù) Y
    uint8_t shift = y % 8; //22%8shift=6   左移位數(shù)
    uint8_t shift2 = 8 - shift;//8-2   shift2=2   右移位數(shù)
    y /= 8; //22/8      y=2  顯示的行位置
                                         //          x=0  顯示的列位置

    for(; h; h--)//3行
    {
       if (y >= LCD_GFX_HEIGHT / 8)break;//判斷行數(shù)y值是否超出屏幕的行數(shù),y最大是8

       uint8_t* dst0 = lcd_buffer + x + y *LCD_GFX_WIDTH;//指向數(shù)組[0+2*128]的位置,第3行第一個(gè)位置(3->4->5)
       uint8_t* dst1 = lcd_buffer + x + y *LCD_GFX_WIDTH +LCD_GFX_WIDTH;//指向數(shù)組[0+2*128+128]的位置,第4行第一個(gè)位置(4->5->6)
       for(uint8_t _w = w; _w; _w--)//128列
       {
           uint8_t c= pgm_read_byte(gfx++);//把數(shù)組的值賦給變量c(一個(gè)字節(jié))
           *dst0++ |=c << shift;//低2位
//第3行字節(jié)最低的2位變?yōu)楦?位,即把整個(gè)數(shù)組網(wǎng)上挪了2個(gè)位
//或等于的作用是保留原來(lái)lcd_buffer數(shù)組里面的其他區(qū)域的值
                 //本來(lái)是在ultimakerTextGfx數(shù)組的低2位數(shù)據(jù)和高6位數(shù)據(jù)拆開(kāi),分別賦值到上下兩個(gè)字節(jié),
//比如第二行的高2位是ultimakerTextGfx數(shù)組的低2位數(shù)據(jù),第三行低6位是ultimakerTextGfx數(shù)組的高6位數(shù)據(jù)
           if (shift&& y <7)//shift==0是不需要挪動(dòng),y<7作用是限定在一個(gè)字節(jié)里面,如果等于7,那么dst就指向了別的字節(jié)
              *dst1++ |= c >>shift2;//高6位,和dst0同理,分別指向一個(gè)字節(jié)的高位和低位
                  
       }
       y++;//2->3->4
    }
}

void main()
{
unsigned int i,j,k;
char c='#';
initgraph(8*128, 16*64);
lcd_lib_draw_gfx(0, 22, ultimakerTextGfx);

for(i=0;i<8;i++)//8行掃描
{
for(k=0;k<8;k++)//字節(jié)8位掃描
{
for(j=0;j<128;j++)//128列掃描
{
if( lcd_buffer[i*128+j]&(0x01<<k) )
{      
outtextxy(j*8, (i*8+k)*16, c);
}
}
}
}
getch();
closegraph();
}
聲明:3D打印資源庫(kù)(3dzyk)內(nèi)網(wǎng)友所發(fā)表的所有內(nèi)容及言論僅代表其本人,并不代表3D打印資源庫(kù)(3dzyk)觀點(diǎn)和立場(chǎng);如對(duì)文章有異議或投訴,請(qǐng)联系kefu@3dzyk.cn。
標(biāo)簽:
Ultimaker2Malin函數(shù)詳解——lcd_lib_draw_gfx(0, 22, ultimakerTextGfx); 
快速回復(fù) 返回頂部 返回列表
日韩一级大片| 久久久网老色批| 亚洲伊人久久大香线蕉综合图片| 亚洲一区精品在线| 中文字幕一区二区三区四区| 久久精品国产亚洲一区二区| 精品波多| 国产人妻15p| 久久久久久亚洲精品中文字幕浪潮| 国产综合欧美激情| 国产一区二区三区四区老人| 综合网婷婷| 久久久久久久久探花精品红桃| 大荔县| 亚洲无码成人小电影| 色哟哟性AV| 日韩一本无码视频| 国广精品91久久久久| 一木久道热线v| 少妇一级在线观看| 亚洲精品www47| 欧美专区第1页| 欧美日韩中文日日骚| 亚洲综合色导航| 异族黑人巨大怪物| 黄色在线看| 狠狠爱av| 亚欧www| 亚洲欧美成人| 蜜桃97夜夜做| 狠狠色综合网站久久久久| 蜜桃5| 色吆吆| 欧美日韩人妻精品| 91精品国产乱码久久蜜臀 | 色老头色老太aaabbb| 久久毛片中文字幕| 国产偷国产偷亚洲清高APP| 久久久久91精品视频| 日本一区不卡二区高清| 97超碰.com|