野火F1开发板STM32案例 0.96 oled综合库使用

本文涉及的产品
数据传输服务 DTS,数据迁移 small 3个月
推荐场景:
MySQL数据库上云
数据传输服务 DTS,数据同步 small 3个月
推荐场景:
数据库上云
数据传输服务 DTS,数据同步 1个月
简介: 野火F1开发板STM32案例 0.96 oled综合库使用

野火F1开发板STM32案例 0.96 oled综合库使用

硬件平台

  1. 野火STM32F103ZET6 霸道V2开发板
  2. 正点原子F1系列开发板
  3. 0.96 IIC oled模块
    STM32产品

    软件平台

  4. Keil MDK 5.31
  5. 串口调试助手

IIC总线

处理器和芯片间的通信可以形象的比喻成两个人讲话:1、你说的别人得能听懂:双方约定信号的协议。2、你的语速别人得能接受:双方满足时序要求。
一、IIC总线的信号类型
开始和停止信号
1、开始信号:处理器让SCL时钟保持高电平,然后让SDA数据信号由高变低就表示一个开始信号。同时IIC总线上的设备检测到这个开始信号它就知道处理器要发送数据了。

2、停止信号:处理器让SCL时钟保持高电平,然后让SDA数据信号由低变高就表示一个停止信号。同时IIC总线上的设备检测到这个停止信号它就知道处理器已经结束了数据传输,我们就可以各忙各个的了,如休眠等。
二、IIC数据传输过程
IIC数据传输
1、在数据传输时,SDA的数据在SCL为高电平时,必须保持稳定,SCL高电平器件完成数据的传输。在SCL低电平器件,可以任意改变SDA的数据。数据写入过程是从最好为开始,高位在前,低位在后,即MSB。
2、响应信号(ACK):接收器在接收到8位数据后,在第9个时钟周期,拉低SDA电平。即接收数据的IC在接收到8bit数据后,向发送数据的IC发出特定的低电平脉冲,表示已收到数据。CPU向受控单元发出一个信号后,等待受控单元发出一个应答信号,CPU接收到应答信号后,根据实际情况作出是否继续传递信号的判断。若未收到应答信号,由判断为受控单元出现故障。
3、数据写入的过程
写入数据过程
首先发送一个开始信号,接着发送从机地址,OLED的从机地址前7位为地址,最后一位表示读(1)或者写(0)。应答ACK信号表示有这个从设备存在。在接收到应答信号后,发送控制位,来区分之后所发送的数据是控制命令还是显示相关的数据。在发送控制位后,等待应答信号。然后发送相应的控制命令或者数据。最后发送停止信号,表示数据传输完成。

bsp_oled.c


//  功能描述   : 0.96寸OLED 接口演示例程(STM32F103ZE系列IIC)
//              说明: 
//              ----------------------------------------------------------------
//              GND   电源地
//              VCC   接5V或3.3v电源
//              SCL   接PD6(SCL)
//              SDA   接PD7(SDA)            
//              --------------------------------------------------------------

#include "oled.h"
#include "stdlib.h"
#include "oledfont.h"       
#include "delay.h"
#include "math.h"
//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             

unsigned char OLED_GRAM[128][8];
unsigned char OLED_GRAM_TEMP[128][8];
/**********************************************
//IIC Start
**********************************************/
void IIC_Start()
{
   
   

    OLED_SCLK_Set() ;
    OLED_SDIN_Set();
    OLED_SDIN_Clr();
    OLED_SCLK_Clr();
}

/**********************************************
//IIC Stop
**********************************************/
void IIC_Stop()
{
   
   
  OLED_SCLK_Set() ;
    OLED_SDIN_Clr();
    OLED_SDIN_Set();

}

void IIC_Wait_Ack()
{
   
   
    OLED_SCLK_Set() ;
    OLED_SCLK_Clr();
}
/**********************************************
// IIC Write byte
**********************************************/

void Write_IIC_Byte(unsigned char IIC_Byte)
{
   
   
    unsigned char i;
    unsigned char message,dat;

    dat=IIC_Byte;
    OLED_SCLK_Clr();

    for(i=0;i<8;i++)        
    {
   
   
      message=dat;
      message=message&0x80;

      if(message==0x80)
      {
   
   
        OLED_SDIN_Set();
      }
      else
      {
   
   
        OLED_SDIN_Clr();
      }    

      dat=dat<<1;
      OLED_SCLK_Set();
      OLED_SCLK_Clr();
    }


}
/**********************************************
// IIC Write Command
**********************************************/
void Write_IIC_Command(unsigned char IIC_Command)
{
   
   
   IIC_Start();
   Write_IIC_Byte(0x78);            //Slave address,SA0=0
     IIC_Wait_Ack();    
   Write_IIC_Byte(0x00);            //write command
     IIC_Wait_Ack();    
   Write_IIC_Byte(IIC_Command); 
     IIC_Wait_Ack();    
   IIC_Stop();
}
/**********************************************
// IIC Write Data
**********************************************/
void Write_IIC_Data(unsigned char IIC_Data)
{
   
   
   IIC_Start();
   Write_IIC_Byte(0x78);            //D/C#=0; R/W#=0
     IIC_Wait_Ack();    
   Write_IIC_Byte(0x40);            //write data
     IIC_Wait_Ack();    
   Write_IIC_Byte(IIC_Data);
     IIC_Wait_Ack();    
   IIC_Stop();
}
//OLED_WR_Byte(写数据,写命令)
// OLED_WR_Byte-->Write_IIC_Data
// OLED_WR_Byte-->Write_IIC_Command
/*
#define OLED_CMD  0    //写命令
#define OLED_DATA 1    //写数据 
*/
void OLED_WR_Byte(unsigned dat,unsigned cmd)
{
   
   
    if(cmd)
    {
   
   
    Write_IIC_Data(dat);
    }
    else 
  {
   
   
    Write_IIC_Command(dat);
    }
}


/********************************************
// fill_Picture
********************************************/
void fill_picture(unsigned char fill_Data)
{
   
   
    unsigned char m,n;
    for(m=0;m<8;m++)
    {
   
   
      OLED_WR_Byte(0xb0+m,OLED_CMD);        //page0-page1
      OLED_WR_Byte(0x00,OLED_CMD);        //low column start address
      OLED_WR_Byte(0x10,OLED_CMD);        //high column start address
      for(n=0;n<128;n++)
      {
   
   
        OLED_WR_Byte(fill_Data,OLED_DATA);
      }
    }
}


/***********************Delay****************************************/
void Delay_50ms(unsigned int Delay_50ms)
{
   
   
    unsigned int count;
    for(;Delay_50ms>0;Delay_50ms--)
        for(count=6245;count>0;count--);
}

void Delay_1ms(unsigned int Delay_1ms)
{
   
   
    unsigned char count;
    while(Delay_1ms--)
    {
   
       
        for(count=0;count<123;count++);
    }
}

//初始化SSD1306                        
void OLED_Init(void)
{
   
        

     GPIO_InitTypeDef  GPIO_InitStructure;

     RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);     //使能PC,D,G端口时钟

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9|GPIO_Pin_10;     //PD3,PD6推挽输出  
     GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;          //推挽输出
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;//速度50MHz
     GPIO_Init(GPIOB, &GPIO_InitStructure);      //初始化GPIOD3,6
     GPIO_SetBits(GPIOB,GPIO_Pin_9|GPIO_Pin_10);    //PD3,PD6 输出高


  delay_ms(200);

  OLED_WR_Byte(0xAE,OLED_CMD);//--display off
    OLED_WR_Byte(0x00,OLED_CMD);//---set low column address
    OLED_WR_Byte(0x10,OLED_CMD);//---set high column address
    OLED_WR_Byte(0x40,OLED_CMD);//--set start line address  
    OLED_WR_Byte(0xB0,OLED_CMD);//--set page address
    OLED_WR_Byte(0x81,OLED_CMD); // contract control
    OLED_WR_Byte(0xFF,OLED_CMD);//--128   
    OLED_WR_Byte(0xA1,OLED_CMD);//set segment remap 
    OLED_WR_Byte(0xA6,OLED_CMD);//--normal / reverse
    OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64)
    OLED_WR_Byte(0x3F,OLED_CMD);//--1/32 duty
    OLED_WR_Byte(0xC8,OLED_CMD);//Com scan direction
    OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset
    OLED_WR_Byte(0x00,OLED_CMD);//

    OLED_WR_Byte(0xD5,OLED_CMD);//set osc division
    OLED_WR_Byte(0x80,OLED_CMD);//

    OLED_WR_Byte(0xD8,OLED_CMD);//set area color mode off
    OLED_WR_Byte(0x05,OLED_CMD);//

    OLED_WR_Byte(0xD9,OLED_CMD);//Set Pre-Charge Period
    OLED_WR_Byte(0xF1,OLED_CMD);//

    OLED_WR_Byte(0xDA,OLED_CMD);//set com pin configuartion
    OLED_WR_Byte(0x12,OLED_CMD);//

    OLED_WR_Byte(0xDB,OLED_CMD);//set Vcomh
    OLED_WR_Byte(0x30,OLED_CMD);//

    OLED_WR_Byte(0x8D,OLED_CMD);//set charge pump enable
    OLED_WR_Byte(0x14,OLED_CMD);//

    OLED_WR_Byte(0xAF,OLED_CMD);//--turn on oled panel
}  

