Skip to content

Commit

Permalink
update to latest elektron version
Browse files Browse the repository at this point in the history
  • Loading branch information
spielhuus committed May 10, 2024
1 parent 01cf6e5 commit caced54
Show file tree
Hide file tree
Showing 87 changed files with 35,504 additions and 12,933 deletions.
15 changes: 3 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ PYTHON = python3
PIP = pip
endif

RUST_DEBUG=info
debug ?=
ifdef debug
DEBUG=ELEKTRON_DEBUG=true
RUST_DEBUG=debug
endif

MAKEFILES=$(shell find src -type f -name "Makefile" -exec dirname "{}" \; | sed 's/ /\\ /g')
MARKDOWN_FILES=$(shell find src -type f -name "*.md" | sed 's/ /\\ /g')
PDF_FILES=$(shell find src -type f -name "*.pdf" | sed 's/ /\\ /g')
Expand Down Expand Up @@ -58,7 +51,7 @@ LibDaisy:

.PHONY: $(MAKEFILES)
$(MAKEFILES):
make BUILD_DEPS=$(BUILD_DEPS) -C $@
make BUILD_DEPS=$(BUILD_DEPS) -s -C $@

site: build
hugo
Expand All @@ -67,7 +60,7 @@ serve: build
hugo serve -D

clean:
$(foreach var,$(MAKEFILES), make -C $(var) clean;)
$(foreach var,$(MAKEFILES), make -s -C $(var) clean;)
rm -rf static/pdoc
rm -rf public
rm -rf resources
Expand All @@ -77,13 +70,11 @@ clean:
rm -f content/elektrophon.html

distclean: clean
$(foreach var,$(MAKEFILES), make -C $(var) distclean;)
$(foreach var,$(MAKEFILES), make -s -C $(var) distclean;)
rm -rf $(VENV)

content/elektrophon.html: lib/python/elektrophon/__init__.py lib/python/makedoc/__main__.py
mkdir -p static/pdoc
python lib/python/makedoc
PYTHONPATH=:./lib/python python -m pdoc --no-search -t lib/pdoc -o content elektrophon
rm content/index.html

$(V).SILENT:
26 changes: 8 additions & 18 deletions article.mk
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
VENV_ACTIVATE=. ../../.venv/bin/activate

MARKDOWN_FILE = index.rmd
MARKDOWN_TARGET = ../../content/post/$(NAME)/index.md
MARKDOWN_TARGET_PATH = ../../content/post/$(NAME)

debug ?=
ifdef debug
DEBUG=ELEKTRON_DEBUG=true
ifdef RUST_LOG
RUST_LEVEL := $(RUST_LOG)
else
RUST_LEVEL := info
endif

BUILD_DEPS ?=
ifdef debug
BUILD_DEPS=true
RUST_LEVEL=debug
ifdef ELEKTRON_DEBUG
ELEKTRON_DEBUG := $(ELEKTRON_DEBUG)
else
BUILD_DEPS=false
RUST_LEVEL=info
ELEKTRON_DEBUG := false
endif

.PHONY: all help test doc clean
all: $(MARKDOWN_TARGET)

$(MARKDOWN_TARGET): $(MARKDOWN_FILE)
ifeq ($(BUILD_DEPS),true)
$(VENV_ACTIVATE) && $(DEBUG) RUST_LOG=$(RUST_LEVEL) MPLBACKEND=module://elektron elektron convert --input $< --output $@
else
$(DEBUG) MPLBACKEND=module://elektron ELEKTRON_SPICE=lib/spice ELEKTRON_SYMBOLS=/usr/share/kicad/symbols:lib/symbols elektron convert --input $< --output $@
endif
ELEKTRON_DEBUG=$(ELEKTRON_DEBUG) RUST_LOG=$(RUST_LEVEL) MPLBACKEND=module://elektron elektron convert --input $< --output $@

