UP 通用OLED

This commit is contained in:
JiXieShi
2024-06-22 16:41:48 +08:00
parent a1624f0682
commit c784f3ca96
3 changed files with 13 additions and 20 deletions

View File

@@ -3,40 +3,34 @@
#include "log.h"
#include "tool.h"
#include "t_oled.h"
#include <windows.h>
uint8_t Cmd(uint8_t *data, size_t l) {
void Cmd(uint8_t *data, size_t l) {
Buf_Print("Cmd", data, l, 16);
}
uint8_t Data(uint8_t *data, size_t l) {
void Data(uint8_t *data, size_t l) {
Buf_Print("Data", data, l, 16);
}
void Refresh_Call(OLED_T *dev) {
LOGT("OLED", "CALL");
Buf_Print("Buf", dev->buf, dev->width * (dev->height / 8), 16);
BufPrint("Buf", dev->buf, T_U8, dev->width * (dev->height / 8), 16);
}
uint8_t oledbuf[8][128];
uint8_t oledbuf[8][128] = {0};
void Test_OLED() {
OLED_T oled = {
.height=64,
.height=(uint8_t) 64,
.width=128,
.state=IDLE,
.buf=oledbuf,
.call=Refresh_Call,
.cmd=Cmd,
.data=Data
.data=Data,
.call=Refresh_Call,
};
OLED_Init(&oled);
Sleep(150);
OLED_CLS(&oled);
OLED_ShowString(&oled, 0, 0, "sss", 4);
while (1) {
// 每5ms调用一次key_ticks函数
OLED_Refresh(&oled);
Sleep(5); // 使用Windows平台的Sleep函数进行5ms延时
}
OLED_ShowString(&oled, 0, 0, "Hello", 12);
OLED_Refresh(&oled);
}