Skip to content

Commit

Permalink
#39 Target C3: dma
Browse files Browse the repository at this point in the history
  • Loading branch information
martinberlin committed Apr 19, 2021
1 parent 8bd7776 commit 8382b3b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
10 changes: 5 additions & 5 deletions components/CalEPD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ set(srcs
"models/plasticlogic/plasticlogic031.cpp"

# Parallel epapers supported by Epdiy driver (Uncomment epdParallel & REQUIRES "epd_driver")
#"models/parallel/ED047TC1.cpp"
#"models/parallel/ED047TC1touch.cpp"
#"models/parallel/ED060SC4.cpp"
"models/parallel/ED047TC1.cpp"
"models/parallel/ED047TC1touch.cpp"
"models/parallel/ED060SC4.cpp"

# Pending for more testing:
"models/gdeh0213b73.cpp"
Expand All @@ -46,14 +46,14 @@ set(srcs
"epdspi.cpp"
"epd4spi.cpp"
# Only for parallel epapers:
#"epdParallel.cpp"
"epdParallel.cpp"
)

# If the project does not use a touch display component FT6X36-IDF can be removed or #commented
idf_component_register(SRCS ${srcs}
REQUIRES "Adafruit-GFX"
REQUIRES "FT6X36-IDF"
# Only for parallel epapers:
#REQUIRES "epd_driver"
REQUIRES "epd_driver"
INCLUDE_DIRS "include"
)
2 changes: 1 addition & 1 deletion components/CalEPD/epd4spi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#elif defined CONFIG_IDF_TARGET_ESP32C3
// chip only support spi dma channel auto-alloc
#define EPD_HOST SPI2_HOST
#define DMA_CHAN 0
#define DMA_CHAN SPI_DMA_CH_AUTO
#endif
/** DISPLAYS REF:
__________
Expand Down
14 changes: 7 additions & 7 deletions components/CalEPD/epdspi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
#elif defined CONFIG_IDF_TARGET_ESP32C3
// chip only support spi dma channel auto-alloc
#define EPD_HOST SPI2_HOST
#define DMA_CHAN 0
#define DMA_CHAN SPI_DMA_CH_AUTO
#endif

void EpdSpi::init(uint8_t frequency=4,bool debug=false){
debug_enabled = debug;
if (debug) {
printf("MOSI: %d CLK: %d\nSPI_CS: %d DC: %d RST: %d BUSY: %d\n\n", CONFIG_EINK_SPI_MOSI, CONFIG_EINK_SPI_CLK,
CONFIG_EINK_SPI_CS,CONFIG_EINK_DC,CONFIG_EINK_RST,CONFIG_EINK_BUSY);
if (true) {
printf("MOSI: %d CLK: %d\nSPI_CS: %d DC: %d RST: %d BUSY: %d DMA_CH: %d\n\n", CONFIG_EINK_SPI_MOSI, CONFIG_EINK_SPI_CLK,
CONFIG_EINK_SPI_CS,CONFIG_EINK_DC,CONFIG_EINK_RST,CONFIG_EINK_BUSY, DMA_CHAN);
}
//Initialize GPIOs direction & initial states
gpio_set_direction((gpio_num_t)CONFIG_EINK_SPI_CS, GPIO_MODE_OUTPUT);
Expand Down Expand Up @@ -91,7 +91,7 @@ void EpdSpi::cmd(const uint8_t cmd)
{
if (debug_enabled) {
printf("C %x\n",cmd);
}
}

esp_err_t ret;
spi_transaction_t t;
Expand All @@ -110,9 +110,9 @@ void EpdSpi::cmd(const uint8_t cmd)

void EpdSpi::data(uint8_t data)
{
if (debug_enabled) {
/* if (debug_enabled) {
printf("D %x\n",data);
}
} */
esp_err_t ret;
spi_transaction_t t;
memset(&t, 0, sizeof(t)); //Zero out the transaction
Expand Down
15 changes: 10 additions & 5 deletions components/CalEPD/models/plasticlogic/epdspi2cs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@
#include "esp_log.h"

#ifdef CONFIG_IDF_TARGET_ESP32
#define EPD_HOST HSPI_HOST
#define DMA_CHAN 2
#define EPD_HOST HSPI_HOST
#define DMA_CHAN 2

#elif defined CONFIG_IDF_TARGET_ESP32S2 || defined CONFIG_IDF_TARGET_ESP32C3
#define EPD_HOST SPI2_HOST
#define DMA_CHAN EPD_HOST
#elif defined CONFIG_IDF_TARGET_ESP32S2
#define EPD_HOST SPI2_HOST
#define DMA_CHAN EPD_HOST

#elif defined CONFIG_IDF_TARGET_ESP32C3
// chip only support spi dma channel auto-alloc
#define EPD_HOST SPI2_HOST
#define DMA_CHAN SPI_DMA_DISABLED
#endif


Expand Down

0 comments on commit 8382b3b

Please sign in to comment.