2024-06-22 07:21:15 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "oled.h"
|
|
|
|
#include "log.h"
|
|
|
|
#include "tool.h"
|
|
|
|
#include "t_oled.h"
|
2024-06-22 11:13:18 +00:00
|
|
|
#include "sim_oled.h"
|
|
|
|
#include <windows.h>
|
2024-06-22 07:21:15 +00:00
|
|
|
|
2024-06-22 08:42:53 +00:00
|
|
|
uint8_t Cmd(uint8_t *data, size_t l) {
|
2024-06-22 07:21:15 +00:00
|
|
|
Buf_Print("Cmd", data, l, 16);
|
|
|
|
}
|
|
|
|
|
2024-06-22 08:42:53 +00:00
|
|
|
uint8_t Data(uint8_t *data, size_t l) {
|
2024-06-22 11:13:18 +00:00
|
|
|
Buf_Print("Data", data, l, 16);
|
2024-06-22 07:21:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Refresh_Call(OLED_T *dev) {
|
|
|
|
LOGT("OLED", "CALL");
|
2024-06-22 11:13:18 +00:00
|
|
|
Buf_Print("Buf", dev->buf, dev->width * (dev->height / 8), 128);
|
|
|
|
SIM_OLED_DrawFromBuffer(dev->buf, dev->width, dev->height / 8);
|
2024-06-22 07:21:15 +00:00
|
|
|
}
|
|
|
|
|
2024-06-22 08:41:48 +00:00
|
|
|
uint8_t oledbuf[8][128] = {0};
|
2024-06-22 07:21:15 +00:00
|
|
|
|
|
|
|
void Test_OLED() {
|
2024-06-22 12:48:59 +00:00
|
|
|
SIM_OLED_INIT(128, 64, CYAN, 0x0, 5, 0);
|
2024-06-22 07:21:15 +00:00
|
|
|
OLED_T oled = {
|
2024-06-22 08:42:53 +00:00
|
|
|
.height=64,
|
2024-06-22 07:21:15 +00:00
|
|
|
.width=128,
|
|
|
|
.state=IDLE,
|
|
|
|
.buf=oledbuf,
|
|
|
|
.cmd=Cmd,
|
2024-06-22 08:41:48 +00:00
|
|
|
.data=Data,
|
|
|
|
.call=Refresh_Call,
|
2024-06-22 07:21:15 +00:00
|
|
|
};
|
|
|
|
OLED_Init(&oled);
|
|
|
|
OLED_CLS(&oled);
|
2024-06-22 11:13:18 +00:00
|
|
|
OLED_DrawRect(&oled, 0, 0, 127, 63);
|
|
|
|
OLED_ShowString(&oled, 12, 24, "Hello JXS", 16);
|
|
|
|
SIM_OLED_START();
|
|
|
|
int s = 0;
|
|
|
|
char buf[30];
|
2024-06-22 12:48:59 +00:00
|
|
|
while (s < 10) {
|
2024-06-22 11:13:18 +00:00
|
|
|
sprintf(buf, "DATA:%d", s);
|
|
|
|
OLED_ShowString(&oled, 2, 2, buf, 12);
|
|
|
|
OLED_Refresh(&oled);
|
|
|
|
s++;
|
|
|
|
Sleep(500);
|
|
|
|
}
|
|
|
|
SIM_OLED_STOP();
|
2024-06-22 07:21:15 +00:00
|
|
|
}
|