Прошло 2 года.
This commit is contained in:
3
lib/epdiy/examples/dragon/main/CMakeLists.txt
Normal file
3
lib/epdiy/examples/dragon/main/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
set(app_sources "main.c")
|
||||
|
||||
idf_component_register(SRCS ${app_sources} REQUIRES epdiy)
|
||||
30942
lib/epdiy/examples/dragon/main/dragon.h
Normal file
30942
lib/epdiy/examples/dragon/main/dragon.h
Normal file
File diff suppressed because it is too large
Load Diff
50
lib/epdiy/examples/dragon/main/main.c
Normal file
50
lib/epdiy/examples/dragon/main/main.c
Normal file
@@ -0,0 +1,50 @@
|
||||
/* Simple firmware for a ESP32 displaying a static image on an EPaper Screen */
|
||||
|
||||
#include "esp_heap_caps.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
#include "dragon.h"
|
||||
#include "epd_highlevel.h"
|
||||
#include "epdiy.h"
|
||||
|
||||
EpdiyHighlevelState hl;
|
||||
|
||||
// choose the default demo board depending on the architecture
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#define DEMO_BOARD epd_board_v6
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
#define DEMO_BOARD epd_board_v7
|
||||
#endif
|
||||
|
||||
void idf_loop() {
|
||||
EpdRect dragon_area = { .x = 0, .y = 0, .width = dragon_width, .height = dragon_height };
|
||||
|
||||
int temperature = 25;
|
||||
|
||||
epd_poweron();
|
||||
epd_fullclear(&hl, temperature);
|
||||
|
||||
epd_copy_to_framebuffer(dragon_area, dragon_data, epd_hl_get_framebuffer(&hl));
|
||||
|
||||
enum EpdDrawError _err = epd_hl_update_screen(&hl, MODE_GC16, temperature);
|
||||
epd_poweroff();
|
||||
|
||||
vTaskDelay(1000);
|
||||
}
|
||||
|
||||
void idf_setup() {
|
||||
epd_init(&DEMO_BOARD, &ED097TC2, EPD_LUT_64K);
|
||||
epd_set_vcom(1560);
|
||||
hl = epd_hl_init(EPD_BUILTIN_WAVEFORM);
|
||||
}
|
||||
|
||||
#ifndef ARDUINO_ARCH_ESP32
|
||||
void app_main() {
|
||||
idf_setup();
|
||||
|
||||
while (1) {
|
||||
idf_loop();
|
||||
};
|
||||
}
|
||||
#endif
|
||||
30
lib/epdiy/examples/dragon/main/main.ino
Normal file
30
lib/epdiy/examples/dragon/main/main.ino
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* This is the Arduino wrapper for the "Demo" example.
|
||||
* Please go to the main.c for the main example file.
|
||||
*
|
||||
* This example was developed for the ESP IoT Development Framework (IDF).
|
||||
* You can still use this code in the Arduino IDE, but it may not look
|
||||
* and feel like a classic Arduino sketch.
|
||||
* If you are looking for an example with Arduino look-and-feel,
|
||||
* please check the other examples.
|
||||
*/
|
||||
|
||||
// Important: These are C functions, so they must be declared with C linkage!
|
||||
extern "C" {
|
||||
void idf_setup();
|
||||
void idf_loop();
|
||||
}
|
||||
|
||||
void setup() {
|
||||
if (psramInit()) {
|
||||
Serial.println("\nThe PSRAM is correctly initialized");
|
||||
} else {
|
||||
Serial.println("\nPSRAM does not work");
|
||||
}
|
||||
|
||||
idf_setup();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
idf_loop();
|
||||
}
|
||||
Reference in New Issue
Block a user