Skip to content
This repository has been archived by the owner on Apr 13, 2021. It is now read-only.

Commit

Permalink
Add step to the documentation build that compiles diagrams from latex…
Browse files Browse the repository at this point in the history
…/tikz source into PNG files that can be included from Doxygen. Added diagram for a Costas loop.
  • Loading branch information
fnoble committed Apr 4, 2012
1 parent 911b1fb commit edea121
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ clean:
done

docs:
$(MAKE) -C docs/diagrams
doxygen docs/Doxyfile

2 changes: 1 addition & 1 deletion docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ EXAMPLE_RECURSIVE = NO
# directories that contain image that are included in the documentation (see
# the \image command).

IMAGE_PATH =
IMAGE_PATH = docs/diagrams/

# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
Expand Down
17 changes: 17 additions & 0 deletions docs/diagrams/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

DIAGRAMS = costas_loop.tex

PDFS = $(DIAGRAMS:.tex=.pdf)

PNGS = $(PDFS:.pdf=.png)

all: $(PNGS)

%.pdf: %.tex
pdflatex $<

%.png: %.pdf
convert -density 120 -trim -bordercolor White -border 20 $< $@

clean:
rm *.aux *.log *.pdf *.png
52 changes: 52 additions & 0 deletions docs/diagrams/costas_loop.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
\documentclass{article}
\pagestyle{empty}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}

\input{tikz_styles.tex}

\tikzstyle{mix} = [draw, circle, node distance=1cm, minimum size=0.7cm]
\tikzstyle{input} = [coordinate]

\begin{tikzpicture}[auto, thick, node distance=1.5cm, >=stealth']

\def\h{2.5cm}

\node [input, name=input] {};
\node [input, right of=input, name=split] {};
\node [block, right of=split, node distance=2cm] (nco) {Carrier NCO};
\node [mix, above of=nco, node distance=\h] (Imix) {};
\node [simpleblock, below of=nco, node distance=\h*0.4] (Qphase) {$\frac{\pi}{2}$};
\node [mix, below of=nco, node distance=\h] (Qmix) {};
\node [block, right of=nco, node distance=3.5cm, text width=2cm] (filter) {Loop filter \\ $D[z]$};
\node [block, above of=filter, node distance=\h, text width=2cm] (Idump) {Integrate \& Dump};
\node [block, below of=filter, node distance=\h, text width=2cm] (Qdump) {Integrate \& Dump};
\node [block, right of=filter, node distance=3.5cm] (desc) {Discriminator};

\draw [->] (input) -- node {$x(n)$} (split);
\draw [->] (split) |- (Imix);
\draw [->] (split) |- (Qmix);
\draw [->] (Imix) -- node {$x_i(n)$} (Idump);
\draw [->] (Qmix) -- node {$x_q(n)$} (Qdump);
\draw [->] (Idump) -| node[near start, above] {$I(n)$} (desc);
\draw [->] (Qdump) -| node[near start, above] {$Q(n)$} (desc);
\draw [->] (desc) -- node {$\varepsilon(n)$} (filter);
\draw [->] (filter) -- node {$\tilde f(n)$} (nco);
\draw [->] (nco) -- node {$\tilde x_i(n)$} (Imix);
\draw [->] (nco) -- (Qphase);
\draw [->] (Qphase) -- node[left] {$\tilde x_q(n)$} (Qmix);

\draw [-] (Imix.south west) -- (Imix.north east);
\draw [-] (Imix.south east) -- (Imix.north west);
\draw [-] (Qmix.south west) -- (Qmix.north east);
\draw [-] (Qmix.south east) -- (Qmix.north west);

\node [above right of=Imix, node distance=0.7cm] {\textbf{I}};
\node [below right of=Qmix, node distance=0.7cm] {\textbf{Q}};

\end{tikzpicture}

\end{document}

15 changes: 15 additions & 0 deletions docs/diagrams/tikz_styles.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
% Define some styles for use in Tikz diagrams.

\tikzstyle{simpleblock} = [draw, rectangle, minimum height=2em, minimum width=1em]

\tikzstyle{block} = [
draw=blue!50!black!50,
very thick,
top color=blue!5,
bottom color=blue!15,
rounded corners=1.5mm,
rectangle,
minimum height=2em,
minimum width=1em,
text centered
]

0 comments on commit edea121

Please sign in to comment.