Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugged st7735 on MINI_160X80 #11

Open
wants to merge 58 commits into
base: ST7735
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
9c9b5af
Initial Commit - ST7735
SenexCrenshaw May 18, 2020
7ef29a5
Updated for CI checks
SenexCrenshaw May 18, 2020
f82e7f7
Updated for travis build
SenexCrenshaw May 18, 2020
b44ea8a
Travis fixes
SenexCrenshaw May 18, 2020
5df070a
Travis line too long
SenexCrenshaw May 18, 2020
05a8cfd
Travis fixes
SenexCrenshaw May 18, 2020
004cfa6
Fixed up travis format issues
SenexCrenshaw May 18, 2020
2455167
Travis Fixes
SenexCrenshaw May 18, 2020
92bdcc3
Initial Commit - ST7735
SenexCrenshaw May 18, 2020
6ccd79b
Updated for CI checks
SenexCrenshaw May 18, 2020
037f9e5
Updated for travis build
SenexCrenshaw May 18, 2020
2c76aec
Travis fixes
SenexCrenshaw May 18, 2020
4c1c41c
Travis line too long
SenexCrenshaw May 18, 2020
dcdc2a3
Travis fixes
SenexCrenshaw May 18, 2020
d030989
Fixed up travis format issues
SenexCrenshaw May 18, 2020
5f8c516
Travis Fixes
SenexCrenshaw May 18, 2020
7f949c5
Update to new color API and added test
SenexCrenshaw Oct 23, 2020
6f5eb4c
Check fixes
SenexCrenshaw Oct 23, 2020
7231f1f
Fixed sid length in test
SenexCrenshaw Oct 23, 2020
8eefed1
Cleaned up whitespaces
SenexCrenshaw Oct 23, 2020
8207dd1
kbx81 recommended fixes
SenexCrenshaw Oct 23, 2020
f347c59
test fix
SenexCrenshaw Oct 23, 2020
3521fce
Fixes of fixes
SenexCrenshaw Oct 23, 2020
523df92
Fixed test1.yaml
SenexCrenshaw Oct 23, 2020
b083e36
Fixed test1.yaml
SenexCrenshaw Oct 23, 2020
a5f647a
Changed digital pin #s to gpio
SenexCrenshaw Oct 23, 2020
247c081
Updated to match kbx's color names
SenexCrenshaw Oct 23, 2020
1e6095e
Typo for ST7735_INITR_MINI_160X80
SenexCrenshaw Oct 23, 2020
9c2b1b6
Merge pull request #1 from SenexCrenshaw/ST7735
expaso Oct 23, 2020
76d360c
- Debugged colorspace issues between 8bit and 6big colors
Oct 23, 2020
ac1586a
- Removed unneeded include
Oct 24, 2020
e1754aa
- Fix CLang format
Oct 24, 2020
068db9b
Updated 8bit color space code
SenexCrenshaw Oct 24, 2020
7069743
Merge branch 'ST7735' into st7735
expaso Oct 24, 2020
840f612
- Fixed RGB vs BGR error
Oct 24, 2020
47adec7
Whitespace commit to satisfy linter
Oct 24, 2020
d5c7db1
Renamed lookup table for clarity.
Oct 24, 2020
b3c9347
Renamed Lookup table for clarity
Oct 24, 2020
2b86ded
- Fixed typo in display.py model enum, preventing from compiling for …
Oct 24, 2020
98e8287
Fixed RGB/BGR problems between display models.
Oct 25, 2020
1e76186
Added in to_rgb_332,to_bgr_332, rgb_332to_rgb_556 and a more generic …
SenexCrenshaw Oct 26, 2020
462bf0f
Fixed MADCTL
SenexCrenshaw Oct 26, 2020
23bd6ce
Fixp MADCTL
SenexCrenshaw Oct 26, 2020
f7298bb
Implemented usrbgr option
SenexCrenshaw Oct 26, 2020
84746eb
Updated to_bgr_332
SenexCrenshaw Oct 26, 2020
3713d1b
Fix up for clang
SenexCrenshaw Oct 26, 2020
a74169a
FIx up init code. type in buffer caused overrun
SenexCrenshaw Oct 26, 2020
740c8e6
fixup protected names
SenexCrenshaw Oct 26, 2020
8af8c99
typos
SenexCrenshaw Oct 26, 2020
b06251f
Matched use_bgr to its conf
SenexCrenshaw Oct 26, 2020
f1351b3
color.h red fix in bgr_233to_rgb_565
SenexCrenshaw Oct 26, 2020
36cbdcb
Fix ST7735_INITR_MINI_160X80
SenexCrenshaw Oct 26, 2020
9775a30
Renamed bgr_233to_bgr_565 to match its function
SenexCrenshaw Oct 27, 2020
a976bb6
Fix
SenexCrenshaw Oct 27, 2020
6a87159
clang fix
SenexCrenshaw Oct 27, 2020
dd46e4d
Merge branch 'ST7735' into st7735
expaso Oct 27, 2020
1f09ce3
Update color.h
expaso Oct 27, 2020
b5c395f
Reverse commit.
Oct 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions esphome/components/st7735/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import esphome.codegen as cg
st7735_ns = cg.esphome_ns.namespace('st7735')
73 changes: 73 additions & 0 deletions esphome/components/st7735/display.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import pins
from esphome.components import spi
from esphome.components import display
from esphome.core import coroutine
from esphome.const import CONF_DC_PIN, CONF_ID, CONF_LAMBDA, CONF_MODEL, CONF_RESET_PIN, CONF_PAGES
from . import st7735_ns