//更新显存到LCD         
void OLED_Refresh_Gram(void)
{
   
   
    u8 i,n;            
    for(i=0;i<8;i++)  
    {
   
     
        OLED_WR_Byte (0xb0+i,OLED_CMD);    //设置页地址(0~7)
        OLED_WR_Byte (0x00,OLED_CMD);      //设置显示位置―列低地址
        OLED_WR_Byte (0x10,OLED_CMD);      //设置显示位置―列高地址   
        for(n=0;n<128;n++)
      OLED_WR_Byte(OLED_GRAM[n][i],OLED_DATA); 
    }   
}
//==================================================================================================
//  函数功能: OLED 外设驱动函数部分
//  函数标记: 外设驱动函数
//  函数说明: 无
//--------------------------------------------------------------------------------------------------
//  输入参量: 无
//  输出参量: 无
//-------------------------------------------------------------------------------------------------
//  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
//==================================================================================================
//开启OLED显示    
void OLED_Display_On(void)
{
   
   
    OLED_WR_Byte(0X8D,OLED_CMD);  //SET DCDC命令
    OLED_WR_Byte(0X14,OLED_CMD);  //DCDC ON
    OLED_WR_Byte(0XAF,OLED_CMD);  //DISPLAY ON
}
//关闭OLED显示     
void OLED_Display_Off(void)
{
   
   
    OLED_WR_Byte(0X8D,OLED_CMD);  //SET DCDC命令
    OLED_WR_Byte(0X10,OLED_CMD);  //DCDC OFF
    OLED_WR_Byte(0XAE,OLED_CMD);  //DISPLAY OFF
}                        
//清屏函数,清完屏,整个屏幕是黑色的!和没点亮一样!!!      
void OLED_Clear(void)  
{
   
     
    uint8_t count,num;            
    for(count=0;count<8;count++)  
    {
   
     
        OLED_WR_Byte (0xb0+count,OLED_CMD);    //设置页地址(0~7)
        OLED_WR_Byte (0x00,OLED_CMD);      //设置显示位置—列低地址
        OLED_WR_Byte (0x10,OLED_CMD);      //设置显示位置—列高地址

        for(num=0;num<128;num++)
      OLED_WR_Byte(0x00,OLED_DATA); 
    } //更新显示
}


void OLED_On(void)  
{
   
     
    uint8_t count,num;            
    for(count=0;count<8;count++)  
    {
   
     
        OLED_WR_Byte (0xb0+count,OLED_CMD);    //设置页地址(0~7)
        OLED_WR_Byte (0x00,OLED_CMD);      //设置显示位置—列低地址
        OLED_WR_Byte (0x10,OLED_CMD);      //设置显示位置—列高地址

        for(num=0;num<128;num++)
      OLED_WR_Byte(0x01,OLED_DATA); 
    } //更新显示
}




 /**
  * @brief  OLED_Fill,填充整个屏幕
  * @param  fill_Data:要填充的数据
    * @retval 无
  */
void OLED_Fill(unsigned char fill_Data)//全屏填充
{
   
   
    unsigned char m,n;
    for(m=0;m<8;m++)
    {
   
   
        OLED_WR_Byte(0xb0+m,OLED_CMD);        //page0-page1
        OLED_WR_Byte(0x00,OLED_CMD);        //low column start address
        OLED_WR_Byte(0x10,OLED_CMD);        //high column start address
        for(n=0;n<128;n++)
            {
   
   
                OLED_WR_Byte(fill_Data,OLED_DATA);
            }
    }
}



//显示汉字
//==================================================================================================
//  实现功能: OLED 显示汉字
//  函数标记: 外设驱动函数
//  函数说明: 无
//--------------------------------------------------------------------------------------------------
//  输入参量: X - X方向坐标  取值范围 - 0~127
//            Y - Y方向坐标  取值范围 - 0~  7
//            Chinese - 待显示汉字  取值范围 - 单个汉字组成的字符串
//  输出参量: 无
//--------------------------------------------------------------------------------------------------
//  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
//==================================================================================================
void OLED_ShowCHinese(unsigned char X,unsigned char Y,unsigned char Chinese)

{
   
                         
    unsigned char count,adder=0;
    OLED_Set_Pos(X,Y);    
  for(count=0;count<16;count++)
  {
   
   
    OLED_WR_Byte(CHinese[2*Chinese][count],OLED_DATA);
    adder+=1;
  }    
  OLED_Set_Pos(X,Y+1);    
  for(count=0;count<16;count++)
  {
   
       
    OLED_WR_Byte(CHinese[2*Chinese+1][count],OLED_DATA);
    adder+=1;
  }                    
}

//==================================================================================================
//  实现功能: OLED_Set_Pos 定位光标
//  函数标记: 外设驱动函数
//  函数说明: 无
//--------------------------------------------------------------------------------------------------
//  输入参量: X - X方向坐标  取值范围 - 0~127
//            Y - Y方向坐标  取值范围 - 0~  7
//  输出参量: 无
//--------------------------------------------------------------------------------------------------
//  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
//==================================================================================================
void OLED_Set_Pos(unsigned char X, unsigned char Y) 
{
   
        
  OLED_WR_Byte(0xb0+Y,OLED_CMD);
    OLED_WR_Byte(((X&0xf0)>>4)|0x10,OLED_CMD);
    OLED_WR_Byte((X&0x0f),OLED_CMD); 
}   

//==================================================================================================
//  实现功能: OLED 清除屏幕区域内容
//  函数标记: 外设驱动函数
//  函数说明: 无
//--------------------------------------------------------------------------------------------------
//  输入参量: X - X方向坐标  取值范围 - 0~127
//            Y - Y方向坐标  取值范围 - 0~  7
//            X_Size - X方向尺寸  取值范围 - 1~127
//            Y_Size - Y方向尺寸  取值范围 - 1~  7
//  输出参量: 无
//--------------------------------------------------------------------------------------------------
//  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
//==================================================================================================
void OLED_AreaClear(unsigned char X, unsigned char Y, unsigned char X_Size, unsigned char Y_Size)
{
   
   
    unsigned char i;                                // 定义局部变量 用于函数循环计数
    unsigned char j;                                // 定义局部变量 用于函数循环计数



    for(i=0; i<(Y_Size/8); i++)                     // 遍历每一行
    {
   
   
        OLED_Set_Pos(X, Y+i);                       // 设置显示坐标
        for(j=0; j<X_Size; j++)                     // 遍历每一列
        {
   
   
            OLED_WR_Byte(0x00,OLED_DATA);
        }
    }
}

//==================================================================================================
//  实现功能: OLED 指定位置 显示字符 06x08像素
//  函数标记: 应用函数 已完成 
//  函数说明: 1. 位置选取不恰当 可能造成字符串显示不完全
//            2. 如果字库不存在该文字则不显示
//--------------------------------------------------------------------------------------------------
//  输入参量: X - X方向坐标  取值范围 - 0~127
//            Y - Y方向坐标  取值范围 - 0~  7
//            Char - 待写字符   取值范围 - ASCII字符
//  输出参量: 无
//--------------------------------------------------------------------------------------------------
//  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
//==================================================================================================
void OLED_ShowChar_06x08(unsigned char X, unsigned char Y, unsigned char Char)
{
   
   
    unsigned char i;                                // 定义局部变量 用于函数循环计数
    unsigned char j;                                // 定义局部变量 用于函数循环计数
    unsigned char FontCount;                        // 定义局部变量 用于记录字符字库个数



    FontCount=sizeof(OLED_ASCII_06x08_FontCode)/sizeof(OLED_ASCII_06x08_FontCode[0]);

    for(i=0; i<FontCount; i++)                      // 遍历每一字库
    {
   
   
        if(Char == OLED_ASCII_06x08_FontCode[i].Char)
        {
   
   
            OLED_Set_Pos(X,Y);                      // 设置显示坐标
            for(j=0; j<6; j++)                      // 遍历每一列
            {
   
   
                OLED_WR_Byte(OLED_ASCII_06x08_FontCode[i].Code[j],OLED_DATA);
            }
            break;
        }
    }
}

//==================================================================================================
//  实现功能: OLED 指定位置 显示字符串 06x08像素
//  函数标记: 外设驱动函数
//  函数说明: 1. 位置选取不恰当 可能造成字符串显示不完全
//            2. 如果字库不存在该文字则不显示
//            3. 06x08像素不能显示汉字 只能显示ASCII字符
//--------------------------------------------------------------------------------------------------
//  输入参量: X - X方向坐标  取值范围 - 0~127
//            Y - Y方向坐标  取值范围 - 0~  7
//            String - 待显示字符串  取值范围 - ASCII字符串
//  输出参量: 无
//--------------------------------------------------------------------------------------------------
//  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
//==================================================================================================
void OLED_ShowString_06x08(unsigned char X, unsigned char Y, unsigned char *String)
{
   
   


    while(*String)                                  // 判断字符串是否为空 
    {
   
   
        OLED_ShowChar_06x08(X, Y, *String);         // 指定位置显示字符
        String++;                                   // 字符串指针移动下一个字节
        X+=6;                                       // X坐标移动下一个位置
    }
}


