From d99829736600b0a1e0f61738376754a663eb2915 Mon Sep 17 00:00:00 2001 From: Suke0811 <49264928+Suke0811@users.noreply.github.com> Date: Mon, 28 Oct 2024 20:18:52 -0700 Subject: [PATCH] Fix: flip the connection Update: display footprint with numbering --- edg/parts/Lcd_Er_Tft1_28_3.py | 35 ++++++++++--------- .../Lcd_Er_Tft1_28_3_Outline.kicad_mod | 10 ++++++ 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/edg/parts/Lcd_Er_Tft1_28_3.py b/edg/parts/Lcd_Er_Tft1_28_3.py index c080a740b..6e8657695 100644 --- a/edg/parts/Lcd_Er_Tft1_28_3.py +++ b/edg/parts/Lcd_Er_Tft1_28_3.py @@ -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 * @@ -19,18 +19,19 @@ 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, @@ -38,33 +39,33 @@ def __init__(self) -> None: 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): @@ -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 diff --git a/examples/edg.pretty/Lcd_Er_Tft1_28_3_Outline.kicad_mod b/examples/edg.pretty/Lcd_Er_Tft1_28_3_Outline.kicad_mod index fd79bcc96..770d55fd2 100644 --- a/examples/edg.pretty/Lcd_Er_Tft1_28_3_Outline.kicad_mod +++ b/examples/edg.pretty/Lcd_Er_Tft1_28_3_Outline.kicad_mod @@ -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)) )