DEPENDENCIES = ['spi']

CONF_DEVICEWIDTH = 'devicewidth'
CONF_DEVICEHEIGHT = 'deviceheight'
CONF_ROWSTART = 'rowstart'
CONF_COLSTART = 'colstart'
CONF_EIGHTBITCOLOR = 'eightbitcolor'
CONF_USEBGR = 'usebgr'

SPIST7735 = st7735_ns.class_('ST7735', cg.PollingComponent, display.DisplayBuffer, spi.SPIDevice)
ST7735Model = st7735_ns.enum('ST7735Model')

MODELS = {
'INITR_GREENTAB': ST7735Model.ST7735_INITR_GREENTAB,
'INITR_REDTAB': ST7735Model.ST7735_INITR_REDTAB,
'INITR_BLACKTAB': ST7735Model.ST7735_INITR_BLACKTAB,
'INITR_MINI160X80': ST7735Model.ST7735_INITR_MINI_160X80,
'INITR_18BLACKTAB': ST7735Model.ST7735_INITR_18BLACKTAB,
'INITR_18REDTAB': ST7735Model.ST7735_INITR_18REDTAB
}
ST7735_MODEL = cv.enum(MODELS, upper=True, space="_")


ST7735_SCHEMA = display.FULL_DISPLAY_SCHEMA.extend({
cv.Required(CONF_MODEL): ST7735_MODEL,
cv.Optional(CONF_RESET_PIN): pins.gpio_output_pin_schema
}).extend(cv.polling_component_schema('1s'))

CONFIG_SCHEMA = cv.All(ST7735_SCHEMA.extend({
cv.GenerateID(): cv.declare_id(SPIST7735),
cv.Required(CONF_DC_PIN): pins.gpio_output_pin_schema,
cv.Required(CONF_DEVICEWIDTH): cv.int_,
cv.Required(CONF_DEVICEHEIGHT): cv.int_,
cv.Required(CONF_COLSTART): cv.int_,
cv.Required(CONF_ROWSTART): cv.int_,
cv.Optional(CONF_EIGHTBITCOLOR, default=False): cv.boolean,
cv.Optional(CONF_USEBGR, default=False): cv.boolean,
}).extend(cv.COMPONENT_SCHEMA).extend(spi.spi_device_schema()),
cv.has_at_most_one_key(CONF_PAGES, CONF_LAMBDA))


@coroutine
def setup_st7735(var, config):
yield cg.register_component(var, config)
yield display.register_display(var, config)

if CONF_RESET_PIN in config:
reset = yield cg.gpio_pin_expression(config[CONF_RESET_PIN])
cg.add(var.set_reset_pin(reset))
if CONF_LAMBDA in config:
lambda_ = yield cg.process_lambda(
config[CONF_LAMBDA], [(display.DisplayBufferRef, 'it')], return_type=cg.void)
cg.add(var.set_writer(lambda_))


def to_code(config):
var = cg.new_Pvariable(config[CONF_ID], config[CONF_MODEL], config[CONF_DEVICEWIDTH],
config[CONF_DEVICEHEIGHT], config[CONF_COLSTART], config[CONF_ROWSTART],
config[CONF_EIGHTBITCOLOR], config[CONF_USEBGR])
yield setup_st7735(var, config)
yield spi.register_spi_device(var, config)

dc = yield cg.gpio_pin_expression(config[CONF_DC_PIN])
cg.add(var.set_dc_pin(dc))
Loading