//==================================================================================================
//  实现功能: OLED 指定位置 显示字符 08x16像素
//  函数标记: 应用函数 已完成 
//  函数说明: 1. 位置选取不恰当 可能造成字符串显示不完全
//            2. 如果字库不存在该文字则不显示
//--------------------------------------------------------------------------------------------------
//  输入参量: X - X方向坐标  取值范围 - 0~127
//            Y - Y方向坐标  取值范围 - 0~  7
//            Char - 待显示字符  取值范围 - ASCII字符
//  输出参量: 无
//--------------------------------------------------------------------------------------------------
//  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
//==================================================================================================
void OLED_ShowChar_08x16(unsigned char X, unsigned char Y, unsigned char Char)
{
   
   
    unsigned char i;                                // 定义局部变量 用于函数循环计数
    unsigned char j;                                // 定义局部变量 用于函数循环计数
    unsigned char FontCount;                        // 定义局部变量 用于记录字符字库个数



    FontCount=sizeof(OLED_ASCII_08x16_FontCode)/sizeof(OLED_ASCII_08x16_FontCode[0]);

    for(i=0; i<FontCount; i++)                      // 循环查询字符字模位置
    {
   
   
        if(Char == OLED_ASCII_08x16_FontCode[i].Char)
        {
   
   
            OLED_Set_Pos(X,Y);                      // 设置显示坐标 用于显示字符
            for(j=0; j<8; j++)
            {
   
   
                OLED_WR_Byte(OLED_ASCII_08x16_FontCode[i].Code[j],OLED_DATA);
            }
            OLED_Set_Pos(X,Y+1);                    // 设置显示坐标 用于显示字符
            for(j=8; j<16; j++)
            {
   
   
                OLED_WR_Byte(OLED_ASCII_08x16_FontCode[i].Code[j],OLED_DATA);
            }
            break;
        }
    }
}

////==================================================================================================
////  实现功能: OLED 指定位置 显示中文 16x16像素
////  函数标记: 应用函数 已完成 
////  函数说明: 1. 位置选取不恰当 可能造成字符串显示不完全
////            2. 如果字库不存在该文字则不显示
////--------------------------------------------------------------------------------------------------
////  输入参量: X - X方向坐标  取值范围 - 0~127
////            Y - Y方向坐标  取值范围 - 0~  7
////            Chinese - 待显示汉字  取值范围 - 单个汉字组成的字符串
////  输出参量: 无
////--------------------------------------------------------------------------------------------------
////  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
////==================================================================================================
//void OLED_ShowChinese_16x16(unsigned char X, unsigned char Y, unsigned char *Chinese)
//{
   
   
//    unsigned char i;                                // 定义局部变量 用于函数循环计数
//    unsigned char j;                                // 定义局部变量 用于函数循环计数
//    unsigned char FontCount;                        // 定义局部变量 用于记录字符字库个数

//    // 断言检查参数

//    
//    FontCount=sizeof(OLED_CHINESE_16x16_FontCode)/sizeof(OLED_CHINESE_16x16_FontCode[0]);

//    for(i=0; i<FontCount; i++)                      // 循环查询字符字模位置
//    {
   
   
//        if ((*Chinese     == OLED_CHINESE_16x16_FontCode[i].Char[0])
//        &&  (*(Chinese+1) == OLED_CHINESE_16x16_FontCode[i].Char[1]))
//        {
   
   
//            OLED_SetArea(X,Y);                      // 设置显示坐标 用于显示字符
//            for(j=0; j<16; j++)
//            {
   
   
//                OLED_WR_Byte(OLED_CHINESE_16x16_FontCode[i].Code[j],OLED_DATA);
//            }
//            OLED_SetArea(X,Y+1);                    // 设置显示坐标 用于显示字符
//            for(j=16; j<32; j++)
//            {
   
   
//                OLED_WR_Byte(OLED_CHINESE_16x16_FontCode[i].Code[j],OLED_DATA);
//            }
//            break;
//        }
//    }
//}


//==================================================================================================
//  实现功能: OLED 指定位置 显示中英文混合字符串 08x16像素
//  函数标记: 外设驱动函数
//  函数说明: 1. 位置选取不恰当 可能造成字符串显示不完全
//            2. 目前能显示英文和汉字混合字符串
//--------------------------------------------------------------------------------------------------
//  输入参量: X - X方向坐标  取值范围 - 0~127
//            Y - Y方向坐标  取值范围 - 0~  7
//            String - 待显示字符串  取值范围 - ASCII和汉字混合字符串
//  输出参量: 无
//--------------------------------------------------------------------------------------------------
//  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
//==================================================================================================
void OLED_ShowString_16x16(unsigned char X, unsigned char Y, unsigned char *String)
{
   
   
    unsigned char Position = 0;                     // 定义局部变量 用于标记字符串位置

    while(*String)
    {
   
   
        // 判断字符串中的某字符的编码值是否小于0x80
        // 如果小于0x80 即为ASCII字符
        // 如果大于0x80 即为汉字字符串
        if(*String < 0x80)
        {
   
   
            // 显示ASCII字符
            OLED_ShowChar_08x16(X+Position*8, Y, *String);
            String++;                               // 字符串指针移动下一个字节
            Position++;                             // 字符串位置下一个位置
        }
        else
        {
   
   
//            // 显示汉字
//            OLED_ShowChinese_16x16(X+Position*8, Y, (unsigned char*)String);
//            String+=2;                              // 字符串指针移动下一个字节
//            Position+=2;                            // 字符串位置下一个位置
        }
    }
}

void OLED_ShowArray_06x08(unsigned char X, unsigned char Y, unsigned char *Array, unsigned char Count)
{
   
   
    unsigned char i;                                // 定义局部变量 用于函数循环计数
    unsigned char j;                                // 定义局部变量 用于函数循环计数
    unsigned char k;                                // 定义局部变量 用于函数循环计数
    unsigned char FontCount;                        // 定义局部变量 用于记录字符字库个数


    FontCount=sizeof(OLED_ASCII_06x08_FontCode)/sizeof(OLED_ASCII_06x08_FontCode[0]);

    for(i=0; i<Count; i++)
    {
   
   
        for(j=0; j<FontCount; j++)                  // 循环查询字符字模位置
        {
   
   
            if(*Array == OLED_ASCII_06x08_FontCode[j].Char)
            {
   
   
                OLED_Set_Pos(X,Y);                  // 设置显示坐标 用于显示字符
                for(k=0; k<6; k++)
                {
   
   
                    OLED_WR_Byte(OLED_ASCII_06x08_FontCode[j].Code[k],OLED_DATA);
                }
                break;
            }
        }
        Array++;
        X += 6;                                     // 数组位置下一个位置
    }
}
//==================================================================================================
//  实现功能: OLED 指定位置 显示有符号整形数字
//  函数标记: 外设驱动函数
//  函数说明: 1.最大显示5位数字 位置选取不恰当 可能造成数字显示不完全
//--------------------------------------------------------------------------------------------------
//  输入参量: X - X方向坐标  取值范围 - 0~127
//            Y - Y方向坐标  取值范围 - 0~  7
//            IntegerNumber - 待显示整型数字 取值范围 - -32767~+32768
//            Count - 待显示整型数字长度     取值范围 - 0~5;
//  输出参量: 无
//--------------------------------------------------------------------------------------------------
//  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
//==================================================================================================
void OLED_ShowNumber_SignedInteger_06x08(unsigned char X, unsigned char Y, signed short IntegerNumber, unsigned char Count)
{
   
   
    unsigned char IntegerNumber_Array[5]={
   
   0};       // 定义局部数组 用于数组数据存储


    // 判断 整型数字正负
    if(IntegerNumber < 0)
    {
   
   
        IntegerNumber=0 - IntegerNumber;
        OLED_ShowChar_06x08(X, Y, '-');
    }
    else
    {
   
   
        OLED_ShowChar_06x08(X, Y, '+');
    }

    // 计算各位数值的字符
    if(Count>4) IntegerNumber_Array[0] = (IntegerNumber/10000) % 10 + 0x30;
    if(Count>3) IntegerNumber_Array[1] = (IntegerNumber/1000 ) % 10 + 0x30;
    if(Count>2) IntegerNumber_Array[2] = (IntegerNumber/100  ) % 10 + 0x30;
    if(Count>1) IntegerNumber_Array[3] = (IntegerNumber/10   ) % 10 + 0x30;
    if(Count>0) IntegerNumber_Array[4] = (IntegerNumber/1    ) % 10 + 0x30;

    // 执行显示操作
    OLED_ShowArray_06x08(X+6, Y, &IntegerNumber_Array[5-Count], Count);
}



