ESP32_Weather/main/app_main.c

51 lines
1.2 KiB
C
Raw Normal View History

2022-07-26 01:50:17 +00:00
/* Hello World Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>
#include "sdkconfig.h"
/* FreeRTOS */
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
/* IDF drivers */
#include "esp_spi_flash.h"
#include "esp_system.h"
/* EPD driver */
#include "epd_driver.h"
#include "epd_highlevel.h"
/* Fonts */
#include "firasans.h"
#include "image_1.h"
static EpdiyHighlevelState s_epd_hl;
void app_main(void) {
epd_init(EPD_LUT_1K);
s_epd_hl = epd_hl_init(EPD_BUILTIN_WAVEFORM);
// A reference to the framebuffer
uint8_t* fb = epd_hl_get_framebuffer(&s_epd_hl);
epd_hl_set_all_white(&s_epd_hl);
// draw image.
EpdRect some_rect = {.x = 0, .y = 0, .width = 960, .height = 540};
epd_copy_to_framebuffer(some_rect, image_1_data, fb);
// finally, update the display!
int temperature = 25;
epd_poweron();
epd_clear();
enum EpdDrawError err = epd_hl_update_screen(&s_epd_hl, MODE_GC16, temperature);
epd_poweroff();
}