manual: include the BOM in an appendix

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
6 files changed, 83 insertions(+), 1 deletions(-)

M manual/.hgignore
M manual/Makefile
M manual/appendices.tex
A => manual/bom.csv
M manual/construction.tex
A => manual/gen-bom.py
M manual/.hgignore +1 -0
@@ 1,6 1,7 @@ 
 syntax: glob
 
 manual.pdf
+bom.tex
 rev.tex
 
 *.aux

          
M manual/Makefile +4 -0
@@ 1,5 1,6 @@ 
 FILES=\
 	appendices.tex \
+	bom.tex \
 	construction.tex \
 	construction-steps.tex \
 	datasheet.tex \

          
@@ 64,3 65,6 @@ rev.tex: get-hg-rev
 
 .fig.pdf:
 	fig2dev -L pdf ${.IMPSRC} > ${.TARGET}
+
+bom.tex: bom.csv gen-bom.py
+	./gen-bom.py bom.csv > bom.tex

          
M manual/appendices.tex +6 -0
@@ 4,6 4,8 @@ Appendix~\ref{datasheet} includes the da
 
 Appendix~\ref{schematic} includes the schematic.
 
+Appendix~\ref{bom} lists the bill of materials.
+
 Appendix~\ref{stripboard} includes the stripboard layout.
 
 Appendix~\ref{chap:license-mit} includes a copy of the MIT License under

          
@@ 18,6 20,10 @@ Licence Version 2 - Permissive under whi
 \label{schematic}
 \includepdf[landscape=true]{figures/schematic.pdf}
 
+\chapter{Bill of Materials}
+\label{bom}
+\input{bom}
+
 \input{stripboard}
 \input{license-mit}
 \input{license-cern}

          
A => manual/bom.csv +26 -0
@@ 0,0 1,26 @@ 
+"Item","Qty","Reference(s)","Value","LibPart","Footprint","Datasheet"
+"1","2","C1, C2","10p","Device:C","Capacitor_THT:C_Disc_D5.1mm_W3.2mm_P5.00mm","~"
+"2","1","C3","22u","Device:C_Polarized","Capacitor_THT:C_Radial_D6.3mm_H11.0mm_P2.50mm","~"
+"3","1","C4","100n","Device:C","Capacitor_THT:C_Disc_D5.1mm_W3.2mm_P5.00mm","~"
+"4","1","C5","10u","Device:C","Capacitor_THT:C_Disc_D5.1mm_W3.2mm_P5.00mm","~"
+"5","1","C6","10n","Device:C","Capacitor_THT:C_Disc_D5.1mm_W3.2mm_P5.00mm","~"
+"6","1","C7","0.1u","Device:C","Capacitor_THT:C_Disc_D5.1mm_W3.2mm_P5.00mm","~"
+"7","2","D1, D2","1N4006","Diode:1N4006","Diode_THT:D_DO-41_SOD81_P10.16mm_Horizontal","http://www.vishay.com/docs/88503/1n4001.pdf"
+"8","1","J1","Conn_01x02_Male","Connector:Conn_01x02_Male","Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical","~"
+"9","1","J2","3.5mm",":Conn_01x03_Male_2","Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical","~"
+"10","1","J3","2.5mm",":Conn_01x03_Male_1","Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical","~"
+"11","3","L1, L2, L3","17T FT37-43","Device:L_Ferrite_Small","Inductor_THT:L_Toroid_Horizontal_D6.5mm_P10.00mm_Diameter7-5mm_Amidon-T25","~"
+"12","1","Q1","BC549","Transistor_BJT:BC549","Package_TO_SOT_THT:TO-92_Inline","https://www.onsemi.com/pub/Collateral/BC550-D.pdf"
+"13","1","Q2","2N7000","Transistor_FET:2N7000","Package_TO_SOT_THT:TO-92_Inline","https://www.vishay.com/docs/70226/70226.pdf"
+"14","9","R1, R2, R3, R4, R5, R6, R7, R8, R9","2k","Device:R","Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal","~"
+"15","7","R10, R11, R12, R13, R14, R15, R16","1k","Device:R","Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal","~"
+"16","1","R17","4.7k","Device:R","Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal","~"
+"17","2","R18, R19","10k","Device:R","Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal","~"
+"18","1","R20","22k","Device:R","Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal","~"
+"19","1","R21","220","Device:R","Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal","~"
+"20","1","R22","2.2k","Device:R","Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal","~"
+"21","2","RV1, RV2","2k","Device:R_Potentiometer_Trim","Potentiometer_THT:Potentiometer_Piher_PT-10-V10_Vertical","~"
+"22","1","U1","ATmega48P","MCU_Microchip_ATmega:ATmega48P-20P","Package_DIP:DIP-28_W7.62mm_Socket","http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-8025-8-bit-AVR-Microcontroller-ATmega48P-88P-168P_Datasheet.pdf"
+"23","1","U2","74HC595","74xx:74HC595","Package_DIP:DIP-16_W7.62mm_Socket","http://www.ti.com/lit/ds/symlink/sn74hc595.pdf"
+"24","1","U3","LM317","Regulator_Linear:LM317_TO-220","Package_TO_SOT_THT:TO-220-3_Vertical","http://www.ti.com/lit/ds/symlink/lm317.pdf"
+"25","1","Y1","8.388608MHz","Device:Crystal","Crystal:Crystal_HC49-U_Vertical","~"

          
M manual/construction.tex +1 -1
@@ 12,6 12,6 @@ on the same board, and the Baofeng inter
 I did this to allow for some flexibility in driving different radios with
 the same source.
 
-% TODO: reference BOM
+See appendix~\ref{bom} for the bill of materials.
 
 \input{construction-steps}

          
A => manual/gen-bom.py +45 -0
@@ 0,0 1,45 @@ 
+#!/usr/bin/env python3
+#
+# Copyright (c) 2022 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+
+import sys
+
+print("\\begin{tabular}{ll}")
+print("\\textbf{Values} & \\textbf{References}\\\\")
+print("\\hline")
+for line in open(sys.argv[1], "r").readlines():
+    line = ','.join(line.strip().split(",")[2:])
+    assert line[0] == '"', line
+
+    line = line.split('"')
+
+    refs = line[1]
+    assert line[2] == ',', line
+    vals = line[3]
+
+    vals = vals.replace("_", "\\_")
+
+    if line[:4] == ["", "Reference(s)", ",", "Value"]:
+        continue
+
+    print("%s & %s\\\\" % (vals, refs))
+print("\\end{tabular}")