aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2016-07-27 11:45:12 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2016-07-27 19:28:29 +0200
commit7ab005681a15ef2f4b60d8fce866731aa028f7b9 (patch)
treee2d27e116defcdd8a3d9eac9b3db7408416fdfbc
parenta8256910d40a0eee85bf539a3f120c9d92485f3f (diff)
downloadkicad-utils-7ab005681a15ef2f4b60d8fce866731aa028f7b9.tar.gz
kicad-utils-7ab005681a15ef2f4b60d8fce866731aa028f7b9.tar.bz2
kicad-utils-7ab005681a15ef2f4b60d8fce866731aa028f7b9.tar.xz
kicad-utils-7ab005681a15ef2f4b60d8fce866731aa028f7b9.zip
o Support for Intel Quark D2000 chip.
-rw-r--r--examples/.gitignore1
-rw-r--r--examples/CMakeLists.txt1
-rw-r--r--examples/arduino-led/schematic.h6
-rw-r--r--examples/intel-quark-d2000/CMakeLists.txt13
-rw-r--r--examples/intel-quark-d2000/schematic/intel-quark-d2000.net211
-rw-r--r--examples/intel-quark-d2000/schematic/intel-quark-d2000.pro61
-rw-r--r--examples/intel-quark-d2000/schematic/intel-quark-d2000.sch120
-rw-r--r--include/trygvis/kicad.h1
-rw-r--r--kicad/kicad_utils.lib52
-rw-r--r--main.cpp67
10 files changed, 531 insertions, 2 deletions
diff --git a/examples/.gitignore b/examples/.gitignore
index a84bc5f..2da258c 100644
--- a/examples/.gitignore
+++ b/examples/.gitignore
@@ -1,2 +1,3 @@
*.bak
*-cache.lib
+*.kicad_pcb
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 6f09874..04baca4 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1 +1,2 @@
add_subdirectory(arduino-led)
+add_subdirectory(intel-quark-d2000)
diff --git a/examples/arduino-led/schematic.h b/examples/arduino-led/schematic.h
index 78ed83c..f41a300 100644
--- a/examples/arduino-led/schematic.h
+++ b/examples/arduino-led/schematic.h
@@ -1,6 +1,12 @@
#ifndef SCHEMATIC_H
#define SCHEMATIC_H
+/*
+THIS FILE IS GENERATED. DO NOT EDIT.
+
+Generated from schematic for reference U1, part ARDUINO_UNO in library kicad_utils.
+*/
+
namespace schematic {
static const int STATUS_LED = 3;
static const int ANALOG_LIGHT_1 = 2;
diff --git a/examples/intel-quark-d2000/CMakeLists.txt b/examples/intel-quark-d2000/CMakeLists.txt
new file mode 100644
index 0000000..4c0ef68
--- /dev/null
+++ b/examples/intel-quark-d2000/CMakeLists.txt
@@ -0,0 +1,13 @@
+kicad_gen(
+ TARGET schematic.h
+ NET schematic/intel-quark-d2000.net
+ REF U1)
+
+if (FALSE)
+ # If you have Intel Quark 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(intel-quark-d2000 ALL DEPENDS schematic.h)
+endif ()
diff --git a/examples/intel-quark-d2000/schematic/intel-quark-d2000.net b/examples/intel-quark-d2000/schematic/intel-quark-d2000.net
new file mode 100644
index 0000000..eb1f168
--- /dev/null
+++ b/examples/intel-quark-d2000/schematic/intel-quark-d2000.net
@@ -0,0 +1,211 @@
+(export (version D)
+ (design
+ (source /home/trygvis/dev/io.trygvis/2016/07/kicad-utils/examples/intel-quark-d2000/schematic/intel-quark-d2000.sch)
+ (date "Wed 27 Jul 2016 11:16:59 CEST")
+ (tool "Eeschema 4.0.2+dfsg1-stable")
+ (sheet (number 1) (name /) (tstamps /)
+ (title_block
+ (title)
+ (company)
+ (rev)
+ (date)
+ (source intel-quark-d2000.sch)
+ (comment (number 1) (value ""))
+ (comment (number 2) (value ""))
+ (comment (number 3) (value ""))
+ (comment (number 4) (value "")))))
+ (components
+ (comp (ref U1)
+ (value INTEL_QUARK_D2000)
+ (libsource (lib kicad_utils) (part INTEL_QUARK_D2000))
+ (sheetpath (names /) (tstamps /))
+ (tstamp 5798834E))
+ (comp (ref SW1)
+ (value SW_PUSH)
+ (libsource (lib device) (part SW_PUSH))
+ (sheetpath (names /) (tstamps /))
+ (tstamp 57988394))
+ (comp (ref D1)
+ (value LED)
+ (libsource (lib device) (part LED))
+ (sheetpath (names /) (tstamps /))
+ (tstamp 579883E8))
+ (comp (ref R1)
+ (value R)
+ (libsource (lib device) (part R))
+ (sheetpath (names /) (tstamps /))
+ (tstamp 57988445)))
+ (libparts
+ (libpart (lib kicad_utils) (part INTEL_QUARK_D2000)
+ (fields
+ (field (name Reference) U)
+ (field (name Value) INTEL_QUARK_D2000))
+ (pins
+ (pin (num 1) (name AR) (type input))
+ (pin (num 2) (name F_10) (type input))
+ (pin (num 3) (name F_11) (type input))
+ (pin (num 4) (name F_12) (type input))
+ (pin (num 5) (name F_13) (type input))
+ (pin (num 6) (name F_14) (type input))
+ (pin (num 7) (name F_15) (type input))
+ (pin (num 8) (name F_16) (type input))
+ (pin (num 9) (name F_17) (type input))
+ (pin (num 10) (name F_18) (type input))
+ (pin (num 11) (name F_9) (type input))
+ (pin (num 12) (name IOVDD) (type input))
+ (pin (num 13) (name F_20) (type input))
+ (pin (num 14) (name F_21) (type input))
+ (pin (num 15) (name F_22) (type input))
+ (pin (num 16) (name F_23) (type input))
+ (pin (num 17) (name DVDD) (type input))
+ (pin (num 18) (name F_19) (type input))
+ (pin (num 19) (name HYB_XTALI) (type input))
+ (pin (num 20) (name HYB_XTAL0) (type input))
+ (pin (num 21) (name F_24) (type input))
+ (pin (num 22) (name RTC_XTALI) (type input))
+ (pin (num 23) (name RTC_XTALO) (type input))
+ (pin (num 24) (name DVDD) (type input))
+ (pin (num 25) (name GSENSE) (type input))
+ (pin (num 26) (name LX) (type input))
+ (pin (num 27) (name PVDD) (type input))
+ (pin (num 28) (name VSENSE) (type input))
+ (pin (num 29) (name VREN) (type input))
+ (pin (num 30) (name ~RST) (type input))
+ (pin (num 31) (name F_0) (type input))
+ (pin (num 32) (name F_1) (type input))
+ (pin (num 33) (name F_2) (type input))
+ (pin (num 34) (name F_3) (type input))
+ (pin (num 35) (name F_4) (type input))
+ (pin (num 36) (name F_5) (type input))
+ (pin (num 37) (name F_6) (type input))
+ (pin (num 38) (name F_7) (type input))
+ (pin (num 39) (name F_8) (type input))
+ (pin (num 40) (name AVDD) (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))))
+ (libpart (lib device) (part SW_PUSH)
+ (description Button)
+ (fields
+ (field (name Reference) SW)
+ (field (name Value) SW_PUSH))
+ (pins
+ (pin (num 1) (name 1) (type passive))
+ (pin (num 2) (name 2) (type passive)))))
+ (libraries
+ (library (logical kicad_utils)
+ (uri /home/trygvis/dev/io.trygvis/2016/07/kicad-utils/kicad/kicad_utils.lib))
+ (library (logical device)
+ (uri /usr/share/kicad/library/device.lib)))
+ (nets
+ (net (code 1) (name "Net-(U1-Pad26)")
+ (node (ref U1) (pin 26)))
+ (net (code 2) (name "Net-(U1-Pad36)")
+ (node (ref U1) (pin 36)))
+ (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-Pad37)")
+ (node (ref U1) (pin 37)))
+ (net (code 6) (name "Net-(U1-Pad18)")
+ (node (ref U1) (pin 18)))
+ (net (code 7) (name "Net-(U1-Pad28)")
+ (node (ref U1) (pin 28)))
+ (net (code 8) (name "Net-(U1-Pad38)")
+ (node (ref U1) (pin 38)))
+ (net (code 9) (name "Net-(U1-Pad19)")
+ (node (ref U1) (pin 19)))
+ (net (code 10) (name "Net-(U1-Pad29)")
+ (node (ref U1) (pin 29)))
+ (net (code 11) (name "Net-(U1-Pad39)")
+ (node (ref U1) (pin 39)))
+ (net (code 12) (name "Net-(U1-Pad16)")
+ (node (ref U1) (pin 16)))
+ (net (code 13) (name "Net-(D1-Pad1)")
+ (node (ref D1) (pin 1))
+ (node (ref R1) (pin 1)))
+ (net (code 14) (name GND)
+ (node (ref R1) (pin 2))
+ (node (ref SW1) (pin 1)))
+ (net (code 15) (name /STATUS_LED)
+ (node (ref D1) (pin 2))
+ (node (ref U1) (pin 7)))
+ (net (code 16) (name /PUSH_BUTTON)
+ (node (ref U1) (pin 3))
+ (node (ref SW1) (pin 2)))
+ (net (code 17) (name "Net-(U1-Pad21)")
+ (node (ref U1) (pin 21)))
+ (net (code 18) (name "Net-(U1-Pad2)")
+ (node (ref U1) (pin 2)))
+ (net (code 19) (name "Net-(U1-Pad4)")
+ (node (ref U1) (pin 4)))
+ (net (code 20) (name "Net-(U1-Pad5)")
+ (node (ref U1) (pin 5)))
+ (net (code 21) (name "Net-(U1-Pad6)")
+ (node (ref U1) (pin 6)))
+ (net (code 22) (name "Net-(U1-Pad8)")
+ (node (ref U1) (pin 8)))
+ (net (code 23) (name "Net-(U1-Pad9)")
+ (node (ref U1) (pin 9)))
+ (net (code 24) (name "Net-(U1-Pad10)")
+ (node (ref U1) (pin 10)))
+ (net (code 25) (name "Net-(U1-Pad20)")
+ (node (ref U1) (pin 20)))
+ (net (code 26) (name "Net-(U1-Pad30)")
+ (node (ref U1) (pin 30)))
+ (net (code 27) (name "Net-(U1-Pad40)")
+ (node (ref U1) (pin 40)))
+ (net (code 28) (name "Net-(U1-Pad11)")
+ (node (ref U1) (pin 11)))
+ (net (code 29) (name "Net-(U1-Pad1)")
+ (node (ref U1) (pin 1)))
+ (net (code 30) (name "Net-(U1-Pad31)")
+ (node (ref U1) (pin 31)))
+ (net (code 31) (name "Net-(U1-Pad12)")
+ (node (ref U1) (pin 12)))
+ (net (code 32) (name "Net-(U1-Pad22)")
+ (node (ref U1) (pin 22)))
+ (net (code 33) (name "Net-(U1-Pad32)")
+ (node (ref U1) (pin 32)))
+ (net (code 34) (name "Net-(U1-Pad13)")
+ (node (ref U1) (pin 13)))
+ (net (code 35) (name "Net-(U1-Pad23)")
+ (node (ref U1) (pin 23)))
+ (net (code 36) (name "Net-(U1-Pad33)")
+ (node (ref U1) (pin 33)))
+ (net (code 37) (name "Net-(U1-Pad14)")
+ (node (ref U1) (pin 14)))
+ (net (code 38) (name "Net-(U1-Pad24)")
+ (node (ref U1) (pin 24)))
+ (net (code 39) (name "Net-(U1-Pad34)")
+ (node (ref U1) (pin 34)))
+ (net (code 40) (name "Net-(U1-Pad15)")
+ (node (ref U1) (pin 15)))
+ (net (code 41) (name "Net-(U1-Pad25)")
+ (node (ref U1) (pin 25)))
+ (net (code 42) (name "Net-(U1-Pad35)")
+ (node (ref U1) (pin 35))))) \ No newline at end of file
diff --git a/examples/intel-quark-d2000/schematic/intel-quark-d2000.pro b/examples/intel-quark-d2000/schematic/intel-quark-d2000.pro
new file mode 100644
index 0000000..6ff1c7a
--- /dev/null
+++ b/examples/intel-quark-d2000/schematic/intel-quark-d2000.pro
@@ -0,0 +1,61 @@
+update=Wed 27 Jul 2016 10:58:23 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/intel-quark-d2000/schematic/intel-quark-d2000.sch b/examples/intel-quark-d2000/schematic/intel-quark-d2000.sch
new file mode 100644
index 0000000..b9fd1bd
--- /dev/null
+++ b/examples/intel-quark-d2000/schematic/intel-quark-d2000.sch
@@ -0,0 +1,120 @@
+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
+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 INTEL_QUARK_D2000 U1
+U 1 1 5798834E
+P 4850 3150
+F 0 "U1" H 4850 3150 60 0000 C CNN
+F 1 "INTEL_QUARK_D2000" H 4850 2800 60 0000 C CNN
+F 2 "" H 4850 3150 60 0000 C CNN
+F 3 "" H 4850 3150 60 0000 C CNN
+ 1 4850 3150
+ 1 0 0 -1
+$EndComp
+$Comp
+L SW_PUSH SW1
+U 1 1 57988394
+P 2250 2900
+F 0 "SW1" H 2400 3010 50 0000 C CNN
+F 1 "SW_PUSH" H 2250 2820 50 0000 C CNN
+F 2 "" H 2250 2900 50 0000 C CNN
+F 3 "" H 2250 2900 50 0000 C CNN
+ 1 2250 2900
+ 1 0 0 -1
+$EndComp
+$Comp
+L GND #PWR1
+U 1 1 579883CB
+P 1750 4250
+F 0 "#PWR1" H 1750 4000 50 0001 C CNN
+F 1 "GND" H 1750 4100 50 0000 C CNN
+F 2 "" H 1750 4250 50 0000 C CNN
+F 3 "" H 1750 4250 50 0000 C CNN
+ 1 1750 4250
+ 1 0 0 -1
+$EndComp
+$Comp
+L LED D1
+U 1 1 579883E8
+P 2850 3300
+F 0 "D1" H 2850 3400 50 0000 C CNN
+F 1 "LED" H 2850 3200 50 0000 C CNN
+F 2 "" H 2850 3300 50 0000 C CNN
+F 3 "" H 2850 3300 50 0000 C CNN
+ 1 2850 3300
+ 1 0 0 -1
+$EndComp
+$Comp
+L R R1
+U 1 1 57988445
+P 2250 3300
+F 0 "R1" V 2330 3300 50 0000 C CNN
+F 1 "R" V 2250 3300 50 0000 C CNN
+F 2 "" V 2180 3300 50 0000 C CNN
+F 3 "" H 2250 3300 50 0000 C CNN
+ 1 2250 3300
+ 0 1 1 0
+$EndComp
+Wire Wire Line
+ 2550 2900 3700 2900
+Wire Wire Line
+ 1750 4250 1750 3300
+Wire Wire Line
+ 1750 3300 1750 2900
+Wire Wire Line
+ 1750 2900 1950 2900
+Wire Wire Line
+ 3050 3300 3700 3300
+Wire Wire Line
+ 2650 3300 2400 3300
+Wire Wire Line
+ 2100 3300 1750 3300
+Connection ~ 1750 3300
+Text Label 3650 3300 2 60 ~ 0
+STATUS_LED
+Text Label 3650 2900 2 60 ~ 0
+PUSH_BUTTON
+$EndSCHEMATC
diff --git a/include/trygvis/kicad.h b/include/trygvis/kicad.h
index ae67673..e555e9c 100644
--- a/include/trygvis/kicad.h
+++ b/include/trygvis/kicad.h
@@ -9,6 +9,7 @@ namespace trygvis {
namespace kicad {
template<typename T>
using opt = std::experimental::optional<T>;
+using std::experimental::nullopt;
} // namespace kicad
} // namespace trygvis
diff --git a/kicad/kicad_utils.lib b/kicad/kicad_utils.lib
index 586f2c9..fb4746d 100644
--- a/kicad/kicad_utils.lib
+++ b/kicad/kicad_utils.lib
@@ -43,4 +43,56 @@ X SDA 29 750 1100 200 L 50 50 1 1 I
ENDDRAW
ENDDEF
#
+# INTEL_QUARK_D2000
+#
+DEF INTEL_QUARK_D2000 U 0 40 Y Y 1 F N
+F0 "U" 0 0 60 H V C CNN
+F1 "INTEL_QUARK_D2000" 0 -350 60 H V C CNN
+F2 "" 0 0 60 H V C CNN
+F3 "" 0 0 60 H V C CNN
+DRAW
+S -950 950 950 -950 0 1 0 N
+X AR 1 -1150 450 200 R 50 50 1 1 I
+X F_10 2 -1150 350 200 R 50 50 1 1 I
+X F_11 3 -1150 250 200 R 50 50 1 1 I
+X F_12 4 -1150 150 200 R 50 50 1 1 I
+X F_13 5 -1150 50 200 R 50 50 1 1 I
+X F_14 6 -1150 -50 200 R 50 50 1 1 I
+X F_15 7 -1150 -150 200 R 50 50 1 1 I
+X F_16 8 -1150 -250 200 R 50 50 1 1 I
+X F_17 9 -1150 -350 200 R 50 50 1 1 I
+X F_18 10 -1150 -450 200 R 50 50 1 1 I
+X HYB_XTAL0 20 450 -1150 200 U 50 50 1 1 I
+X ~RST 30 1150 450 200 L 50 50 1 1 I
+X AVDD 40 -450 1150 200 D 50 50 1 1 I
+X F_9 11 -450 -1150 200 U 50 50 1 1 I
+X F_24 21 1150 -450 200 L 50 50 1 1 I
+X F_0 31 450 1150 200 D 50 50 1 1 I
+X IOVDD 12 -350 -1150 200 U 50 50 1 1 I
+X RTC_XTALI 22 1150 -350 200 L 50 50 1 1 I
+X F_1 32 350 1150 200 D 50 50 1 1 I
+X F_20 13 -250 -1150 200 U 50 50 1 1 I
+X RTC_XTALO 23 1150 -250 200 L 50 50 1 1 I
+X F_2 33 250 1150 200 D 50 50 1 1 I
+X F_21 14 -150 -1150 200 U 50 50 1 1 I
+X DVDD 24 1150 -150 200 L 50 50 1 1 I
+X F_3 34 150 1150 200 D 50 50 1 1 I
+X F_22 15 -50 -1150 200 U 50 50 1 1 I
+X GSENSE 25 1150 -50 200 L 50 50 1 1 I
+X F_4 35 50 1150 200 D 50 50 1 1 I
+X F_23 16 50 -1150 200 U 50 50 1 1 I
+X LX 26 1150 50 200 L 50 50 1 1 I
+X F_5 36 -50 1150 200 D 50 50 1 1 I
+X DVDD 17 150 -1150 200 U 50 50 1 1 I
+X PVDD 27 1150 150 200 L 50 50 1 1 I
+X F_6 37 -150 1150 200 D 50 50 1 1 I
+X F_19 18 250 -1150 200 U 50 50 1 1 I
+X VSENSE 28 1150 250 200 L 50 50 1 1 I
+X F_7 38 -250 1150 200 D 50 50 1 1 I
+X HYB_XTALI 19 350 -1150 200 U 50 50 1 1 I
+X VREN 29 1150 350 200 L 50 50 1 1 I
+X F_8 39 -350 1150 200 D 50 50 1 1 I
+ENDDRAW
+ENDDEF
+#
#End Library
diff --git a/main.cpp b/main.cpp
index cb5750e..811a08f 100644
--- a/main.cpp
+++ b/main.cpp
@@ -6,6 +6,7 @@
#include <getopt.h>
#include <cstring>
#include <memory>
+#include <map>
#include "trygvis/kicad.h"
using namespace std;
@@ -97,6 +98,61 @@ public:
}
};
+class intel_quark_d2000 : public part {
+public:
+ intel_quark_d2000() : part("INTEL_QUARK_D2000") { }
+
+ ~intel_quark_d2000() {
+ }
+
+ virtual bool generate(stringstream &out, const string &ref, const vector<const net *> usages) override {
+ static map<int, string> gpio_map{
+ {2, "10"},
+ {3, "11"},
+ {4, "12"},
+ {5, "13"},
+ {6, "14"},
+ {7, "15"},
+ {8, "16"},
+ {9, "17"},
+ {10, "18"},
+
+ {11, "9"},
+ {13, "20"},
+ {14, "21"},
+ {15, "22"},
+ {16, "23"},
+ {18, "19"},
+
+ {21, "24"},
+
+ {31, "0"},
+ {32, "1"},
+ {33, "2"},
+ {34, "3"},
+ {35, "4"},
+ {36, "5"},
+ {37, "6"},
+ {38, "7"},
+ {39, "8"},
+ };
+
+ out << "#include <stddef.h>" << endl;
+ out << endl;
+
+ for (auto &usage: usages) {
+ auto node = usage->node_for_ref(ref);
+
+ auto gpio = gpio_map.find(node->pin);
+
+ if (gpio != gpio_map.end()) {
+ out << "static const uint8_t SCHEMATIC_" << usage->name << " = " << gpio->second << ";" << endl;
+ }
+ }
+
+ return true;
+ }
+};
class library {
public:
@@ -114,7 +170,7 @@ public:
}
}
- return nullptr;
+ return nullopt;
}
};
@@ -125,6 +181,7 @@ public:
kicad_gen() {
library kicad_utils("kicad_utils");
kicad_utils.parts.push_back(make_unique<arduino_uno>());
+ kicad_utils.parts.push_back(make_unique<intel_quark_d2000>());
libraries.push_back(std::move(kicad_utils));
}
@@ -136,7 +193,7 @@ public:
}
}
- return nullptr;
+ return nullopt;
}
};
@@ -176,6 +233,12 @@ bool generate(const char *ref, const trygvis::kicad::netlist::netlist &netlist,
out << "#ifndef SCHEMATIC_H" << endl;
out << "#define SCHEMATIC_H" << endl;
out << endl;
+ out << "/*" << endl;
+ out << "THIS FILE IS GENERATED. DO NOT EDIT." << endl;
+ out << endl;
+ out << "Generated from schematic for reference " << ref << ", part " << partName << " in library " << library->name << "." << endl;
+ out << "*/" << endl;
+ out << endl;
auto usages = netlist.find_usage_of(ref);