oled显示汉字字体 形状 使用

news2025/2/23 18:25:41

oled模块的工作原理

在这里插入图片描述
oled的上方四个接口是IIC总线 通过IIC总线可以进行数据的传输 在OLED模块背后有一个芯片叫做SSD1306 这个芯片内部有1024个字节的RAM 对应到右边的小屏幕上就有1024个字节 一个字节八个bit位 每一个bit位就对应着一个小点 我们只需要往oled的RAM上写入数据就可以显示对应的字符和图片

OLED驱动简介

在这里插入图片描述
在单片机内部开一块buffer 也是1024kb的对应着oled屏幕 相当于一块画布 然后可以调用pal库的接口对oled画线等图案

OLED初始化

在这里插入图片描述
在这里插入图片描述
初始化屏幕就是 oled屏幕内部有一个芯片 芯片有一个SA0引脚 如果接地就为0 如果接高电平就为1
SA0接地为0 从机地址为0111100 接高电平就为0111101 我们的oled芯片是接地的所以SA0传入的值为RESET (0)

#include "stm32f10x.h"
#include "stm32f10x_pal.h"
#include "stm32f10x_pal_i2c.h"
#include "stm32f10x_pal_oled.h"


static PalI2C_HandleTypeDef hi2c1;
static PalOled_HandleTypeDef holed;

int main(void)
{
	PAL_Init();
	//初始化iic
	hi2c1.Init.I2Cx = I2C1;
	hi2c1.Init.I2C_ClockSpeed = 400000;
	hi2c1.Init.I2C_DutyCycle = I2C_DutyCycle_2;
	PAL_I2C_Init(&hi2c1);
	
	//初始化oled屏幕
	holed.Init.hi2c = &hi2c1;
	holed.Init.SA0 = RESET;
	PAL_OLED_Init(&holed);
	
	
	
	
	
	while(1)
	{
	}
}

绘制基本形状

在这里插入图片描述
在X和Y的方向上移动光标 就是X和Y坐标同时变化
画笔和画刷
在这里插入图片描述
如要画123和一个苹果 就是先画一个矩形 画笔和画刷都设置为白色就得到一个蓝色背景的矩形
然后绘画数字123 就是用黑色的画笔 透明的画刷 (这样就不会挡住后面的背景色了) 绘画苹果也是设置黑色画笔 透明画刷
画点
在这里插入图片描述

#include "stm32f10x.h"
#include "stm32f10x_pal.h"
#include "stm32f10x_pal_i2c.h"
#include "stm32f10x_pal_oled.h"


static PalI2C_HandleTypeDef hi2c1;
static PalOled_HandleTypeDef holed;

int main(void)
{
	PAL_Init(); 
	//初始化iic
	hi2c1.Init.I2Cx = I2C1;
	hi2c1.Init.I2C_ClockSpeed = 400000;
	hi2c1.Init.I2C_DutyCycle = I2C_DutyCycle_2;
	PAL_I2C_Init(&hi2c1);
	
	//初始化oled屏幕
	holed.Init.hi2c = &hi2c1;
	holed.Init.SA0 = RESET;
	PAL_OLED_Init(&holed);
	
	
	PAL_OLED_Clear(&holed);
	PAL_OLED_SetPen(&holed,OLED_COLOR_WHITE,3);
	PAL_OLED_SetCursor(&holed,29,32);
	PAL_OLED_DrawDot(&holed);
	uint32_t i;
	
	for(i=1;i<8;i++)
	{
		PAL_OLED_MoveCursorX(&holed,10);
		PAL_OLED_DrawDot(&holed);
	}
	
	 PAL_OLED_SendBuffer(&holed);
	
	
	while(1)
	{
	}
}

画线
在这里插入图片描述

#include "stm32f10x.h"
#include "stm32f10x_pal.h"
#include "stm32f10x_pal_i2c.h"
#include "stm32f10x_pal_oled.h"


static PalI2C_HandleTypeDef hi2c1;
static PalOled_HandleTypeDef holed;

