Rate my Example

So I gave SKiDL a short test. After writing about 80 lines of (kinda) reusable stuff, I can describe my toy example like this:

#createPart connects all GND and VCC pins and puts 100nF on each VCC Pin
mcu = createPart(Part("MCU_ST_STM32F1", "STM32F103C8Tx", footprint="Package_QFP:LQFP-48_7x7mm_P0.5mm"), True)

#rename Pins for SPI use
mcu.PA5.name = "SCK"
mcu.PA6.name = "MISO"
mcu.PA7.name = "MOSI"

#custom part, renames Pins for SPI and uses createPart
bme = bme280("SPI")

#Connects all SPI signals

#add Pullup to Pin
pullup(mcu.PA8, r="1k")
#add LEDs and series resistor
ledResistor(mcu.PA3, I=10, Vf=1.4)
ledResistor(mcu.PA2, I=20, footprint="LED_0805_2012Metric")

(This example has no intention of being complete, also I am in no way a trained/skilled electrical engineer)
And get this Board (crappy placement by me + freerouting 1.3).

I rename some pins and the bypass caps, so I know immediately where they go.

I don’t know if this in any way how it was meant to be done or helpful at all.

It was a nice experience and I can totally see how repeating tasks are easy to solve with SKiDL. It would be awesome, if it was possible to also get a schematic, because that is what other people understand.
Here is the complete script.

Mike, thanks for posting your example. I’m not even going to try to rate your example. Because SKiDL was built on top of a general-purpose programming language, people have a lot of flexibility in how they can build a system. There hasn’t been enough SKiDL use to establish a standard coding practice (aside from standard Python coding guidelines), so if you get a usable result, that’s probably good enough!

In regards to schematic output, that feature is almost ready for release. The initial output is going to be SVG, but later I want to output a KiCad schematic file so it will be easier to edit. Be warned that these auto-generated schematics are gonna suck compared to what most people would do by hand. Probably their biggest use will be by new SKiDL users who want to check the schematic against their code to make sure they’re doing it right.

I was missing a few short and simple examples, that show how to efficiently use SKiDL. I’m sure with my current renaming approach, I’ll run into problems with bigger designs. Do you know, if I can put my custom names on Eco1.User or similar, so I don’t have to use those weird reference names?

I think if I would have read the documentation, I would have already found some ways to improve my code

I have somewhere seen a (SO?) question about going netlist -> EESchema referencing SKiDL and seen the preview Screenshots. That looked kinda rough. If the schematic parts can be grouped by subcircuits, that would already help a lot. I’m still excited to see you working on this.

Yes, the need for some short, simple examples was mentioned here.
Hopefully, we’ll get that started (after four years!).

Nice. I’ve got a board intended for 8 SPI lines, intended to run 8 APA102 LED strips. Good to see how you’ve renamed the pins to make it more readable.

An alternative to changing the base name of the pin is to use aliases:

mcu = createPart(Part("MCU_ST_STM32F1", "STM32F103C8Tx", footprint="Package_QFP:LQFP-48_7x7mm_P0.5mm"), True)

# Give the pin an alias.
mcu.PA5.aliases += "SCK"

You can assign as many aliases as you like:

mcu.PA6.aliases += 'MISO', 'MISO_2'
mcu.PA6.aliases += 'another_MISO'

Then you can reference that pin using any of PA6, MISO, MISO_2, or another_MISO.