Signed-off-by: kevin <kevin@lmve.net>

This commit is contained in:
2022-04-15 22:56:01 +08:00
parent 41c3c361ca
commit 368f32622f
16 changed files with 342 additions and 261 deletions
+49 -1
View File
@@ -65,6 +65,12 @@ void OLED_Setting_luminance(unsigned char a)
}
/*
初始化OLED
硬件扫描方式
从左到右从上到下
纵向8点上高位
*/
void OLED_Init(void)
{
@@ -131,7 +137,7 @@ void OLED_Cache_to_hardware()
//16*16 ASCII字符集点阵
const unsigned char asc2_1608[95][16]={
const char asc2_1608[95][16]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xCC,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00},/*"!",1*/
{0x00,0x00,0x08,0x00,0x30,0x00,0x60,0x00,0x08,0x00,0x30,0x00,0x60,0x00,0x00,0x00},/*""",2*/
@@ -228,6 +234,48 @@ const unsigned char asc2_1608[95][16]={
{0x00,0x00,0x40,0x02,0x40,0x02,0x3E,0xFC,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"}",93*/
{0x00,0x00,0x60,0x00,0x80,0x00,0x80,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x20,0x00},/*"~",94*/
};
/*
打点函数
打点类型
dot_type=0 清除点
=1 打点
=2 取反点
*/
void OLED_set_dot(unsigned char x,unsigned char y,unsigned char dot_type)
{
if(x>=X_WIDTH||y>=Y_WIDTH)
{
return ;
}
uint8_t y1=y/8;
switch(dot_type)
{
case 0:
OLED_buff[y1][x] &= ~(1<<(y%8));
break;
case 1:
OLED_buff[y1][x] |= (1<<(y%8));
break;
case 2:
OLED_buff[y1][x] ^= (1<<(y%8));
break;
case 3:break;
}
}
/*
绘图函数
*/
void OLED_Pix(unsigned char x,unsigned char y,unsigned char w,unsigned char h,const char *p)
{
OLED_Set_Pos(0,0);
for(int a=0;a<36;a++)
{
OLED_WrDat(p[a]);
}
}
void OLED_ShowChar(unsigned char x,unsigned char y,unsigned char chr)
{
OLED_Set_Pos(x,y);