initial ESP-IDF project

Signed-off-by: Peter Siegmund <peter@rdkr.com>
This commit is contained in:
Peter Siegmund
2024-05-29 23:03:43 +02:00
parent 2a98cb9367
commit 09037c6df0
68 changed files with 27746 additions and 88 deletions

View File

@@ -1,7 +1,47 @@
#include <esp_task_wdt.h>
#include <stdio.h>
#include "timber.h"
#include <string.h>
#include "epd_driver.h"
#include "staticmap.h"
#include "utilities.h"
uint8_t* framebuffer;
void setup(void) {
epd_init();
framebuffer =
(uint8_t*)heap_caps_malloc(EPD_WIDTH * EPD_HEIGHT / 2, MALLOC_CAP_SPIRAM);
if (!framebuffer) {
printf("alloc memory failed !!!");
while (1)
;
}
memset(framebuffer, 0xFF, EPD_WIDTH * EPD_HEIGHT / 2);
int32_t width = staticmap_width;
int32_t height = staticmap_height;
const uint8_t* data = staticmap_data;
Rect_t area = {
.x = EPD_WIDTH - width, .y = 0, .width = width, .height = height};
epd_poweron();
epd_clear();
// epd_draw_grayscale_image(area, (uint8_t*)data);
epd_draw_image(area, (uint8_t*)data, BLACK_ON_WHITE);
epd_poweroff();
}
void loop(void) {
vTaskDelay(pdMS_TO_TICKS(100));
}
extern "C" void app_main(void) {
Timber::plant(TreeESP32());
Timber::tag("ESP32Timber");
setup();
while (1) {
loop();
}
}