clean:
rm -rf $(MARKDOWN_TARGET_PATH)

.PHONY distclean: clean

$(V).SILENT:
Binary file added assets/images/default-landscape.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/default-panel.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/default-portrait.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions content/categories/article/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: article
hero: is-small
---
4 changes: 4 additions & 0 deletions content/categories/module/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: module
hero: is-small
---
1 change: 1 addition & 0 deletions content/status.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ excerpt: ""
subtitle: ""
title: "status"
version: 1
hero: is-small
---

{{< status >}}
1 change: 1 addition & 0 deletions lib/pdoc/frame.html.jinja2
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout:: "pdoc"
title: {{ module.modulename if module else "API Reference" }}
hero: is-small
---

<div>
Expand Down
2 changes: 1 addition & 1 deletion lib/python/makedoc/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def main() -> int:
# draw.plot(filename="decouple_tl072.svg", border=False)

prefix = "static/pdoc"
scale = 5
scale = 2

draw = Draw(["/usr/share/kicad/symbols", "../../lib/symbols"])
input_jack(draw, "J1", "INPUT", (0,0))
Expand Down
23 changes: 7 additions & 16 deletions module.mk
Original file line number Diff line number Diff line change
@@ -1,33 +1,24 @@
VENV_ACTIVATE=. ../../.venv/bin/activate

MARKDOWN_FILE = index.rmd
MARKDOWN_TARGET = ../../content/post/$(NAME)/index.md
MARKDOWN_TARGET_PATH = ../../content/post/$(NAME)

debug ?=
ifdef debug
DEBUG=ELEKTRON_DEBUG=true
RUST_LEVEL=debug
ifdef RUST_LOG
RUST_LEVEL := $(RUST_LOG)
else
RUST_LEVEL=info
RUST_LEVEL := info
endif

BUILD_DEPS ?=
ifdef debug
BUILD_DEPS=true
ifdef ELEKTRON_DEBUG
ELEKTRON_DEBUG := $(ELEKTRON_DEBUG)
else
BUILD_DEPS=false
ELEKTRON_DEBUG := false
endif

.PHONY: all help test doc clean
all: $(MARKDOWN_TARGET)

$(MARKDOWN_TARGET): $(MARKDOWN_FILE)
ifeq ($(BUILD_DEPS),true)
$(VENV_ACTIVATE) && $(DEBUG) RUST_LOG=$(RUST_LEVEL) MPLBACKEND=module://elektron ELEKTRON_SPICE=lib/spice ELEKTRON_SYMBOLS=/usr/share/kicad/symbols:../../lib/symbols elektron convert --input $< --output $@
else
$(DEBUG) MPLBACKEND=module://elektron RUST_LOG=$(RUST_LEVEL) elektron convert --input $< --output $@
endif
ELEKTRON_DEBUG=$(ELEKTRON_DEBUG) RUST_LOG=$(RUST_LEVEL) MPLBACKEND=module://elektron elektron convert --input $< --output $@

clean:
rm -rf $(MARKDOWN_TARGET_PATH)
Expand Down
26 changes: 9 additions & 17 deletions module_python.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,24 @@ MARKDOWN_TARGET_PATH = ../../content/post/$(NAME)
PYTHON_SRC = __init__.py
PYTHON_TARGET = $(foreach dir,$(SUBMODULES),$(dir)/$(dir).kicad_sch)

debug ?=
ifdef debug
DEBUG=ELEKTRON_DEBUG=true
ifdef RUST_LOG
RUST_LEVEL := $(RUST_LOG)
else
RUST_LEVEL := info
endif

BUILD_DEPS ?=
ifdef debug
BUILD_DEPS=true
RUST_LEVEL=debug
ifdef ELEKTRON_DEBUG
ELEKTRON_DEBUG := $(ELEKTRON_DEBUG)
else
BUILD_DEPS=false
RUST_LEVEL=info
ELEKTRON_DEBUG := false
endif

