diff --git a/.gitignore b/.gitignore
index a230a78..3037be0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,5 @@
.venv/
+venv/
__pycache__/
+.idea/
+.ropeproject
diff --git a/Templates/Spec.txt b/Templates/Spec.txt
new file mode 100644
index 0000000..a4ee57c
--- /dev/null
+++ b/Templates/Spec.txt
@@ -0,0 +1 @@
+Cílem této větve je vytvořit pinout_diagram.py který nebude muset být editová pro každý jenotlivý devkit.
diff --git a/Templates/data.py b/Templates/data.py
new file mode 100644
index 0000000..f190566
--- /dev/null
+++ b/Templates/data.py
@@ -0,0 +1,229 @@
+#Names
+brdName = "esp32_lpkit" #add board name here
+brdImgName = "esp32_lpkit.png" #add name of board .png
+
+
+D_WIDTH = 1920 #resulting diagram width
+D_HEIGHT = 1080 #resulting diagram height
+
+
+#Hardware coordinates, add your hardware in the format ("name", x, y)
+hwCoordiantes =[("3v3", 10, 81), ("3v3", 10, 81), ("gnd", 221, 79), ("pin_pitch_v", 0, 23), ("pin_pitch_h", 30, 0), ("usb_power", 112, 610), ("usup", 15, 476), ("bat", 230, 485)]
+
+
+#certain labels don't generate properly, as the image gets moved by pinout_diagram.py. This calculates that same shift and allows it to be applied to pin labels
+from pinout.core import Group, Image
+image = Image(brdImgName, embed=True)
+wid_shift = (D_WIDTH-image.width) // 2 #image.x
+hgt_shift = 32 * 4 #image.y
+
+# Text
+title = "LaskaKit ESP32-LPKit Pinout"
+
+legend = [
+ ("Analog", "analog"),
+ ("Other", "other"),
+ ("Ground", "gnd"),
+ ("GPIO", "gpio"),
+ ("Power", "pwr"),
+ ("RTC", "rtc"),
+ ("I2C", "i2c"),
+ ("SPI", "spi"),
+ ("UART", "uart"),
+]
+
+# Pinlabels. Each pin is an array of touples, with each touple being in the format of (TEXT, appearance)
+
+left_header = [
+ [
+ ("3V3", "pwr"),
+ ],
+ [
+ ("EN", "pwr"),
+ ],
+ [
+ ("GP36", "gpio"),
+ ("ADC1_0", "analog"),
+ ("RTC_IO0", "rtc"),
+ ("SENSOR_VP", "other"),
+ ("INPUT ONLY", "other"),
+ ],
+ [
+ ("GP39", "gpio"),
+ ("ADC1_3", "analog"),
+ ("RTC_IO3", "rtc"),
+ ("SENSOR_VN", "other"),
+ ("INPUT ONLY", "other"),
+ ],
+ [
+ ("GP34", "gpio"),
+ ("ADC1_6", "analog"),
+ ("RTC_IO4", "rtc"),
+ ("INPUT ONLY", "other"),
+ ],
+ [
+ ("GP35", "gpio"),
+ ("ADC1_7", "analog"),
+ ("RTC_IO5", "rtc"),
+ ("INPUT ONLY", "other"),
+ ],
+ [
+ ("GP32", "gpio"),
+ ("ADC1_4", "analog"),
+ ("RTC_IO9", "rtc"),
+ ("Touch9", "other"),
+ ("XTAL_32_P", "other"),
+ ],
+ [
+ ("GP33", "gpio"),
+ ("ADC1_5", "analog"),
+ ("RTC_IO8", "rtc"),
+ ("Touch8", "other"),
+ ("XTAL_32_N", "other"),
+ ],
+ [
+ ("GP25", "gpio"),
+ ("ADC2_8", "analog"),
+ ("RTC_IO6", "rtc"),
+ ("DAC1", "other"),
+ ],
+ [
+ ("GP26", "gpio"),
+ ("ADC2_9", "analog"),
+ ("RTC_IO7", "rtc"),
+ ("DAC2", "other"),
+ ],
+ [
+ ("GP27", "gpio"),
+ ("ADC2_7", "analog"),
+ ("RTC_IO17", "rtc"),
+ ("Touch7", "other"),
+ ],
+ [
+ ("GP14", "gpio"),
+ ("ADC2_6", "analog"),
+ ("RTC_IO16", "rtc"),
+ ("Touch6", "other"),
+ ("HSPI_CLK", "spi"),
+ ],
+ [
+ ("GP12", "gpio"),
+ ("ADC2_5", "analog"),
+ ("RTC_IO15", "rtc"),
+ ("Touch5", "other"),
+ ("HSPI_MISO", "spi"),
+ ],
+ [
+ ("GND", "gnd"),
+ ],
+ [
+ ("GP13", "gpio"),
+ ("ADC2_4", "analog"),
+ ("RTC_IO14", "rtc"),
+ ("Touch4", "other"),
+ ("HSPI_MOSI", "spi"),
+ ],
+ [
+ ("VCC", "pwr"),
+ ],
+]
+
+
+right_header = [
+ [
+ ("GND", "gnd"),
+ ],
+ [
+ ("GP23", "gpio"),
+ ("VSPI_MOSI", "spi"),
+ ],
+ [
+ ("GP22", "gpio"),
+ ("SCL", "i2c"),
+ ],
+ [
+ ("GP1", "gpio"),
+ ("TXD_0", "uart"),
+ ],
+ [
+ ("GP3", "gpio"),
+ ("RXD_0", "uart"),
+ ],
+ [
+ ("GP21", "gpio"),
+ ("I2C_SCL", "i2c"),
+ ],
+ [
+ ("GND", "gnd"),
+ ],
+ [
+ ("GP19", "gpio"),
+ ("VSPI_MISO", "spi"),
+ ],
+ [
+ ("GP18", "gpio"),
+ ("VSPI_CLK", "spi"),
+ ],
+ [
+ ("GP5", "gpio"),
+ ("VSPI_CS0", "spi"),
+ ],
+ [
+ ("GP17", "gpio"),
+ ("TXD_2", "uart"),
+ ],
+ [
+ ("GP16", "gpio"),
+ ("RXD_2", "uart"),
+ ],
+ [
+ ("GP4", "gpio"),
+ ("ADC2_0", "adc"),
+ ("RTC_IO10", "rtc"),
+ ("Touch0", "other"),
+ ],
+ [
+ ("GP0", "gpio"),
+ ("ADC2_1", "adc"),
+ ("RTC_IO11", "rtc"),
+ ("Touch1", "other"),
+ ],
+ [
+ ("GP2", "gpio"),
+ ("ADC2_2", "adc"),
+ ("RTC_IO12", "rtc"),
+ ("Touch2", "other"),
+ ],
+ [
+ ("GP15", "gpio"),
+ ("ADC2_3", "adc"),
+ ("RTC_IO13", "rtc"),
+ ("Touch3", "other"),
+ ("HSPI_CS0", "spi"),
+ ],
+]
+
+def linear_search(data, target):
+ for tup in data:
+ if target in tup:
+ return tup
+ return None
+
+
+#content, x, y, tag, scale, body, leaderline
+#hwCoordiantes =[("3v3", 10, 81), ("3v3", 10, 81), ("gnd", 221, 79), ("pin_pitch_v", 0, 23), ("pin_pitch_h", 30, 0), ("usb_power", 112, 610), ("usup", 0, 476), ("bat", 230, 485)]
+#linear_search(hwCoordiantes, "usb_power")
+graphicPinLabels = [("USB-POWER", linear_search(hwCoordiantes, "usb_power")[1], linear_search(hwCoordiantes, "usb_power")[2], "pwr", (1, 1), {"x": 100, "y": 30, "width": 100, "height": 30}, {"direction": "vh"}),
+ ("uSup i2c", linear_search(hwCoordiantes, "usup")[1], linear_search(hwCoordiantes, "usup")[2], "i2c", (-1,1), {"x": 30, "y": 0, "width": 100, "height": 30}, None),
+ ("battery connector", linear_search(hwCoordiantes, "bat")[1], linear_search(hwCoordiantes, "bat")[2], "pwr", (1, 1), {"x": 30, "y": 0, "width": 150, "height": 30}, None)
+ ]
+graphicPinLabelGroups = [(linear_search(hwCoordiantes, "gnd")[1], linear_search(hwCoordiantes, "gnd")[2], linear_search(hwCoordiantes, "pin_pitch_v"), (30, 0), (0, 23), (1, 1), right_header, {"height": 20, "width": 100}),
+ (linear_search(hwCoordiantes, "3v3")[1], linear_search(hwCoordiantes, "3v3")[2], linear_search(hwCoordiantes, "pin_pitch_v"),(30, 0), (0, 23), (-1, 1), left_header, {"height": 20, "width": 100})
+ ]
+
+
+# description = """Python tool kit to assist with
+# documentation of electronic hardware.
+# More info at pinout.readthedocs.io"""
+
+
diff --git a/Templates/esp32_lpkit.png b/Templates/esp32_lpkit.png
new file mode 100644
index 0000000..27533b3
Binary files /dev/null and b/Templates/esp32_lpkit.png differ
diff --git a/Templates/pinout_diagram.py b/Templates/pinout_diagram.py
new file mode 100644
index 0000000..dfbb650
--- /dev/null
+++ b/Templates/pinout_diagram.py
@@ -0,0 +1,92 @@
+###########################################
+#
+# Example script to build a
+# pinout diagram. Includes basic
+# features and convenience classes.
+#
+###########################################
+
+from pinout.core import Group, Image
+from pinout.components.layout import Diagram
+from pinout.components.pinlabel import PinLabelGroup, PinLabel
+from pinout.components.text import TextBlock
+from pinout.components.legend import Legend
+#import cv2
+
+# Import data for the diagram
+import data
+from data import brdImgName
+
+# Read image data UNUSED - READING IMAGE DATA UNNECESSARY.
+# img = cv2.imread(brdImgName)
+
+# Create a new diagram
+# The Diagram_2Rows class provides 2 panels,
+# 'panel_01' and 'panel_02', to insert components into.
+
+
+D_WIDTH = data.D_WIDTH
+D_HEIGHT = data.D_HEIGHT
+
+diagram = Diagram(D_WIDTH, D_HEIGHT, data.brdName)
+
+
+# Add a stylesheet
+diagram.add_stylesheet("styles.css", embed=True)
+
+# Create a group to hold the pinout-diagram components.
+graphic = diagram.add(Group())
+
+# Add and embed an image
+image = Image(data.brdImgName, embed=True)
+image.x = (diagram.width - image.width) // 2 # center the image\
+image.y = 32 * 4
+hardware = graphic.add(image)
+
+# Measure and record key locations with the hardware Image instance
+for name, x, y in data.hwCoordiantes:
+ hardware.add_coord(name, x, y)
+
+
+for content, x, y, tag, scale, body, leaderline in data.graphicPinLabels:
+ graphic.add(PinLabel(
+ content=content,
+ x=x + data.wid_shift,
+ y=y + data.hgt_shift,
+ tag=tag,
+ scale = scale,
+ body=body,
+ leaderline=leaderline,
+ )
+)
+
+for x, y, pin_pitch, label_start, label_pitch, scale, labels, body in data.graphicPinLabelGroups:
+ graphic.add(
+ PinLabelGroup(
+ x = x + data.wid_shift,
+ y = y + data.hgt_shift,
+ pin_pitch = (hardware.coord("pin_pitch_v", raw=True)),
+ label_start = label_start,
+ label_pitch = label_pitch,
+ scale = scale,
+ labels = labels,
+ body = body,
+ )
+ )
+
+# Title
+title = TextBlock(data.title)
+title.x = 16 * 3
+title.y = 32 * 3
+diagram.add(title)
+
+
+# Create a legend
+legend = Legend(data.legend)
+legend.x = 32
+legend.y = 32 * 8
+diagram.add(legend)
+
+with open("diagram.svg", "w") as f:
+ f.write(diagram.render())
+
diff --git a/Templates/styles.css b/Templates/styles.css
new file mode 100644
index 0000000..92c49bf
--- /dev/null
+++ b/Templates/styles.css
@@ -0,0 +1,178 @@
+:root {
+ --varMoveSwatch: -30px; /*Change this value to move swatch, var(--varMoveSwatch)*/
+ --varMovePinLabelText: -7px; /*Change this value to move pin label text, var(--varMovePinLabelText)*/
+}
+
+text {
+ font-family: Verdana, Georgia, sans-serif;
+ font-size: 24px;
+ font-weight: bold;
+}
+
+.pinlabel__leader{
+ stroke-width: 2;
+ fill: none;
+ text-anchor: middle;
+}
+
+.pinlabel__text{
+ fill: #fff;
+ font-weight: bold;
+ stroke-width: 0;
+ baseline-shift: var(--varMovePinLabelText);
+ text-anchor: middle;
+}
+
+
+.i2c .pinlabel__body{
+ fill: rgb(0, 100, 173);
+}
+.i2c .pinlabel__leader{
+ stroke: rgb(0, 100, 173);
+}
+.i2c .swatch__body {
+ fill: rgb(0, 100, 173);
+ font-size: 32px;
+ text-align: left;
+ transform: translate(var(--varMoveSwatch),0px);
+}
+
+.pwr .pinlabel__body{
+ fill: rgb(173, 0, 0);
+}
+.pwr .pinlabel__leader{
+ stroke: rgb(173, 0, 0);
+}
+.pwr .swatch__body {
+ fill: rgb(173, 0, 0);
+ font-size: 24px;
+ text-align: left;
+ transform: translate(var(--varMoveSwatch),0px);
+
+}
+.uart .pinlabel__body{
+ fill: rgb(182, 69, 176);
+}
+.uart .pinlabel__leader{
+ stroke: rgb(182, 69, 176);
+}
+.uart .swatch__body {
+ fill: rgb(182, 69, 176);
+ font-size: 24px;
+ text-anchor: start;
+ transform: translate(var(--varMoveSwatch),0px);
+}
+.gpio .pinlabel__body{
+ fill: rgb(160, 133, 26);
+}
+.gpio .pinlabel__leader{
+ stroke: rgb(160, 133, 26);
+}
+.gpio .swatch__body {
+ fill: rgb(160, 133, 26);
+ font-size: 24px;
+ text-anchor: start;
+ transform: translate(var(--varMoveSwatch),0px);
+}
+.analog .pinlabel__body{
+ fill: rgb(32, 150, 165);
+}
+.analog .pinlabel__leader{
+ stroke: rgb(32, 150, 165);
+}
+.analog .swatch__body {
+ fill: rgb(32, 150, 165);
+ font-size: 24px;
+ text-anchor: start;
+ transform: translate(var(--varMoveSwatch),0px);
+}
+.gnd .pinlabel__body{
+ fill: rgb(0, 0, 0);
+}
+.gnd .pinlabel__leader{
+ stroke: rgb(0, 0, 0);
+}
+.gnd .swatch__body {
+ fill: rgb(0, 0, 0);
+ font-size: 24px;
+ text-anchor: start;
+ transform: translate(var(--varMoveSwatch),0px);
+}
+.spi .pinlabel__body{
+ fill: rgb(151, 76, 23);
+}
+.spi .pinlabel__leader{
+ stroke: rgb(151, 76, 23);
+}
+.spi .swatch__body {
+ fill: rgb(151, 76, 23);
+ font-size: 24px;
+ text-anchor: start;
+ transform: translate(var(--varMoveSwatch),0px);
+}
+.touch .pinlabel__body{
+ fill: rgb(230, 87, 10);
+}
+.touch .pinlabel__leader{
+ stroke: rgb(230, 87, 10);
+}
+.touch .swatch__body {
+ fill: rgb(230, 87, 10);
+ font-size: 24px;
+ text-anchor: start;
+ transform: translate(var(--varMoveSwatch),0px);
+}
+
+.rtc .pinlabel__body{
+ fill: rgb(100, 200, 10);
+}
+.rtc .pinlabel__leader{
+ stroke: rgb(100, 200, 10);
+}
+.rtc .swatch__body {
+ fill: rgb(100, 200, 10);
+ font-size: 24px;
+ text-anchor: start;
+ transform: translate(-29px,0px);
+}
+
+.other .pinlabel__body{
+ fill: rgb(200, 200, 200);
+}
+.other .pinlabel__leader{
+ stroke: rgb(200, 200, 200);
+}
+.other .swatch__body {
+ fill: rgb(200, 200, 200);
+ font-size: 40px;
+ transform: translate(var(--varMoveSwatch),0px);
+
+}
+
+.panel__inner {
+ fill: #fff;
+}
+.panel__outer {
+ fill: #333;
+}
+
+.legendentry text {
+ dominant-baseline: central;
+ text-anchor: middle;
+}
+
+.title {
+ font-size: 60px;
+ /* font-style: italic; */
+}
+
+.italic{
+ font-style: italic;
+}
+.strong{
+ font-weight: bold;
+}
+
+.panel--info .panel__inner{
+ fill: #f4f4f4;
+}
diff --git a/esp32_lan/data.py b/esp32_lan/data.py
new file mode 100644
index 0000000..f1d49e2
--- /dev/null
+++ b/esp32_lan/data.py
@@ -0,0 +1,154 @@
+#Names
+brdName = "esplan" #add board name here
+brdImgName = "esplan.png" #add name of board .png
+
+
+D_WIDTH = 1920 #resulting diagram width
+D_HEIGHT = 1200 #resulting diagram height
+
+
+#Hardware coordinates, add your hardware in the format ("name", x, y)
+hwCoordiantes =[("3v3", 303, 627), ("pin_pitch_v", 27, 0), ("pin_pitch_h", 0, 30), ("usb_power", 42, 506), ("usup", 240, 620)]
+
+
+#certain labels don't generate properly, as the image gets moved by pinout_diagram.py. This calculates that same shift and allows it to be applied to pin labels
+from pinout.core import Group, Image
+image = Image(brdImgName, embed=True)
+wid_shift = (D_WIDTH-image.width) // 2 #image.x
+hgt_shift = 32 * 4 #image.y
+
+# Text
+title = "LaskaKit ESP32-LPKit Pinout"
+
+legend = [
+ ("Analog", "analog"),
+ ("Other", "other"),
+ ("Ground", "gnd"),
+ ("GPIO", "gpio"),
+ ("Power", "pwr"),
+ ("RTC", "rtc"),
+ ("I2C", "i2c"),
+ ("SPI", "spi"),
+ ("UART", "uart"),
+]
+
+# Pinlabels. Each header array is an array of pins. Each pin is an array of touples, with each touple being in the format of (TEXT, appearance)
+
+header = [
+ [
+ ("3V3", "pwr"),
+ ],
+ [
+ ("VCC", "pwr"),
+ ],
+ [
+ ("GND", "gnd"),
+ ],
+ [
+ ("GP34", "gpio"),
+ ("ADC1_6", "analog"),
+ ("RTC_IO4", "rtc"),
+ ("INPUT ONLY", "other"),
+ ],
+ [
+ ("GP35", "gpio"),
+ ("ADC1_7", "analog"),
+ ("RTC_IO5", "rtc"),
+ ("INPUT ONLY", "other"),
+ ],
+ [
+ ("GP32", "gpio"),
+ ("ADC1_4", "analog"),
+ ("RTC_IO9", "rtc"),
+ ("Touch9", "other"),
+ ("XTAL_32_P", "other"),
+ ],
+ [
+ ("GP33", "gpio"),
+ ("ADC1_4", "analog"),
+ ("RTC_IO9", "rtc"),
+ ("Touch9", "other"),
+ ("XTAL_32_P", "other"),
+ ],
+ [
+ ("GPO0", "gpio"),
+ ("ADC1_5", "analog"),
+ ("RTC_IO8", "rtc"),
+ ("Touch8", "other"),
+ ("XTAL_32_N", "other"),
+ ],
+ [
+ ("TX1", "uart"),
+ ],
+ [
+ ("GPO16", "gpio"),
+ ("ADC2_8", "analog"),
+ ("RTC_IO6", "rtc"),
+ ("DAC1", "other"),
+ ],
+ [
+ ("GPO13", "gpio"),
+ ("ADC2_9", "analog"),
+ ("RTC_IO7", "rtc"),
+ ("DAC2", "other"),
+ ],
+ [
+ ("GPO12", "gpio"),
+ ("ADC2_7", "analog"),
+ ("RTC_IO17", "rtc"),
+ ("Touch7", "other"),
+ ],
+ [
+ ("GPO14", "gpio"),
+ ("ADC2_6", "analog"),
+ ("RTC_IO16", "rtc"),
+ ("Touch6", "other"),
+ ("HSPI_CLK", "spi"),
+ ],
+ [
+ ("SNS_VN", "gpio"),
+ ],
+ [
+ ("RX1", "uart"),
+ ],
+ [
+ ("EN", "pwr"),
+ ],
+]
+
+def linear_search(data, target):
+ for tup in data:
+ if target in tup:
+ return tup
+ return None
+
+
+#content
+#x
+#y
+#tag
+#scale
+#body
+#leaderline
+
+graphicPinLabels = [("USB-POWER", linear_search(hwCoordiantes, "usb_power")[1], linear_search(hwCoordiantes, "usb_power")[2], "pwr", (1, 1), {"x": 100, "y": 30, "width": 100, "height": 30}, {"direction": "vh"}),
+ ("uSup i2c", linear_search(hwCoordiantes, "usup")[1], linear_search(hwCoordiantes, "usup")[2], "i2c", (-1,1), {"x": 100, "y": -30, "width": 100, "height": 30}, None),
+ ]
+
+#x, y: HW coordinates
+#pin_pitch - space between pins
+#label_start
+#label_pitch
+#scale - move this first one to change start of labels
+#labels
+#body
+
+graphicPinLabelGroups = [(linear_search(hwCoordiantes, "3v3")[1], linear_search(hwCoordiantes, "3v3")[2], linear_search(hwCoordiantes, "pin_pitch_v"),(30, 40), (0, 23), (-1, 0.9), header, {"height": 20, "width": 100})
+ ]
+
+
+# description = """Python tool kit to assist with
+# documentation of electronic hardware.
+# More info at pinout.readthedocs.io"""
+
+
diff --git a/esp32_lan/esplan.png b/esp32_lan/esplan.png
new file mode 100644
index 0000000..174ac94
Binary files /dev/null and b/esp32_lan/esplan.png differ
diff --git a/esp32_lan/pinout_diagram.py b/esp32_lan/pinout_diagram.py
new file mode 100644
index 0000000..23dae9d
--- /dev/null
+++ b/esp32_lan/pinout_diagram.py
@@ -0,0 +1,91 @@
+###########################################
+#
+# Example script to build a
+# pinout diagram. Includes basic
+# features and convenience classes.
+#
+###########################################
+
+from pinout.core import Group, Image
+from pinout.components.layout import Diagram
+from pinout.components.pinlabel import PinLabelGroup, PinLabel
+from pinout.components.text import TextBlock
+from pinout.components.legend import Legend
+#import cv2
+
+# Import data for the diagram
+import data
+from data import brdImgName
+
+# Read image data UNUSED - READING IMAGE DATA UNNECESSARY.
+# img = cv2.imread(brdImgName)
+
+# Create a new diagram
+# The Diagram_2Rows class provides 2 panels,
+# 'panel_01' and 'panel_02', to insert components into.
+
+
+D_WIDTH = data.D_WIDTH
+D_HEIGHT = data.D_HEIGHT
+
+diagram = Diagram(D_WIDTH, D_HEIGHT, data.brdName)
+
+
+# Add a stylesheet
+diagram.add_stylesheet("styles.css", embed=True)
+
+# Create a group to hold the pinout-diagram components.
+graphic = diagram.add(Group())
+
+# Add and embed an image
+image = Image(data.brdImgName, embed=True)
+image.x = (diagram.width - image.width) // 2 # center the image\
+image.y = 32 * 4
+hardware = graphic.add(image)
+
+# Measure and record key locations with the hardware Image instance
+for name, x, y in data.hwCoordiantes:
+ hardware.add_coord(name, x, y)
+
+
+for content, x, y, tag, scale, body, leaderline in data.graphicPinLabels:
+ graphic.add(PinLabel(
+ content=content,
+ x=x + data.wid_shift,
+ y=y + data.hgt_shift,
+ tag=tag,
+ scale = scale,
+ body=body,
+ leaderline=leaderline,
+ )
+)
+
+for x, y, pin_pitch, label_start, label_pitch, scale, labels, body in data.graphicPinLabelGroups:
+ graphic.add(
+ PinLabelGroup(
+ x = x + data.wid_shift,
+ y = y + data.hgt_shift,
+ pin_pitch = (hardware.coord("pin_pitch_v", raw=True)),
+ label_start = label_start,
+ label_pitch = label_pitch,
+ scale = scale,
+ labels = labels,
+ body = body,
+ )
+ )
+
+# Title
+title = TextBlock(data.title)
+title.x = 16 * 3
+title.y = 32 * 3
+diagram.add(title)
+
+
+# Create a legend
+legend = Legend(data.legend)
+legend.x = 32
+legend.y = 32 * 8
+diagram.add(legend)
+
+with open("diagram.svg", "w") as f:
+ f.write(diagram.render())
diff --git a/esp32_lan/styles.css b/esp32_lan/styles.css
new file mode 100644
index 0000000..e896830
--- /dev/null
+++ b/esp32_lan/styles.css
@@ -0,0 +1,140 @@
+text {
+ font-family: Verdana, Georgia, sans-serif;
+ font-size: 14px;
+ font-weight: normal;
+}
+
+.pinlabel__leader{
+ stroke-width: 2;
+ fill: none;
+}
+
+.pinlabel__text{
+ dominant-baseline: central;
+ fill: #fff;
+ font-weight: bold;
+ stroke-width: 0;
+ text-anchor: middle;
+}
+
+
+.i2c .pinlabel__body{
+ fill: rgb(0, 100, 173);
+}
+.i2c .pinlabel__leader{
+ stroke: rgb(0, 100, 173);
+}
+.i2c .swatch__body {
+ fill: rgb(0, 100, 173);
+}
+
+.pwr .pinlabel__body{
+ fill: rgb(173, 0, 0);
+}
+.pwr .pinlabel__leader{
+ stroke: rgb(173, 0, 0);
+}
+.pwr .swatch__body {
+ fill: rgb(173, 0, 0);
+}
+.uart .pinlabel__body{
+ fill: rgb(182, 69, 176);
+}
+.uart .pinlabel__leader{
+ stroke: rgb(182, 69, 176);
+}
+.uart .swatch__body {
+ fill: rgb(182, 69, 176);
+}
+.gpio .pinlabel__body{
+ fill: rgb(160, 133, 26);
+}
+.gpio .pinlabel__leader{
+ stroke: rgb(160, 133, 26);
+}
+.gpio .swatch__body {
+ fill: rgb(160, 133, 26);
+}
+.analog .pinlabel__body{
+ fill: rgb(32, 150, 165);
+}
+.analog .pinlabel__leader{
+ stroke: rgb(32, 150, 165);
+}
+.analog .swatch__body {
+ fill: rgb(32, 150, 165);
+}
+.gnd .pinlabel__body{
+ fill: rgb(0, 0, 0);
+}
+.gnd .pinlabel__leader{
+ stroke: rgb(0, 0, 0);
+}
+.gnd .swatch__body {
+ fill: rgb(0, 0, 0);
+}
+.spi .pinlabel__body{
+ fill: rgb(151, 76, 23);
+}
+.spi .pinlabel__leader{
+ stroke: rgb(151, 76, 23);
+}
+.spi .swatch__body {
+ fill: rgb(151, 76, 23);
+}
+.touch .pinlabel__body{
+ fill: rgb(230, 87, 10);
+}
+.touch .pinlabel__leader{
+ stroke: rgb(230, 87, 10);
+}
+.touch .swatch__body {
+ fill: rgb(230, 87, 10);
+}
+
+.rtc .pinlabel__body{
+ fill: rgb(100, 200, 10);
+}
+.rtc .pinlabel__leader{
+ stroke: rgb(100, 200, 10);
+}
+.rtc .swatch__body {
+ fill: rgb(100, 200, 10);
+}
+
+.other .pinlabel__body{
+ fill: rgb(200, 200, 200);
+}
+.other .pinlabel__leader{
+ stroke: rgb(200, 200, 200);
+}
+.other .swatch__body {
+ fill: rgb(200, 200, 200);
+}
+
+.panel__inner {
+ fill: #fff;
+}
+.panel__outer {
+ fill: #333;
+}
+
+.legendentry text {
+ dominant-baseline: central;
+}
+
+.title {
+ font-size: 32px;
+ /* font-style: italic; */
+}
+
+.italic{
+ font-style: italic;
+}
+.strong{
+ font-weight: bold;
+}
+
+.panel--info .panel__inner{
+ fill: #f4f4f4;
+}
diff --git a/esp32_lpkit/diagram.svg b/esp32_lpkit/diagram.svg
deleted file mode 100644
index 476071f..0000000
--- a/esp32_lpkit/diagram.svg
+++ /dev/null
@@ -1,6027 +0,0 @@
-
-
\ No newline at end of file
diff --git a/espInk/ESPink.png b/espInk/ESPink.png
new file mode 100644
index 0000000..7975026
Binary files /dev/null and b/espInk/ESPink.png differ
diff --git a/espInk/data.py b/espInk/data.py
new file mode 100644
index 0000000..34d6464
--- /dev/null
+++ b/espInk/data.py
@@ -0,0 +1,228 @@
+#Names
+from sndhdr import whathdr
+
+brdName = "ESPink" #add board name here
+brdImgName = "ESPink.png" #add name of board .png
+
+
+D_WIDTH = 3180 #resulting diagram width
+D_HEIGHT = 1860 #resulting diagram height
+
+
+#certain labels don't generate properly, as the image gets moved by pinout_diagram.py. This calculates that same shift and allows it to be applied to pin labels
+from pinout.core import Group, Image
+image = Image(brdImgName, embed=True)
+wid_shift = ((D_WIDTH-image.width) // 2) +200 #image.x
+hgt_shift = 32 * 4 #image.y
+
+# Text
+title = "LaskaKit ESP32-LPKit Pinout"
+
+legend = [
+ ("Analog ", "analog"),
+ ("Other ", "other"),
+ ("Ground ", "gnd"),
+ ("GPIO ", "gpio"),
+ ("Power ", "pwr"),
+ ("RTC ", "rtc"),
+ ("I2C ", "i2c"),
+ ("SPI ", "spi"),
+ ("UART ", "uart"),
+]
+
+legendSPI = [
+ ("CS - 46 ", "rtc"),
+ ("MOSI - 3 ", "mosi"),
+ ("SCK - 14 ", "scl"),
+ ("MISO - 21", "sda"),
+ ("3.3V - 47", "pwr"),
+ ("GND", "gnd")
+]
+
+legendI2C = [
+ ("GND", "gnd"),
+ ("3.3V - 47", "pwr"),
+ ("SDA - 42", "sda"),
+ ("SCL - 2 ", "scl")
+]
+
+legendList = [legendI2C, legendSPI, legend]
+legendCoords = [(-390, 1080), (870, 520), (32-wid_shift, 32*8-hgt_shift)]
+
+
+# Pinlabels. Each pin is an array of touples, with each touple being in the format of (TEXT, appearance)
+
+left_header = [
+ [
+ ("3V3", "pwr"),
+ ],
+ [
+ ("EN", "pwr"),
+ ],
+ [
+ ("GP4", "gpio"),
+ ("ADC1 CH3", "analog"),
+ ("TOUCH 4", "other"),
+ ("RTC_IO4", "rtc")
+ ],
+ [
+ ("GP5", "gpio"),
+ ("ADC1 CH4", "analog"),
+ ("TOUCH 5", "other"),
+ ("RTC_IO5", "rtc")
+ ],
+ [
+ ("GP6", "gpio"),
+ ("ADC1 CH5", "analog"),
+ ("TOUCH 6", "other"),
+ ("RTC_IO6", "rtc")
+ ],
+ [
+ ("GP7", "gpio"),
+ ("ADC1 CH6", "analog"),
+ ("TOUCH 7", "other"),
+ ("RTC_IO7", "rtc")
+ ],
+ [
+ ("GP15", "gpio"),
+ ("ADC2 CH4", "analog"),
+ ("TOUCH 12", "other"),
+ ("RTS_0", "spi"),
+ ("RTC_IO15", "rtc"),
+ ("RXD 1", "uart")
+ ],
+ [
+ ("GP16", "gpio"),
+ ("ADC2 CH5", "analog"),
+ ("CTS_0", "spi"),
+ ("RTC_IO16", "rtc"),
+ ("TXD 1", "uart")
+ ],
+ [
+ ("GP17", "gpio"),
+ ("ADC2 CH6", "analog"),
+ ("TXD 1", "spi"),
+ ("RTC_IO17", "rtc")
+ ],
+ [
+ ("GP18", "gpio"),
+ ("ADC2 CH7", "analog"),
+ ("RXD 1", "spi"),
+ ("RTC_IO18", "rtc"),
+ ("CLK_OUT3", "other")
+ ],
+ [
+ ("GP8", "gpio"),
+ ("ADC1 CH7", "analog"),
+ ("TOUCH 8", "other"),
+ ("RTC_IO8", "rtc"),
+ ("SDA", "i2c")
+ ],
+ [
+ ("GP19", "gpio"),
+ ("ADC2 CH8", "analog"),
+ ("RXD 2", "uart"),
+ ("RTS 1", "spi"),
+ ("RTC_IO19", "rtc"),
+ ("CLK_OUT2", "other"),
+ ("USB D+", "other")
+ ],
+ [
+ ("GP20", "gpio"),
+ ("ADC2 CH9", "analog"),
+ ("TXD 2", "uart"),
+ ("RTS 1", "spi"),
+ ("RTC_IO19", "rtc"),
+ ("CLK_OUT2", "other"),
+ ("USB D-", "other")
+ ],
+ [
+ ("GP3", "gpio"),
+ ("ADC1 CH2", "analog"),
+ ("TOUCH 3", "other"),
+ ("RTC_IO3", "rtc"),
+ ("JTAG", "other")
+ ],
+ [
+ ("GND", "gnd"),
+ ],
+ [
+ ("VCC", "pwr"),
+ ]
+
+
+
+]
+
+right_header = [
+ [
+ ("GND", "gnd"),
+ ],
+ [
+ ("GP1", "gpio"),
+ ("ADC1 CH0", "analog"),
+ ("TOUCH 1", "other"),
+ ("RTC_IO1", "rtc"),
+ ],
+ [
+ ("GP43", "gpio"),
+ ("CLK OUT1", "other"),
+ ("TXD 0","uart")
+ ],
+ [
+ ("GP44", "gpio"),
+ ("CLK OUT2", "other"),
+ ("RXD 0", "uart")
+ ],
+ [
+ ("GP41", "gpio"),
+ ("MTDI", "other")
+ ],
+ [
+ ("GP40", "gpio"),
+ ("CLK OUT2", "other"),
+ ("MTDO", "other"),
+ ("Pushbutton", "other")
+ ],
+ [
+ ("GP39", "gpio"),
+ ("CLK OUT3", "other"),
+ ("MTDCK", "other")
+ ],
+ [
+ ("If PSRAM = OFF", "pwr"),
+ ("GP35", "gpio"),
+ ("FSPIPW", "other")
+ ],
+]
+
+def linear_search(data, target):
+ for tup in data:
+ if target in tup:
+ return tup
+ return None
+
+
+#Hardware coordinates, add your hardware in the format ("name", x, y)
+hwCoordiantes =[("3v3", 50, 145), ("3v3", 10, 81), ("gnd", 560, 145), ("pin_pitch_v", 0, 51), ("pin_pitch_h", 50, 0), ("usb_power", 320, 1435), ("usup", 80, 1140), ("bat", 530, 790), ("disp", 570, 1150), ("SPI", 530, 640)]
+
+#content, x, y, tag, scale, body, leaderline
+#hwCoordiantes =[("3v3", 10, 81), ("3v3", 10, 81), ("gnd", 221, 79), ("pin_pitch_v", 0, 23), ("pin_pitch_h", 30, 0), ("usb_power", 112, 610), ("usup", 0, 476), ("bat", 230, 485)]
+#linear_search(hwCoordiantes, "usb_power")
+graphicPinLabels = [("USB-POWER", linear_search(hwCoordiantes, "usb_power")[1], linear_search(hwCoordiantes, "usb_power")[2], "pwr", (1, 1), {"x": 0, "y": 200, "width": 200, "height": 40}, {"direction": "vh"}),
+ ("μŠup i2c", linear_search(hwCoordiantes, "usup")[1], linear_search(hwCoordiantes, "usup")[2], "i2c", (-1,1), {"x": 100, "y": 0, "width": 200, "height": 40}, None),
+ ("Battery Connector", linear_search(hwCoordiantes, "bat")[1], linear_search(hwCoordiantes, "bat")[2], "pwr", (1, 1), {"x": 100, "y": 0, "width": 250, "height": 40}, None),
+ ("Display Connector", linear_search(hwCoordiantes, "disp")[1], linear_search(hwCoordiantes, "disp")[2], "other", (1, 1), {"x": 100, "y": 0, "width": 300, "height": 40}, None),
+ ("μŠup SPI", linear_search(hwCoordiantes, "SPI")[1], linear_search(hwCoordiantes, "SPI")[2], "spi", (1, 1), {"x": 100, "y": 0, "width": 210, "height": 40}, None)
+
+ ]
+graphicPinLabelGroups = [(linear_search(hwCoordiantes, "gnd")[1], linear_search(hwCoordiantes, "gnd")[2], linear_search(hwCoordiantes, "pin_pitch_v"), (50, 0), (0, 50), (1, 1), right_header, {"height": 38, "width": 200}),
+ (linear_search(hwCoordiantes, "3v3")[1], linear_search(hwCoordiantes, "3v3")[2], linear_search(hwCoordiantes, "pin_pitch_v"),(50, 0), (0, 50), (-1, 1), left_header, {"height": 38, "width": 200})
+ ]
+
+
+# description = """Python tool kit to assist with
+# documentation of electronic hardware.
+# More info at pinout.readthedocs.io"""
+
+
diff --git a/espInk/pinout_diagram.py b/espInk/pinout_diagram.py
new file mode 100644
index 0000000..dcb0413
--- /dev/null
+++ b/espInk/pinout_diagram.py
@@ -0,0 +1,108 @@
+###########################################
+#
+# Example script to build a
+# pinout diagram. Includes basic
+# features and convenience classes.
+#
+###########################################
+import swatch
+from pinout.core import Group, Image
+from pinout import config
+from pinout.components.layout import Diagram
+from pinout.components.pinlabel import PinLabelGroup, PinLabel
+from pinout.components.text import TextBlock
+from pinout.components.legend import Legend, Swatch
+from pinout.config import legend
+#import cv2
+
+# Import data for the diagram
+import data
+from data import brdImgName
+
+# Read image data UNUSED - READING IMAGE DATA UNNECESSARY.
+# img = cv2.imread(brdImgName)
+
+# Create a new diagram
+# The Diagram_2Rows class provides 2 panels,
+# 'panel_01' and 'panel_02', to insert components into.
+
+
+D_WIDTH = data.D_WIDTH
+D_HEIGHT = data.D_HEIGHT
+
+diagram = Diagram(D_WIDTH, D_HEIGHT, data.brdName)
+
+
+# Add a stylesheet
+diagram.add_stylesheet("styles.css", embed=True)
+
+# Create a group to hold the pinout-diagram components.
+graphic = diagram.add(Group())
+
+# Add and embed an image
+image = Image(data.brdImgName, embed=True)
+image.x = ((diagram.width - image.width) // 2) + 200 # center the image\
+image.y = 32 * 4
+hardware = graphic.add(image)
+
+# Measure and record key locations with the hardware Image instance
+for name, x, y in data.hwCoordiantes:
+ hardware.add_coord(name, x, y)
+
+
+for content, x, y, tag, scale, body, leaderline in data.graphicPinLabels:
+ graphic.add(PinLabel(
+ content=content,
+ x=x + data.wid_shift,
+ y=y + data.hgt_shift,
+ tag=tag,
+ scale = scale,
+ body=body,
+ leaderline=leaderline,
+ )
+)
+
+for x, y, pin_pitch, label_start, label_pitch, scale, labels, body in data.graphicPinLabelGroups:
+ graphic.add(
+ PinLabelGroup(
+ x = x + data.wid_shift,
+ y = y + data.hgt_shift,
+ pin_pitch = (hardware.coord("pin_pitch_v", raw=True)),
+ label_start = label_start,
+ label_pitch = label_pitch,
+ scale = scale,
+ labels = labels,
+ body = body,
+ )
+ )
+
+# Title
+title = TextBlock(data.title)
+title.x = 16 * 3
+title.y = 32 * 3
+diagram.add(title)
+
+config.legend["entry"]["height"] = 40
+config.legend["entry"]["swatch"]["height"] = 10
+
+
+# Create a legend
+#legend = Legend(data.legend)
+#legend.x = 32
+#legend.y = 32 * 8
+#legend.skewx = 200
+#diagram.add(legend)
+
+# Create legends
+
+for leg, loc in zip(data.legendList, data.legendCoords):
+ legend = Legend(leg)
+ legend.x = loc[0] + data.wid_shift
+ legend.y = loc[1] + data.hgt_shift
+ diagram.add(legend)
+
+
+
+with open("diagram.svg", "w") as f:
+ f.write(diagram.render())
+
diff --git a/espInk/styles.css b/espInk/styles.css
new file mode 100644
index 0000000..2cae5a6
--- /dev/null
+++ b/espInk/styles.css
@@ -0,0 +1,204 @@
+:root {
+ --varMoveSwatch: -0px; /*Change this value to move swatch, shouldn't be necessary, var(--varMoveSwatch)*/
+ --varMovePinLabelText: -7px; /*Change this value to move pin label text, var(--varMovePinLabelText)*/
+}
+
+text {
+ font-family: Verdana, Georgia, sans-serif;
+ font-size: 24px;
+ font-weight: bold;
+}
+
+.pinlabel__leader{
+ stroke-width: 2;
+ fill: none;
+ text-anchor: middle;
+}
+
+.pinlabel__text{
+ fill: #fff;
+ font-weight: bold;
+ stroke-width: 0;
+ baseline-shift: var(--varMovePinLabelText);
+ text-anchor: middle;
+}
+
+
+.i2c .pinlabel__body{
+ fill: rgb(0, 100, 173);
+}
+.i2c .pinlabel__leader{
+ stroke: rgb(0, 100, 173);
+}
+.i2c .swatch__body {
+ fill: rgb(0, 100, 173);
+ font-size: 32px;
+ transform: translate(var(--varMoveSwatch),0px);
+}
+
+.pwr .pinlabel__body{
+ fill: rgb(173, 0, 0);
+ text-align: left;
+}
+.pwr .pinlabel__leader{
+ stroke: rgb(173, 0, 0);
+ text-align: left;
+}
+.pwr .swatch__body {
+ fill: rgb(173, 0, 0);
+ font-size: 24px;
+ text-align: left;
+ transform: translate(var(--varMoveSwatch),0px);
+
+}
+.uart .pinlabel__body{
+ fill: rgb(182, 69, 176);
+}
+.uart .pinlabel__leader{
+ stroke: rgb(182, 69, 176);
+}
+.uart .swatch__body {
+ fill: rgb(182, 69, 176);
+ font-size: 24px;
+ transform: translate(var(--varMoveSwatch),0px);
+}
+.gpio .pinlabel__body{
+ fill: rgb(160, 133, 26);
+ text-align: left;
+}
+.gpio .pinlabel__leader{
+ stroke: rgb(160, 133, 26);
+ text-align: left;
+}
+.gpio .swatch__body {
+ fill: rgb(160, 133, 26);
+ font-size: 24px;
+ transform: translate(var(--varMoveSwatch),0px);
+}
+.analog .pinlabel__body{
+ fill: rgb(32, 150, 165);
+ text-align: left;
+}
+.analog .pinlabel__leader{
+ stroke: rgb(32, 150, 165);
+ text-align: left;
+}
+.analog .swatch__body {
+ fill: rgb(32, 150, 165);
+ font-size: 24px;
+ transform: translate(var(--varMoveSwatch),0px);
+}
+.gnd .pinlabel__body{
+ fill: rgb(0, 0, 0);
+ text-align: left;
+}
+.gnd .pinlabel__leader{
+ stroke: rgb(0, 0, 0);
+ text-align: left;
+}
+.gnd .swatch__body {
+ fill: rgb(0, 0, 0);
+ font-size: 24px;
+ transform: translate(var(--varMoveSwatch),0px);
+}
+.spi .pinlabel__body{
+ fill: rgb(4, 128, 92);
+ text-align: left;
+}
+.spi .pinlabel__leader{
+ stroke: rgb(4, 128, 92);
+ text-align: left;
+}
+.spi .swatch__body {
+ fill: rgb(4, 128, 92);
+ font-size: 24px;
+ transform: translate(var(--varMoveSwatch),0px);
+}
+.touch .pinlabel__body{
+ fill: rgb(230, 87, 10);
+ text-align: left;
+}
+.touch .pinlabel__leader{
+ stroke: rgb(230, 87, 10);
+ text-align: left;
+}
+.touch .swatch__body {
+ fill: rgb(230, 87, 10);
+ font-size: 24px;
+ transform: translate(var(--varMoveSwatch),0px);
+}
+
+.rtc .pinlabel__body{
+ fill: rgb(100, 200, 10);
+ text-align: left;
+}
+.rtc .pinlabel__leader{
+ stroke: rgb(100, 200, 10);
+ text-align: left;
+}
+.rtc .swatch__body {
+ fill: rgb(100, 200, 10);
+ font-size: 24px;
+ transform: translate(var(--varMoveSwatch),0px);
+}
+
+.other .pinlabel__body{
+ fill: rgb(200, 200, 200);
+ text-align: left;
+}
+.other .pinlabel__leader{
+ stroke: rgb(200, 200, 200);
+ text-align: left;
+}
+.other .swatch__body {
+ fill: rgb(200, 200, 200);
+ font-size: 40px;
+ transform: translate(var(--varMoveSwatch),0px);
+
+}
+
+.panel__inner {
+ fill: #fff;
+}
+.panel__outer {
+ fill: #333;
+}
+
+.legendentry text {
+ dominant-baseline: central;
+ text-anchor: left;
+ background: orange;
+ border-color: red
+}
+
+.title {
+ font-size: 60px;
+ /* font-style: italic; */
+}
+
+.italic{
+ font-style: italic;
+}
+.strong{
+ font-weight: bold;
+}
+
+.panel--info .panel__inner{
+ fill: #f4f4f4;
+}
+
+
+.scl .swatch__body {
+ fill: rgb(255, 255, 0);
+ transform: translate(var(--varMoveSwatch),0px);
+}
+
+.sda .swatch__body {
+ fill: rgb(0, 0, 255);
+ transform: translate(var(--varMoveSwatch),0px);
+}
+
+.mosi .swatch__body {
+ fill: rgb(255, 255, 255);
+ transform: translate(var(--varMoveSwatch),0px);
+}
\ No newline at end of file