aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2016-07-26 00:22:55 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2016-07-26 00:22:55 +0200
commit128e53d220d97225803d61d86f8e43439563181d (patch)
treee0d5da8d666c54d1d17e64ee6f52af424129f90d /examples
downloadkicad-utils-128e53d220d97225803d61d86f8e43439563181d.tar.gz
kicad-utils-128e53d220d97225803d61d86f8e43439563181d.tar.bz2
kicad-utils-128e53d220d97225803d61d86f8e43439563181d.tar.xz
kicad-utils-128e53d220d97225803d61d86f8e43439563181d.zip
WIP: kicad_gen is a util to generate schematic.h files from KiCAD netlist files.
Current code contains a lexer and parser for KiCAD's netlist files and code to build a tree of the netlist which can be used for generation. Contains CMake code for integrating the generation into CMake too.
Diffstat (limited to 'examples')
-rw-r--r--examples/.gitignore2
-rw-r--r--examples/CMakeLists.txt1
-rw-r--r--examples/arduino-led/CMakeLists.txt14
-rw-r--r--examples/arduino-led/arduino-led.ino13
-rw-r--r--examples/arduino-led/schematic/arduino-led.net166
-rw-r--r--examples/arduino-led/schematic/arduino-led.pro61
-rw-r--r--examples/arduino-led/schematic/arduino-led.sch101
7 files changed, 358 insertions, 0 deletions
diff --git a/examples/.gitignore b/examples/.gitignore
new file mode 100644
index 0000000..a84bc5f
--- /dev/null
+++ b/examples/.gitignore
@@ -0,0 +1,2 @@
+*.bak
+*-cache.lib
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
new file mode 100644
index 0000000..6f09874
--- /dev/null
+++ b/examples/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(arduino-led)
diff --git a/examples/arduino-led/CMakeLists.txt b/examples/arduino-led/CMakeLists.txt
new file mode 100644
index 0000000..7bd82af
--- /dev/null
+++ b/examples/arduino-led/CMakeLists.txt
@@ -0,0 +1,14 @@
+kicad_gen(
+ TARGET schematic.h
+ NET schematic/arduino-led.net
+ REF U1
+ IN_SOURCE)
+
+if (FALSE)
+ # If you have Arduino support for CMake something like this would work:
+
+ #add_executable(arduino-led arduino-led.ino schematic.h)
+ #target_include_directories(arduino-led PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/kicad-include)
+else ()
+ add_custom_target(arduino-led ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/schematic.h)
+endif ()
diff --git a/examples/arduino-led/arduino-led.ino b/examples/arduino-led/arduino-led.ino
new file mode 100644
index 0000000..01c83ea
--- /dev/null
+++ b/examples/arduino-led/arduino-led.ino
@@ -0,0 +1,13 @@
+#include <stdlib.h>
+#include "Arduino.h"
+#include "schematic.h"
+
+void setup() {
+}
+
+void loop() {
+ digitalWrite(SCHEMATIC_STATUS_LED, HIGH);
+ delay(1000);
+ digitalWrite(SCHEMATIC_STATUS_LED, LOW);
+ delay(1000);
+}
diff --git a/examples/arduino-led/schematic/arduino-led.net b/examples/arduino-led/schematic/arduino-led.net
new file mode 100644
index 0000000..f230aaa
--- /dev/null
+++ b/examples/arduino-led/schematic/arduino-led.net
@@ -0,0 +1,166 @@
+(export (version D)
+ (design
+ (source /home/trygvis/dev/io.trygvis/2016/07/kicad-utils/examples/arduino+led/schematic/arduino+led.sch)
+ (date "Mon 25 Jul 2016 19:16:49 CEST")
+ (tool "Eeschema 4.0.2+dfsg1-stable")
+ (sheet (number 1) (name /) (tstamps /)
+ (title_block
+ (title)
+ (company)
+ (rev)
+ (date)
+ (source arduino+led.sch)
+ (comment (number 1) (value ""))
+ (comment (number 2) (value ""))
+ (comment (number 3) (value ""))
+ (comment (number 4) (value "")))))
+ (components
+ (comp (ref U1)
+ (value ARDUINO_UNO)
+ (libsource (lib kicad_utils) (part ARDUINO_UNO))
+ (sheetpath (names /) (tstamps /))
+ (tstamp 57913050))
+ (comp (ref R1)
+ (value R)
+ (libsource (lib device) (part R))
+ (sheetpath (names /) (tstamps /))
+ (tstamp 579130F0))
+ (comp (ref D1)
+ (value LED)
+ (libsource (lib device) (part LED))
+ (sheetpath (names /) (tstamps /))
+ (tstamp 5791311D)))
+ (libparts
+ (libpart (lib kicad_utils) (part ARDUINO_UNO)
+ (fields
+ (field (name Reference) U)
+ (field (name Value) ARDUINO_UNO))
+ (pins
+ (pin (num 1) (name ~RST) (type input))
+ (pin (num 2) (name 3V3) (type input))
+ (pin (num 3) (name 5V) (type input))
+ (pin (num 4) (name GND) (type input))
+ (pin (num 5) (name GND) (type input))
+ (pin (num 6) (name Vin) (type input))
+ (pin (num 7) (name A0) (type input))
+ (pin (num 8) (name A1) (type input))
+ (pin (num 9) (name A2) (type input))
+ (pin (num 10) (name A3) (type input))
+ (pin (num 11) (name A4) (type power_out))
+ (pin (num 12) (name A5) (type input))
+ (pin (num 13) (name D0) (type input))
+ (pin (num 14) (name D1) (type input))
+ (pin (num 15) (name D2) (type input))
+ (pin (num 16) (name D3) (type input))
+ (pin (num 17) (name D4) (type input))
+ (pin (num 18) (name D5) (type input))
+ (pin (num 19) (name D6) (type input))
+ (pin (num 20) (name D7) (type input))
+ (pin (num 21) (name D8) (type input))
+ (pin (num 22) (name D9) (type input))
+ (pin (num 23) (name D10) (type input))
+ (pin (num 24) (name D11) (type input))
+ (pin (num 25) (name D12) (type input))
+ (pin (num 26) (name D13) (type input))
+ (pin (num 27) (name GND) (type input))
+ (pin (num 28) (name Aref) (type input))
+ (pin (num 29) (name SDA) (type input))
+ (pin (num 30) (name SCL) (type input))))
+ (libpart (lib device) (part LED)
+ (footprints
+ (fp LED-3MM)
+ (fp LED-5MM)
+ (fp LED-10MM)
+ (fp LED-0603)
+ (fp LED-0805)
+ (fp LED-1206)
+ (fp LEDV))
+ (fields
+ (field (name Reference) D)
+ (field (name Value) LED))
+ (pins
+ (pin (num 1) (name K) (type passive))
+ (pin (num 2) (name A) (type passive))))
+ (libpart (lib device) (part R)
+ (description Resistor)
+ (footprints
+ (fp R_*)
+ (fp Resistor_*))
+ (fields
+ (field (name Reference) R)
+ (field (name Value) R))
+ (pins
+ (pin (num 1) (name ~) (type passive))
+ (pin (num 2) (name ~) (type passive)))))
+ (libraries
+ (library (logical device)
+ (uri /usr/share/kicad/library/device.lib))
+ (library (logical kicad_utils)
+ (uri /home/trygvis/dev/io.trygvis/2016/07/kicad-utils/kicad/kicad_utils.lib)))
+ (nets
+ (net (code 1) (name "Net-(U1-Pad25)")
+ (node (ref U1) (pin 25)))
+ (net (code 2) (name "Net-(U1-Pad26)")
+ (node (ref U1) (pin 26)))
+ (net (code 3) (name "Net-(U1-Pad17)")
+ (node (ref U1) (pin 17)))
+ (net (code 4) (name "Net-(U1-Pad27)")
+ (node (ref U1) (pin 27)))
+ (net (code 5) (name "Net-(U1-Pad18)")
+ (node (ref U1) (pin 18)))
+ (net (code 6) (name "Net-(U1-Pad28)")
+ (node (ref U1) (pin 28)))
+ (net (code 7) (name "Net-(U1-Pad19)")
+ (node (ref U1) (pin 19)))
+ (net (code 8) (name "Net-(U1-Pad29)")
+ (node (ref U1) (pin 29)))
+ (net (code 9) (name "Net-(U1-Pad15)")
+ (node (ref U1) (pin 15)))
+ (net (code 10) (name GND)
+ (node (ref D1) (pin 1)))
+ (net (code 11) (name "Net-(D1-Pad2)")
+ (node (ref D1) (pin 2))
+ (node (ref R1) (pin 2)))
+ (net (code 12) (name /STATUS_LED)
+ (node (ref U1) (pin 16))
+ (node (ref R1) (pin 1)))
+ (net (code 13) (name "Net-(U1-Pad20)")
+ (node (ref U1) (pin 20)))
+ (net (code 14) (name "Net-(U1-Pad2)")
+ (node (ref U1) (pin 2)))
+ (net (code 15) (name "Net-(U1-Pad3)")
+ (node (ref U1) (pin 3)))
+ (net (code 16) (name "Net-(U1-Pad4)")
+ (node (ref U1) (pin 4)))
+ (net (code 17) (name "Net-(U1-Pad5)")
+ (node (ref U1) (pin 5)))
+ (net (code 18) (name "Net-(U1-Pad6)")
+ (node (ref U1) (pin 6)))
+ (net (code 19) (name "Net-(U1-Pad7)")
+ (node (ref U1) (pin 7)))
+ (net (code 20) (name "Net-(U1-Pad8)")
+ (node (ref U1) (pin 8)))
+ (net (code 21) (name "Net-(U1-Pad9)")
+ (node (ref U1) (pin 9)))
+ (net (code 22) (name "Net-(U1-Pad10)")
+ (node (ref U1) (pin 10)))
+ (net (code 23) (name "Net-(U1-Pad1)")
+ (node (ref U1) (pin 1)))
+ (net (code 24) (name "Net-(U1-Pad30)")
+ (node (ref U1) (pin 30)))
+ (net (code 25) (name "Net-(U1-Pad11)")
+ (node (ref U1) (pin 11)))
+ (net (code 26) (name "Net-(U1-Pad21)")
+ (node (ref U1) (pin 21)))
+ (net (code 27) (name "Net-(U1-Pad12)")
+ (node (ref U1) (pin 12)))
+ (net (code 28) (name "Net-(U1-Pad22)")
+ (node (ref U1) (pin 22)))
+ (net (code 29) (name "Net-(U1-Pad13)")
+ (node (ref U1) (pin 13)))
+ (net (code 30) (name "Net-(U1-Pad23)")
+ (node (ref U1) (pin 23)))
+ (net (code 31) (name "Net-(U1-Pad14)")
+ (node (ref U1) (pin 14)))
+ (net (code 32) (name "Net-(U1-Pad24)")
+ (node (ref U1) (pin 24))))) \ No newline at end of file
diff --git a/examples/arduino-led/schematic/arduino-led.pro b/examples/arduino-led/schematic/arduino-led.pro
new file mode 100644
index 0000000..e707bbb
--- /dev/null
+++ b/examples/arduino-led/schematic/arduino-led.pro
@@ -0,0 +1,61 @@
+update=Mon 25 Jul 2016 19:13:30 CEST
+version=1
+last_client=kicad
+[pcbnew]
+version=1
+LastNetListRead=
+UseCmpFile=1
+PadDrill=0.600000000000
+PadDrillOvalY=0.600000000000
+PadSizeH=1.500000000000
+PadSizeV=1.500000000000
+PcbTextSizeV=1.500000000000
+PcbTextSizeH=1.500000000000
+PcbTextThickness=0.300000000000
+ModuleTextSizeV=1.000000000000
+ModuleTextSizeH=1.000000000000
+ModuleTextSizeThickness=0.150000000000
+SolderMaskClearance=0.000000000000
+SolderMaskMinWidth=0.000000000000
+DrawSegmentWidth=0.200000000000
+BoardOutlineThickness=0.100000000000
+ModuleOutlineThickness=0.150000000000
+[cvpcb]
+version=1
+NetIExt=net
+[general]
+version=1
+[eeschema]
+version=1
+LibDir=../../../kicad
+[eeschema/libraries]
+LibName1=power
+LibName2=device
+LibName3=transistors
+LibName4=conn
+LibName5=linear
+LibName6=regul
+LibName7=74xx
+LibName8=cmos4000
+LibName9=adc-dac
+LibName10=memory
+LibName11=xilinx
+LibName12=microcontrollers
+LibName13=dsp
+LibName14=microchip
+LibName15=analog_switches
+LibName16=motorola
+LibName17=texas
+LibName18=intel
+LibName19=audio
+LibName20=interface
+LibName21=digital-audio
+LibName22=philips
+LibName23=display
+LibName24=cypress
+LibName25=siliconi
+LibName26=opto
+LibName27=atmel
+LibName28=contrib
+LibName29=valves
+LibName30=kicad_utils
diff --git a/examples/arduino-led/schematic/arduino-led.sch b/examples/arduino-led/schematic/arduino-led.sch
new file mode 100644
index 0000000..642cd4b
--- /dev/null
+++ b/examples/arduino-led/schematic/arduino-led.sch
@@ -0,0 +1,101 @@
+EESchema Schematic File Version 2
+LIBS:power
+LIBS:device
+LIBS:transistors
+LIBS:conn
+LIBS:linear
+LIBS:regul
+LIBS:74xx
+LIBS:cmos4000
+LIBS:adc-dac
+LIBS:memory
+LIBS:xilinx
+LIBS:microcontrollers
+LIBS:dsp
+LIBS:microchip
+LIBS:analog_switches
+LIBS:motorola
+LIBS:texas
+LIBS:intel
+LIBS:audio
+LIBS:interface
+LIBS:digital-audio
+LIBS:philips
+LIBS:display
+LIBS:cypress
+LIBS:siliconi
+LIBS:opto
+LIBS:atmel
+LIBS:contrib
+LIBS:valves
+LIBS:kicad_utils
+LIBS:arduino+mod-lcd3310-cache
+EELAYER 25 0
+EELAYER END
+$Descr A4 11693 8268
+encoding utf-8
+Sheet 1 1
+Title ""
+Date ""
+Rev ""
+Comp ""
+Comment1 ""
+Comment2 ""
+Comment3 ""
+Comment4 ""
+$EndDescr
+$Comp
+L ARDUINO_UNO U1
+U 1 1 57913050
+P 5250 3750
+F 0 "U1" H 5250 3750 60 0000 C CNN
+F 1 "ARDUINO_UNO" H 5250 3850 60 0000 C CNN
+F 2 "" H 5250 3750 60 0000 C CNN
+F 3 "" H 5250 3750 60 0000 C CNN
+ 1 5250 3750
+ 1 0 0 -1
+$EndComp
+$Comp
+L GND #PWR1
+U 1 1 579130D3
+P 7100 5200
+F 0 "#PWR1" H 7100 4950 50 0001 C CNN
+F 1 "GND" H 7100 5050 50 0000 C CNN
+F 2 "" H 7100 5200 50 0000 C CNN
+F 3 "" H 7100 5200 50 0000 C CNN
+ 1 7100 5200
+ 1 0 0 -1
+$EndComp
+Wire Wire Line
+ 6000 4050 7100 4050
+Wire Wire Line
+ 7100 4050 7100 4150
+$Comp
+L R R1
+U 1 1 579130F0
+P 7100 4300
+F 0 "R1" V 7180 4300 50 0000 C CNN
+F 1 "R" V 7100 4300 50 0000 C CNN
+F 2 "" V 7030 4300 50 0000 C CNN
+F 3 "" H 7100 4300 50 0000 C CNN
+ 1 7100 4300
+ 1 0 0 -1
+$EndComp
+$Comp
+L LED D1
+U 1 1 5791311D
+P 7100 4750
+F 0 "D1" H 7100 4850 50 0000 C CNN
+F 1 "LED" H 7100 4650 50 0000 C CNN
+F 2 "" H 7100 4750 50 0000 C CNN
+F 3 "" H 7100 4750 50 0000 C CNN
+ 1 7100 4750
+ 0 -1 -1 0
+$EndComp
+Wire Wire Line
+ 7100 4450 7100 4550
+Wire Wire Line
+ 7100 4950 7100 5200
+Text Label 6400 4050 0 60 ~ 0
+STATUS_LED
+$EndSCHEMATC