首页 技术 正文
技术 2022年11月16日
0 收藏 633 点赞 2,441 浏览 1307 个字

上一篇随笔整理了一下逐行扫描型Memory LCD的显存管理与emWin移植,这篇就整理一下分页型Memory LCD显存管理与emWin移植。

//此处以SSD1306作为实例

//OLED的显存
//存放格式如下.
//[0]0 1 2 3 … 127    
//[1]0 1 2 3 … 127    
//[2]0 1 2 3 … 127    
//[3]0 1 2 3 … 127    
//[4]0 1 2 3 … 127    
//[5]0 1 2 3 … 127    
//[6]0 1 2 3 … 127    
//[7]0 1 2 3 … 127

uint8_t OLED_GRAM[128][8];

//画点
//x:0~127
//y:0~63
//t:1 填充 0,清空                   
void OLED_DrawPoint(uint8_t x,uint8_t y,uint8_t t)
{
    uint8_t pos,bx,temp=0;
    if(x>127||y>63)return;//超出范围了.
    pos=7-y/8;
    bx=y%8;
    temp=1<<(7-bx);
    if(t)OLED_GRAM[x][pos]|=temp;
    else OLED_GRAM[x][pos]&=~temp;        
}

/*

void OLED_Fill(uint8_t x1,uint8_t y1,uint8_t x2,uint8_t y2,uint8_t dot)  
{  
    uint8_t x,y;  
    for(x=x1;x<=x2;x++)
    {
        for(y=y1;y<=y2;y++)OLED_DrawPoint(x,y,dot);
    }                                                        
    OLED_Refresh_Gram();//更新显示
}

*/

void OLED_FillRect(uint16_t x,uint16_t y,uint16_t w,uint16_t h,bool bDraw)
{
  uint16_t wi,hi;
  for(hi=0;hi<h;hi++){
   for(wi=0;wi<w;wi++)
      OLED_DrawPoint(x+wi,y+hi,bDraw);
  }
}

void OLED_FillRectByXY(uint16_t x0,uint16_t y0,uint16_t x1,uint16_t y1,bool bDraw)
{
   uint16_t xStart=0,yStart=0;
   uint16_t w,h;
   
   if(x0<x1){
     xStart=x0;
     w=x1-x0+1;
   }else{
     xStart=x1;
     w=x0-x1+1;
   }
   
   if(y0<y1){
     yStart=y0;
     h=y1-y0+1;
   }else{
      yStart=y1;
      h=y0-y1+1;
   }
   OLED_FillRect(xStart,yStart,w,h,bDraw);  
}

uint32_t OLED_GetPoint(uint16_t x,uint16_t y)
{
}

上一篇: Matlab编程知识点
下一篇: 初识virtual memory
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,104
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,580
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,428
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,200
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,835
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,918