-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(display): Add patches files for MCUFRIEND_kbv (#11)
Support auto patch in PIO
- Loading branch information
1 parent
98b524b
commit f95207f
Showing
7 changed files
with
175 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
18c18 | ||
< //#define SUPPORT_9163 // | ||
--- | ||
> #define SUPPORT_9163 // | ||
2227c2227 | ||
< *p16 = 160; | ||
--- | ||
> *p16 = 128; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
1c1 | ||
< //#define USE_SPECIAL //check for custom drivers | ||
--- | ||
> #define USE_SPECIAL //check for custom drivers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
2a3 | ||
> #define USE_EPSON_PNL_CE02 // 6.39sec | ||
47a49,139 | ||
> #elif defined(__AVR_ATmega2560__) && defined(USE_EPSON_PNL_CE02) | ||
> // LCD pins |D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0 | |RD |WR |RST |RS |CS | | ||
> // EPSON_PNL_CE02 | Parallel multiplexer 9 & 10 | |VCC |WR |RST | Register 9, 10 & 11 | | ||
> // ATmega2560 | PG2 (SCK) | PG1 (SER IN) | |- |PL0 |PL2 |PB1 |PB2 |PL1 | | ||
> // MEGA2560pin | 51 | 52 | |- |49 |47 | 52 |51 |48 | | ||
> | ||
> #include <Arduino.h> | ||
> #include <Epson_PNL_CE02.h> | ||
> extern Epson_PNL_CE02 controlPanel; | ||
> | ||
> #warning USE_MEGA_8BIT_SHIELD for EPSON_PNL_CE02 | ||
> | ||
> #define WR_PORT PORTL | ||
> #define WR_PIN 0 // D49 CTE | ||
> #define RESET_PORT PORTL | ||
> #define RESET_PIN 2 // D25 CTE | ||
> | ||
> #define VIRTUAL_PORT _MMIO_BYTE(0XFF) // Set Virtual Port for PIN_ methods | ||
> #define CD_PORT VIRTUAL_PORT | ||
> #define CD_PIN static_cast<int>(ExtenderPin::LCD_DC) // D4 VHC595 | ||
> #define CS_PORT VIRTUAL_PORT | ||
> #define CS_PIN static_cast<int>(ExtenderPin::LCD_CS) // D3 VHC595 | ||
> | ||
> #define UNUSED_PORT _MMIO_BYTE(0XFE) // Disable READ methods as the control panel wired the display in write-only mode | ||
> #define RD_PORT UNUSED_PORT | ||
> #define RD_PIN -1 | ||
> | ||
> #define write_8(x) ({ controlPanel.displayWrite(x); }) | ||
> | ||
> #define read_8() (PINC) | ||
> #define setWriteDir() ({ DDRC = 0xFF; }) | ||
> #define setReadDir() ({ DDRC = 0x00; }) | ||
> #define write8(x) \ | ||
> ({ \ | ||
> write_8(x); \ | ||
> WR_ACTIVE; \ | ||
> WR_STROBE; \ | ||
> }) | ||
> #define write16(x) \ | ||
> ({ \ | ||
> uint8_t h = (x) >> 8, l = x; \ | ||
> write8(h); \ | ||
> write8(l); \ | ||
> }) | ||
> #define READ_8(dst) \ | ||
> ({ \ | ||
> RD_STROBE; \ | ||
> dst = read_8(); \ | ||
> RD_IDLE; \ | ||
> }) | ||
> #define READ_16(dst) \ | ||
> ({ \ | ||
> RD_STROBE; \ | ||
> dst = read_8(); \ | ||
> RD_IDLE; \ | ||
> RD_STROBE; \ | ||
> dst = (dst << 8) | read_8(); \ | ||
> RD_IDLE; \ | ||
> }) | ||
> | ||
> #define PIN_LOW(p, b) \ | ||
> ({ \ | ||
> if (&p != &VIRTUAL_PORT) \ | ||
> { \ | ||
> (p) &= ~(1 << (b)); \ | ||
> } \ | ||
> else \ | ||
> { \ | ||
> controlPanel.extenderWrite((ExtenderPin)b, LOW); \ | ||
> } \ | ||
> }) | ||
> | ||
> #define PIN_HIGH(p, b) \ | ||
> ({ \ | ||
> if (&p != &VIRTUAL_PORT) \ | ||
> { \ | ||
> (p) |= (1 << (b)); \ | ||
> } \ | ||
> else \ | ||
> { \ | ||
> controlPanel.extenderWrite((ExtenderPin)b, HIGH); \ | ||
> } \ | ||
> }) | ||
> | ||
> #define PIN_OUTPUT(p, b) \ | ||
> ({ \ | ||
> if (&p != &VIRTUAL_PORT) \ | ||
> { \ | ||
> *(&p - 1) |= (1 << (b)); \ | ||
> } \ | ||
> }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Script to override package files. | ||
# Apply patches from "patches" folder into ".pio/lib_deps/<env>/" | ||
# The "patches" folder must match ".pio/lib_deps/<env>/" structure | ||
|
||
from os import walk | ||
from os.path import join, isfile, relpath | ||
|
||
Import("env") | ||
|
||
LIB_DEPS_DIR = join(env.subst("$PROJECT_LIBDEPS_DIR"), env.subst("$PIOENV")) | ||
PATCHES_DIR = "patches" | ||
|
||
for dir_, _, files in walk(PATCHES_DIR): | ||
for file_name in files: | ||
rel_dir = relpath(dir_, PATCHES_DIR) | ||
rel_file = join(rel_dir, file_name) | ||
|
||
original_file = join(LIB_DEPS_DIR, rel_file) | ||
patch_file = join(PATCHES_DIR, rel_file) | ||
|
||
patched = isfile(f"{original_file}.patched") | ||
|
||
# patch file only if we didn't do it before | ||
if not patched: | ||
|
||
assert isfile(original_file) and isfile(patch_file) | ||
|
||
print("patch %s %s" % (original_file, patch_file)) | ||
env.Execute("patch %s %s" % (original_file, patch_file)) | ||
env.Execute("touch " + f"{original_file}.patched") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters