-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
67b1c43
commit ed13296
Showing
5 changed files
with
174 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,75 @@ | ||
# Possible Designators | ||
|
||
(copied from <https://en.wikipedia.org/wiki/Reference_designator> and edited lightly) | ||
|
||
| Designator | Component type | Implemented? | | ||
|:--:|:--|:--:| | ||
| A, ASSY | Separable assembly or sub-assembly || | ||
| AE | Aerial, antenna || | ||
| AT | Attenuator or isolator || | ||
| B, BT, BAT | Battery | Yes | | ||
| BR | Bridge rectifier || | ||
| C | Capacitor | Yes | | ||
| CV, VC | Variable capacitor | Yes | | ||
| CN | Connector || | ||
| CRT | Cathode ray tube || | ||
| D, LED, CR | Diode (all types, including LED), thyristor | Yes | | ||
| DL | Delay line || | ||
| DS | Display, general light source, lamp, signal light || | ||
| DSP | Digital signal processor || | ||
| F | Fuse || | ||
| FB | Ferrite bead || | ||
| FD | Fiducial || | ||
| FET | Field-effect transistor || | ||
| FL | Filter || | ||
| G | Generator or oscillator || | ||
| GDT, SVP | Gas discharge tube, Surge Voltage Protector || | ||
| GN | General network || | ||
| H | Pin header || | ||
| HY | Circulator or directional coupler || | ||
| IC, U | Integrated circuit | Partial | | ||
| IR | Infrared Diode | Yes | | ||
| J | Jack (least-movable connector of a connector pair) || | ||
| J, JW | Wire link ("jumper") || | ||
| JFET | Junction gate field-effect transistor || | ||
| JP | Jumper (Link) || | ||
| K, RY, RLA | Relay or contactor || | ||
| L | Inductor or coil or ferrite bead || | ||
| LA | Lightning arrester || | ||
| LCD | Liquid crystal display || | ||
| LDR | Light-dependent resistor || | ||
| LS | Loudspeaker or buzzer || | ||
| M | Motor || | ||
| MCB | Miniature circuit breaker || | ||
| MIC, MK | Microphone || | ||
| MOSFET | Metal-oxide-semiconductor field-effect transistor || | ||
| MP | Mechanical part (including screws and fasteners) || | ||
| NE | Neon lamp || | ||
| OP | Opto-isolator || | ||
| P | Plug (most-movable connector of a connector pair) || | ||
| PCB | Printed circuit board || | ||
| PLC | Programmable logic controller || | ||
| PS | Power supply || | ||
| PU | Pickup || | ||
| Q | Transistor (all types) || | ||
| R | Resistor | Yes | | ||
| RV, VR | Variable resistor (potentiometer or rheostat) | Yes | | ||
| RN | Resistor network || | ||
| RT | Thermistor || | ||
| S, SW | Switch (all types, including buttons) || | ||
| SCR | Silicon-controlled rectifier || | ||
| SUS | Silicon unilateral switch || | ||
| T | Transformer || | ||
| TC | Thermocouple || | ||
| TFT | Thin-film transistor (display) || | ||
| TH | Thermistor || | ||
| TP | Test point || | ||
| TUN | Tuner || | ||
| V | Vacuum tube || | ||
| VDR, MOV | Voltage-dependent resistor (varistor) || | ||
| VFD | Vacuum fluorescent display || | ||
| VT | Voltage transformer || | ||
| W | Wire | (implicit) | | ||
| X, XTAL, Y | Crystal oscillator, ceramic resonator || | ||
This is a list of all components that Schemascii *might* support. For a complete list of all supported components, (generated from the implementation file), please see [supported-components.md](./supported-components.md). If a component you want is not supported, have a look at [#3](https://github.com/dragoncoder047/schemascii/issues/3) or fork and implement it yourself. | ||
|
||
| Designator | Component type | | ||
|:--:|:--| | ||
| A, ASSY | Separable assembly or sub-assembly | | ||
| AE | Aerial, antenna | | ||
| AT | Attenuator or isolator | | ||
| B, BT, BAT | Battery | | ||
| BR | Bridge rectifier | | ||
| C | Capacitor | | ||
| CV, VC | Variable capacitor | | ||
| CN | Connector | | ||
| CRT | Cathode ray tube | | ||
| D, LED, CR | Diode (all types, including LED), thyristor | | ||
| DL | Delay line | | ||
| DS | Display, general light source, lamp, signal light | | ||
| DSP | Digital signal processor | | ||
| F | Fuse | | ||
| FB | Ferrite bead | | ||
| FD | Fiducial | | ||
| FET | Field-effect transistor | | ||
| FL | Filter | | ||
| G | Generator or oscillator | | ||
| GDT, SVP | Gas discharge tube, Surge Voltage Protector | | ||
| GN | General network | | ||
| H | Pin header | | ||
| HY | Circulator or directional coupler | | ||
| IC, U | Integrated circuit | | ||
| IR | Infrared Diode | | ||
| J | Jack (least-movable connector of a connector pair) | | ||
| J, JW | Wire link ("jumper") | | ||
| JFET | Junction gate field-effect transistor | | ||
| JP | Jumper (Link) | | ||
| K, RY, RLA | Relay or contactor | | ||
| L | Inductor or coil or ferrite bead | | ||
| LA | Lightning arrester | | ||
| LCD | Liquid crystal display | | ||
| LDR | Light-dependent resistor | | ||
| LS | Loudspeaker or buzzer | | ||
| M | Motor | | ||
| MCB | Miniature circuit breaker | | ||
| MIC, MK | Microphone | | ||
| MOSFET | Metal-oxide-semiconductor field-effect transistor | | ||
| MP | Mechanical part (including screws and fasteners) | | ||
| NE | Neon lamp | | ||
| OP | Opto-isolator | | ||
| P | Plug (most-movable connector of a connector pair) | | ||
| PCB | Printed circuit board | | ||
| PLC | Programmable logic controller | | ||
| PS | Power supply | | ||
| PU | Pickup | | ||
| Q | Transistor (all types) | | ||
| R | Resistor | | ||
| RV, VR | Variable resistor (potentiometer or rheostat) | | ||
| RN | Resistor network | | ||
| RT | Thermistor | | ||
| S, SW | Switch (all types, including buttons) | | ||
| SCR | Silicon-controlled rectifier | | ||
| SUS | Silicon unilateral switch | | ||
| T | Transformer | | ||
| TC | Thermocouple | | ||
| TFT | Thin-film transistor (display) | | ||
| TH | Thermistor | | ||
| TP | Test point | | ||
| TUN | Tuner | | ||
| V | Vacuum tube | | ||
| VDR, MOV | Voltage-dependent resistor (varistor) | | ||
| VFD | Vacuum fluorescent display | | ||
| VT | Voltage transformer | | ||
| W | Wire | | ||
| X, XTAL, Y | Crystal oscillator, ceramic resonator | |
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,53 @@ | ||
#! /usr/bin/env python3 | ||
import re | ||
from itertools import groupby | ||
from schemascii.components_render import RENDERERS | ||
|
||
# pylint: disable=unspecified-encoding,missing-function-docstring,invalid-name,not-an-iterable | ||
# cSpell:ignore siht etareneg redner iicsa stpircs | ||
# cSpell:ignore mehcs daetsn detareneg yllacitamotua codc stnenopmoc | ||
|
||
TOP = ("# Supported Schemascii Components\n\n<!--\n" | ||
+ "".join(reversed(".elif siht etareneg-er ot yp.codc/" | ||
"stpircs nur dna yp.redner_stnenopmoc/iicsa" | ||
"mehcs tide ,daetsnI\n!TIDE TON OD\n!ELIF" | ||
" DETARENEG YLLACITAMOTUA")) + | ||
"\n-->\n\n| Reference Designators | Description | BOM Syntax | Supported Flags |" | ||
"\n|:--:|:--|:--:|:--|\n") | ||
|
||
|
||
def group_components_by_func(): | ||
items = groupby(list(RENDERERS.items()), lambda x: x[1]) | ||
out = {} | ||
for x, g in items: | ||
out[x] = [p[0] for p in g] | ||
return out | ||
|
||
|
||
def parse_docstring(d): | ||
out = [None, None, None] | ||
if fs := re.search(r"flags:(.*?)$", d, re.M): | ||
out[2] = [f.split("=") for f in fs.group(1).split(",")] | ||
d = d.replace(fs.group(), "") | ||
if b := re.search(r"bom:(.*?)$", d, re.M): | ||
out[1] = b.group(1) | ||
d = d.replace(b.group(), "") | ||
out[0] = d.strip() | ||
return out | ||
|
||
|
||
def main(): | ||
content = TOP | ||
for func, rds in group_components_by_func().items(): | ||
data = parse_docstring(func.__doc__) | ||
content += "| " + ", ".join(f"`{x}`" for x in rds) + " | " | ||
content += data[0].replace("\n", "<br>") + " | " | ||
content += "`" + data[1] + "` | " | ||
content += "<br>".join(f"`{x[0]}` = {x[1]}" for x in (data[2] or [])) | ||
content += " |\n" | ||
with open("supported-components.md", "w") as f: | ||
f.write(content) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
File renamed without changes.
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,17 @@ | ||
# Supported Schemascii Components | ||
|
||
<!-- | ||
AUTOMATICALLY GENERATED FILE! | ||
DO NOT EDIT! | ||
Instead, edit schemascii/components_render.py and run scripts/cdoc.py to re-generate this file. | ||
--> | ||
|
||
| Reference Designators | Description | BOM Syntax | Supported Flags | | ||
|:--:|:--|:--:|:--| | ||
| `R`, `RV`, `VR` | Resistor, Variable resistor, etc. | `ohms[,watts]` | | | ||
| `C`, `CV`, `VC` | Draw a capacitor, variable capacitor, etc. | `farads[,volts]` | `+` = positive | | ||
| `B`, `BT`, `BAT` | Draw a battery cell. | `volts[,amp-hours]` | `+` = positive | | ||
| `D`, `LED`, `CR`, `IR` | Draw a diode or LED. | `part-number` | `+` = positive | | ||
| `U`, `IC` | Draw an IC. | `part-number[,pin1-label[,pin2-label[,...]]]` | | | ||
| `J`, `P` | Draw a jack connector or plug. | `label` | | | ||
| `Q`, `MOSFET`, `MOS`, `FET` | Draw a bipolar transistor (PNP/NPN) or FET (NFET/PFET). | `{npn/pnp/nfet/pfet}:part-number` | `s` = source<br>`d` = drain<br>`g` = gate<br>`e` = emitter<br>`c` = collector<br>`b` = base | |