Signed-off-by: kevin <kevin@lmve.net>
This commit is contained in:
@@ -7,19 +7,34 @@
|
||||
#include "mymain.h"
|
||||
#include "hread_interface.h"
|
||||
|
||||
|
||||
const char testbmp[]=
|
||||
{
|
||||
0x00,0x00,0x00,0x00,0x16,0x1D,0x10,0x18,0x08,0x0C,0x06,0x07,0x02,0x03,0x02,0x02,
|
||||
0x06,0x05,0x05,0x0D,0x79,0x51,0xC1,0x73,0x1D,0x07,0x03,0x03,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x93,0xFF,0x2C,0x19,0x11,0x33,0x22,0x26,
|
||||
0x64,0x44,0x4C,0xC8,0xC8,0x58,0x90,0x11,0x90,0xB0,0x30,0x20,0x30,0x20,0x60,0xC0,
|
||||
0xE6,0x3F,0x1F,0x03,0x01,0x00,0x00,0x00,0x00,0x01,0x1F,0x7E,0xFF,0xC0,0x80,0x80,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0x00,0x00,0x00,
|
||||
0x00,0x20,0x30,0x70,0x51,0x7D,0x57,0xF1,0xE1,0x7B,0x0F,0x07,0x7B,0xE3,0x07,0xBF,
|
||||
0xFF,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
|
||||
0x03,0x03,0x63,0x43,0xC3,0xC3,0x8B,0x9F,0xBB,0x23,0xB3,0x23,0x63,0x43,0xC3,0x03
|
||||
};
|
||||
|
||||
|
||||
void mymain()
|
||||
{
|
||||
uint32_t run_tick=0;
|
||||
|
||||
OLED_Init();
|
||||
|
||||
|
||||
|
||||
|
||||
OLED_Pix(0,0,36,32,testbmp);
|
||||
while(1)
|
||||
{
|
||||
|
||||
|
||||
OLED_Cache_to_hardware();
|
||||
//OLED_Cache_to_hardware();
|
||||
if(HAL_GetTick()>run_tick)
|
||||
{
|
||||
run_tick+=500;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -21,6 +21,9 @@ void OLED_Init(void);
|
||||
|
||||
void OLED_Cache_to_hardware();
|
||||
|
||||
void OLED_set_dot(unsigned char x,unsigned char y,unsigned char dot_type);
|
||||
void OLED_Pix(unsigned char x,unsigned char y,unsigned char w,unsigned char h,const char *p);
|
||||
|
||||
void OLED_ShowStr(unsigned char x,unsigned char y,char *str);
|
||||
|
||||
#endif /* OLED_H_ */
|
||||
|
||||
Reference in New Issue
Block a user