# kunBasketball **Repository Path**: yitangp/kun-basketball ## Basic Information - **Project Name**: kunBasketball - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-06-27 - **Last Updated**: 2024-06-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # OLED播放位图 ## 播放芯片内存储位图 1. 通过python程序将视频位图数据保存到txt文件 2. 将txt文件数据存储为.h头文件 3. 设备段调用drawBitmap方法显示位图 ## 上位机串口发送位图数据 1. python程序将视频分割成位图 2. 位图转为设备可用的数组数据128*64bit,即1024字节 3. 设备每次从串口读1024个数据,用drawBitmap显示位图 ## 移植要点 1. 使用的0.9寸oled,库用的arduino的Adafruit SSD1306 2. 库中的位图显示原函数为逐行显示,高位在前;本仓库中修改为逐行显示,低位在前 ``` //芯片内部存储数据,const数据写法 /* 源库算法:逐行 高位在前 */ /*** 1. i=0 b=bitmap[0] 判断最高位(i=0对应最高位)为1,则在(x+i, y)写像素1 2. i=1 b为字节0 取出次高位 判断次高位为1,则在(x+i, y)写像素1 ***/ // for (int16_t j = 0; j < h; j++, y++) // { // for (int16_t i = 0; i < w; i++) // { // if (i & 7) // b <<= 1; // else // b = pgm_read_byte(&bitmap[j * byteWidth + i / 8]); // if (b & 0x80) // writePixel(x + i, y, color); // } // } /* 本仓库算法:逐行 低位在前 */ /*** 1. i=0 b=bitmap[0] 判断最低位(i=0对应最低位)为1,则在(x+i, y)写像素1 2. i=1 b为字节0 取出次低位 判断次低位为1,则在(x+i, y)写像素1 ***/ for (int16_t j = 0; j < h; j++, y++) { for (int16_t i = 0; i < w; i++) { if (i & 7) // 能被8整除,读字节;不能整除,b就左移1位 b >>= 1; else b = pgm_read_byte(&bitmap[j * byteWidth + i / 8]); if (b & 0x01) writePixel(x + i, y, color); } } ```