Skip to content

Commit

Permalink
move epd driver to own idf component
Browse files Browse the repository at this point in the history
  • Loading branch information
vroland committed Apr 21, 2020
1 parent 373b535 commit 5a1461f
Show file tree
Hide file tree
Showing 273 changed files with 77 additions and 971 deletions.
15 changes: 15 additions & 0 deletions software/firmware/components/epd_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
set(app_sources "epd_driver.c"
"ed097oc4.c"
"font.c"
"i2s_data_bus.c"
"rmt_pulse.c"
"epd_temperature.c")

idf_component_register(SRCS ${app_sources} INCLUDE_DIRS "include" REQUIRES esp_adc_cal)

option(BUILD_SHARED_LIBS OFF)
option(SKIP_INSTALL_ALL ON)

add_subdirectory(lib/zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib)

target_link_libraries(${COMPONENT_LIB} PUBLIC zlib)
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "EPD.h"
#include "epd_driver.h"
#include "ed097oc4.h"
#include "epd_temperature.h"

#include "esp_assert.h"
#include "esp_heap_caps.h"
Expand Down Expand Up @@ -35,6 +36,7 @@ void reorder_line_buffer(uint32_t *line_data);
void epd_init() {
skipping = 0;
epd_base_init(EPD_WIDTH);
epd_temperature_init();

conversion_lut = (uint8_t *)heap_caps_malloc(1 << 16, MALLOC_CAP_8BIT);
assert(conversion_lut != NULL);
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "font.h"

#include "EPD.h"
#include "epd_driver.h"
#include "esp_assert.h"
#include "esp_heap_caps.h"
#include "esp_log.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "i2s_data_bus.h"
#include "driver/periph_ctrl.h"
#include "esp_heap_caps.h"
#include "rom/lldesc.h"
#include "esp32/rom/lldesc.h"
#include "soc/i2s_reg.h"
#include "soc/i2s_struct.h"
#include "soc/rtc.h"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,55 @@ void epd_draw_hline(int x, int y, int length, uint8_t color,
*/
void epd_draw_vline(int x, int y, int length, uint8_t color,
uint8_t *framebuffer);

/**
* Get the current ambient temperature in °C.
*/
float epd_ambient_temperature();


/// Font data stored PER GLYPH
typedef struct {
uint8_t width; ///< Bitmap dimensions in pixels
uint8_t height; ///< Bitmap dimensions in pixels
uint8_t advance_x; ///< Distance to advance cursor (x axis)
int16_t left; ///< X dist from cursor pos to UL corner
int16_t top; ///< Y dist from cursor pos to UL corner
uint16_t compressed_size; ///< Size of the zlib-compressed font data.
uint32_t data_offset; ///< Pointer into GFXfont->bitmap
} GFXglyph;

/// Glyph interval structure
typedef struct {
uint32_t first; ///< The first unicode code point of the interval
uint32_t last; ///< The last unicode code point of the interval
uint32_t offset; ///< Index of the first code point into the glyph array
} UnicodeInterval;

/// Data stored for FONT AS A WHOLE
typedef struct {
uint8_t *bitmap; ///< Glyph bitmaps, concatenated
GFXglyph *glyph; ///< Glyph array
UnicodeInterval *intervals; ///< Valid unicode intervals for this font
uint32_t interval_count; ///< Number of unicode intervals.
uint8_t advance_y; ///< Newline distance (y axis)
} GFXfont;

/*!
* Get the text bounds for string, when drawn at (x, y).
*/
void get_text_bounds(GFXfont *font, char *string, int x, int y, int *x1,
int *y1, int *w, int *h);

/*!
* Write a line of text to the EPD.
*/
void writeln(GFXfont *font, char *string, int *cursor_x, int *cursor_y,
uint8_t *framebuffer);

/**
* Write a (multi-line) string to the EPD.
*/
void write_string(GFXfont *font, char *string, int *cursor_x, int *cursor_y,
uint8_t *framebuffer);

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 2 additions & 18 deletions software/firmware/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
#Warning !This code was automatically generated for projects
#without default 'CMakeLists.txt' file.
set(app_sources "main.c")

set(app_sources "EPD.c"
"ed097oc4.c"
"font.c"
"i2s_data_bus.c"
"main.c"
"rmt_pulse.c"
"epd_temperature.c")

idf_component_register(SRCS ${app_sources})

option(BUILD_SHARED_LIBS OFF)
option(SKIP_INSTALL_ALL ON)

add_subdirectory(lib/zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib)

target_link_libraries(${COMPONENT_LIB} PUBLIC zlib)
idf_component_register(SRCS ${app_sources} REQUIRES epd_driver)
2 changes: 1 addition & 1 deletion software/firmware/main/firasans.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "font.h"
#include "epd_driver.h"
const uint8_t FiraSansBitmaps[185282] = {
0x78, 0x9C, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x78, 0x9C, 0x6D, 0xCE, 0x31, 0x0B, 0x81, 0x61,
0x00, 0x45, 0xE1, 0x53, 0x32, 0x48, 0x29, 0x24, 0x16, 0xA5, 0x2C, 0x24, 0x29, 0x25, 0x83, 0x0C,
Expand Down
52 changes: 0 additions & 52 deletions software/firmware/main/font.h

This file was deleted.

5 changes: 1 addition & 4 deletions software/firmware/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
#include <stdio.h>
#include <string.h>

#include "EPD.h"
#include "epd_temperature.h"
#include "epd_driver.h"
#include "firasans.h"
#include "font.h"
#include "giraffe.h"
#include "image.h"
#include "img_board.h"
Expand Down Expand Up @@ -107,7 +105,6 @@ void loop() {

void epd_task() {
epd_init();
epd_temperature_init();

ESP_LOGW("main", "allocating...\n");

Expand Down

0 comments on commit 5a1461f

Please sign in to comment.