Skip to content

Commit

Permalink
Fix: flip the connection
Browse files Browse the repository at this point in the history
Update: display footprint with numbering
  • Loading branch information
Suke0811 committed Oct 29, 2024
1 parent 241affa commit d998297
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
35 changes: 18 additions & 17 deletions edg/parts/Lcd_Er_Tft1_28_3.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from edg.parts.PassiveConnector_Fpc import Fpc050BottomFlip
from edg.parts.PassiveConnector_Fpc import Fpc050Bottom
from edg import *
from edg.abstract_parts import *

Expand All @@ -19,52 +19,53 @@ class Er_Tft_128_3_Device(InternalSubcircuit, Nonstrict3v3Compatible, Block):
def __init__(self) -> None:
super().__init__()

self.conn = self.Block(Fpc050BottomFlip(length=15))
self.conn = self.Block(Fpc050Bottom(length=15)) # Pin numbering in the doc is flipped in the footprint

# Power pins
self.vdd = self.Export(self.conn.pins.request('4').adapt_to(VoltageSink(
self.vdd = self.Export(self.conn.pins.request('12').adapt_to(VoltageSink(
voltage_limits=self.nonstrict_3v3_compatible.then_else(
(2.5, 3.6) * Volt, # abs max is 4.6v
(2.5, 3.3) * Volt),
)))
self.gnd = self.Export(self.conn.pins.request('1').adapt_to(Ground()))

self.gnd = self.Export(self.conn.pins.request('15').adapt_to(Ground()))
# Backlight control
self.ledk = self.Export(self.conn.pins.request('2'))
self.leda = self.Export(self.conn.pins.request('3'))
self.ledk = self.Export(self.conn.pins.request('14'))
self.leda = self.Export(self.conn.pins.request('13'))

dio_model = DigitalBidir.from_supply(
self.gnd, self.vdd,
voltage_limit_tolerance=(-0.3, 0.3)*Volt,
input_threshold_factor=(0.3, 0.7)
)

self.rs = self.Export(self.conn.pins.request('5').adapt_to(DigitalSink.from_bidir(dio_model)))
self.rs = self.Export(self.conn.pins.request('11').adapt_to(DigitalSink.from_bidir(dio_model)))

# Control pins
self.spi = self.Port(SpiPeripheral.empty())
self.cs = self.Export(self.conn.pins.request('6').adapt_to(DigitalSink.from_bidir(dio_model)))
self.connect(self.spi.sck, self.conn.pins.request('7').adapt_to(DigitalSink.from_bidir(dio_model)))
self.cs = self.Export(self.conn.pins.request('10').adapt_to(DigitalSink.from_bidir(dio_model)))
self.connect(self.spi.sck, self.conn.pins.request('9').adapt_to(DigitalSink.from_bidir(dio_model)))
self.connect(self.spi.mosi, self.conn.pins.request('8').adapt_to(DigitalSink.from_bidir(dio_model)))

self.miso_nc = self.Block(DigitalBidirNotConnected())
self.connect(self.spi.miso, self.miso_nc.port)

self.rst = self.Export(self.conn.pins.request('9').adapt_to(DigitalSink.from_bidir((dio_model))))
self.rst = self.Export(self.conn.pins.request('7').adapt_to(DigitalSink.from_bidir((dio_model))))

# Capacitive Touch Panel (CTP)
self.ctp_i2c = self.Port(I2cTarget(DigitalBidir.empty(), addresses=[0x15]),)

self.ctp_vdd = self.Export(self.conn.pins.request('10').adapt_to(VoltageSink(
self.ctp_vdd = self.Export(self.conn.pins.request('6').adapt_to(VoltageSink(
voltage_limits=(2.7, 3.6) * Volt,
current_draw=(5 * uAmp, 2.5 * mAmp)
)))

self.connect(self.gnd, self.conn.pins.request('11').adapt_to(Ground()))
self.connect(self.gnd, self.conn.pins.request('5').adapt_to(Ground()))

self.ctp_rst = self.Export(self.conn.pins.request('12').adapt_to(DigitalSink.from_bidir(dio_model)))
self.ctp_int = self.Export(self.conn.pins.request('13').adapt_to(DigitalSink.from_bidir(dio_model)))
self.connect(self.ctp_i2c.sda, self.conn.pins.request('14').adapt_to(dio_model))
self.connect(self.ctp_i2c.scl, self.conn.pins.request('15').adapt_to(DigitalSink.from_bidir(dio_model)))
self.ctp_rst = self.Export(self.conn.pins.request('4').adapt_to(DigitalSink.from_bidir(dio_model)))
self.ctp_int = self.Export(self.conn.pins.request('3').adapt_to(DigitalSink.from_bidir(dio_model)))
self.connect(self.ctp_i2c.sda, self.conn.pins.request('2').adapt_to(dio_model))
self.connect(self.ctp_i2c.scl, self.conn.pins.request('1').adapt_to(DigitalSink.from_bidir(dio_model)))


class Er_Tft_128_3(Lcd, Resettable, Block):
Expand All @@ -88,7 +89,7 @@ def contents(self):
self.connect(self.reset, self.ic.rst)
self.require(self.reset.is_connected())

# self.lcd = self.Block(Er_Tft_128_3_Outline()) # for ic outline
self.lcd = self.Block(Er_Tft_128_3_Outline()) # for ic outline

self.connect(self.ic.ledk.adapt_to(Ground()), self.gnd)
forward_current = (24, 30)*mAmp
Expand Down
10 changes: 10 additions & 0 deletions examples/edg.pretty/Lcd_Er_Tft1_28_3_Outline.kicad_mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 9e0eb252-2082-4c15-95e3-15c23edf5f3c)
)
(fp_text user "15" (at -6.25 82.5 unlocked) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.1)) (justify left bottom))
(tstamp a5286b7c-f41a-4461-86ea-7adf9f1b17f5)
)
(fp_text user "1" (at 6.25 82.5 unlocked) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.1)) (justify right bottom))
(tstamp a90dced0-2718-48d4-90a2-7931eb6fce2a)
)
(fp_rect (start -6.25 42) (end 6.25 82.5)
(stroke (width 0.1) (type default)) (fill none) (layer "F.SilkS") (tstamp 097e6a3c-5877-4784-91c0-2153e77b31c8))
(fp_circle (center 0 0) (end 32.5 0)
(stroke (width 0.1) (type default)) (fill none) (layer "F.SilkS") (tstamp 2e62d766-e910-40f3-bede-596eff1d9e4f))
(fp_circle (center 0 0) (end 42.5 0)
(stroke (width 0.1) (type default)) (fill none) (layer "F.SilkS") (tstamp d6945a76-c1fe-46e9-88b2-10abd193a137))
)

0 comments on commit d998297

Please sign in to comment.