野火F1开发板STM32案例-MultiButton移植
硬件平台
野火STM32F103ZET6 霸道V2开发板正点原子F1系列开发板0.96 IIC oled模块
软件平台
Keil MDK 5.31串口调试助手
IIC总线
处理器和芯片间的通信可以形象的比喻成两个人讲话:1、你说的别人得能听懂:双方约定信号的协议。2、你的语速别人得能接受:双方满足时序要求。 一、IIC总线的信号类型 1、开始信号:处理器让SCL时钟保持高电平,然后让SDA数据信号由高变低就表示一个开始信号。同时IIC总线上的设备检测到这个开始信号它就知道处理器要发送数据了。
2、停止信号:处理器让SCL时钟保持高电平,然后让SDA数据信号由低变高就表示一个停止信号。同时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
#include "oled.h"
#include "stdlib.h"
#include "oledfont.h"
#include "delay.h"
#include "math.h"
unsigned char OLED_GRAM
[128][8];
unsigned char OLED_GRAM_TEMP
[128][8];
void IIC_Start()
{
OLED_SCLK_Set() ;
OLED_SDIN_Set();
OLED_SDIN_Clr();
OLED_SCLK_Clr();
}
void IIC_Stop()
{
OLED_SCLK_Set() ;
OLED_SDIN_Clr();
OLED_SDIN_Set();
}
void IIC_Wait_Ack()
{
OLED_SCLK_Set() ;
OLED_SCLK_Clr();
}
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();
}
}
void Write_IIC_Command(unsigned char IIC_Command
)
{
IIC_Start();
Write_IIC_Byte(0x78);
IIC_Wait_Ack();
Write_IIC_Byte(0x00);
IIC_Wait_Ack();
Write_IIC_Byte(IIC_Command
);
IIC_Wait_Ack();
IIC_Stop();
}
void Write_IIC_Data(unsigned char IIC_Data
)
{
IIC_Start();
Write_IIC_Byte(0x78);
IIC_Wait_Ack();
Write_IIC_Byte(0x40);
IIC_Wait_Ack();
Write_IIC_Byte(IIC_Data
);
IIC_Wait_Ack();
IIC_Stop();
}
void OLED_WR_Byte(unsigned dat
,unsigned cmd
)
{
if(cmd
)
{
Write_IIC_Data(dat
);
}
else
{
Write_IIC_Command(dat
);
}
}
void fill_picture(unsigned char fill_Data
)
{
unsigned char m
,n
;
for(m
=0;m
<8;m
++)
{
OLED_WR_Byte(0xb0+m
,OLED_CMD
);
OLED_WR_Byte(0x00,OLED_CMD
);
OLED_WR_Byte(0x10,OLED_CMD
);
for(n
=0;n
<128;n
++)
{
OLED_WR_Byte(fill_Data
,OLED_DATA
);
}
}
}
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
++);
}
}
void OLED_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure
;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB
, ENABLE
);
GPIO_InitStructure
.GPIO_Pin
= GPIO_Pin_9
|GPIO_Pin_10
;
GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_Out_PP
;
GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_50MHz
;
GPIO_Init(GPIOB
, &GPIO_InitStructure
);
GPIO_SetBits(GPIOB
,GPIO_Pin_9
|GPIO_Pin_10
);
delay_ms(200);
OLED_WR_Byte(0xAE,OLED_CMD
);
OLED_WR_Byte(0x00,OLED_CMD
);
OLED_WR_Byte(0x10,OLED_CMD
);
OLED_WR_Byte(0x40,OLED_CMD
);
OLED_WR_Byte(0xB0,OLED_CMD
);
OLED_WR_Byte(0x81,OLED_CMD
);
OLED_WR_Byte(0xFF,OLED_CMD
);
OLED_WR_Byte(0xA1,OLED_CMD
);
OLED_WR_Byte(0xA6,OLED_CMD
);
OLED_WR_Byte(0xA8,OLED_CMD
);
OLED_WR_Byte(0x3F,OLED_CMD
);
OLED_WR_Byte(0xC8,OLED_CMD
);
OLED_WR_Byte(0xD3,OLED_CMD
);
OLED_WR_Byte(0x00,OLED_CMD
);
OLED_WR_Byte(0xD5,OLED_CMD
);
OLED_WR_Byte(0x80,OLED_CMD
);
OLED_WR_Byte(0xD8,OLED_CMD
);
OLED_WR_Byte(0x05,OLED_CMD
);
OLED_WR_Byte(0xD9,OLED_CMD
);
OLED_WR_Byte(0xF1,OLED_CMD
);
OLED_WR_Byte(0xDA,OLED_CMD
);
OLED_WR_Byte(0x12,OLED_CMD
);
OLED_WR_Byte(0xDB,OLED_CMD
);
OLED_WR_Byte(0x30,OLED_CMD
);
OLED_WR_Byte(0x8D,OLED_CMD
);
OLED_WR_Byte(0x14,OLED_CMD
);
OLED_WR_Byte(0xAF,OLED_CMD
);
}
void OLED_Refresh_Gram(void)
{
u8 i
,n
;
for(i
=0;i
<8;i
++)
{
OLED_WR_Byte
(0xb0+i
,OLED_CMD
);
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
);
}
}
void OLED_Display_On(void)
{
OLED_WR_Byte(0X8D,OLED_CMD
);
OLED_WR_Byte(0X14,OLED_CMD
);
OLED_WR_Byte(0XAF,OLED_CMD
);
}
void OLED_Display_Off(void)
{
OLED_WR_Byte(0X8D,OLED_CMD
);
OLED_WR_Byte(0X10,OLED_CMD
);
OLED_WR_Byte(0XAE,OLED_CMD
);
}
void OLED_Clear(void)
{
uint8_t count
,num
;
for(count
=0;count
<8;count
++)
{
OLED_WR_Byte
(0xb0+count
,OLED_CMD
);
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
);
OLED_WR_Byte
(0x00,OLED_CMD
);
OLED_WR_Byte
(0x10,OLED_CMD
);
for(num
=0;num
<128;num
++)
OLED_WR_Byte(0x01,OLED_DATA
);
}
}
void OLED_Fill(unsigned char fill_Data
)
{
unsigned char m
,n
;
for(m
=0;m
<8;m
++)
{
OLED_WR_Byte(0xb0+m
,OLED_CMD
);
OLED_WR_Byte(0x00,OLED_CMD
);
OLED_WR_Byte(0x10,OLED_CMD
);
for(n
=0;n
<128;n
++)
{
OLED_WR_Byte(fill_Data
,OLED_DATA
);
}
}
}
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;
}
}
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
);
}
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
);
}
}
}
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;
}
}
}
void OLED_ShowString_06x08(unsigned char X
, unsigned char Y
, unsigned char *String
)
{
while(*String
)
{
OLED_ShowChar_06x08(X
, Y
, *String
);
String
++;
X
+=6;
}
}
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;
}
}
}
void OLED_ShowString_16x16(unsigned char X
, unsigned char Y
, unsigned char *String
)
{
unsigned char Position
= 0;
while(*String
)
{
if(*String
< 0x80)
{
OLED_ShowChar_08x16(X
+Position
*8, Y
, *String
);
String
++;
Position
++;
}
else
{
}
}
}
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;
}
}
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
);
}
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
);
}
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
,'+');
}
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);
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
);
}
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');
}
else
{
OLED_ShowChar_06x08(X
, Y
, '0');
}
BinaryNumber
<<= 1;
X
+= 6;
}
}
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;
}
}
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
);
}
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
);
}
}
}
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();
}
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
;
}
}
}
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
);
OLED_DrawDot
( usX_Center
- sCurrentX
, usY_Center
+ sCountY
,OLED_DATA
);
OLED_DrawDot
( usX_Center
- sCountY
, usY_Center
+ sCurrentX
,OLED_DATA
);
OLED_DrawDot
( usX_Center
- sCountY
, usY_Center
- sCurrentX
,OLED_DATA
);
OLED_DrawDot
( usX_Center
- sCurrentX
, usY_Center
- sCountY
,OLED_DATA
);
OLED_DrawDot
( usX_Center
+ sCurrentX
, usY_Center
- sCountY
,OLED_DATA
);
OLED_DrawDot
( usX_Center
+ sCountY
, usY_Center
- sCurrentX
,OLED_DATA
);
OLED_DrawDot
( usX_Center
+ sCountY
, usY_Center
+ sCurrentX
,OLED_DATA
);
}
else
{
OLED_DrawDot
( usX_Center
+ sCurrentX
, usY_Center
+ sCurrentY
,OLED_DATA
);
OLED_DrawDot
( usX_Center
- sCurrentX
, usY_Center
+ sCurrentY
,OLED_DATA
);
OLED_DrawDot
( usX_Center
- sCurrentY
, usY_Center
+ sCurrentX
,OLED_DATA
);
OLED_DrawDot
( usX_Center
- sCurrentY
, usY_Center
- sCurrentX
,OLED_DATA
);
OLED_DrawDot
( usX_Center
- sCurrentX
, usY_Center
- sCurrentY
,OLED_DATA
);
OLED_DrawDot
( usX_Center
+ sCurrentX
, usY_Center
- sCurrentY
,OLED_DATA
);
OLED_DrawDot
( usX_Center
+ sCurrentY
, usY_Center
- sCurrentX
,OLED_DATA
);
OLED_DrawDot
( usX_Center
+ sCurrentY
, usY_Center
+ sCurrentX
,OLED_DATA
);
}
sCurrentX
++;
if ( sError
< 0 )
sError
+= 4 * sCurrentX
+ 6;
else
{
sError
+= 10 + 4 * ( sCurrentX
- sCurrentY
);
sCurrentY
--;
}
}
}
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
);
}
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
;
if( (y
>= Y0
&& y
<= R
) || (y
< Y0
&& y
>= 2*Y0
-R
)|| dot
== 0 )
{
OLED_DrawDot(y
,x
,dot
);
}
}
}
}
void OLED_RollDisplay(void)
{
OLED_WR_Byte(0x2E,OLED_CMD
);
OLED_WR_Byte(0x29,OLED_CMD
);
OLED_WR_Byte(0x00,OLED_CMD
);
OLED_WR_Byte(0x00,OLED_CMD
);
OLED_WR_Byte(0x07,OLED_CMD
);
OLED_WR_Byte(0x07,OLED_CMD
);
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
#define OLED_SCLK_Clr() GPIO_ResetBits(GPIOB,GPIO_Pin_9)
#define OLED_SCLK_Set() GPIO_SetBits(GPIOB,GPIO_Pin_9)
#define OLED_SDIN_Clr() GPIO_ResetBits(GPIOB,GPIO_Pin_10)
#define OLED_SDIN_Set() GPIO_SetBits(GPIOB,GPIO_Pin_10)
#define OLED_CMD 0
#define OLED_DATA 1
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);
void Delay_50ms(unsigned int Delay_50ms
);
void Delay_1ms(unsigned int Delay_1ms
);
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);
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
);
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_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
);
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
);
void OLED_DrawLine(unsigned char X
, unsigned char Y
, unsigned char PointData
);
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
);
void OLED_DrawCircle( uint16_t usX_Center
, uint16_t usY_Center
, uint16_t usRadius
, uint8_t ucFilled
);
void LCD_DrawRectangle(unsigned short X1
, unsigned short Y1
, unsigned short X2
, unsigned short Y2
);
#endif
#ifndef __OLEDFONT_H
#define __OLEDFONT_H
const struct struct_OLED_ASCII_06x08
{
unsigned char Char
;
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 },
'$',{ 0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12 },
'%',{ 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 },
'1',{ 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00 },
'2',{ 0x00, 0x42, 0x61, 0x51, 0x49, 0x46 },
'3',{ 0x00, 0x21, 0x41, 0x45, 0x4B, 0x31 },
'4',{ 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10 },
'5',{ 0x00, 0x27, 0x45, 0x45, 0x45, 0x39 },
'6',{ 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30 },
'7',{ 0x00, 0x01, 0x71, 0x09, 0x05, 0x03 },
'8',{ 0x00, 0x36, 0x49, 0x49, 0x49, 0x36 },
'9',{ 0x00, 0x06, 0x49, 0x49, 0x29, 0x1E },
':',{ 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 },
'B',{ 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36 },
'C',{ 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22 },
'D',{ 0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C },
'E',{ 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41 },
'F',{ 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01 },
'G',{ 0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A },
'H',{ 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F },
'I',{ 0x00, 0x00, 0x41, 0x7F, 0x41, 0x00 },
'J',{ 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01 },
'K',{ 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41 },
'L',{ 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40 },
'M',{ 0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F },
'N',{ 0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F },
'O',{ 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E },
'P',{ 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06 },
'Q',{ 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E },
'R',{ 0x00, 0x7F, 0x09, 0x19, 0x29, 0x46 },
'S',{ 0x00, 0x46, 0x49, 0x49, 0x49, 0x31 },
'T',{ 0x00, 0x01, 0x01, 0x7F, 0x01, 0x01 },
'U',{ 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F },
'V',{ 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F },
'W',{ 0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F },
'X',{ 0x00, 0x63, 0x14, 0x08, 0x14, 0x63 },
'Y',{ 0x00, 0x07, 0x08, 0x70, 0x08, 0x07 },
'Z',{ 0x00, 0x61, 0x51, 0x49, 0x45, 0x43 },
'[',{ 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 },
'b',{ 0x00, 0x7F, 0x48, 0x44, 0x44, 0x38 },
'c',{ 0x00, 0x38, 0x44, 0x44, 0x44, 0x20 },
'd',{ 0x00, 0x38, 0x44, 0x44, 0x48, 0x7F },
'e',{ 0x00, 0x38, 0x54, 0x54, 0x54, 0x18 },
'f',{ 0x00, 0x08, 0x7E, 0x09, 0x01, 0x02 },
'g',{ 0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C },
'h',{ 0x00, 0x7F, 0x08, 0x04, 0x04, 0x78 },
'i',{ 0x00, 0x00, 0x44, 0x7D, 0x40, 0x00 },
'j',{ 0x00, 0x40, 0x80, 0x84, 0x7D, 0x00 },
'k',{ 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00 },
'l',{ 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00 },
'm',{ 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78 },
'n',{ 0x00, 0x7C, 0x08, 0x04, 0x04, 0x78 },
'o',{ 0x00, 0x38, 0x44, 0x44, 0x44, 0x38 },
'p',{ 0x00, 0xFC, 0x24, 0x24, 0x24, 0x18 },
'q',{ 0x00, 0x18, 0x24, 0x24, 0x18, 0xFC },
'r',{ 0x00, 0x7C, 0x08, 0x04, 0x04, 0x08 },
's',{ 0x00, 0x48, 0x54, 0x54, 0x54, 0x20 },
't',{ 0x00, 0x04, 0x3F, 0x44, 0x40, 0x20 },
'u',{ 0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C },
'v',{ 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C },
'w',{ 0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C },
'x',{ 0x00, 0x44, 0x28, 0x10, 0x28, 0x44 },
'y',{ 0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C },
'z',{ 0x00, 0x44, 0x64, 0x54, 0x4C, 0x44 },
'|',{ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14 }
};
const struct struct_OLED_ASCII_08x16
{
unsigned char Char
;
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 },
'$',{ 0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00 },
'%',{ 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 },
'1',{ 0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00 },
'2',{ 0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00 },
'3',{ 0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00 },
'4',{ 0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00 },
'5',{ 0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00 },
'6',{ 0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00 },
'7',{ 0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00 },
'8',{ 0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00 },
'9',{ 0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00 },
':',{ 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 },
'B',{ 0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00 },
'C',{ 0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00 },
'D',{ 0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00 },
'E',{ 0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00 },
'F',{ 0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00 },
'G',{ 0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00 },
'H',{ 0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20 },
'I',{ 0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00 },
'J',{ 0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00 },
'K',{ 0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00 },
'L',{ 0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00 },
'M',{ 0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00 },
'N',{ 0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00 },
'O',{ 0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00 },
'P',{ 0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00 },
'Q',{ 0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00 },
'R',{ 0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20 },
'S',{ 0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00 },
'T',{ 0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00 },
'U',{ 0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00 },
'V',{ 0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00 },
'W',{ 0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00 },
'X',{ 0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20 },
'Y',{ 0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00 },
'Z',{ 0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00 },
'[',{ 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 },
'b',{ 0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00 },
'c',{ 0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00 },
'd',{ 0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20 },
'e',{ 0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00 },
'f',{ 0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00 },
'g',{ 0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00 },
'h',{ 0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20 },
'i',{ 0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00 },
'j',{ 0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00 },
'k',{ 0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00 },
'l',{ 0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00 },
'm',{ 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F },
'n',{ 0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20 },
'o',{ 0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00 },
'p',{ 0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00 },
'q',{ 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80 },
'r',{ 0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00 },
's',{ 0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00 },
't',{ 0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00 },
'u',{ 0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20 },
'v',{ 0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00 },
'w',{ 0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00 },
'x',{ 0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00 },
'y',{ 0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00 },
'z',{ 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00 },
'{',{ 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},
{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},
{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},
{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},
{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},
{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},
{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},
{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},
{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},
{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},
{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},
{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},
{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},
{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},
};
#endif
测试效果
博客地址https://delehub.vercel.app/