| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597 |
- C51 COMPILER V9.54 OLED 09/26/2022 20:11:46 PAGE 1
- C51 COMPILER V9.54, COMPILATION OF MODULE OLED
- OBJECT MODULE PLACED IN .\Objects\oled.obj
- COMPILER INVOKED BY: D:\Keil5 C51\C51\BIN\C51.EXE oled.c LARGE OPTIMIZE(8,SPEED) BROWSE DEBUG OBJECTEXTEND PRINT(.\Listi
- -ngs\oled.lst) TABS(2) OBJECT(.\Objects\oled.obj)
- line level source
- 1 #include "STC8XXXX.H"
- 2 #include "oled.h"
- 3 #include "oledfont.h"
- 4 #include <math.h>
- 5 #include <stdlib.h>
- 6 #include <string.h>
- 7
- 8 unsigned char _buf[128*8]=0;
- 9
- 10 unsigned char code height=8;
- 11 unsigned char code width=128;
- 12
- 13 bit _OLED_Reverse = 0;
- 14 bit _OLED_Overlap = 1;
- 15
- 16 static char __x, __y;
- 17
- 18 void delay_ms(unsigned int ms)
- 19 {
- 20 1 unsigned int a;
- 21 1 while(ms)
- 22 1 {
- 23 2 a=1800;
- 24 2 while(a--);
- 25 2 ms--;
- 26 2 }
- 27 1 return;
- 28 1 }
- 29
- 30 //反显函数
- 31 void OLED_ColorTurn(u8 i)
- 32 {
- 33 1 if(i==0)
- 34 1 {
- 35 2 OLED_WR_Byte(0xA6,OLED_CMD);//正常显示
- 36 2 }
- 37 1 if(i==1)
- 38 1 {
- 39 2 OLED_WR_Byte(0xA7,OLED_CMD);//反色显示
- 40 2 }
- 41 1 }
- 42
- 43 //屏幕旋转180度
- 44 void OLED_DisplayTurn(u8 i)
- 45 {
- 46 1 if(i==0)
- 47 1 {
- 48 2 OLED_WR_Byte(0xC8,OLED_CMD);//正常显示
- 49 2 OLED_WR_Byte(0xA1,OLED_CMD);
- 50 2 }
- 51 1 if(i==1)
- 52 1 {
- 53 2 OLED_WR_Byte(0xC0,OLED_CMD);//反转显示
- 54 2 OLED_WR_Byte(0xA0,OLED_CMD);
- C51 COMPILER V9.54 OLED 09/26/2022 20:11:46 PAGE 2
- 55 2 }
- 56 1 }
- 57
- 58 //延时
- 59 void IIC_delay(void)
- 60 {
- 61 1 _nop_();
- 62 1 }
- 63
- 64 //起始信号
- 65 void I2C_Start(void)
- 66 {
- 67 1 OLED_SDA_Set();
- 68 1 OLED_SCL_Set();
- 69 1 IIC_delay();
- 70 1 OLED_SDA_Clr();
- 71 1 IIC_delay();
- 72 1 OLED_SCL_Clr();
- 73 1
- 74 1 }
- 75
- 76 //结束信号
- 77 void I2C_Stop(void)
- 78 {
- 79 1 OLED_SDA_Clr();
- 80 1 OLED_SCL_Set();
- 81 1 IIC_delay();
- 82 1 OLED_SDA_Set();
- 83 1 }
- 84
- 85 //等待信号响应
- 86 void I2C_WaitAck(void) //测数据信号的电平
- 87 {
- 88 1 OLED_SDA_Set();
- 89 1 IIC_delay();
- 90 1 OLED_SCL_Set();
- 91 1 IIC_delay();
- 92 1 OLED_SCL_Clr();
- 93 1 IIC_delay();
- 94 1 }
- 95
- 96 //写入一个字节
- 97 void Send_Byte(u8 dat)
- 98 {
- 99 1 u8 i;
- 100 1 for(i=0;i<8;i++)
- 101 1 {
- 102 2 OLED_SCL_Clr();//将时钟信号设置为低电平
- 103 2 if(dat&0x80)//将dat的8位从最高位依次写入
- 104 2 {
- 105 3 OLED_SDA_Set();
- 106 3 }
- 107 2 else
- 108 2 {
- 109 3 OLED_SDA_Clr();
- 110 3 }
- 111 2 IIC_delay();
- 112 2 OLED_SCL_Set();
- 113 2 IIC_delay();
- 114 2 OLED_SCL_Clr();
- 115 2 dat<<=1;
- 116 2 }
- C51 COMPILER V9.54 OLED 09/26/2022 20:11:46 PAGE 3
- 117 1 }
- 118
- 119 //发送一个字节
- 120 //向SSD1306写入一个字节。
- 121 //mode:数据/命令标志 0,表示命令;1,表示数据;
- 122 void OLED_WR_Byte(u8 dat,u8 mode)
- 123 {
- 124 1 I2C_Start();
- 125 1 Send_Byte(0x78);
- 126 1 I2C_WaitAck();
- 127 1 if(mode){Send_Byte(0x40);}
- 128 1 else{Send_Byte(0x00);}
- 129 1 I2C_WaitAck();
- 130 1 Send_Byte(dat);
- 131 1 I2C_WaitAck();
- 132 1 I2C_Stop();
- 133 1 }
- 134
- 135 //坐标设置
- 136 void OLED_Set_Pos(u8 x, u8 y)
- 137 {
- 138 1 OLED_WR_Byte(0xb0+y,OLED_CMD);
- 139 1 OLED_WR_Byte(((x&0xf0)>>4)|0x10,OLED_CMD);
- 140 1 OLED_WR_Byte((x&0x0f),OLED_CMD);
- 141 1 }
- 142 //开启OLED显示
- 143 void OLED_Display_On(void)
- 144 {
- 145 1 OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
- 146 1 OLED_WR_Byte(0X14,OLED_CMD); //DCDC ON
- 147 1 OLED_WR_Byte(0XAF,OLED_CMD); //DISPLAY ON
- 148 1 }
- 149 //关闭OLED显示
- 150 void OLED_Display_Off(void)
- 151 {
- 152 1 OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
- 153 1 OLED_WR_Byte(0X10,OLED_CMD); //DCDC OFF
- 154 1 OLED_WR_Byte(0XAE,OLED_CMD); //DISPLAY OFF
- 155 1 }
- 156 //清屏函数,清完屏,整个屏幕是黑色的!和没点亮一样!!!
- 157 void OLED_Clear(void)
- 158 {
- 159 1 u8 i,n;
- 160 1 for(i=0;i<8;i++)
- 161 1 {
- 162 2 OLED_WR_Byte (0xb0+i,OLED_CMD); //设置页地址(0~7)
- 163 2 OLED_WR_Byte (0x00,OLED_CMD); //设置显示位置—列低地址
- 164 2 OLED_WR_Byte (0x10,OLED_CMD); //设置显示位置—列高地址
- 165 2 for(n=0;n<128;n++)OLED_WR_Byte(0,OLED_DATA);
- 166 2 } //更新显示
- 167 1 }
- 168
- 169 //在指定位置显示一个字符,包括部分字符
- 170 //x:0~127
- 171 //y:0~63
- 172 //sizey:选择字体 6x8 8x16
- 173 void OLED_ShowChar(u8 x,u8 y,u8 chr,u8 sizey)
- 174 {
- 175 1 u8 c=0,sizex=sizey/2;
- 176 1 u16 i=0,size1;
- 177 1 if(sizey==8)size1=6;
- 178 1 else size1=(sizey/8+((sizey%8)?1:0))*(sizey/2);
- C51 COMPILER V9.54 OLED 09/26/2022 20:11:46 PAGE 4
- 179 1 c=chr-' ';//得到偏移后的值
- 180 1 OLED_Set_Pos(x,y);
- 181 1 for(i=0;i<size1;i++)
- 182 1 {
- 183 2 if(i%sizex==0&&sizey!=8) OLED_Set_Pos(x,y++);
- 184 2 if(sizey==8) OLED_WR_Byte(asc2_0806[c][i],OLED_DATA);//6X8字号
- 185 2 else if(sizey==16) OLED_WR_Byte(asc2_1608[c][i],OLED_DATA);//8x16字号
- 186 2 // else if(sizey==xx) OLED_WR_Byte(asc2_xxxx[c][i],OLED_DATA);//用户添加字号
- 187 2 else return;
- 188 2 }
- 189 1 }
- 190 //m^n函数
- 191 u32 oled_pow(u8 m,u8 n)
- 192 {
- 193 1 u32 result=1;
- 194 1 while(n--)result*=m;
- 195 1 return result;
- 196 1 }
- 197 //显示数字
- 198 //x,y :起点坐标
- 199 //num:要显示的数字
- 200 //len :数字的位数
- 201 //sizey:字体大小
- 202 void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 sizey)
- 203 {
- 204 1 u8 t,temp,m=0;
- 205 1 u8 enshow=0;
- 206 1 if(sizey==8)m=2;
- 207 1 for(t=0;t<len;t++)
- 208 1 {
- 209 2 temp=(num/oled_pow(10,len-t-1))%10;
- 210 2 if(enshow==0&&t<(len-1))
- 211 2 {
- 212 3 if(temp==0)
- 213 3 {
- 214 4 OLED_ShowChar(x+(sizey/2+m)*t,y,' ',sizey);
- 215 4 continue;
- 216 4 }else enshow=1;
- 217 3 }
- 218 2 OLED_ShowChar(x+(sizey/2+m)*t,y,temp+'0',sizey);
- 219 2 }
- 220 1 }
- 221
- 222 //显示一个字符号串
- 223 void OLED_ShowString(u8 x,u8 y,u8 *chr,u8 sizey)
- 224 {
- 225 1 u8 j=0;
- 226 1 while (chr[j]!='\0')
- 227 1 {
- 228 2 OLED_ShowChar(x,y,chr[j++],sizey);
- 229 2 if(sizey==8)x+=6;
- 230 2 else x+=sizey/2;
- 231 2 }
- 232 1 }
- 233 //显示汉字
- 234 //void OLED_ShowChinese(u8 x,u8 y,u8 no,u8 sizey)
- 235 //{
- 236 // u16 i,size1=(sizey/8+((sizey%8)?1:0))*sizey;
- 237 // for(i=0;i<size1;i++)
- 238 // {
- 239 // if(i%sizey==0) OLED_Set_Pos(x,y++);
- 240 // if(sizey==16) OLED_WR_Byte(Hzk[no][i],OLED_DATA);//16x16字号
- C51 COMPILER V9.54 OLED 09/26/2022 20:11:46 PAGE 5
- 241 //// else if(sizey==xx) OLED_WR_Byte(xxx[c][i],OLED_DATA);//用户添加字号
- 242 // else return;
- 243 // }
- 244 //}
- 245
- 246
- 247 //显示图片
- 248 //x,y显示坐标
- 249 //sizex,sizey,图片长宽
- 250 //BMP:要显示的图片
- 251 void OLED_DrawBMP(int x,int y,unsigned char sizex, unsigned char sizey,unsigned char BMP[])
- 252 {
- 253 1 int j=0;
- 254 1 int i,m;
- 255 1 sizey=sizey/8+((sizey%8)?1:0);
- 256 1 for(i=0;i<sizey;i++)
- 257 1 {
- 258 2 OLED_Set_Pos(x,i+y);
- 259 2 for(m=0;m<sizex;m++)
- 260 2 {
- 261 3 OLED_WR_Byte(BMP[j++],OLED_DATA);
- 262 3 }
- 263 2 }
- 264 1 }
- 265
- 266
- 267
- 268 //初始化
- 269 void OLED_Init(void)
- 270 {
- 271 1 OLED_RES_Clr();
- 272 1 delay_ms(200);
- 273 1 OLED_RES_Set();
- 274 1 delay_ms(200);
- 275 1 OLED_WR_Byte(0xAE,OLED_CMD);//--turn off oled panel
- 276 1 OLED_WR_Byte(0x00,OLED_CMD);//---set low column address
- 277 1 OLED_WR_Byte(0x10,OLED_CMD);//---set high column address
- 278 1 OLED_WR_Byte(0x40,OLED_CMD);//--set start line address Set Mapping RAM Display Start Line (0x00~0x3F)
- 279 1 OLED_WR_Byte(0x81,OLED_CMD);//--set contrast control register
- 280 1 OLED_WR_Byte(0xff,OLED_CMD); // Set SEG Output Current Brightness
- 281 1 OLED_WR_Byte(0xA1,OLED_CMD);//--Set SEG/Column Mapping 0xa0左右反置 0xa1正常
- 282 1 OLED_WR_Byte(0xC8,OLED_CMD);//Set COM/Row Scan Direction 0xc0上下反置 0xc8正常
- 283 1 OLED_WR_Byte(0xA6,OLED_CMD);//--set normal display
- 284 1 OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64)
- 285 1 OLED_WR_Byte(0x3f,OLED_CMD);//--1/64 duty
- 286 1 OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset Shift Mapping RAM Counter (0x00~0x3F)
- 287 1 OLED_WR_Byte(0x00,OLED_CMD);//-not offset
- 288 1 OLED_WR_Byte(0xd5,OLED_CMD);//--set display clock divide ratio/oscillator frequency
- 289 1 OLED_WR_Byte(0x80,OLED_CMD);//--set divide ratio, Set Clock as 100 Frames/Sec
- 290 1 OLED_WR_Byte(0xD9,OLED_CMD);//--set pre-charge period
- 291 1 OLED_WR_Byte(0xF1,OLED_CMD);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
- 292 1 OLED_WR_Byte(0xDA,OLED_CMD);//--set com pins hardware configuration
- 293 1 OLED_WR_Byte(0x12,OLED_CMD);
- 294 1 OLED_WR_Byte(0xDB,OLED_CMD);//--set vcomh
- 295 1 OLED_WR_Byte(0x40,OLED_CMD);//Set VCOM Deselect Level
- 296 1 OLED_WR_Byte(0x20,OLED_CMD);//-Set Page Addressing Mode (0x00/0x01/0x02)
- 297 1 OLED_WR_Byte(0x02,OLED_CMD);//
- 298 1 OLED_WR_Byte(0x8D,OLED_CMD);//--set Charge Pump enable/disable
- 299 1 OLED_WR_Byte(0x14,OLED_CMD);//--set(0x10) disable
- 300 1 OLED_WR_Byte(0xA4,OLED_CMD);// Disable Entire Display On (0xa4/0xa5)
- 301 1 OLED_WR_Byte(0xA6,OLED_CMD);// Disable Inverse Display On (0xa6/a7)
- 302 1 OLED_Clear();
- C51 COMPILER V9.54 OLED 09/26/2022 20:11:46 PAGE 6
- 303 1 OLED_WR_Byte(0xAF,OLED_CMD); /*display ON*/
- 304 1 OLED_Clear();
- 305 1 OLED_ColorTurn(0);
- 306 1 OLED_DisplayTurn(0);
- 307 1 OLED_Display_On();
- 308 1 }
- 309
- 310 void OLED_DrawPixel(unsigned char x, unsigned char y,unsigned char color)
- 311 {
- 312 1 unsigned char mask;
- 313 1 unsigned char *pBuf;
- 314 1 if(y%2 == 0)
- 315 1 {
- 316 2 y++;
- 317 2 }
- 318 1 if (__x > width)
- 319 1 {
- 320 2 __x = 0;
- 321 2 __y += 1;
- 322 2 }
- 323 1 if (__y > height * 8)
- 324 1 {
- 325 2 __y = 0;
- 326 2 }
- 327 1 pBuf = &_buf[(y >> 3) * width + x];
- 328 1 mask = 1 << (y & 7);
- 329 1 if (!color)
- 330 1 {
- 331 2 *pBuf++ &= ~mask;
- 332 2 }
- 333 1 else
- 334 1 {
- 335 2 *pBuf++ |= mask;
- 336 2 }
- 337 1 }
- 338
- 339 void _swap_char(unsigned char* a,unsigned char* b)
- 340 {
- 341 1 unsigned char tmp = *a;
- 342 1 *a = *b;
- 343 1 *b = tmp;
- 344 1 }
- 345
- 346 /*========================================================
- 347 *????: ?0.96Oled???
- 348 *????: x1 -> ??x1?? y1 -> ??y1??
- 349 * x2 -> ??x1?? y2 -> ??y1??
- 350 *????: ?
- 351 *========================================================*/
- 352 void OLED_DrawLine(unsigned char x1,unsigned char y1,unsigned char x2,unsigned char y2, unsigned char colo
- -r)
- 353 {
- 354 1 unsigned char i = 0;
- 355 1 char DeltaY = 0,DeltaX = 0;
- 356 1 float k = 0,b = 0;
- 357 1 if(x1>x2)
- 358 1 {
- 359 2 i = x2;x2 = x1;x1 = i;
- 360 2 i = y2;y2 = y1;y1 = i;
- 361 2 i = 0;
- 362 2 }
- 363 1 DeltaY = y2 - y1;
- C51 COMPILER V9.54 OLED 09/26/2022 20:11:46 PAGE 7
- 364 1 DeltaX = x2 - x1;
- 365 1 if(DeltaX == 0)
- 366 1 {
- 367 2 if(y1<=y2)
- 368 2 {
- 369 3 for(y1;y1<=y2;y1++)
- 370 3 {
- 371 4 OLED_DrawPixel(x1,y1,color);
- 372 4 }
- 373 3 }else if(y1>y2)
- 374 2 {
- 375 3 for(y2;y2<=y1;y2++)
- 376 3 {
- 377 4 OLED_DrawPixel(x1,y2,color);
- 378 4 }
- 379 3 }
- 380 2 }
- 381 1 else if(DeltaY == 0)
- 382 1 {
- 383 2 for(x1;x1<=x2;x1++)
- 384 2 {
- 385 3 OLED_DrawPixel(x1,y1,color);
- 386 3 }
- 387 2 }
- 388 1 else
- 389 1 {
- 390 2 k = ((float)DeltaY)/((float)DeltaX);
- 391 2 b = y2 - k * x2;
- 392 2 if((k>-1&k<1))
- 393 2 {
- 394 3 for(x1;x1<=x2;x1++)
- 395 3 {
- 396 4 OLED_DrawPixel(x1,(int)(k * x1 + b),color);
- 397 4 }
- 398 3 }else if((k>=1)|(k<=-1))
- 399 2 {
- 400 3 if(y1<=y2)
- 401 3 {
- 402 4 for(y1;y1<=y2;y1++)
- 403 4 {
- 404 5 OLED_DrawPixel((int)((y1 - b) / k),y1,color);
- 405 5 }
- 406 4 }else if(y1>y2)
- 407 3 {
- 408 4 for(y2;y2<=y1;y2++)
- 409 4 {
- 410 5 OLED_DrawPixel((int)((y2 - b) / k),y2,color);
- 411 5 }
- 412 4 }
- 413 3 }
- 414 2 }
- 415 1 }
- 416
- 417 void OLED_display(void)
- 418 {
- 419 1 OLED_DrawBMP(0,0,128,64,_buf);
- 420 1 //OLED_DrawBMP(0,6,width[1],heigth[1]*8,_buf1);
- 421 1 }
- 422
- 423 void OLED_display_clear()
- 424 {
- 425 1 memset(_buf, 0x00, width * height);
- C51 COMPILER V9.54 OLED 09/26/2022 20:11:46 PAGE 8
- 426 1 }
- 427
- 428 void OLED_Draw_Byte(unsigned char *pBuf, unsigned char mask, unsigned char offset, bit reserve_hl)
- 429 {
- 430 1 if (_OLED_Overlap)
- 431 1 {
- 432 2 if (_OLED_Reverse)
- 433 2 *pBuf |= ~mask;
- 434 2 else
- 435 2 *pBuf |= mask;
- 436 2 }
- 437 1 else
- 438 1 {
- 439 2 if (_OLED_Reverse)
- 440 2 {
- 441 3 /* 保留高位
- 442 3 Reserve upper */
- 443 3 if (reserve_hl)
- 444 3 {
- 445 4 *pBuf &= (~mask) | (0xFF << (8 - offset));
- 446 4 *pBuf |= (~mask) & (0xFF >> offset);
- 447 4 }
- 448 3 /* 保留低位
- 449 3 Reserve lower */
- 450 3 else
- 451 3 {
- 452 4 *pBuf &= (~mask) | (0xFF >> (8 - offset));
- 453 4 *pBuf |= (~mask) & (0xFF << offset);
- 454 4 }
- 455 3 }
- 456 2 else
- 457 2 {
- 458 3 /* 保留高位
- 459 3 Reserve upper */
- 460 3 if (reserve_hl)
- 461 3 {
- 462 4 *pBuf &= mask | (0xFF << (8 - offset));
- 463 4 *pBuf |= mask & (0xFF >> offset);
- 464 4 }
- 465 3 /* 保留低位
- 466 3 Reserve lower */
- 467 3 else
- 468 3 {
- 469 4 *pBuf &= mask | (0xFF >> (8 - offset));
- 470 4 *pBuf |= mask & (0xFF << offset);
- 471 4 }
- 472 3 }
- 473 2 }
- 474 1 }
- 475
- 476
- 477 void OLED_DrawChar(unsigned char x, unsigned char y, unsigned char chr)
- 478 {
- 479 1 unsigned char c;
- 480 1 unsigned char i;
- 481 1 unsigned char mask;
- 482 1 unsigned char *pBuf;
- 483 1 unsigned char offset;
- 484 1 offset = y & 7;
- 485 1 c = chr - ' ';
- 486 1 pBuf = &_buf[(y >> 3) * width + x];
- 487 1
- C51 COMPILER V9.54 OLED 09/26/2022 20:11:46 PAGE 9
- 488 1 for (i = 0; i < 8; i++)
- 489 1 {
- 490 2 mask = asc2_1608[c][i] << offset;
- 491 2 OLED_Draw_Byte(pBuf++, mask, offset, 0);
- 492 2 }
- 493 1 if (offset && y < 56 - 8)
- 494 1 {
- 495 2 pBuf = &_buf[((y >> 3) + 1) * 100 + x];
- 496 2 for (i = 0; i < 6; i++)
- 497 2 {
- 498 3 mask = asc2_0806[c][i] >> (8 - offset);
- 499 3 OLED_Draw_Byte(pBuf++, mask, 8 - offset, 1);
- 500 3 }
- 501 2 }
- 502 1 }
- 503 void OLED_Set_Posi(unsigned char x, unsigned char y)
- 504 {
- 505 1 __x = x;
- 506 1 __y = y;
- 507 1 }
- 508
- 509 void OLED_DrawNum(unsigned char digit, unsigned char len)
- 510 {
- 511 1 unsigned char t, i, temp;
- 512 1 unsigned char enshow = 0;
- 513 1 i = 0;
- 514 1 for (t = 0; t < len; t++)
- 515 1 {
- 516 2 temp = (digit / oled_pow(10, len - t - 1)) % 10;
- 517 2
- 518 2 if (enshow == 0 && t < (len - 1))
- 519 2 {
- 520 3 if (temp == 0)
- 521 3 {
- 522 4 i++;
- 523 4 continue;
- 524 4 }
- 525 3 else
- 526 3 enshow = 1;
- 527 3 }
- 528 2
- 529 2 if (__x > 100 - 6)
- 530 2 {
- 531 3 __x = 0;
- 532 3 __y += 8;
- 533 3 }
- 534 2 if (__y > 56 - 8)
- 535 2 {
- 536 3 __y = 0;
- 537 3 }
- 538 2
- 539 2 OLED_DrawChar(__x + (6) * (t - i), __y, temp + '0');
- 540 2 }
- 541 1 __x += len;
- 542 1 }
- 543
- 544 void OLED_DrawBMP_2(u8 x0, u8 page0, u8 xsize, u8 ysize, u8 *BMP)
- 545 {
- 546 1 u16 i, j;
- 547 1 for(j = page0; j < page0+ysize/8; j++)
- 548 1 {
- 549 2 for(i = x0; i < x0+xsize; i++)
- C51 COMPILER V9.54 OLED 09/26/2022 20:11:46 PAGE 10
- 550 2 {
- 551 3 _buf[i+(j)*width]=BMP[(i-x0)+(j-page0)*xsize];
- 552 3 }
- 553 2 }
- 554 1 }
- MODULE INFORMATION: STATIC OVERLAYABLE
- CODE SIZE = 3490 ----
- CONSTANT SIZE = 2074 ----
- XDATA SIZE = 1026 99
- PDATA SIZE = ---- ----
- DATA SIZE = ---- ----
- IDATA SIZE = ---- ----
- BIT SIZE = 2 1
- END OF MODULE INFORMATION.
- C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
|