UP 增加OLED模拟器
This commit is contained in:
@@ -3,23 +3,27 @@
|
||||
#include "log.h"
|
||||
#include "tool.h"
|
||||
#include "t_oled.h"
|
||||
#include "sim_oled.h"
|
||||
#include <windows.h>
|
||||
|
||||
uint8_t Cmd(uint8_t *data, size_t l) {
|
||||
Buf_Print("Cmd", data, l, 16);
|
||||
}
|
||||
|
||||
uint8_t Data(uint8_t *data, size_t l) {
|
||||
Buf_Print("Data", data, l, 128);
|
||||
Buf_Print("Data", data, l, 16);
|
||||
}
|
||||
|
||||
void Refresh_Call(OLED_T *dev) {
|
||||
LOGT("OLED", "CALL");
|
||||
BufPrint("Buf", dev->buf, T_U8, dev->width * (dev->height / 8), 16);
|
||||
Buf_Print("Buf", dev->buf, dev->width * (dev->height / 8), 128);
|
||||
SIM_OLED_DrawFromBuffer(dev->buf, dev->width, dev->height / 8);
|
||||
}
|
||||
|
||||
uint8_t oledbuf[8][128] = {0};
|
||||
|
||||
void Test_OLED() {
|
||||
SIM_OLED_INIT(0xFFFFFF, 0x0, 10, true);
|
||||
OLED_T oled = {
|
||||
.height=64,
|
||||
.width=128,
|
||||
@@ -31,6 +35,17 @@ void Test_OLED() {
|
||||
};
|
||||
OLED_Init(&oled);
|
||||
OLED_CLS(&oled);
|
||||
OLED_ShowString(&oled, 0, 0, "Hello", 12);
|
||||
OLED_Refresh(&oled);
|
||||
OLED_DrawRect(&oled, 0, 0, 127, 63);
|
||||
OLED_ShowString(&oled, 12, 24, "Hello JXS", 16);
|
||||
SIM_OLED_START();
|
||||
int s = 0;
|
||||
char buf[30];
|
||||
while (s < 500) {
|
||||
sprintf(buf, "DATA:%d", s);
|
||||
OLED_ShowString(&oled, 2, 2, buf, 12);
|
||||
OLED_Refresh(&oled);
|
||||
s++;
|
||||
Sleep(500);
|
||||
}
|
||||
SIM_OLED_STOP();
|
||||
}
|
Reference in New Issue
Block a user