int main(void)
{
	PAL_Init(); 
	//初始化iic
	hi2c1.Init.I2Cx = I2C1;
	hi2c1.Init.I2C_ClockSpeed = 400000;
	hi2c1.Init.I2C_DutyCycle = I2C_DutyCycle_2;
	PAL_I2C_Init(&hi2c1);
	
	//初始化oled屏幕
	holed.Init.hi2c = &hi2c1;
	holed.Init.SA0 = RESET;
	PAL_OLED_Init(&holed);
	
	
//	PAL_OLED_Clear(&holed);
//	PAL_OLED_SetPen(&holed,OLED_COLOR_WHITE,3);
//	PAL_OLED_SetCursor(&holed,29,32);
//	PAL_OLED_DrawDot(&holed);
//	uint32_t i;
//	
//	for(i=1;i<8;i++)
//	{
//		PAL_OLED_MoveCursorX(&holed,10);
//		PAL_OLED_DrawDot(&holed);
//	}
//	
//	 PAL_OLED_SendBuffer(&holed);

		PAL_OLED_Clear(&holed);
		
		PAL_OLED_SetCursor(&holed,17,20);
		
		PAL_OLED_SetPen(&holed,OLED_COLOR_WHITE,1);
		PAL_OLED_DrawLine(&holed,PAL_OLED_GetCursorX(&holed) + 45,PAL_OLED_GetCursorY(&holed));
		
		PAL_OLED_MoveCursorY(&holed,8);
		PAL_OLED_SetPen(&holed,OLED_COLOR_WHITE,2);
		PAL_OLED_DrawLine(&holed,PAL_OLED_GetCursorX(&holed) + 45,PAL_OLED_GetCursorY(&holed));
		
		PAL_OLED_MoveCursorY(&holed,8);
		PAL_OLED_SetPen(&holed,OLED_COLOR_WHITE,3);
		PAL_OLED_DrawLine(&holed,PAL_OLED_GetCursorX(&holed) + 45,PAL_OLED_GetCursorY(&holed));
		
		PAL_OLED_MoveCursorY(&holed,8);
		PAL_OLED_SetPen(&holed,OLED_COLOR_WHITE,4);
		PAL_OLED_DrawLine(&holed,PAL_OLED_GetCursorX(&holed) + 45,PAL_OLED_GetCursorY(&holed));
		
		PAL_OLED_SendBuffer(&holed);
	while(1)
	{
	}
}
#include "stm32f10x.h"
#include "stm32f10x_pal.h"
#include "stm32f10x_pal_i2c.h"
#include "stm32f10x_pal_oled.h"


static PalI2C_HandleTypeDef hi2c1;
static PalOled_HandleTypeDef holed;

int main(void)
{
	PAL_Init(); 
	//初始化iic
	hi2c1.Init.I2Cx = I2C1;
	hi2c1.Init.I2C_ClockSpeed = 400000;
	hi2c1.Init.I2C_DutyCycle = I2C_DutyCycle_2;
	PAL_I2C_Init(&hi2c1);
	
	//初始化oled屏幕
	holed.Init.hi2c = &hi2c1;
	holed.Init.SA0 = RESET;
	PAL_OLED_Init(&holed);
	
	
//	PAL_OLED_Clear(&holed);
//	PAL_OLED_SetPen(&holed,OLED_COLOR_WHITE,3);
//	PAL_OLED_SetCursor(&holed,29,32);
//	PAL_OLED_DrawDot(&holed);
//	uint32_t i;
//	
//	for(i=1;i<8;i++)
//	{
//		PAL_OLED_MoveCursorX(&holed,10);
//		PAL_OLED_DrawDot(&holed);
//	}
//	
//	 PAL_OLED_SendBuffer(&holed);

		PAL_OLED_Clear(&holed);
		
		PAL_OLED_SetCursor(&holed,17,20);
		
		PAL_OLED_SetPen(&holed,OLED_COLOR_WHITE,1);
		PAL_OLED_DrawLine(&holed,PAL_OLED_GetCursorX(&holed) + 45,PAL_OLED_GetCursorY(&holed));
		
		PAL_OLED_MoveCursorY(&holed,8);
		PAL_OLED_SetPen(&holed,OLED_COLOR_WHITE,2);
		PAL_OLED_DrawLine(&holed,PAL_OLED_GetCursorX(&holed) + 45,PAL_OLED_GetCursorY(&holed));
		
		PAL_OLED_MoveCursorY(&holed,8);
		PAL_OLED_SetPen(&holed,OLED_COLOR_WHITE,3);
		PAL_OLED_DrawLine(&holed,PAL_OLED_GetCursorX(&holed) + 45,PAL_OLED_GetCursorY(&holed));
		
		PAL_OLED_MoveCursorY(&holed,8);
		PAL_OLED_SetPen(&holed,OLED_COLOR_WHITE,4);
		PAL_OLED_DrawLine(&holed,PAL_OLED_GetCursorX(&holed) + 45,PAL_OLED_GetCursorY(&holed));
		
		
		
		PAL_OLED_SetPen(&holed,OLED_COLOR_WHITE,1);
		
		PAL_OLED_SetCursor(&holed,91,10);
		PAL_OLED_LineTo(&holed,87,24);
		PAL_OLED_LineTo(&holed,72,24);
		PAL_OLED_LineTo(&holed,84,33);
		PAL_OLED_LineTo(&holed,80,48);
		PAL_OLED_LineTo(&holed,91,38);
		PAL_OLED_LineTo(&holed,101,48);
		PAL_OLED_LineTo(&holed,97,33);
		PAL_OLED_LineTo(&holed,110,24);
		PAL_OLED_LineTo(&holed,95,24);
		PAL_OLED_LineTo(&holed,91,10);
		
		PAL_OLED_SendBuffer(&holed);
	while(1)
	{
	}
}