//==================================================================================================
//  实现功能: OLED 指定位置 显示无符号整形数字
//  函数标记: 外设驱动函数
//  函数说明: 1.最大显示5位数字 位置选取不恰当 可能造成数字显示不完全
//--------------------------------------------------------------------------------------------------
//  输入参量: X - X方向坐标  取值范围 - 0~127
//            Y - Y方向坐标  取值范围 - 0~  7
//            IntegerNumber - 待显示整型数字 取值范围 - -32767~+32768
//            Count - 待显示整型数字长度     取值范围 - 0~5;
//  输出参量: 无
//--------------------------------------------------------------------------------------------------
//  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
//==================================================================================================
void OLED_ShowNumber_UnsignedInteger_06x08(unsigned char X, unsigned char Y, unsigned short IntegerNumber, unsigned char Count)
{
   
   
    unsigned char IntegerNumber_Array[5]={
   
   0};       // 定义局部数组 用于数组数据存储



    // 计算各位数值的字符
    if(Count>4) IntegerNumber_Array[0] = (IntegerNumber/10000) % 10 + 0x30;
    if(Count>3) IntegerNumber_Array[1] = (IntegerNumber/1000 ) % 10 + 0x30;
    if(Count>2) IntegerNumber_Array[2] = (IntegerNumber/100  ) % 10 + 0x30;
    if(Count>1) IntegerNumber_Array[3] = (IntegerNumber/10   ) % 10 + 0x30;
    if(Count>0) IntegerNumber_Array[4] = (IntegerNumber/1    ) % 10 + 0x30;

    // 执行显示操作
    OLED_ShowArray_06x08(X, Y, &IntegerNumber_Array[5-Count], Count);
}

//==================================================================================================
//  实现功能: OLED 指定位置 显示06x08大小的浮点数字
//  函数标记: 外设驱动函数
//  函数说明: float型数据有效数字显示7位 double型数据有效数字16位
//--------------------------------------------------------------------------------------------------
//  输入参量: X - X方向坐标  取值范围 - 0~127
//            Y - Y方向坐标  取值范围 - 0~  7
//            FloatNumber - 待显示浮点型数字  取值范围 - -99999.99999~99999.99999
//            Count1 - 整数显示位数  取值范围 - 0~5
//            Count2 - 小数显示位数  取值范围 - 0~5
//  输出参量: 无
//--------------------------------------------------------------------------------------------------
//  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
//==================================================================================================
void OLED_ShowNumber_Float_06x08(unsigned char X, unsigned char Y, float FloatNumber, unsigned char Count1, unsigned char Count2)
{
   
   
    unsigned char Number_Integer_Array[5];          // 定义局部数组 用于存储整数位各位数据
    unsigned char Number_Decimal_Array[5];          // 定义局部数组 用于存储小数位各位数据

    unsigned long Number_Integer = 0;               // 定义局部变量 表示浮点数的 整数部分
    unsigned long Number_Decimal = 0;               // 定义局部变量 表示浮点数的 小数部分



    if(FloatNumber < 0)
    {
   
   
        FloatNumber= 0 - FloatNumber;
        OLED_ShowChar_06x08(X,Y,'-');
    }
    else
    {
   
   
        OLED_ShowChar_06x08(X,Y,'+');
    }

    //----------------------------------------------------------------------------------------------
    // 限制 显示字符数
    //----------------------------------------------------------------------------------------------
    // 由于由于float型的有效十进制数值最多为7位 即整数位 + 小数位 数量一定小于等于7
    while((Count1 + Count2 > 7 ))
    {
   
   
        if((Count1 > 5) && (Count1 != 0))
        {
   
   
            --Count1;
        }
        else
        {
   
   
            --Count2;
        }
    }

    Number_Integer = (unsigned long)(FloatNumber);                                      // 取整数部分
    Number_Decimal = (unsigned long)((FloatNumber - Number_Integer + 0.000005) * 1e5);  // 取小数部分 1e5科学计数法

    Number_Integer_Array[0] = Number_Integer/10000 % 10 + 0x30;     // 计算整数部分
    Number_Integer_Array[1] = Number_Integer/ 1000 % 10 + 0x30;
    Number_Integer_Array[2] = Number_Integer/  100 % 10 + 0x30;
    Number_Integer_Array[3] = Number_Integer/   10 % 10 + 0x30;
    Number_Integer_Array[4] = Number_Integer/    1 % 10 + 0x30;

    Number_Decimal_Array[0] = Number_Decimal/10000 % 10 + 0x30;     // 计算小数部分
    Number_Decimal_Array[1] = Number_Decimal/ 1000 % 10 + 0x30;
    Number_Decimal_Array[2] = Number_Decimal/  100 % 10 + 0x30;
    Number_Decimal_Array[3] = Number_Decimal/   10 % 10 + 0x30;
    Number_Decimal_Array[4] = Number_Decimal/    1 % 10 + 0x30;

    OLED_ShowArray_06x08(X+6,            Y, &Number_Integer_Array[5-Count1], Count1);   // 显示整数位
    OLED_ShowChar_06x08( X+(1+Count1)*6, Y, '.');                                       // 显示小数点
    OLED_ShowArray_06x08(X+(2+Count1)*6, Y, &Number_Decimal_Array[0],        Count2);   // 显示小数位
}

//==================================================================================================
//  实现功能: OLED 指定位置 显示06x08大小的二进制数字
//  函数标记: 外设驱动函数
//  函数说明: 1. 位置选取不恰当 可能造成字符串显示不完全
//            2. 显示8位二进制数字 主要作为寄存器数据显示
//--------------------------------------------------------------------------------------------------
//  输入参量: X - X方向坐标  取值范围 - 0~127
//            Y - Y方向坐标  取值范围 - 0~  7
//            BinaryNumber - 待显示二进制数字  取值范围 - 0~4294967295
//            Count - 二进制显示位数  取值范围 - 1~16
//  输出参量: 无
//--------------------------------------------------------------------------------------------------
//  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
//==================================================================================================
void OLED_ShowNumber_Binary_06x08(unsigned char X, unsigned char Y, unsigned long BinaryNumber, unsigned char Count)
{
   
   
    unsigned char i;                                // 定义局部变量 用于函数循环计数



    for(i=Count; i>0; i--)
    {
   
   
        if(BinaryNumber & ( 1 << (Count-1) ))
        {
   
   
            OLED_ShowChar_06x08(X, Y, '1');         // 显示二进制字符'1'
        }
        else
        {
   
   
            OLED_ShowChar_06x08(X, Y, '0');         // 显示二进制字符'1'
        }
        BinaryNumber <<= 1;                         // 移位运算
        X += 6;                                     // 数组位置下一个位置
    }
}

//==================================================================================================
//  实现功能: OLED 指定位置 显示06x08大小的十六进制数字
//  函数标记: 外设驱动函数
//  函数说明: 1. 位置选取不恰当 可能造成字符串显示不完全
//            2. 显示8位二进制数字 主要作为寄存器数据显示
//--------------------------------------------------------------------------------------------------
//  输入参量: X - X方向坐标  取值范围 - 0~127
//            Y - Y方向坐标  取值范围 - 0~  7
//            BinaryNumber - 待显示二进制数字  取值范围 - 0~4294967295
//            Count - 二进制显示位数  取值范围 - 1~8
//  输出参量: 无
//--------------------------------------------------------------------------------------------------
//  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
//==================================================================================================
void OLED_ShowNumber_Hex_06x08(unsigned char X, unsigned char Y, unsigned long HexNumber, unsigned char Count)
{
   
   
    unsigned char i;                                // 定义局部变量 用于函数循环计数
    unsigned long Number;                           // 定义局部变量 用于装载数据



    for(i=Count; i>0; i--)
    {
   
   
        Number = HexNumber>>(4*(i-1)) & 0x0000000F;
        if(Number<10)
        {
   
   
            OLED_ShowChar_06x08(X, Y, '0'+Number); 
        }
        else
        {
   
   
            OLED_ShowChar_06x08(X, Y, 'A'+(Number-10)); 
        }
        X += 6;                                     // 数组位置下一个位置
    }
}

//==================================================================================================
//  实现功能: OLED 指定位置 绘制直线数据
//  函数标记: 外设驱动函数
//  函数说明: 该点为8个像素的竖线 并非实际像素点
//--------------------------------------------------------------------------------------------------
//  输入参量: X - X方向坐标  取值范围 - 0~127
//            Y - Y方向坐标  取值范围 - 0~  7
//            PointData - 直线数据  取值范围 - 0~255
//  输出参量: 无
//--------------------------------------------------------------------------------------------------
//  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
//==================================================================================================
void OLED_DrawLine(unsigned char X, unsigned char Y, unsigned char PointData)
{
   
   


    OLED_WR_Byte(0xB0+Y,OLED_CMD);
    OLED_WR_Byte(((X & 0xF0)>>4) | 0x10,OLED_CMD);
    OLED_WR_Byte( (X & 0x0F)     | 0x01,OLED_CMD);
    OLED_WR_Byte(PointData,OLED_DATA);
}