.PHONY: all help test doc clean

all: $(MARKDOWN_TARGET)

$(MARKDOWN_TARGET): $(MARKDOWN_FILE) $(PYTHON_TARGET)
ifeq ($(BUILD_DEPS),true)
$(VENV_ACTIVATE) && $(DEBUG) RUST_LOG=$(RUST_LEVEL) MPLBACKEND=module://elektron ELEKTRON_SPICE=lib/spice ELEKTRON_SYMBOLS=/usr/share/kicad/symbols:../../lib/symbols elektron convert --input $< --output $@
echo $(IMAGES)
else
$(DEBUG) MPLBACKEND=module://elektron RUST_LOG=$(RUST_LEVEL) elektron convert --input $< --output $@
endif
ELEKTRON_DEBUG=$(ELEKTRON_DEBUG) RUST_LOG=$(RUST_LEVEL) MPLBACKEND=module://elektron elektron convert --input $< --output $@

$(PYTHON_TARGET): $(PYTHON_SRC)
ifeq ($(BUILD_DEPS),true)
Expand All @@ -46,5 +40,3 @@ distclean: clean
$(foreach var,$(SUBMODULES), rm -rf $(var)/$(var)-backups;)
$(foreach var,$(SUBMODULES), rm -rf $(var)/$(var).kicad_prl;)
$(foreach var,$(SUBMODULES), rm -rf $(var)/fp-info-cache;)

$(V).SILENT:
3 changes: 3 additions & 0 deletions src/4007/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NAME=4007