画矩形和画圆

#include "stm32f10x.h"
#include "stm32f10x_pal.h"
#include "stm32f10x_pal_i2c.h"
#include "stm32f10x_pal_oled.h"


static PalI2C_HandleTypeDef hi2c1;
static PalOled_HandleTypeDef holed;

int main(void)
{
	PAL_Init(); 
	//初始化iic
	hi2c1.Init.I2Cx = I2C1;
	hi2c1.Init.I2C_ClockSpeed = 400000;
	hi2c1.Init.I2C_DutyCycle = I2C_DutyCycle_2;
	PAL_I2C_Init(&hi2c1);
	
	//初始化oled屏幕
	holed.Init.hi2c = &hi2c1;
	holed.Init.SA0 = RESET;
	PAL_OLED_Init(&holed);
	
	
	PAL_OLED_Clear(&holed);
	
	PAL_OLED_SetCursor(&holed,0,0);
	PAL_OLED_SetPen(&holed,OLED_COLOR_WHITE ,1);
	PAL_OLED_SetBrush(&holed,BRUSH_WHITE);//设置背景颜色
	PAL_OLED_DrawRect(&holed,PAL_OLED_GetScreenWidth(&holed),PAL_OLED_GetScreenHeight(&holed));
	
	
	PAL_OLED_SetPen(&holed,OLED_COLOR_BLACK ,1);
	PAL_OLED_SetBrush(&holed,BRUSH_TRANSPARENT);
	PAL_OLED_SetCursor(&holed,20,20);
	PAL_OLED_DrawRect(&holed,40,20);
	
	
	PAL_OLED_SetPen(&holed,OLED_COLOR_TRANSPARENT ,1);
	PAL_OLED_SetBrush(&holed,BRUSH_BLACK);
	PAL_OLED_SetCursor(&holed,70,20);
	PAL_OLED_DrawRect(&holed,40,20);  
	
	
	PAL_OLED_SetPen(&holed,OLED_COLOR_TRANSPARENT ,1);
	PAL_OLED_SetBrush(&holed,BRUSH_BLACK);
	PAL_OLED_SetCursor(&holed,65,30);
	PAL_OLED_DrawCircle(&holed,5);
	PAL_OLED_SendBuffer(&holed);

		
		
		
	while(1)
	{
	}
}

显示文字

基本字符的显示
在这里插入图片描述

		PAL_OLED_Clear(&holed);
		PAL_OLED_SetCursor(&holed,5,20);
		PAL_OLED_SetPen(&holed,OLED_COLOR_WHITE ,1);
		PAL_OLED_SetBrush(&holed,BRUSH_TRANSPARENT); 
		PAL_OLED_DrawString(&holed,"Hello World");
		
		
		PAL_OLED_SetCursor(&holed,5,30);
		PAL_OLED_Printf(&holed,"Today is %02d/%02d/%02d",23,12,26);
		PAL_OLED_SendBuffer(&holed);