//==================================================================================================
//  实现功能: OLED 指定位置 绘制图像 Draw_BMP
//  函数标记: 外设驱动函数
//  函数说明: 
//--------------------------------------------------------------------------------------------------
//  输入参量: X - X方向坐标  取值范围 - 0~127
//            Y - Y方向坐标  取值范围 - 0~  7
//            X_Size - X方向尺寸大小 取值范围 - 0~127
//            Y_Size - Y方向尺寸大小 取值范围 - 0~7
//            Image - 图像数据
//  输出参量: 无
/*功能描述:显示显示BMP图片128×64起始点坐标(x,y),x的范围0~127,y为页的范围0~7*****************/
//--------------------------------------------------------------------------------------------------
//  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
//==================================================================================================
void Draw_BMP(unsigned char X0,unsigned char Y0,unsigned char X1,unsigned char Y1,unsigned char BMP[])
{
   
   
    unsigned int j=0;
    unsigned char x,y;

  if(Y1%8==0) y=Y1/8;      
  else y=Y1/8+1;
    for(y=Y0;y<Y1;y++)
    {
   
   
        OLED_Set_Pos(X0,y);
    for(x=X0;x<X1;x++)
        {
   
         
            OLED_WR_Byte(BMP[j++],OLED_DATA);
        }
    }
}

////==================================================================================================
////  实现功能: OLED 指定位置 画点
////  函数标记: 外设驱动函数
////  函数说明: 
////--------------------------------------------------------------------------------------------------
////  输入参量: //画点 
//              //x:0~127
//              //y:0~63
//              //t:1 填充 0,清空    
////--------------------------------------------------------------------------------------------------
////  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
////==================================================================================================
void OLED_DrawDot(unsigned char X,unsigned char Y,unsigned char T)
{
   
   
      unsigned char pos,bx,temp=0;
        if(X>127||Y>63) return;
        pos=(Y)/8;
        bx=Y%8;
        temp=1<<(bx);
        if(T) OLED_GRAM[X][pos]|=temp;
        else OLED_GRAM[X][pos]&=~temp;
        OLED_Refresh_Gram();    
}
////==================================================================================================
////  实现功能: OLED LCD_DrawLine画直线函数
////  函数标记: 外设驱动函数
////  函数说明: 
////--------------------------------------------------------------------------------------------------
////  输入参量: unsigned int X1,  直线:俩点坐标(x1,y1  ,(x2,y2)
////            unsigned int Y1, 
////            unsigned int X2,
////            unsigned int Y2,
////--------------------------------------------------------------------------------------------------
////  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
////==================================================================================================
void LCD_DrawLine(unsigned int X1, unsigned int Y1, unsigned int X2,unsigned int Y2)
{
   
   
    unsigned int t; 
    int xerr=0,yerr=0,delta_x,delta_y,distance; 
    int incx,incy,uRow,uCol;

    delta_x=X2-X1; //计算坐标增量 
    delta_y=Y2-Y1; 
    uRow=X1; 
    uCol=Y1; 

    if(delta_x>0)
  {
   
   
    incx=1; //设置单步方向 
  }

    else if(delta_x==0)
  {
   
   
    incx=0;//垂直线 
  }
    else 
  {
   
   
     incx=-1;
     delta_x=-delta_x;
  } 

    if(delta_y>0)
    incy=1; 
    else if(delta_y==0)
    incy=0;//水平线 
    else
  {
   
   
    incy=-1;
    delta_y=-delta_y;
  } 
    if( delta_x>delta_y)
    distance=delta_x; //选取基本增量坐标轴 
    else 
    distance=delta_y; 

    for(t=0;t<=distance+1;t++ )//画线输出 
    {
   
     
        OLED_DrawDot(uRow,uCol,1);//画点 
        xerr+=delta_x ; 
        yerr+=delta_y ; 
        if(xerr>distance) 
        {
   
    
            xerr-=distance; 
            uRow+=incx; 
        } 
        if(yerr>distance) 
        {
   
    
            yerr-=distance; 
            uCol+=incy; 
        } 
    }  
}  

////================================================================================================== 
/**
 * @brief  在 oled 显示器上使用 Bresenham 算法画圆
 * @param  usX_Center :在特定扫描方向下圆心的X坐标
 * @param  usY_Center :在特定扫描方向下圆心的Y坐标
 * @param  usRadius:圆的半径(单位:像素)
 * @param  ucFilled :选择是否填充该圆
  *   该参数为以下值之一:
  *     @arg 0 :空心圆
  *     @arg 1 :实心圆
 * @retval 无
 */
////--------------------------------------------------------------------------------------------------
////  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
////==================================================================================================
void OLED_DrawCircle( uint16_t usX_Center, uint16_t usY_Center, uint16_t usRadius, uint8_t ucFilled )
{
   
   
    int16_t sCurrentX, sCurrentY;
    int16_t sError;


    sCurrentX = 0; sCurrentY = usRadius;      

    sError = 3 - ( usRadius << 1 );     //判断下个点位置的标志


    while ( sCurrentX <= sCurrentY )
    {
   
   
        int16_t sCountY;


        if ( ucFilled )             
            for ( sCountY = sCurrentX; sCountY <= sCurrentY; sCountY ++ ) 
            {
   
                         
                OLED_DrawDot ( usX_Center + sCurrentX, usY_Center + sCountY,OLED_DATA );           //1,研究对象 
                OLED_DrawDot ( usX_Center - sCurrentX, usY_Center + sCountY,OLED_DATA);           //2       
                OLED_DrawDot ( usX_Center - sCountY,   usY_Center + sCurrentX,OLED_DATA);           //3
                OLED_DrawDot ( usX_Center - sCountY,   usY_Center - sCurrentX,OLED_DATA );           //4
                OLED_DrawDot ( usX_Center - sCurrentX, usY_Center - sCountY,OLED_DATA );           //5    
                OLED_DrawDot ( usX_Center + sCurrentX, usY_Center - sCountY,OLED_DATA );           //6
                OLED_DrawDot ( usX_Center + sCountY,   usY_Center - sCurrentX,OLED_DATA );           //7     
                OLED_DrawDot ( usX_Center + sCountY,   usY_Center + sCurrentX,OLED_DATA );           //0                
            }    
        else
        {
   
             
                OLED_DrawDot ( usX_Center + sCurrentX, usY_Center + sCurrentY,OLED_DATA );             //1,研究对象
                OLED_DrawDot ( usX_Center - sCurrentX, usY_Center + sCurrentY,OLED_DATA );             //2      
                OLED_DrawDot ( usX_Center - sCurrentY, usY_Center + sCurrentX,OLED_DATA );             //3
                OLED_DrawDot ( usX_Center - sCurrentY, usY_Center - sCurrentX,OLED_DATA );             //4
                OLED_DrawDot ( usX_Center - sCurrentX, usY_Center - sCurrentY,OLED_DATA );             //5       
                OLED_DrawDot ( usX_Center + sCurrentX, usY_Center - sCurrentY,OLED_DATA);             //6
                OLED_DrawDot ( usX_Center + sCurrentY, usY_Center - sCurrentX,OLED_DATA);             //7 
                OLED_DrawDot ( usX_Center + sCurrentY, usY_Center + sCurrentX,OLED_DATA );             //0
    }                    
        sCurrentX ++;        
        if ( sError < 0 ) 
            sError += 4 * sCurrentX + 6;      
        else
        {
   
   
            sError += 10 + 4 * ( sCurrentX - sCurrentY );   
            sCurrentY --;
        }         
    }    
}

////==================================================================================================
////  实现功能: OLED LCD_DrawRectangle
////  函数标记: 外设驱动函数
////  函数说明: 
////--------------------------------------------------------------------------------------------------
////  输入参量: unsigned int X1,  长度 宽度:俩点坐标(x1,y1  ,(x2,y2)
////            unsigned int Y1, 
////            unsigned int X2,
////            unsigned int Y2,
////--------------------------------------------------------------------------------------------------
////  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
////==================================================================================================

void LCD_DrawRectangle(unsigned short X1, unsigned short Y1, unsigned short X2, unsigned short Y2)
{
   
   
        LCD_DrawLine(X1,Y1,X2,Y1);
        LCD_DrawLine(X1,Y1,X1,Y2);
        LCD_DrawLine(X1,Y2,X2,Y2);
        LCD_DrawLine(X2,Y1,X2,Y2);
}
////==================================================================================================
////  实现功能: OLED OLED_Fill_Draw_circle //画圆填充
////  函数标记: 外设驱动函数
////  函数说明: 
////--------------------------------------------------------------------------------------------------
////  输入参量: //写画实心圆心(x0,y0),半径r,dot=1填充,dot=0不填充
////--------------------------------------------------------------------------------------------------
////  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
////==================================================================================================
void OLED_Fill_Draw_circle(unsigned char X0,unsigned char Y0,unsigned char r,unsigned char dot)
{
   
       
        unsigned char x = 0,y = 0,R = 0;
        for(x = X0-r;x <= X0+r;x++)
    {
   
   
                for(y = Y0-r; y <= Y0+r ;y++ )
        {
   
   
                    R = sqrt(pow(r,2)-pow(x-X0,2))+Y0; //圆方程  x,y反置        
                    if( (y >= Y0 && y <= R) || (y < Y0 && y >= 2*Y0-R )|| dot == 0 )
          {
   
     //点限制在 圆方程内    
            OLED_DrawDot(y,x,dot);
          }    
                }
        }
}

