diff options
author | Karl Berry <karl@freefriends.org> | 2019-11-27 22:04:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-11-27 22:04:46 +0000 |
commit | dfcfaf13bf06d6f9d566e374ca651bfee453ae24 (patch) | |
tree | b6b70291be73551d8ff476c07d1b126cfa5d931e | |
parent | a928eb9724aca82d58f67dda4cdaf5f3628dbcb1 (diff) |
pinoutikz (27nov19)
git-svn-id: svn://tug.org/texlive/trunk@52946 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/pinoutikz/README.md | 21 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pinoutikz/pinoutikz_doc_en.pdf | bin | 53111 -> 68332 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/pinoutikz/pinoutikz_doc_en.tex | 268 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pinoutikz/pinoutikz.sty | 119 |
4 files changed, 349 insertions, 59 deletions
diff --git a/Master/texmf-dist/doc/latex/pinoutikz/README.md b/Master/texmf-dist/doc/latex/pinoutikz/README.md index 748cb642b90..f042634706b 100644 --- a/Master/texmf-dist/doc/latex/pinoutikz/README.md +++ b/Master/texmf-dist/doc/latex/pinoutikz/README.md @@ -1,15 +1,17 @@ _________________ pinoutikz package - v 1.0.1 - 2019/11/23 + 1.1.0 + 2019/11/25 _________________ -This package provides macros manipulating for generating chip pinout diagrams. +This package provides macros for chip pinout diagrams typesetting. Main features are: * pinout diagrams: - PDIP packages + - TQFP packages + - PLCC packages * formatting of pin labels: - logical negation (show as a text with oveeline). @@ -17,10 +19,21 @@ This bundle contains 4 files: * pinoutikz.sty (the package itself) * pinoutikz_doc.tex and pinoutikz_doc.pdf (manual in english) - this one substitutes for a quick test as well - * README (this file) + * README.md (this file) ############################################################################## Robert Blazek <robert.h.blazek@gmail.com> +License: +------------------------------------------------------------------------------ This material is subject to the LATEX Project Public License 1.3c + +Change history: +------------------------------------------------------------------------------ +Version 1.1.0, 2019/11/25 (against 1.0.1) +* New packages added: TQFP, PLCC +* Pin label syntax changed -> <pin position>/<pin label> + +Version 1.0.1 2019/11/23 +* version created diff --git a/Master/texmf-dist/doc/latex/pinoutikz/pinoutikz_doc_en.pdf b/Master/texmf-dist/doc/latex/pinoutikz/pinoutikz_doc_en.pdf Binary files differindex 928aca5222c..82680ea7865 100644 --- a/Master/texmf-dist/doc/latex/pinoutikz/pinoutikz_doc_en.pdf +++ b/Master/texmf-dist/doc/latex/pinoutikz/pinoutikz_doc_en.pdf diff --git a/Master/texmf-dist/doc/latex/pinoutikz/pinoutikz_doc_en.tex b/Master/texmf-dist/doc/latex/pinoutikz/pinoutikz_doc_en.tex index 4540a2bfcdb..b0013609291 100644 --- a/Master/texmf-dist/doc/latex/pinoutikz/pinoutikz_doc_en.tex +++ b/Master/texmf-dist/doc/latex/pinoutikz/pinoutikz_doc_en.tex @@ -97,7 +97,7 @@ \begin{minipage}{0.85\linewidth} \noindent \hfill\textbf{\textit{Abstract}}\hfill{}\medskip\par - This package which requires $\varepsilon$-\TeX{}, provides macros manipulating strings of tokens. For a basic use, tokens can be alphanumeric chars, but the macros can also be useful for manipulating tokens, i.e. \TeX{} code. + This package which requires $\varepsilon$-\TeX{}, provides macros for creating pinout diagrams of chips. \end{minipage} \end{center} @@ -118,7 +118,7 @@ I hope others will find it as useful as it was to me and my colleagues. This is my first latex package documentation ever - and since I hate reinventing the wheel - this manual has been based upon that of \textbf{xstrings} - with the courtesy of the author, of course. \section{The macros} -For a better understanding, let's see first the macros with the simpler arguments possible. No special catcode, no exotic token, no control sequence neither: only alphanumeric chars will be contained in the arguments.\medskip +For a better understanding, let's see first the macros with the simpler arguments possible. No special catcode, no exotic token, no control sequence either: only alphanumeric chars will be contained in the arguments.\medskip In the following chapters, all the macros will be presented this way: \begin{itemize} @@ -133,12 +133,14 @@ All the macros of \pinouTikz are displayed in {\makeatletter\color{@xs@keywordsp \subsection{The pinout diagrams} \subsubsection{\ttfamily\textbackslash PDIP} -\verbinline|\PDIP|\arguD{pinnumber}\ARGU{pinarray} +\verbinline|\PDIP|\arguD{pincount}\ARGU{pinarray} \smallskip +Draws a PDIP package, with generic number of pins. + \begin{itemize} - \item \argu{pinnumber} thethe number of pins of a DIP package and should be an even number. - \item \ARGU{pinarray} is a list of pins - position of every pin's description is defined by its position in this array. + \item \argu{pincount} the number of pins of a DIP package and should be an even number. + \item \ARGU{pinarray} is a comma-separated list of pins - each pin definition is as follows: \argu{pinnumber}/\ARGU{pinlabel}. \end{itemize} %% 4-pin example @@ -147,16 +149,16 @@ All the macros of \pinouTikz are displayed in {\makeatletter\color{@xs@keywordsp \begin{figure} \centering \PDIP(4){% - 1/E,2/B,3/NC,4/C} + 1/{E},2/B,3/NC,4/C} \caption{NPN-Transistor, 4-pin PDIP package} \label{fig:X_DIP4} \end{figure} \end{lstlisting}% %% 4-pin example -\begin{figure} +\begin{figure}[ht!] \centering \PDIP(4){% - 1/E, + 1/{E}, 2/B, 3/NC, 4/C @@ -176,7 +178,7 @@ All the macros of \pinouTikz are displayed in {\makeatletter\color{@xs@keywordsp 3/B, 4/GND, 5/Y, - 6/\FormatPinLabel{~Y~}, + 6/{\FormatPinLabel{~Y~}/RESET}, 7/NC, 8/$V_{cc}$% } @@ -185,7 +187,7 @@ All the macros of \pinouTikz are displayed in {\makeatletter\color{@xs@keywordsp \end{lstlisting}% %% 8-pin example -\begin{figure} +\begin{figure}[ht!] \centering \PDIP(8){% 1/CLK, @@ -193,59 +195,233 @@ All the macros of \pinouTikz are displayed in {\makeatletter\color{@xs@keywordsp 3/B, 4/GND, 5/Y, - 6/\FormatPinLabel{~Y~}, + 6/{\FormatPinLabel{~Y~}/RESET}, 7/NC, 8/$V_{cc}$% } \caption{TTL logic chip, 8-pin PDIP package} \label{fig:X_DIP8} \end{figure} - %\end{minipage}\hfill + %% 14-pin example -%\begin{minipage}[t]{0.65\linewidth} -\begin{lstlisting} -\begin{figure} +\begin{figure}[ht!] \centering \PDIP(14){% - 1/A1, %1 - 2/B1, %2 - 3/\FormatPinLabel{\#1 AND/~OR~/GPIO1}, %3 - 4/Y1, %4 - 5/C1, %5 - 6/\FormatPinLabel{\#2 AND/~OR~/GPIO2}, %6 - 7/GND, %7 - 8/PCLK, %8 - 9/PDAT, %9 - 10/A2, %10 - 11/B2, %11 - 12/\FormatPinLabel{\#2 INV/~SME~/GPIO3}, %12 - 13/C2, %13 - 14/$V_{cc}$} %14 + 1/A1, + 2/B1, + 3/\FormatPinLabel{\#1 AND/~OR~/GPIO1}, + 4/Y1, + 5/C1, + 6/\FormatPinLabel{\#2 AND/~OR~/GPIO2}, + 7/GND, + 8/PCLK, + 9/PDAT, + 10/A2, + 11/B2, + 12/\FormatPinLabel{\#2 INV/~SME~/GPIO3}, + 13/C2, + 14/$V_{cc}$} \caption{Generic programmable TTL logic chip, 14-pin PDIP package} \label{fig:X_DIP14} \end{figure} -\end{lstlisting}% -%\end{minipage}\hfill %% 14-pin example -\begin{figure} +\begin{minipage}[t]{0.65\linewidth} +\begin{lstlisting} +\begin{figure}[ht!] \centering \PDIP(14){% - 1/A1, %1 - 2/B1, %2 - 3/\FormatPinLabel{\#1 AND/~OR~/GPIO1}, %3 - 4/Y1, %4 - 5/C1, %5 - 6/\FormatPinLabel{\#2 AND/~OR~/GPIO2}, %6 - 7/GND, %7 - 8/PCLK, %8 - 9/PDAT, %9 - 10/A2, %10 - 11/B2, %11 - 12/\FormatPinLabel{\#2 INV/~SME~/GPIO3}, %12 - 13/C2, %13 - 14/$V_{cc}$} %14 + 1/A1, + 2/B1, + 3/\FormatPinLabel{\#1 AND/~OR~/GPIO1}, + 4/Y1, + 5/C1, + 6/\FormatPinLabel{\#2 AND/~OR~/GPIO2}, + 7/GND, + 8/PCLK, + 9/PDAT, + 10/A2, + 11/B2, + 12/\FormatPinLabel{\#2 INV/~SME~/GPIO3}, + 13/C2, + 14/$V_{cc}$} \caption{Generic programmable TTL logic chip, 14-pin PDIP package} \label{fig:X_DIP14} \end{figure} +\end{lstlisting}% +\end{minipage}\hfill + +\subsubsection{\ttfamily\textbackslash TQFP} +\verbinline|\TQFP|\arguD{pinnumber}\ARGU{pinarray} +\smallskip + +\begin{itemize} + \item \argu{pincount} the number of pins of a DIP package and should be an even number. + \item \ARGU{pinarray} is a comma-separated list of pins - each pin definition is as follows: \argu{pinnumber}/\ARGU{pinlabel}. +\end{itemize} + +%% 32-pin TQFP example +\begin{minipage}[t]{0.65\linewidth} +\begin{lstlisting} +\begin{figure}[ht!] + \centering + \TQFP(32){% + 1/{PD.0/RTX1}, + 2/{PA.0/STX1}, + 3/PA.1, + 4/PA.2, + 5/PA.3, + 6/PA.4, + 7/PA.5, + 8/GND, + 9/PA.6, + 10/PA.7, + 11/{PB.0/RTX1}, + 12/{PB.1/STX1}, + 13/PB.2, + 14/PB.3, + 15/PB.4, + 16/PB.5, + 17/PB.6, + 18/PB.7, + 19/\FormatPinLabel{PC.0/~ALE~/PLPBC0}, + 20/PC.1, + 21/PC.2, + 22/PC.3, + 23/PC.4, + 24/PC.5, + 25/PC.6, + 26/PC.7, + 27/XTAL1/PD.3, + 28/XTAL2/PD.4, + 29/RST, + 30/PD.1, + 31/PD.2, + 32/$V_{cc}$} + \caption{A generic MCU chip, 32-pin TQFP package} \label{fig:X_TQFP32} +\end{figure} +\end{lstlisting}% +\end{minipage}\hfill + +%% 32-pin TQFP example +\begin{figure}[ht!] + \centering + \TQFP(32){% + 1/{PD.0/RTX1}, + 2/{PA.0/STX1}, + 3/PA.1, + 4/PA.2, + 5/PA.3, + 6/PA.4, + 7/PA.5, + 8/GND, + 9/PA.6, + 10/PA.7, + 11/{PB.0/RTX1}, + 12/{PB.1/STX1}, + 13/PB.2, + 14/PB.3, + 15/PB.4, + 16/PB.5, + 17/PB.6, + 18/PB.7, + 19/\FormatPinLabel{PC.0/~ALE~/PLPBC0}, + 20/PC.1, + 21/PC.2, + 22/PC.3, + 23/PC.4, + 24/PC.5, + 25/PC.6, + 26/PC.7, + 27/XTAL1/PD.3, + 28/XTAL2/PD.4, + 29/RST, + 30/PD.1, + 31/PD.2, + 32/$V_{cc}$} + \caption{A generic MCU chip, 32-pin TQFP package} \label{fig:X_TQFP32} +\end{figure} + +\subsubsection{\ttfamily\textbackslash PLCC} +\verbinline|\PLCC|\arguD{pinnumber}\ARGU{pinarray} +\smallskip + +\begin{itemize} + \item \argu{pincount} the number of pins of a DIP package and should be an even number. + \item \ARGU{pinarray} is a comma-separated list of pins - each pin definition is as follows: \argu{pinnumber}/\ARGU{pinlabel}. +\end{itemize} + +%% 28-pin PLCC example +\begin{minipage}[t]{0.65\linewidth} +\begin{lstlisting} +\begin{figure}[ht!] + \centering + \PLCC(28){% + 1/{PD.0/RTX1}, + 2/{PA.0/STX1}, + 3/PA.1, + 4/PA.2, + 5/PA.3, + 6/PA.4, + 7/PA.5, + 8/GND, + 9/PA.6, + 10/PA.7, + 11/{PB.0/RTX1}, + 12/{PB.1/STX1}, + 13/PB.2, + 14/PB.3, + 15/PB.4, + 16/PB.5, + 17/PB.6, + 18/PB.7, + 19/\FormatPinLabel{PC.0/~ALE~/PLPBC0}, + 20/PC.1, + 21/PC.2, + 22/PC.3, + 23/{XTAL1/PD.3}, + 24/{XTAL2/PD.4}, + 25/RST, + 26/PD.1, + 27/PD.2, + 28/$V_{cc}$} + \caption{A generic MCU chip, 28-pin PLCC package} \label{fig:X_PLCC28} +\end{figure} +\end{lstlisting}% +\end{minipage}\hfill + +%% 28-pin PLCC example +\begin{figure}[ht!] + \centering + \PLCC(28){% + 1/{PD.0/RTX1}, + 2/{PA.0/STX1}, + 3/PA.1, + 4/PA.2, + 5/PA.3, + 6/PA.4, + 7/PA.5, + 8/GND, + 9/PA.6, + 10/PA.7, + 11/{PB.0/RTX1}, + 12/{PB.1/STX1}, + 13/PB.2, + 14/PB.3, + 15/PB.4, + 16/PB.5, + 17/PB.6, + 18/PB.7, + 19/\FormatPinLabel{PC.0/~ALE~/PLPBC0}, + 20/PC.1, + 21/PC.2, + 22/PC.3, + 23/{XTAL1/PD.3}, + 24/{XTAL2/PD.4}, + 25/RST, + 26/PD.1, + 27/PD.2, + 28/$V_{cc}$} + \caption{A generic MCU chip, 28-pin PLCC package} \label{fig:X_PLCC28} +\end{figure} %% Examples for PDIP packages \begin{minipage}[t]{0.35\linewidth} diff --git a/Master/texmf-dist/tex/latex/pinoutikz/pinoutikz.sty b/Master/texmf-dist/tex/latex/pinoutikz/pinoutikz.sty index 4ecbcdcd314..30656c61435 100644 --- a/Master/texmf-dist/tex/latex/pinoutikz/pinoutikz.sty +++ b/Master/texmf-dist/tex/latex/pinoutikz/pinoutikz.sty @@ -1,5 +1,8 @@ +% License: LATEX Project Public License 1.3c +% Author: Robert Blazek +% Date: 2019/11/25 \NeedsTeXFormat{LaTeX2e}[1994/06/01] -\ProvidesPackage{pinoutikz}[1.0.1 Pinout diagram definitions] +\ProvidesPackage{pinoutikz}[1.1.0 Pinout diagram definitions] \RequirePackage{ifthen} \RequirePackage{lmodern} @@ -9,6 +12,7 @@ \RequirePackage{amsfonts} \RequirePackage{forarray} \RequirePackage{arrayjob} +\RequirePackage{pgf} \RequirePackage{tikz} %% 'sans serif' option @@ -31,9 +35,11 @@ \ProcessOptions\relax +\usetikzlibrary{shapes.misc, shapes.geometric} + \def\pinoutikzname {pinouTikz} -\def\pinoutikzversion {1.0.1} -\def\pinoutikzdate {2019/11/23} +\def\pinoutikzversion {1.1.0} +\def\pinoutikzdate {2019/11/25} %% Formatt a pin name \def\FormatPinLabel#1{ @@ -51,6 +57,18 @@ {#1} } +%% package rectangle +\def\CASE(#1)#2#3#4 {% + \ifthenelse{\equal{#1}{TQFP}}{% + \node[draw=black, rectangle,minimum width=#3,minimum height=#4,line width=1.5pt, chamfered rectangle, chamfered rectangle corners={north west, north east, south east, south west}] at (#2) (case) {}; + \draw (-.39 cm,#4-1.15cm) circle (1.5mm); + }{}% + \ifthenelse{\equal{#1}{PLCC}}{% + \node[draw=black, rectangle,minimum width=#3,minimum height=#4,line width=1.5pt, chamfered rectangle, chamfered rectangle corners={north west}] at (#2) (case) {}; + %\node[draw=black, circle,minimum size=1.5mm] at (#3*.5 cm,#4-1.25cm) (mark) {}; + }{}% +} + %% PIN diagram with label decoding %% @param#1: options %% @param#2: offset @@ -60,14 +78,26 @@ % decode label \begin{scope}[shift={(#2)}] \def\pinlabel{#3} - \ifthenelse{\equal{#1}{right}}{% + \ifthenelse{\equal{#1}{right}}% + {% \draw (0.12,0) node[label=right:{\footnotesize \pinlabel},label=left:{\small \pgfmathprintnumber{#4}} ]{}; \draw (0,-.15) rectangle(0.12,0.15); - }% + }{} + \ifthenelse{\equal{#1}{left}}% {% - \draw (0,0) node[label=left:{\footnotesize \pinlabel},label=right:{\small \pgfmathprintnumber{#4}} ]{}; - \draw (0,-.15) rectangle(0.12,0.15); - }% + \draw (-0.12,0) node[label=left:{\footnotesize \pinlabel},label=right:{\small \pgfmathprintnumber{#4}} ]{}; + \draw[rotate=180] (0,-.15) rectangle(0.12,0.15); + }{} + \ifthenelse{\equal{#1}{top}}% + {% + \draw(0,0.12) node[rotate=90,label=right:\rotatebox{90}{\footnotesize \pinlabel},label=left:\rotatebox{90}{\small \pgfmathprintnumber{#4}} ]{}; + \draw[rotate=90](0,-.15) rectangle(0.12,0.15); + }{} + \ifthenelse{\equal{#1}{bottom}}% + {% + \draw(0,-0.12) node[rotate=90,label=left:\rotatebox{90}{\footnotesize \pinlabel},label=right:\rotatebox{90}{\small \pgfmathprintnumber{#4}} ]{}; + \draw[rotate=-90](0,-.15) rectangle(0.12,0.15); + }{} \end{scope} } @@ -85,7 +115,7 @@ \pgfmathparse{#1/2}\let\cntstr\pgfmathresult \pgfmathparse{#1-1}\let\cntpinsr\pgfmathresult \pgfmathparse{\cntstr*.5}\let\height\pgfmathresult - \draw[line width=1.5pt] (0.12,-0.5) rectangle (1.88,\height); + \draw[line width=1.5pt] (0,-0.5) rectangle (1.88,\height); \draw (0.80,\height) arc (180:360:2mm); %iterate through pin definitions \foreach \pinnum/\i in {#2}% @@ -108,6 +138,77 @@ \end{tikzpicture} } +% #1 - pin count +% #2 - pin array +% #3 - case type +% #4 - pin offset +\def\GENFOUREDGE(#1)#2#3#4{% + \sffamily + \textsf{% + \def\pins{{#2}} + \pgfmathparse{#1/4-1}\let\cntpinsl\pgfmathresult + \pgfmathparse{#1/4}\let\cntstr\pgfmathresult + \pgfmathparse{#1-1}\let\cntpinsr\pgfmathresult + \pgfmathparse{\cntstr*.4+.4}\let\height\pgfmathresult + \pgfmathparse{\height}\let\width\pgfmathresult + %\draw[line width=1.5pt] (-0.75,-0.75) rectangle (\width,\height); +% \node[draw=black, rectangle,minimum width=\width cm + 0.75 cm,minimum height=\height cm + 0.75 cm,line width=1.5pt, chamfered rectangle, chamfered rectangle corners={north west}] at (\width*.5-0.75*.5,\width*.5-0.75*.5) (case) {}; + \CASE(#3){\width*.5-0.75*.5,\width*.5-0.75*.5}{\width cm + 0.75 cm}{\height cm + 0.75 cm} + %iterate through pin definitions + \foreach \pinnum/\i in {#2}% + {% + \pgfmathparse{\pinnum-1}\let\pinidx\pgfmathresult + \pgfmathparse{Mod((int(\pinidx+#1)-#4),#1)}\let\pinidx\pgfmathresult + \pgfmathparse{int(\pinidx/\cntstr)}\let\pinrange\pgfmathresult + \pgfmathparse{Mod(\pinidx,\cntstr)}\let\rngidx\pgfmathresult + \ifthenelse{\equal{\pinrange}{0} }% + {% + \pgfmathparse{(\cntpinsl-\rngidx)*0.40}\let\ypin\pgfmathresult + \PIN[left](-0.75,\ypin){\i}{\pinnum} + }{} + \ifthenelse{\equal{\pinrange}{1} }% + {% + \pgfmathparse{\rngidx*0.40}\let\ypin\pgfmathresult + \PIN[bottom](\ypin,-0.75){\i}{\pinnum} + }{} + \ifthenelse{\equal{\pinrange}{2} }% + {% + \pgfmathparse{\rngidx*0.40}\let\ypin\pgfmathresult + \PIN[right](\width,\ypin){\i}{\pinnum} + }{} + \ifthenelse{\equal{\pinrange}{3} }% + {% + \pgfmathparse{(\cntpinsl-\rngidx)*0.40}\let\ypin\pgfmathresult + \PIN[top](\ypin,\height){\i}{\pinnum} + }{}% \fi + } + } +} + +%% PLCC package diagram +%% @param#1: offset +%% @param#2: number of pins (divisible by 2) +%% @param#3: comma separated definitions list for every pin - every pin definition must be enclosed in quotation marks ("") +\def\PLCC(#1)#2{% + \begin{tikzpicture} + \begin{scope}[shift={(0,0)}] + \GENFOUREDGE(#1){#2}{PLCC}{round(#1*.125)} + \end{scope} + \end{tikzpicture} +} + +%% TQFP package diagram +%% @param#1: offset +%% @param#2: number of pins (divisible by 2) +%% @param#3: comma separated definitions list for every pin - every pin definition must be enclosed in quotation marks ("") +\def\TQFP(#1)#2{% + \begin{tikzpicture} + \begin{scope}[shift={(0,0)}] + \GENFOUREDGE(#1){#2}{TQFP}{0} + \end{scope} + \end{tikzpicture} +} + %% \newlength{\pardefault} |