include ../../article.mk
16 changes: 8 additions & 8 deletions src/4007/index.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The basic usage and pin mapping is explained in the datasheet [[1]](https://www.
```{python error=FALSE, echo=FALSE, results="hide", fig.align='center', fig.cap='4007: Dual complementary pair plus inverter.'}
from elektron import Line, Dot, Label, Element, Draw, Simulation, Circuit
draw = Draw(["/usr/share/kicad/symbols", "lib/symbols"]) \
draw = Draw(["/usr/share/kicad/symbols", "../../lib/symbols"]) \
+ Element("U1", "elektrophon:4007N", value="4007", unit=1, Spice_Primitive="X", Spice_Model="CMOS4007")
draw.plot(scale=15.0, theme='BlackWhite')
Expand All @@ -41,7 +41,7 @@ First i am going to build an amplifier with the chip. ....
from elektron import Line, Dot, Label, Element, Draw, Simulation, Circuit
import json
draw = (Draw(["/usr/share/kicad/symbols", "lib/symbols"])
draw = (Draw(["/usr/share/kicad/symbols", "../../lib/symbols"])
+ Element("U1", "elektrophon:4007N", value="4007", unit=1, Spice_Primitive="X", Spice_Model="CMOS4007")
+ Element("Rin", "Device:R", value="100k", unit=1, Spice_Netlist_Enabled="Y").rotate(270)
Expand Down Expand Up @@ -73,7 +73,7 @@ draw = (Draw(["/usr/share/kicad/symbols", "lib/symbols"])
print(draw.erc())
circuit = draw.circuit(['lib/spice'])
circuit = draw.circuit(['../../lib/spice'])
circuit.voltage("1", "+5V", "GND", "5V")
circuit.voltage("2", "IN", "GND", "5V PULSE(-1, 1, 0, 2ms, 2ms, 1n, 4ms 0)")
circuit.control('''
Expand Down Expand Up @@ -103,7 +103,7 @@ from elektron import Line, Dot, Label, Element, Draw, Simulation, Circuit
import numpy as np
import json
draw = (Draw(["/usr/share/kicad/symbols", "lib/symbols"])
draw = (Draw(["/usr/share/kicad/symbols", "../../lib/symbols"])
+ Label("CV").rotate(180)
+ Line()
+ Element("R10", "Device:R", value="100k", unit=1, Spice_Netlist_Enabled="Y").rotate(90)
Expand Down Expand Up @@ -178,7 +178,7 @@ draw = (Draw(["/usr/share/kicad/symbols", "lib/symbols"])
print(draw.erc())
circuit = draw.circuit(['lib/spice'])
circuit = draw.circuit(['../../lib/spice'])
circuit.voltage("1", "+5V", "GND", "DC 15V")
circuit.voltage("2", "CV", "GND", "DC 2.5V") # SIN(10, 2, 100)")
# circuit.voltage("3", "INPUT", "GND", "SIN(0, 2.5, 1000)")
Expand Down Expand Up @@ -230,7 +230,7 @@ This is the first setup with the 4069 as a voltage follower. C1 and C2 are DC bl

```{python error=TRUE, echo=FALSE, results="nohide", fig.align='center', fig.cap='digital logic'}
circuit = draw.circuit(['lib/spice'])
circuit = draw.circuit(['../../lib/spice'])
circuit.voltage("1", "+5V", "GND", "DC 15V")
circuit.voltage("2", "CV", "GND", "DC 2V")
circuit.voltage("3", "INPUT", "GND", "SIN(0, 2, 100)")
Expand Down Expand Up @@ -259,7 +259,7 @@ from elektron import Line, Dot, Label, Element, Draw, Simulation, Circuit
import numpy as np
import json
draw = (Draw(["/usr/share/kicad/symbols", "lib/symbols"])
draw = (Draw(["/usr/share/kicad/symbols", "../../lib/symbols"])
+ Label("CV").rotate(180)
+ Line()
+ Element("R10", "Device:R", value="100k", unit=1, Spice_Netlist_Enabled="Y").rotate(90)
Expand Down Expand Up @@ -323,7 +323,7 @@ draw = (Draw(["/usr/share/kicad/symbols", "lib/symbols"])
print(draw.erc())
circuit = draw.circuit(['lib/spice'])
circuit = draw.circuit(['../../lib/spice'])
circuit.voltage("1", "+15V", "GND", "DC 15V")
circuit.voltage("2", "-15V", "GND", "DC -5V")
circuit.voltage("3", "CV", "GND", "DC 5V") # SIN(10, 2, 100)")
Expand Down
8 changes: 4 additions & 4 deletions src/4046/index.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tags:
categories:
- module
title: "4046"
references:
references:
- { description: "Thomas Henry X-4046",
title: "Birth of a Synth",
url: "http://birthofasynth.com/Thomas_Henry/Pages/X-4046.html" }
Expand All @@ -18,7 +18,7 @@ draft: False
```{elektron, command="erc", input=["main", "mount"]}```
```{elektron, command="drc", input=["main", "mount"]}```
```{elektron, command="schema", input=["main", "mount"], border=TRUE, theme="Mono"}```
```{elektron, command="pcb", input=["main", "mount", "panel"], border=TRUE}```
```{elektron, command="pcb", input=["main", "mount", "panel"], border=FALSE}```
```{elektron, command="gerber", input=["main", "mount", "panel"]}```
---

Expand All @@ -37,7 +37,7 @@ the gerber files are part of the release. it should be possible to directly orde

the different waveforms are combined out of different parts and you will have to combine those by calibrating the vco. i recommend doing that with an oszilloscope.

connect your scope to the triangle wave output.
bring the oscillator to 1kHz with the coarse and fine adjustments.
connect your scope to the triangle wave output.
bring the oscillator to 1kHz with the coarse and fine adjustments.
then you can calibrate the triangle wave. as you can see in the scope there is a falling and raising slope. use the two triangle connect trimpots (TC1/2) to bring them together.

3 changes: 3 additions & 0 deletions src/4069/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NAME=4069

include ../../article.mk
10 changes: 5 additions & 5 deletions src/4069/index.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ draw = (Draw(["/usr/share/kicad/symbols"])
+ Element("+5V", "power:+5V", value="+5V", on_schema=False).at("U1", "14")
+ Element("GND", "power:GND", value="GND", on_schema=False).at("U1", "7"))
circuit = draw.circuit(["lib/spice"])
circuit = draw.circuit(["../../lib/spice"])
circuit.voltage("1", "+5V", "GND", "DC 5V")
circuit.voltage("2", "IN", "GND", "DC 5 AC 2.5V SIN(0 2.5V 100)")
circuit.control('''let r_act = 100k
Expand Down Expand Up @@ -163,7 +163,7 @@ draw = (Draw(["/usr/share/kicad/symbols"])
+ Element("+5V", "power:+5V", value="+5V", on_schema=False).at("U1", "14")
+ Element("GND", "power:GND", value="GND", on_schema=False).at("U1", "7"))
circuit = draw.circuit(["lib/spice"])
circuit = draw.circuit(["../../lib/spice"])
circuit.voltage("1", "+5V", "GND", "DC 5V")
circuit.voltage("2", "IN1", "GND", "DC 5 AC 2.5V SIN(0 2.5V 500)")
circuit.voltage("3", "IN2", "GND", "DC 5 AC 2.5V SIN(0 2.5V 1k)")
Expand Down Expand Up @@ -213,7 +213,7 @@ draw = (Draw(["/usr/share/kicad/symbols"])
+ Element("+5V", "power:+5V", value="+5V", on_schema=False).at("U1", "14")
+ Element("GND", "power:GND", value="GND", on_schema=False).at("U1", "7"))
circuit = draw.circuit(["lib/spice"])
circuit = draw.circuit(["../../lib/spice"])
circuit.voltage("1", "+5V", "GND", "DC 5V")
circuit.voltage("2", "IN", "GND", "AC 5V SIN(0 5V 500)")
circuit.control('''
Expand Down Expand Up @@ -315,7 +315,7 @@ draw = (Draw(["/usr/share/kicad/symbols"])
+ Element("GND", "power:GND", value="GND", unit=1, on_schema="no").at("U4", "7")
+ Element("+5V", "power:+5V", value="+5V", unit=1, on_schema="no").at("U4", "14"))
circuit = draw.circuit(["lib/spice"])
circuit = draw.circuit(["../../lib/spice"])
circuit.voltage("1", "+5V", "GND", "DC 15V")
circuit.voltage("2", "IN", "GND", "AC 5V SIN(0 2V 1k)")
circuit.control('''
Expand Down Expand Up @@ -433,7 +433,7 @@ draw = (Draw(["/usr/share/kicad/symbols"])
+ Element("GND", "power:GND", value="GND", unit=1, on_schema="no").at("U4", "7")
+ Element("+5V", "power:+5V", value="+5V", unit=1, on_schema="no").at("U4", "14"))
circuit = draw.circuit(["lib/spice"])
circuit = draw.circuit(["../../lib/spice"])
circuit.voltage("1", "+5V", "GND", "DC 15V")
circuit.voltage("2", "IN", "GND", "AC 5V SIN(0 5V 1k)")
circuit.control('''
Expand Down
4 changes: 2 additions & 2 deletions src/adsr/index.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tags:
categories:
- module
title: "adsr"
references:
references:
- { description: "René Schmitz",
title: "Fastest envelope in the west",
url: "https://www.schmitzbits.de/adsr.html" }
Expand All @@ -27,7 +27,7 @@ draft: False
```{elektron, command="erc", input=["main"]}```
```{elektron, command="drc", input=["main"]}```
```{elektron, command="schema", input=["main"], border=TRUE, theme="Mono"}```
```{elektron, command="pcb", input=["main", "panel"], border=TRUE}```
```{elektron, command="pcb", input=["main", "panel"], border=FALSE}```
```{elektron, command="gerber", input=["main", "panel"]}```
---

Expand Down
Loading

0 comments on commit caced54

Please sign in to comment.