////==================================================================================================
////  实现功能: OLED_RollDisplay
////  函数标记: 外设驱动函数
////  函数说明: //水平滚动
////  函数完成情况:有问题
////--------------------------------------------------------------------------------------------------
////  输入参量: 无
////--------------------------------------------------------------------------------------------------
////  |   -   |   -   |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9   
////==================================================================================================

void OLED_RollDisplay(void)
{
   
   
        OLED_WR_Byte(0x2E,OLED_CMD);        //关闭滚动
        OLED_WR_Byte(0x29,OLED_CMD);        //水平向左或者右滚动 2A/29
        OLED_WR_Byte(0x00,OLED_CMD);        //虚拟字节
        OLED_WR_Byte(0x00,OLED_CMD);        //起始页 0
        OLED_WR_Byte(0x07,OLED_CMD);        //滚动时间间隔
        OLED_WR_Byte(0x07,OLED_CMD);        //终止页 7
        OLED_WR_Byte(0x00,OLED_CMD);        //虚拟字节
        OLED_WR_Byte(0xFF,OLED_CMD);        //虚拟字节
        OLED_WR_Byte(0x2F,OLED_CMD);        //开启滚动
}

oled.h

#ifndef __OLED_H
#define __OLED_H                   
#include "sys.h"
#include "stdlib.h"     

#define OLED_MODE 0
#define SIZE 8
#define XLevelL        0x00
#define XLevelH        0x10
#define Max_Column    128
#define Max_Row        64
#define    Brightness    0xFF 
#define X_WIDTH     128
#define Y_WIDTH     64       

//-----------------OLED IIC端口定义----------------                         

#define OLED_SCLK_Clr() GPIO_ResetBits(GPIOB,GPIO_Pin_9)//SDA IIC接口的时钟信号
#define OLED_SCLK_Set() GPIO_SetBits(GPIOB,GPIO_Pin_9)

#define OLED_SDIN_Clr() GPIO_ResetBits(GPIOB,GPIO_Pin_10)//SCL IIC接口的数据信号
#define OLED_SDIN_Set() GPIO_SetBits(GPIOB,GPIO_Pin_10)

#define OLED_CMD  0    //写命令
#define OLED_DATA 1    //写数据   

//OLED控制用函数
void OLED_WR_Byte(unsigned dat,unsigned cmd);  
void OLED_Display_On(void);
void OLED_Display_Off(void);                                                  
void OLED_Init(void);
void OLED_Clear(void);
//oled 延迟函数
void Delay_50ms(unsigned int Delay_50ms);
void Delay_1ms(unsigned int Delay_1ms);

//IIC控制函数
void IIC_Start(void);
void IIC_Stop(void);
void Write_IIC_Command(unsigned char IIC_Command);
void Write_IIC_Data(unsigned char IIC_Data);
void Write_IIC_Byte(unsigned char IIC_Byte);
void IIC_Wait_Ack(void);

//oled 操作函数
void OLED_Fill(unsigned char fill_Data);//全屏填充
void OLED_Refresh_Gram(void);
void OLED_Set_Pos(unsigned char X, unsigned char Y);
void OLED_AreaClear(unsigned char X, unsigned char Y, unsigned char X_Size, unsigned char Y_Size);

//  OLED 显示字符、字符串
void OLED_ShowChar_06x08(unsigned char X, unsigned char Y, unsigned char Char);
void OLED_ShowString_06x08(unsigned char X, unsigned char Y, unsigned char *String);

void OLED_ShowCHinese(unsigned char X,unsigned char Y,unsigned char Chinese);//显示汉字函数

void OLED_ShowChar_08x16(unsigned char X, unsigned char Y, unsigned char Char);
//void OLED_ShowChinese_16x16(unsigned char X, unsigned char Y, unsigned char *Chinese);
void OLED_ShowString_16x16(unsigned char X, unsigned char Y, unsigned char *String);

void OLED_ShowArray_06x08(unsigned char X, unsigned char Y, unsigned char *Array, unsigned char Count);

//  OLED 显示整型数字/浮点型数字/二进制数字/十六进制数字
void OLED_ShowNumber_SignedInteger_06x08(unsigned char X, unsigned char Y, signed short IntegerNumber, unsigned char Count);
void OLED_ShowNumber_UnsignedInteger_06x08(unsigned char X, unsigned char Y, unsigned short IntegerNumber, unsigned char Count);
void OLED_ShowNumber_Float_06x08(unsigned char X, unsigned char Y, float FloatNumber, unsigned char Count1, unsigned char Count2);
void OLED_ShowNumber_Binary_06x08(unsigned char X, unsigned char Y, unsigned long BinaryNumber, unsigned char Count);
void OLED_ShowNumber_Hex_06x08(unsigned char X, unsigned char Y, unsigned long BinaryNumber, unsigned char Count);

//  OLED 绘制直线
void OLED_DrawLine(unsigned char X, unsigned char Y, unsigned char PointData);

//  OLED 绘制图像
void OLED_RollDisplay(void);//设置水平左右移
void Draw_BMP(unsigned char x0,unsigned char y0,unsigned char x1,unsigned char y1,unsigned char BMP[]);


