Skip to content

Commit

Permalink
sdf
Browse files Browse the repository at this point in the history
  • Loading branch information
Syndlex committed Jan 15, 2022
1 parent 1228e12 commit 1598e70
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 62 deletions.
28 changes: 14 additions & 14 deletions components/dmamatrix/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@
cv.Optional(CONF_WIDTH, default="64"): cv.uint8_t,
cv.Optional(CONF_HEIGHT, default="64"): cv.uint8_t,
cv.Optional(CONF_BRIGHTNESS, default="255"): cv.uint8_t,
cv.Optional(CONF_PIN_LATCH, default="GPIO33"): pins.gpio_output_pin_schema,
cv.Optional(CONF_PIN_R1 , default="GPIO17"): pins.gpio_output_pin_schema,
cv.Optional(CONF_PIN_G1 , default="GPIO2"): pins.gpio_output_pin_schema,
cv.Optional(CONF_PIN_B1 , default="GPIO16"): pins.gpio_output_pin_schema,
cv.Optional(CONF_PIN_R2 , default="GPIO04"): pins.gpio_output_pin_schema,
cv.Optional(CONF_PIN_G2 , default="GPIO15"): pins.gpio_output_pin_schema,
cv.Optional(CONF_PIN_B2 , default="GPIO12"): pins.gpio_output_pin_schema,
cv.Optional(CONF_PIN_A , default="GPIO26"): pins.gpio_output_pin_schema,
cv.Optional(CONF_PIN_B , default="GPIO13"): pins.gpio_output_pin_schema,
cv.Optional(CONF_PIN_C , default="GPIO14"): pins.gpio_output_pin_schema,
cv.Optional(CONF_PIN_D , default="GPIO27"): pins.gpio_output_pin_schema,
cv.Optional(CONF_PIN_E , default="GPIO22"): pins.gpio_output_pin_schema,
cv.Optional(CONF_PIN_OE , default="GPIO32"): pins.gpio_output_pin_schema,
cv.Optional(CONF_PIN_CLK , default="GPIO25"): pins.gpio_output_pin_schema,
# cv.Optional(CONF_PIN_LATCH, default="GPIO33"): pins.gpio_output_pin_schema,
# cv.Optional(CONF_PIN_R1 , default="GPIO17"): pins.gpio_output_pin_schema,
# cv.Optional(CONF_PIN_G1 , default="GPIO2"): pins.gpio_output_pin_schema,
# cv.Optional(CONF_PIN_B1 , default="GPIO16"): pins.gpio_output_pin_schema,
# cv.Optional(CONF_PIN_R2 , default="GPIO04"): pins.gpio_output_pin_schema,
# cv.Optional(CONF_PIN_G2 , default="GPIO15"): pins.gpio_output_pin_schema,
# cv.Optional(CONF_PIN_B2 , default="GPIO12"): pins.gpio_output_pin_schema,
# cv.Optional(CONF_PIN_A , default="GPIO26"): pins.gpio_output_pin_schema,
# cv.Optional(CONF_PIN_B , default="GPIO13"): pins.gpio_output_pin_schema,
# cv.Optional(CONF_PIN_C , default="GPIO14"): pins.gpio_output_pin_schema,
# cv.Optional(CONF_PIN_D , default="GPIO27"): pins.gpio_output_pin_schema,
# cv.Optional(CONF_PIN_E , default="GPIO22"): pins.gpio_output_pin_schema,
# cv.Optional(CONF_PIN_OE , default="GPIO32"): pins.gpio_output_pin_schema,
# cv.Optional(CONF_PIN_CLK , default="GPIO25"): pins.gpio_output_pin_schema,
cv.Optional(CONF_CHIPSET, default="FM6124"): cv.enum(DRIVER_CHIPS),
}).extend(cv.polling_component_schema('1s')),
cv.has_at_most_one_key(CONF_PAGES, CONF_LAMBDA))
Expand Down
50 changes: 30 additions & 20 deletions components/dmamatrix/dmamatrix.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
#include "dmamatrix.h"
#include "esphome/core/application.h"



#define R1_PIN 17
#define G1_PIN 2
#define B1_PIN 16
#define R2_PIN 4
#define G2_PIN 15
#define B2_PIN 12
#define A_PIN 26
#define B_PIN 13
#define C_PIN 14
#define D_PIN 27
#define E_PIN 22
#define LAT_PIN 33
#define OE_PIN 32
#define CLK_PIN 25

static const char *TAG = "dmamatrix_display";

