/*
程序: ESP32 OLED 使用 U8G2库
使用FREERTOS
公众号:孤独的二进制
*/
#include <U8g2lib.h>
#include <Wire.h>
#include "badApple.h"
void oledTask(void * pvParam) {
static uint8_t index = 0;
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
u8g2.setBusClock(400000);
u8g2.begin();
Serial.println(xTaskGetTickCount());
// u8g2.clearBuffer(); // clear the internal memory
// u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
// u8g2.drawStr(15, 10, "LONELY BINARY"); // write something to the internal memory
u8g2.drawXBMP(0, 0, 128, 64, epd_bitmap_allArray[index++]);
Serial.println(xTaskGetTickCount());
u8g2.sendBuffer(); // transfer internal memory to the display
Serial.println(xTaskGetTickCount());
if (index == 7) index = 0;
while (1) {
vTaskDelay(3);
}
}
void setup() { //loopBack , Priority 1, Core 1
Serial.begin(115200);
xTaskCreatePinnedToCore(oledTask, "OLED Task", 1024 * 6, NULL, 1, NULL, 1);
vTaskDelete(NULL);
}
void loop() {
}