文本框功能

在这里插入图片描述
在这里插入图片描述
改变字体
在这里插入图片描述
1.
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
复制粘贴到front文件夹
在这里插入图片描述

调出命令行
在这里插入图片描述
![!](https://img-blog.csdnimg.cn/direct/99a9651da639450bb049205d66a97820.png)
输入字体的文件名 在font后面输入完整的文件名(对应字体的文件名)按回车
生成一个头文件
在这里插入图片描述
引用头文件
在这里插入图片描述

#include "stm32f10x.h"
#include "stm32f10x_pal.h"
#include "stm32f10x_pal_i2c.h"
#include "stm32f10x_pal_oled.h"
#include "_freetype_stliti_medium_r_normal__28_200_100_100_p_230_iso10646_1.h"


static PalI2C_HandleTypeDef hi2c1;
static PalOled_HandleTypeDef holed;

int main(void)
{
			 PAL_Init(); 
				//初始化iic 
			 hi2c1.Init.I2Cx = I2C1;
			 hi2c1.Init.I2C_ClockSpeed = 400000;
			 hi2c1.Init.I2C_DutyCycle = I2C_DutyCycle_2;
			 PAL_I2C_Init(&hi2c1);
				
				//初始化oled屏幕
			 holed.Init.hi2c = &hi2c1;
			 holed.Init.SA0 = RESET;
			 PAL_OLED_Init(&holed);
		
			
			 PAL_OLED_Clear(&holed);
			 PAL_OLED_SetFont(&holed,&_freetype_stliti_medium_r_normal__28_200_100_100_p_230_iso10646_1);
			 PAL_OLED_SetCursor(&holed,(PAL_OLED_GetScreenWidth(&holed) - PAL_OLED_GetStrWidth(&holed,"不吃牛肉")) /2,40);
			 PAL_OLED_DrawString(&holed,"不吃牛肉");
		
			 PAL_OLED_SetFont(&holed,&default_font);
			 PAL_OLED_SetCursor(&holed,(PAL_OLED_GetScreenWidth(&holed) - PAL_OLED_GetStrWidth(&holed,"Hello World"))/2,60);
			
			 PAL_OLED_DrawString(&holed,"Hello World");
			 PAL_OLED_SendBuffer(&holed);
			 
		
	while(1)
	{
	}
}

显示图像

在这里插入图片描述

进入网站 把图片转化为二进制 就可以输出图片
https://javl.github.io/image2cpp/ (网站地址)
选择图片
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
声明一个数组用来缓存二进制

#include "stm32f10x.h"
#include "stm32f10x_pal.h"
#include "stm32f10x_pal_i2c.h"
#include "stm32f10x_pal_oled.h"


static PalI2C_HandleTypeDef hi2c1;
static PalOled_HandleTypeDef holed;

static  const uint8_t image[] = {// 'huaqiang', 128x64px
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xf3, 0xff, 0xff, 0xf8, 0x9f, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xe5, 0xff, 0xff, 0xf8, 0x1f, 0x9f, 0xf0, 0x7f, 0xff, 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 
0xf1, 0xff, 0xff, 0xfc, 0x1f, 0xff, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xc0, 
0xe0, 0x3f, 0xff, 0xf8, 0x3f, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x3d, 0xff, 0xe2, 0x81, 
0x08, 0x0f, 0xff, 0xe0, 0x03, 0xff, 0xfd, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xf3, 0xc6, 0xc0, 
0x00, 0x0f, 0xff, 0x80, 0x00, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xe7, 0x83, 0xc2, 
0x00, 0x0f, 0xfe, 0x00, 0x00, 0x3f, 0xf1, 0xdf, 0xff, 0xff, 0xff, 0xff, 0x17, 0xcf, 0xab, 0xf0, 
0x00, 0x07, 0x0c, 0x00, 0x10, 0x3f, 0xd0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x27, 0xcf, 0xdf, 0xf7, 
0x00, 0x07, 0x04, 0x00, 0x00, 0x1c, 0x20, 0xb7, 0xff, 0xff, 0xff, 0xfe, 0x0f, 0x9f, 0xbf, 0xfe, 
0x00, 0x07, 0xc0, 0x00, 0x00, 0x10, 0x00, 0x11, 0xff, 0xff, 0xff, 0xfc, 0x4f, 0x1e, 0x3f, 0xff, 
0x00, 0x07, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x11, 0xff, 0xff, 0xff, 0xfc, 0x9f, 0x3a, 0x2f, 0xfb, 
0x00, 0x07, 0xf0, 0x00, 0x00, 0x02, 0x00, 0x01, 0xff, 0xff, 0xff, 0xec, 0x1e, 0x78, 0x0f, 0xfd, 
0x80, 0x0f, 0xf0, 0x00, 0x00, 0x02, 0x00, 0x07, 0xff, 0xff, 0xff, 0xfd, 0x36, 0x7c, 0x03, 0x7f, 
0x84, 0x0f, 0xe0, 0x1f, 0xe0, 0x04, 0x0e, 0x07, 0xff, 0xff, 0xff, 0xfa, 0x3c, 0xf0, 0x03, 0xff, 
0x84, 0x0f, 0xec, 0x90, 0x3c, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf2, 0x7c, 0xe4, 0x2b, 0xff, 
0x00, 0x07, 0xfc, 0x04, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, 0x5c, 0xc4, 0x23, 0xff, 
0x00, 0x07, 0xc0, 0xf8, 0x00, 0x71, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xf4, 0xff, 0xac, 0x14, 0x5f, 
0x00, 0x07, 0xd0, 0x07, 0xf2, 0x06, 0x00, 0x0f, 0x03, 0x0f, 0xff, 0xac, 0x00, 0x14, 0x45, 0xff, 
0xc0, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x0f, 0xff, 0xff, 0xc8, 0x00, 0x54, 0x0c, 0x00, 
0xc0, 0x00, 0xfe, 0x01, 0x00, 0x38, 0x00, 0x1f, 0xff, 0xff, 0xff, 0x70, 0x00, 0x50, 0x00, 0x00, 
0x30, 0x03, 0xe0, 0x00, 0x00, 0xf8, 0x00, 0x1f, 0xff, 0xff, 0xfe, 0x7e, 0x00, 0x32, 0x3f, 0x7c, 
0x00, 0x02, 0x38, 0x00, 0x00, 0x3e, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0x80, 0x03, 0xff, 0xf8, 
0x00, 0x07, 0xf8, 0x9f, 0xd0, 0x3e, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x43, 0xf8, 0x03, 0xff, 0xe7, 
0x80, 0x07, 0xf0, 0x1f, 0xf2, 0x04, 0xff, 0xf7, 0xff, 0xff, 0xfc, 0x20, 0xff, 0xc3, 0xff, 0x8f, 
0x40, 0x07, 0xf0, 0xbf, 0xcc, 0x1c, 0xfd, 0xf1, 0xff, 0xff, 0xfd, 0x40, 0x00, 0xe0, 0xff, 0xff, 
0x40, 0x07, 0xf1, 0x0f, 0xc6, 0x1c, 0xff, 0xd1, 0xff, 0xff, 0xfd, 0xa0, 0x40, 0x50, 0x79, 0xff, 
0x40, 0x07, 0xf9, 0x3f, 0xe4, 0x1c, 0xe0, 0x17, 0xff, 0xff, 0xff, 0xf8, 0x01, 0xf0, 0x3f, 0xff, 
0x40, 0x07, 0xf9, 0x3f, 0xe6, 0x3c, 0x87, 0x07, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x0f, 0xff, 
0x58, 0x07, 0xfa, 0x90, 0x66, 0x38, 0x0f, 0x83, 0xdf, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x03, 0xff, 
0x48, 0x07, 0xfb, 0x90, 0x06, 0x38, 0x07, 0xc3, 0xbf, 0xff, 0xfe, 0x91, 0xc6, 0x00, 0xbd, 0xff, 
0x3c, 0x07, 0xfb, 0x94, 0x06, 0x78, 0x07, 0x83, 0x7f, 0xff, 0xfc, 0x00, 0x3f, 0x00, 0x38, 0x7e, 
0xbc, 0x07, 0xff, 0xc2, 0x8e, 0x7c, 0x07, 0xc7, 0xff, 0xff, 0xf8, 0x10, 0x03, 0x00, 0x30, 0x43, 
0x3c, 0x07, 0xfd, 0xc0, 0x16, 0x3c, 0x00, 0x01, 0xff, 0xff, 0xf8, 0x18, 0x00, 0x25, 0x40, 0x04, 
0x7c, 0x07, 0xf8, 0x60, 0x08, 0x3c, 0x00, 0x00, 0x7f, 0xff, 0xfc, 0x18, 0x00, 0x02, 0x10, 0x18, 
0x7e, 0x07, 0xfc, 0x3f, 0x80, 0x78, 0x08, 0x0f, 0xff, 0xff, 0xfc, 0x02, 0x00, 0x00, 0x10, 0x7b, 
0xfe, 0x1f, 0xfc, 0x00, 0x00, 0x7f, 0x00, 0x1f, 0xff, 0xff, 0xfc, 0x00, 0x40, 0x00, 0x00, 0xfb, 
0xfc, 0x0f, 0xfc, 0x00, 0x01, 0xff, 0x80, 0x3f, 0xff, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x00, 0xfb, 
0xff, 0xff, 0xf8, 0x00, 0x01, 0xff, 0xc0, 0x7f, 0xff, 0xff, 0xfc, 0x00, 0x01, 0x80, 0x00, 0xfb, 
0xff, 0xff, 0xf8, 0x00, 0x02, 0x7f, 0xe4, 0x7f, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0xfb, 
0xff, 0xff, 0xf8, 0x00, 0x00, 0x7f, 0xc0, 0x7f, 0xff, 0xff, 0xfe, 0x40, 0x00, 0x00, 0xe0, 0x00, 
0xff, 0xff, 0xfc, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x40, 0x00, 0x00, 0x07, 0xe0, 
0xff, 0xff, 0xfc, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x40, 0x00, 0x00, 0x00, 0x00, 
0xff, 0xff, 0xfc, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x40, 0x00, 0x00, 0x00, 0x00, 
0xff, 0xff, 0xfe, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x40, 0x00, 0x00, 0x00, 0x00, 
0xff, 0xff, 0xff, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x40, 0x00, 0x01, 0x00, 0x00, 
0xff, 0xff, 0xff, 0x80, 0x0b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x40, 0x00, 0x01, 0x80, 0x00, 
0xff, 0xff, 0xff, 0xe0, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x60, 0x00, 0x01, 0x00, 0x00, 
0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xe0, 0x00, 0x01, 0x00, 0x00, 
0xff, 0xff, 0xff, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xfe, 0xc0, 0x00, 0x01, 0x00, 0x00, 
0xff, 0xff, 0xc0, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xc0, 0x00, 0x01, 0x80, 0x00, 
0xff, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x0c, 0x01, 0x80, 0x00, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x40, 0x0f, 0x81, 0x80, 0x00, 
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x40, 0x0f, 0xe1, 0x80, 0x00};
static PalI2C_HandleTypeDef hi2c1;
static PalOled_HandleTypeDef holed;

int main(void)
{
			 PAL_Init(); 
				//初始化iic 
			 hi2c1.Init.I2Cx = I2C1;
			 hi2c1.Init.I2C_ClockSpeed = 400000;
			 hi2c1.Init.I2C_DutyCycle = I2C_DutyCycle_2;
			 PAL_I2C_Init(&hi2c1);
				
				//初始化oled屏幕
			 holed.Init.hi2c = &hi2c1;
			 holed.Init.SA0 = RESET;
			 PAL_OLED_Init(&holed);
		//生成图片
			PAL_OLED_Clear(&holed);
			PAL_OLED_SetPen(&holed,PEN_COLOR_WHITE,1);
			PAL_OLED_SetBrush(&holed,BRUSH_BLACK);
			PAL_OLED_SetCursor(&holed,0,0);
			PAL_OLED_DrawBitmap(&holed,128,64,image);
			
			PAL_OLED_SendBuffer(&holed);
			 
		
	while(1)
	{
	}
}

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1341068.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

TPRI-DMP平台介绍

TPRI-DMP平台介绍 TPRI-DMP平台概述 TPRI-DMP为华能集团西安热工院自主产权的工业云PaaS平台&#xff0c;已经过13年的发展和迭代&#xff0c;其具备大规模能源电力行业生产应用软件开发和运行能力。提供TPRI-DMP平台主数据管理、业务系统开发与运行、应用资源管理与运维监控…

新能源光伏行业CRM:推动绿色能源发展与高效客户管理的双重突破

随着“碳中和”计划以及传统能源价格的不断飙升&#xff0c;我国新能源光伏产业在国家“双碳”战略目标和市场需求的双重驱动下高歌猛进&#xff0c;中国光伏产业新增装机量、累计装机量连续多年位居全球首位。CRM在光伏产业中的作用也日益突出。下面为您介绍新能源光伏行业的C…

UDP单播

CMakeLists.txt文件中添加如下行&#xff1a; link_libraries(ws2_32) 1.发送端 #include <iostream> #include <winsock2.h> #include <cstdio>#pragma comment(lib, "Ws2_32.lib") // Link with ws2_32.libint main() {1.Initialize winsock…

Redis中RDB和AOF

Redis中RDB和AOF 定时间间隔执行数据集的时间快照&#xff0c;把某一时刻数据和妆容以文件的形式写到磁盘上&#xff0c;也就是快照。 配置文件 如果是普通安装方式可以跳过&#xff0c;如果是docker安装&#xff0c;需要到官网下载redis.conf配置文件到本地&#xff0c;地址…

配置IPv6静态路由示例

1、静态路由简介 静态路由是一种需要管理员手工配置的特殊路由。 静态路由在不同网络环境中有不同的目的&#xff1a; 当网络结构比较简单时&#xff0c;只需配置静态路由就可以使网络正常工作。 在复杂网络环境中&#xff0c;配置静态路由可以改进网络的性能&#xff0c;并…

嵌入式开发——ADC模拟信号和数字信号

模拟信号和数字信号 模拟信号 自然界中大多数物理量是连续变化的,比如温度、声音、压力等灯,它们在一定时间内,可以有无限多个不同的取值,这些信号就是模拟信号。模拟信号就是指用连续变化的物理量所表示的信号。 自然界中的物理量都需要通过传感器将其转换成电信号后,才能进…

锐捷路由小型综合实验

一、实验拓扑 二、实验目的 1、熟练掌握ospf的配置 2、熟练掌握RIP的配置 3、熟练掌握静态路由的配置 4、熟练掌握各种路由协议之间的引入 5、熟练掌握telnet和ssh的配置 三、实验配置 R1 //配置telent username admin password admin123 enable password admin123 enable…

java设计模式学习之【迭代器模式】

文章目录 引言迭代器模式简介定义与用途实现方式 使用场景优势与劣势在Spring框架中的应用迭代器示例代码地址 引言 想象一下&#xff0c;你在一个书店里浏览各种书籍。你可能会从头到尾查看每一本书&#xff0c;或者可能跳过一些不感兴趣的部分。在这个过程中&#xff0c;你实…

Yapi接口管理平台Centos7部署

文章目录 1.环境准备1.1 关闭透明大页THP1.2 设置最大文件打开数最大进程数 2.Nodejs安装3.安装Mongodb3.1 下载安装3.2 配置3.3 配置环境变量3.4 启动3.5 关闭 4.安装YAPI4.1 离线安装4.2 页面安装&#xff08;本次采用&#xff09;4.3 访问 1.环境准备 1.1 关闭透明大页THP …

c语言:输出范围内的质数|练习题

一、题目 输入一个数n&#xff0c;输出n之内的所有质数 如图&#xff1a; 二、思路分析 1、设置一个数num&#xff0c;从2开始&#xff0c;不断作1操作&#xff0c;作为被除数 2、用一个不断自1的数&#xff0c;除以num&#xff0c;如果num不能被整除&#xff0c;则为质数 3、例…

Google Ad帐号被封?这几个关键点看好

海外广告投放工作中&#xff0c;账号是非常重要的环节。与在Facebook上运行广告相比&#xff0c;运行Google Ads在代理选择方面通常没有那么严格&#xff0c;因为 Google 对 IP 使用并不那么严格。但是&#xff0c;这并不意味着您可以不加考虑地使用任何代理IP。在本文中&#…

MySQL事务、四大原则、执行步骤、四种隔离级别、锁、脏读、脏写等

MySQL事务 MySQL事务1.什么是事务&#xff1f;2.事务的四大原则3.事务执行的步骤4、事务的隔离性5、MySQL中的锁 MySQL事务 模拟一个转账业务&#xff1a; 上图中的sql语句&#xff1a; update from table set money mongey - 100 where name A; update from table set mone…

【数据结构】插入排序、选择排序、冒泡排序、希尔排序、堆排序

前言&#xff1a;生活中我们总是会碰到各种各样的排序&#xff0c;今天我们就对部分常用的排序进行总结和学习&#xff0c;今天的内容还是相对比较简单的一部分&#xff0c;各位一起加油哦&#xff01; &#x1f496; 博主CSDN主页:卫卫卫的个人主页 &#x1f49e; &#x1f44…

Python经典游戏 唤醒你童年记忆

这些游戏你玩过几个&#xff1f; 1.贪吃蛇2.吃豆人3.加农炮4.四子棋5. Fly Bird<font color #f3704ab>6.记忆&#xff1a;数字对拼图游戏&#xff08;欢迎挑战&#xff01;用时&#xff1a;2min&#xff09;7.乒乓球8.上课划水必备-井字游戏&#xff08;我敢说100%的人都…

verilog rs232串口模块

前面发了个发送模块&#xff0c;这次补齐&#xff0c;完整。 串口计数器&#xff0c;波特率适配 uart_clk.v module uart_clk(input wire clk,input wire rst_n,input wire tx_clk_en,input wire rx_clk_en,input wire[1:0] baud_sel,output wire tx_clk,output wire rx_clk )…

spring、springmvc、springboot、springcloud简介

spring简介 spring是什么&#xff1f; spring: 春天spring: 轻量级的控制反转和面向切面编程的框架 历史 2002年&#xff0c;首次推出spring雏形&#xff0c;interface 21框架2004年&#xff0c;发布1.0版本Rod Johnson: 创始人&#xff0c;悉尼大学&#xff0c;音乐学博士…

什么是 NLP (自然语言处理)

NLP&#xff08;自然语言处理&#xff09;到底是做什么&#xff1f; NLP 的全称是 Natural Language Processing&#xff0c;翻译成中文称作&#xff1a;自然语言处理。它是计算机和人工智能的一个重要领域。顾名思义&#xff0c;该领域研究如何处理自然语言。 自然语言就是我…

企业如何购买腾讯云服务器?(详细指南)

腾讯云服务器购买流程直接在官方秒杀活动上购买比较划算&#xff0c;在云服务器CVM或轻量应用服务器页面自定义购买价格比较贵&#xff0c;但是自定义购买云服务器CPU内存带宽配置选择范围广&#xff0c;活动上购买只能选择固定的活动机&#xff0c;选择范围窄&#xff0c;但是…

如何本地部署Nextcloud结合cpolar搭建专属私有云盘远程访问(内网穿透)

文章目录 摘要1. 环境搭建2. 测试局域网访问3. 内网穿透3.1 ubuntu本地安装cpolar3.2 创建隧道3.3 测试公网访问 4 配置固定http公网地址4.1 保留一个二级子域名4.1 配置固定二级子域名4.3 测试访问公网固定二级子域名 摘要 Nextcloud,它是ownCloud的一个分支,是一个文件共享服…

前端基本性能指标及lighthouse使用

文章目录 1、基本指标介绍2、Performace分析2.1 performance属性2.2 使用performace计算2.3 Resource Timing API2.4 不重复的耗时时段区分2.5 其他组合分析2.6 JS 总加载耗时2.7 CSS 总加载耗时 3、lighthouse基本使用3.1 使用Chrome插件lighthouse3.2 使用Chrome浏览器开发者…