Expand All @@ -15,10 +27,8 @@ float DmaMatrixDisplay::get_setup_priority() const { return setup_priority::PROC

void DmaMatrixDisplay::setup() {
ESP_LOGCONFIG(TAG, "Starting setup...");
HUB75_I2S_CFG::i2s_pins _pins={
pin_r1_->get_pin(), pin_g1_->get_pin(), pin_b1_->get_pin(), pin_r2_->get_pin(), pin_g2_->get_pin(),
pin_b2_->get_pin(), pin_a_->get_pin() , pin_b_->get_pin(), pin_c_->get_pin(), pin_d_->get_pin(),
pin_e_->get_pin() , pin_latch_->get_pin() ,pin_oe_->get_pin() ,pin_clk_->get_pin() };
HUB75_I2S_CFG::i2s_pins _pins={R1_PIN, G1_PIN, B1_PIN, R2_PIN, G2_PIN, B2_PIN, A_PIN, B_PIN, C_PIN, D_PIN, E_PIN, LAT_PIN, OE_PIN, CLK_PIN};

ESP_LOGI(TAG, "after pins");
HUB75_I2S_CFG mxconfig(
width_, // module width
Expand Down Expand Up @@ -57,33 +67,33 @@ void DmaMatrixDisplay::update() {

void HOT DmaMatrixDisplay::display() {}

void DmaMatrixDisplay::set_pin_latch(IDFInternalGPIOPin *pin_latch) { this->pin_latch_ = pin_latch; }
// void DmaMatrixDisplay::set_pin_latch(IDFInternalGPIOPin *pin_latch) { this->pin_latch_ = pin_latch; }

void DmaMatrixDisplay::set_pin_r1(IDFInternalGPIOPin *pin_r1) { this->pin_r1_ = pin_r1; }
// void DmaMatrixDisplay::set_pin_r1(IDFInternalGPIOPin *pin_r1) { this->pin_r1_ = pin_r1; }

void DmaMatrixDisplay::set_pin_r2(IDFInternalGPIOPin *pin_r2) { this->pin_r2_ = pin_r2; }
// void DmaMatrixDisplay::set_pin_r2(IDFInternalGPIOPin *pin_r2) { this->pin_r2_ = pin_r2; }

void DmaMatrixDisplay::set_pin_g1(IDFInternalGPIOPin *pin_g1) { this->pin_g1_ = pin_g1; }
// void DmaMatrixDisplay::set_pin_g1(IDFInternalGPIOPin *pin_g1) { this->pin_g1_ = pin_g1; }

void DmaMatrixDisplay::set_pin_g2(IDFInternalGPIOPin *pin_g2) { this->pin_g2_ = pin_g2; }
// void DmaMatrixDisplay::set_pin_g2(IDFInternalGPIOPin *pin_g2) { this->pin_g2_ = pin_g2; }

void DmaMatrixDisplay::set_pin_b1(IDFInternalGPIOPin *pin_b1) { this->pin_b1_ = pin_b1; }
// void DmaMatrixDisplay::set_pin_b1(IDFInternalGPIOPin *pin_b1) { this->pin_b1_ = pin_b1; }

void DmaMatrixDisplay::set_pin_b2(IDFInternalGPIOPin *pin_b2) { this->pin_b2_ = pin_b2; }
// void DmaMatrixDisplay::set_pin_b2(IDFInternalGPIOPin *pin_b2) { this->pin_b2_ = pin_b2; }

void DmaMatrixDisplay::set_pin_clk(IDFInternalGPIOPin *pin_clk) { this->pin_clk_ = pin_clk; }
// void DmaMatrixDisplay::set_pin_clk(IDFInternalGPIOPin *pin_clk) { this->pin_clk_ = pin_clk; }

void DmaMatrixDisplay::set_pin_a(IDFInternalGPIOPin *pin_a) { this->pin_a_ = pin_a; }
// void DmaMatrixDisplay::set_pin_a(IDFInternalGPIOPin *pin_a) { this->pin_a_ = pin_a; }

void DmaMatrixDisplay::set_pin_b(IDFInternalGPIOPin *pin_b) { this->pin_b_ = pin_b; }
// void DmaMatrixDisplay::set_pin_b(IDFInternalGPIOPin *pin_b) { this->pin_b_ = pin_b; }

void DmaMatrixDisplay::set_pin_c(IDFInternalGPIOPin *pin_c) { this->pin_c_ = pin_c; }
// void DmaMatrixDisplay::set_pin_c(IDFInternalGPIOPin *pin_c) { this->pin_c_ = pin_c; }

void DmaMatrixDisplay::set_pin_d(IDFInternalGPIOPin *pin_d) { this->pin_d_ = pin_d; }
// void DmaMatrixDisplay::set_pin_d(IDFInternalGPIOPin *pin_d) { this->pin_d_ = pin_d; }

void DmaMatrixDisplay::set_pin_e(IDFInternalGPIOPin *pin_e) { this->pin_e_ = pin_e; }
// void DmaMatrixDisplay::set_pin_e(IDFInternalGPIOPin *pin_e) { this->pin_e_ = pin_e; }

void DmaMatrixDisplay::set_pin_oe(IDFInternalGPIOPin *pin_oe) { this->pin_oe_ = pin_oe; }
// void DmaMatrixDisplay::set_pin_oe(IDFInternalGPIOPin *pin_oe) { this->pin_oe_ = pin_oe; }

void DmaMatrixDisplay::set_width(uint8_t width) { this->width_ = width; }

Expand Down
56 changes: 28 additions & 28 deletions components/dmamatrix/dmamatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ class DmaMatrixDisplay : public PollingComponent, public display::DisplayBuffer
void update() override;
void fill(Color color) override;

void set_pin_latch(IDFInternalGPIOPin *pin_latch);
void set_pin_r1(IDFInternalGPIOPin *pin_r1);
void set_pin_r2(IDFInternalGPIOPin *pin_r2);
void set_pin_g1(IDFInternalGPIOPin *pin_g1);
void set_pin_g2(IDFInternalGPIOPin *pin_g2);
void set_pin_b1(IDFInternalGPIOPin *pin_b1);
void set_pin_b2(IDFInternalGPIOPin *pin_b2);
void set_pin_a(IDFInternalGPIOPin *pin_a);
void set_pin_b(IDFInternalGPIOPin *pin_b);
void set_pin_c(IDFInternalGPIOPin *pin_c);
void set_pin_d(IDFInternalGPIOPin *pin_d);
void set_pin_e(IDFInternalGPIOPin *pin_e);
void set_pin_oe(IDFInternalGPIOPin *pin_oe);
void set_pin_clk(IDFInternalGPIOPin *pin_clk);
// void set_pin_latch(IDFInternalGPIOPin *pin_latch);
// void set_pin_r1(IDFInternalGPIOPin *pin_r1);
// void set_pin_r2(IDFInternalGPIOPin *pin_r2);
// void set_pin_g1(IDFInternalGPIOPin *pin_g1);
// void set_pin_g2(IDFInternalGPIOPin *pin_g2);
// void set_pin_b1(IDFInternalGPIOPin *pin_b1);
// void set_pin_b2(IDFInternalGPIOPin *pin_b2);
// void set_pin_a(IDFInternalGPIOPin *pin_a);
// void set_pin_b(IDFInternalGPIOPin *pin_b);
// void set_pin_c(IDFInternalGPIOPin *pin_c);
// void set_pin_d(IDFInternalGPIOPin *pin_d);
// void set_pin_e(IDFInternalGPIOPin *pin_e);
// void set_pin_oe(IDFInternalGPIOPin *pin_oe);
// void set_pin_clk(IDFInternalGPIOPin *pin_clk);
void set_width(uint8_t width);
void set_height(uint8_t height);
void set_brightness(uint8_t brightness);
Expand All @@ -47,20 +47,20 @@ class DmaMatrixDisplay : public PollingComponent, public display::DisplayBuffer

MatrixPanel_I2S_DMA *dma_matrix_ ;

IDFInternalGPIOPin *pin_latch_{nullptr};
IDFInternalGPIOPin *pin_r1_{nullptr};
IDFInternalGPIOPin *pin_r2_{nullptr};
IDFInternalGPIOPin *pin_g1_{nullptr};
IDFInternalGPIOPin *pin_g2_{nullptr};
IDFInternalGPIOPin *pin_b1_{nullptr};
IDFInternalGPIOPin *pin_b2_{nullptr};
IDFInternalGPIOPin *pin_clk_{nullptr};
IDFInternalGPIOPin *pin_a_{nullptr};
IDFInternalGPIOPin *pin_b_{nullptr};
IDFInternalGPIOPin *pin_c_{nullptr};
IDFInternalGPIOPin *pin_d_{nullptr};
IDFInternalGPIOPin *pin_e_{nullptr};
IDFInternalGPIOPin *pin_oe_{nullptr};
// IDFInternalGPIOPin *pin_latch_{nullptr};
// IDFInternalGPIOPin *pin_r1_{nullptr};
// IDFInternalGPIOPin *pin_r2_{nullptr};
// IDFInternalGPIOPin *pin_g1_{nullptr};
// IDFInternalGPIOPin *pin_g2_{nullptr};
// IDFInternalGPIOPin *pin_b1_{nullptr};
// IDFInternalGPIOPin *pin_b2_{nullptr};
// IDFInternalGPIOPin *pin_clk_{nullptr};
// IDFInternalGPIOPin *pin_a_{nullptr};
// IDFInternalGPIOPin *pin_b_{nullptr};
// IDFInternalGPIOPin *pin_c_{nullptr};
// IDFInternalGPIOPin *pin_d_{nullptr};
// IDFInternalGPIOPin *pin_e_{nullptr};
// IDFInternalGPIOPin *pin_oe_{nullptr};

uint8_t width_ = 64;
uint8_t height_ = 64;
Expand Down

0 comments on commit 1598e70

Please sign in to comment.