void OLED_DrawDot(unsigned char X,unsigned char Y,unsigned char T);//画点函数
void LCD_DrawLine(unsigned int X1, unsigned int Y1, unsigned int X2,unsigned int Y2);//画直线函数
void OLED_Fill_Draw_circle(unsigned char X0,unsigned char Y0,unsigned char r,unsigned char dot);//dot ==1 表示亮显示出来
void OLED_DrawCircle( uint16_t usX_Center, uint16_t usY_Center, uint16_t usRadius, uint8_t ucFilled );//ucFilled ==1 表示填充 //画直圆函数
void LCD_DrawRectangle(unsigned short X1, unsigned short Y1, unsigned short X2, unsigned short Y2);//矩形
#endif
#ifndef __OLEDFONT_H
#define __OLEDFONT_H        
//常用ASCII表
//偏移量32
//ASCII字符集
//偏移量32
//大小:12*6
/************************************6*8的点阵************************************/
const struct struct_OLED_ASCII_06x08                // 结构体定义
{
   
   
    unsigned char Char;                             // 编码 ASCII字符由1个字节组成
    unsigned char Code[6];                          // 编码内容
} OLED_ASCII_06x08_FontCode[]  =        
{
   
   

    ' ',{
   
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },     //  (空格)
    '!',{
   
    0x00, 0x00, 0x00, 0x2f, 0x00, 0x00 },     // !
    '"',{
   
    0x00, 0x00, 0x07, 0x00, 0x07, 0x00 },     // "
    '#',{
   
    0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14 },     // #
    '{
   
   mathJaxContainer[0]}
    '%',{
   
    0x00, 0x62, 0x64, 0x08, 0x13, 0x23 },     // %
    '&',{
   
    0x00, 0x36, 0x49, 0x55, 0x22, 0x50 },     // &
   '\'',{
   
    0x00, 0x00, 0x05, 0x03, 0x00, 0x00 },     // '
    '(',{
   
    0x00, 0x00, 0x1c, 0x22, 0x41, 0x00 },     // (
    ')',{
   
    0x00, 0x00, 0x41, 0x22, 0x1c, 0x00 },     // )
    '*',{
   
    0x00, 0x14, 0x08, 0x3E, 0x08, 0x14 },     // *
    '+',{
   
    0x00, 0x08, 0x08, 0x3E, 0x08, 0x08 },     // +
    ',',{
   
    0x00, 0x00, 0x00, 0xA0, 0x60, 0x00 },     // ,
    '-',{
   
    0x00, 0x08, 0x08, 0x08, 0x08, 0x08 },     // -
    '.',{
   
    0x00, 0x00, 0x60, 0x60, 0x00, 0x00 },     // .
    '/',{
   
    0x00, 0x20, 0x10, 0x08, 0x04, 0x02 },     // /
    '0',{
   
    0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E },     // 0
    '1',{
   
    0x00, 0x00, 0x42, 0x7F, 0x40, 0x00 },     // 1
    '2',{
   
    0x00, 0x42, 0x61, 0x51, 0x49, 0x46 },     // 2
    '3',{
   
    0x00, 0x21, 0x41, 0x45, 0x4B, 0x31 },     // 3
    '4',{
   
    0x00, 0x18, 0x14, 0x12, 0x7F, 0x10 },     // 4
    '5',{
   
    0x00, 0x27, 0x45, 0x45, 0x45, 0x39 },     // 5
    '6',{
   
    0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30 },     // 6
    '7',{
   
    0x00, 0x01, 0x71, 0x09, 0x05, 0x03 },     // 7
    '8',{
   
    0x00, 0x36, 0x49, 0x49, 0x49, 0x36 },     // 8
    '9',{
   
    0x00, 0x06, 0x49, 0x49, 0x29, 0x1E },     // 9
    ':',{
   
    0x00, 0x00, 0x36, 0x36, 0x00, 0x00 },     // :
    ';',{
   
    0x00, 0x00, 0x56, 0x36, 0x00, 0x00 },     // ;
    '<',{
   
    0x00, 0x08, 0x14, 0x22, 0x41, 0x00 },     // <
    '=',{
   
    0x00, 0x14, 0x14, 0x14, 0x14, 0x14 },     // =
    '>',{
   
    0x00, 0x00, 0x41, 0x22, 0x14, 0x08 },     // >
    '?',{
   
    0x00, 0x02, 0x01, 0x51, 0x09, 0x06 },     // ?
    '@',{
   
    0x00, 0x32, 0x49, 0x59, 0x51, 0x3E },     // @
    'A',{
   
    0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C },     // A
    'B',{
   
    0x00, 0x7F, 0x49, 0x49, 0x49, 0x36 },     // B
    'C',{
   
    0x00, 0x3E, 0x41, 0x41, 0x41, 0x22 },     // C
    'D',{
   
    0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C },     // D
    'E',{
   
    0x00, 0x7F, 0x49, 0x49, 0x49, 0x41 },     // E
    'F',{
   
    0x00, 0x7F, 0x09, 0x09, 0x09, 0x01 },     // F
    'G',{
   
    0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A },     // G
    'H',{
   
    0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F },     // H
    'I',{
   
    0x00, 0x00, 0x41, 0x7F, 0x41, 0x00 },     // I
    'J',{
   
    0x00, 0x20, 0x40, 0x41, 0x3F, 0x01 },     // J
    'K',{
   
    0x00, 0x7F, 0x08, 0x14, 0x22, 0x41 },     // K
    'L',{
   
    0x00, 0x7F, 0x40, 0x40, 0x40, 0x40 },     // L
    'M',{
   
    0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F },     // M
    'N',{
   
    0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F },     // N
    'O',{
   
    0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E },     // O
    'P',{
   
    0x00, 0x7F, 0x09, 0x09, 0x09, 0x06 },     // P
    'Q',{
   
    0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E },     // Q
    'R',{
   
    0x00, 0x7F, 0x09, 0x19, 0x29, 0x46 },     // R
    'S',{
   
    0x00, 0x46, 0x49, 0x49, 0x49, 0x31 },     // S
    'T',{
   
    0x00, 0x01, 0x01, 0x7F, 0x01, 0x01 },     // T
    'U',{
   
    0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F },     // U
    'V',{
   
    0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F },     // V
    'W',{
   
    0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F },     // W
    'X',{
   
    0x00, 0x63, 0x14, 0x08, 0x14, 0x63 },     // X
    'Y',{
   
    0x00, 0x07, 0x08, 0x70, 0x08, 0x07 },     // Y
    'Z',{
   
    0x00, 0x61, 0x51, 0x49, 0x45, 0x43 },     // Z
    '[',{
   
    0x00, 0x00, 0x7F, 0x41, 0x41, 0x00 },     // [
    ']',{
   
    0x00, 0x00, 0x41, 0x41, 0x7F, 0x00 },     // ]
    '^',{
   
    0x00, 0x04, 0x02, 0x01, 0x02, 0x04 },     // ^
    '_',{
   
    0x00, 0x40, 0x40, 0x40, 0x40, 0x40 },     // _
    '`',{
   
    0x00, 0x00, 0x01, 0x02, 0x04, 0x00 },     // `
    'a',{
   
    0x00, 0x20, 0x54, 0x54, 0x54, 0x78 },     // a
    'b',{
   
    0x00, 0x7F, 0x48, 0x44, 0x44, 0x38 },     // b
    'c',{
   
    0x00, 0x38, 0x44, 0x44, 0x44, 0x20 },     // c
    'd',{
   
    0x00, 0x38, 0x44, 0x44, 0x48, 0x7F },     // d
    'e',{
   
    0x00, 0x38, 0x54, 0x54, 0x54, 0x18 },     // e
    'f',{
   
    0x00, 0x08, 0x7E, 0x09, 0x01, 0x02 },     // f
    'g',{
   
    0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C },     // g
    'h',{
   
    0x00, 0x7F, 0x08, 0x04, 0x04, 0x78 },     // h
    'i',{
   
    0x00, 0x00, 0x44, 0x7D, 0x40, 0x00 },     // i
    'j',{
   
    0x00, 0x40, 0x80, 0x84, 0x7D, 0x00 },     // j
    'k',{
   
    0x00, 0x7F, 0x10, 0x28, 0x44, 0x00 },     // k
    'l',{
   
    0x00, 0x00, 0x41, 0x7F, 0x40, 0x00 },     // l
    'm',{
   
    0x00, 0x7C, 0x04, 0x18, 0x04, 0x78 },     // m
    'n',{
   
    0x00, 0x7C, 0x08, 0x04, 0x04, 0x78 },     // n
    'o',{
   
    0x00, 0x38, 0x44, 0x44, 0x44, 0x38 },     // o
    'p',{
   
    0x00, 0xFC, 0x24, 0x24, 0x24, 0x18 },     // p
    'q',{
   
    0x00, 0x18, 0x24, 0x24, 0x18, 0xFC },     // q
    'r',{
   
    0x00, 0x7C, 0x08, 0x04, 0x04, 0x08 },     // r
    's',{
   
    0x00, 0x48, 0x54, 0x54, 0x54, 0x20 },     // s
    't',{
   
    0x00, 0x04, 0x3F, 0x44, 0x40, 0x20 },     // t
    'u',{
   
    0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C },     // u
    'v',{
   
    0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C },     // v
    'w',{
   
    0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C },     // w
    'x',{
   
    0x00, 0x44, 0x28, 0x10, 0x28, 0x44 },     // x
    'y',{
   
    0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C },     // y
    'z',{
   
    0x00, 0x44, 0x64, 0x54, 0x4C, 0x44 },     // z
    '|',{
   
    0x14, 0x14, 0x14, 0x14, 0x14, 0x14 }      // |
};
/****************************************8*16的点阵************************************/
const struct struct_OLED_ASCII_08x16                // 结构体定义
{
   
   
    unsigned char Char;                             // 编码 ASCII字符由1个字节组成
    unsigned char Code[16];                         // 编码内容
} OLED_ASCII_08x16_FontCode[] =      
{
   
   
  ' ',{
   
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },        //  (空格)
    '!',{
   
    0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00 },        // !
    '"',{
   
    0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },        // "
    '#',{
   
    0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00 },        // #
    '{
   
   mathJaxContainer[1]}
    '%',{
   
    0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00 },        // %
    '&',{
   
    0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10 },        // &
   '\'',{
   
    0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },        // '
    '(',{
   
    0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00 },        // (
    ')',{
   
    0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00 },        // )
    '*',{
   
    0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00 },        // *
    '+',{
   
    0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00 },        // +
    ',',{
   
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00 },        // ,
    '-',{
   
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01 },        // -
    '.',{
   
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00 },        // .
    '/',{
   
    0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00 },        // /
    '0',{
   
    0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00 },        // 0
    '1',{
   
    0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00 },        // 1
    '2',{
   
    0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00 },        // 2
    '3',{
   
    0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00 },        // 3
    '4',{
   
    0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00 },        // 4
    '5',{
   
    0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00 },        // 5
    '6',{
   
    0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00 },        // 6
    '7',{
   
    0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00 },        // 7
    '8',{
   
    0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00 },        // 8
    '9',{
   
    0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00 },        // 9
    ':',{
   
    0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00 },        // :
    ';',{
   
    0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00 },        // ;
    '<',{
   
    0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00 },        // <
    '=',{
   
    0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00 },        // =
    '>',{
   
    0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00 },        // >
    '?',{
   
    0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00 },        // ?
    '@',{
   
    0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00 },        // @
    'A',{
   
    0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20 },        // A
    'B',{
   
    0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00 },        // B
    'C',{
   
    0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00 },        // C
    'D',{
   
    0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00 },        // D
    'E',{
   
    0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00 },        // E
    'F',{
   
    0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00 },        // F
    'G',{
   
    0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00 },        // G
    'H',{
   
    0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20 },        // H
    'I',{
   
    0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00 },        // I
    'J',{
   
    0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00 },        // J
    'K',{
   
    0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00 },        // K
    'L',{
   
    0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00 },        // L
    'M',{
   
    0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00 },        // M
    'N',{
   
    0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00 },        // N
    'O',{
   
    0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00 },        // O
    'P',{
   
    0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00 },        // P
    'Q',{
   
    0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00 },        // Q
    'R',{
   
    0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20 },        // R
    'S',{
   
    0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00 },        // S
    'T',{
   
    0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00 },        // T
    'U',{
   
    0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00 },        // U
    'V',{
   
    0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00 },        // V
    'W',{
   
    0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00 },        // W
    'X',{
   
    0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20 },        // X
    'Y',{
   
    0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00 },        // Y
    'Z',{
   
    0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00 },        // Z
    '[',{
   
    0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00 },        // [
    ']',{
   
    0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00 },        // ]
    '^',{
   
    0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },        // ^
    '_',{
   
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80 },        // _
    '`',{
   
    0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },        // `
    'a',{
   
    0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20 },        // a
    'b',{
   
    0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00 },        // b
    'c',{
   
    0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00 },        // c
    'd',{
   
    0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20 },        // d
    'e',{
   
    0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00 },        // e
    'f',{
   
    0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00 },        // f
    'g',{
   
    0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00 },        // g
    'h',{
   
    0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20 },        // h
    'i',{
   
    0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00 },        // i
    'j',{
   
    0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00 },        // j
    'k',{
   
    0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00 },        // k
    'l',{
   
    0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00 },        // l
    'm',{
   
    0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F },        // m
    'n',{
   
    0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20 },        // n
    'o',{
   
    0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00 },        // o
    'p',{
   
    0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00 },        // p
    'q',{
   
    0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80 },        // q
    'r',{
   
    0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00 },        // r
    's',{
   
    0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00 },        // s
    't',{
   
    0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00 },        // t
    'u',{
   
    0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20 },        // u
    'v',{
   
    0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00 },        // v
    'w',{
   
    0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00 },        // w
    'x',{
   
    0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00 },        // x
    'y',{
   
    0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00 },        // y
    'z',{
   
    0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00 },        // z
    '{',{
   
    0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40 },        // {
   
   
    '|',{
   
    0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00 },        // |
    '}',{
   
    0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00 },        // }
    '~',{
   
    0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },        // ~
};


char CHinese[][32]={
   
   

{
   
   0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0x10,0x10,0xF0,0x00,0x00,0x00},
{
   
   0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x0F,0x00,0x00,0x00},/*"中",0*/

{
   
   0x40,0x40,0x40,0x5F,0x55,0x55,0x55,0x75,0x55,0x55,0x55,0x5F,0x40,0x40,0x40,0x00},
{
   
   0x00,0x40,0x20,0x0F,0x09,0x49,0x89,0x79,0x09,0x09,0x09,0x0F,0x20,0x40,0x00,0x00},/*"景",1*/

{
   
   0x00,0xFE,0x02,0x42,0x4A,0xCA,0x4A,0x4A,0xCA,0x4A,0x4A,0x42,0x02,0xFE,0x00,0x00},
{
   
   0x00,0xFF,0x40,0x50,0x4C,0x43,0x40,0x40,0x4F,0x50,0x50,0x5C,0x40,0xFF,0x00,0x00},/*"园",2*/

{
   
   0x00,0x00,0xF8,0x88,0x88,0x88,0x88,0xFF,0x88,0x88,0x88,0x88,0xF8,0x00,0x00,0x00},
{
   
   0x00,0x00,0x1F,0x08,0x08,0x08,0x08,0x7F,0x88,0x88,0x88,0x88,0x9F,0x80,0xF0,0x00},/*"电",3*/

{
   
   0x80,0x82,0x82,0x82,0x82,0x82,0x82,0xE2,0xA2,0x92,0x8A,0x86,0x82,0x80,0x80,0x00},
{
   
   0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"子",4*/

{
   
   0x24,0x24,0xA4,0xFE,0xA3,0x22,0x00,0x22,0xCC,0x00,0x00,0xFF,0x00,0x00,0x00,0x00},
{
   
   0x08,0x06,0x01,0xFF,0x00,0x01,0x04,0x04,0x04,0x04,0x04,0xFF,0x02,0x02,0x02,0x00},/*"科",5*/

{
   
   0x10,0x10,0x10,0xFF,0x10,0x90,0x08,0x88,0x88,0x88,0xFF,0x88,0x88,0x88,0x08,0x00},
{
   
   0x04,0x44,0x82,0x7F,0x01,0x80,0x80,0x40,0x43,0x2C,0x10,0x28,0x46,0x81,0x80,0x00},/*"?",0*/

{
   
   0x40,0x40,0x48,0x48,0x48,0xC8,0x78,0x4F,0x48,0x48,0x48,0x48,0x48,0x40,0x40,0x00},
{
   
   0x00,0x00,0x00,0x00,0x03,0x12,0x12,0x22,0x22,0x52,0x8A,0x06,0x00,0x00,0x00,0x00},/*"专",0*/

{
   
   0x00,0x10,0x60,0x80,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0xC0,0x30,0x00,0x00},
{
   
   0x40,0x40,0x40,0x43,0x40,0x7F,0x40,0x40,0x40,0x7F,0x42,0x41,0x40,0x40,0x40,0x00},/*"业",1*/

{
   
   0x10,0x10,0x10,0xFF,0x10,0x90,0x08,0x88,0x88,0x88,0xFF,0x88,0x88,0x88,0x08,0x00},
{
   
   0x04,0x44,0x82,0x7F,0x01,0x80,0x80,0x40,0x43,0x2C,0x10,0x28,0x46,0x81,0x80,0x00},/*"技",2*/

{
   
   0x00,0x10,0x10,0x10,0x10,0xD0,0x30,0xFF,0x30,0xD0,0x12,0x1C,0x10,0x10,0x00,0x00},
{
   
   0x10,0x08,0x04,0x02,0x01,0x00,0x00,0xFF,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x00},/*"术",3*/

{
   
   0x00,0x00,0xFE,0x22,0x22,0x22,0xFE,0x00,0xFE,0x82,0x82,0x92,0xA2,0x9E,0x00,0x00},
{
   
   0x80,0x60,0x1F,0x02,0x42,0x82,0x7F,0x00,0xFF,0x40,0x2F,0x10,0x2C,0x43,0x80,0x00},/*"服",4*/

{
   
   0x00,0x00,0x90,0x88,0x4C,0x57,0xA4,0x24,0x54,0x54,0x8C,0x84,0x00,0x00,0x00,0x00},
{
   
   0x01,0x01,0x80,0x42,0x22,0x1A,0x07,0x02,0x42,0x82,0x42,0x3E,0x01,0x01,0x01,0x00},/*"务",5*/

{
   
   0x00,0x04,0xE4,0x24,0x2C,0xB4,0x25,0x26,0x24,0xB4,0x2C,0x24,0xE4,0x04,0x00,0x00},
{
   
   0x00,0x00,0xFF,0x02,0x01,0x1E,0x12,0x12,0x12,0x1E,0x41,0x82,0x7F,0x00,0x00,0x00},/*"商",6*/

};


#endif

测试效果

oled 画点 画直线  画圆现象
oled 显示 字符串 整形数字 浮点数
oled 显示图片
oled 显示 汉字 字符串 字符
oled 显示 汉字 不同大小的字符串 圆 矩形  有符号数字

博客地址https://dele.vercel.app/

相关实践学习
通过Ingress进行灰度发布
本场景您将运行一个简单的应用,部署一个新的应用用于新的发布,并通过Ingress能力实现灰度发布。
容器应用与集群管理
欢迎来到《容器应用与集群管理》课程,本课程是“云原生容器Clouder认证“系列中的第二阶段。课程将向您介绍与容器集群相关的概念和技术,这些概念和技术可以帮助您了解阿里云容器服务ACK/ACK Serverless的使用。同时,本课程也会向您介绍可以采取的工具、方法和可操作步骤,以帮助您了解如何基于容器服务ACK Serverless构建和管理企业级应用。 学习完本课程后,您将能够: 掌握容器集群、容器编排的基本概念 掌握Kubernetes的基础概念及核心思想 掌握阿里云容器服务ACK/ACK Serverless概念及使用方法 基于容器服务ACK Serverless搭建和管理企业级网站应用
目录
相关文章
|
4月前
|
传感器
stm32f407探索者开发板(二十二)——通用定时器基本原理讲解
stm32f407探索者开发板(二十二)——通用定时器基本原理讲解
310 0
|
4月前
stm32f407探索者开发板(十九)——外部中断实验-EXIT
stm32f407探索者开发板(十九)——外部中断实验-EXIT
272 0
|
4月前
stm32f407探索者开发板(十七)——串口寄存器库函数配置方法
stm32f407探索者开发板(十七)——串口寄存器库函数配置方法
674 0
|
4月前
STM32CubeMX OLED驱动
STM32CubeMX OLED驱动
61 10
|
4月前
stm32f407探索者开发板(二十三)——定时器中断实验
stm32f407探索者开发板(二十三)——定时器中断实验
331 0
|
4月前
|
程序员
stm32f407探索者开发板(二十一)——窗口看门狗
stm32f407探索者开发板(二十一)——窗口看门狗
133 0
|
4月前
|
芯片
stm32f407探索者开发板(二十)——独立看门狗实验
stm32f407探索者开发板(二十)——独立看门狗实验
280 0
|
4月前
|
监控
stm32f407探索者开发板(十八)——串口通信实验讲解(USART_RX_STA流程图详解)
stm32f407探索者开发板(十八)——串口通信实验讲解(USART_RX_STA流程图详解)
244 0
|
4月前
stm32f407探索者开发板(十六)——串行通信原理讲解-UART
stm32f407探索者开发板(十六)——串行通信原理讲解-UART
247 0
|
4月前
stm32f407探索者开发板(十五)——NVIC中断优先级管理
stm32f407探索者开发板(十五)——NVIC中断优先级管理
166 0