-
Notifications
You must be signed in to change notification settings - Fork 0
/
macros.tex
128 lines (106 loc) · 3.49 KB
/
macros.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
%via https://tex.stackexchange.com/questions/257521/getting-colons-after-every-description-item-not-using-listing-package
\let\svitem\item
\newcommand\altitem[1][\relax]{\ifx\relax#1\svitem\else\svitem[#1:]\fi}
\let\svdescription\description
\def\description{\let\item\altitem\svdescription}
\newcommand{\exampleCall}[1]{
\begin{description}
\item[Call] \hfill \\ \pyv{#1} \pyc{validate_tc(telecommand.#1)}
\end{description}
}
\newcommand{\TelecommandDeclaration}[1]{
\begin{description}
\item[Declaration] \hfill \\ \texttt{\pyc{dump_ctor(telecommand.#1)}}
\end{description}
}
\newcommand{\TelecommandApid}[1]{
\begin{description}
\item[Telecommand APID] \texttt{\pyc{get_uplink_apid(telecommand.#1)}}
\end{description}
}
\newcommand{\ResponseApid}[1]{
\begin{description}
\item[Frame APID] \texttt{\pyc{get_downlink_apid(response_frames.#1)}}
\end{description}
}
\newcommand{\telecommand}[1]{
\section{#1}
\label{tc:#1}
}
\newcommand{\tcref}[1]{\nameref{tc:#1}}
\newcommand{\responseFrame}[1]{
\paragraph{#1}
\label{tc:response:#1}
}
\newcommand{\obcproc}[1]{
\section{#1}
\label{obc:proc:#1}
}
\newcommand{\procref}[1]{\nameref{obc:proc:#1}}
\newcommand{\tool}[1]{
\section{#1}
\label{tool:#1}
}
\newcommand{\toolref}[1]{\nameref{tool:#1}}
\definecolor{dangerousbackground}{RGB}{224, 105, 116}
\definecolor{potentiallydangerousbackground}{RGB}{249, 210, 92}
\definecolor{safebackground}{RGB}{97, 226, 127}
\newenvironment{warning}
{\par\begin{mdframed}[linecolor=black, backgroundcolor=warningbackground]
\begin{list}{}{\leftmargin=1cm
\labelwidth=\leftmargin}\item[\faWarning]}
{\end{list}\end{mdframed}\par}
\newenvironment{coloriconbox}[2]{
\par\begin{mdframed}[linecolor=black, backgroundcolor=#2]
\begin{list}{}{\leftmargin=1cm
\labelwidth=\leftmargin}\item[#1]
}{\end{list}\end{mdframed}\par}
\newcommand{\tccategory}[1]{
\IfEqCase{#1}{%
{D}{
\begin{coloriconbox}{\faHandStopO}{dangerousbackground}
\textbf{Dangerous telecommand}\\
This telecommand has huge impact on satellite. Do not use it recklessly!
\end{coloriconbox}
}%
{PD}{
\begin{coloriconbox}{\faWarning}{potentiallydangerousbackground}
\textbf{Potentially dangerous telecommand}\\
This telecommand has impact on satellite. Think twice before using it!
\end{coloriconbox}
}%
{S}{
\begin{coloriconbox}{\faCheck}{safebackground}
\textbf{Safe telecommand}\\
This telecommand is safe and can be used in most cases.
\end{coloriconbox}
}
}[\PackageError{tree}{Undefined telecommand category: #1}{}]%
}
\newenvironment{tcarglist}
{
\tabularx{\textwidth}{ l | r | X }
Argument & Size [bits] & Description \\
\hline
}{\endtabularx}
\newcommand{\tcarg}[3]{\texttt{#1} & #2 & #3 \\}
\newcommand{\warn}[1]{\faWarning\mbox{} #1}
\newcommand{\danger}[1]{\faBomb\mbox{} #1}
\newcommand{\memsection}[4]{%
% define the height of the memsection
\bytefieldsetup{bitheight=#3\baselineskip}%
\bitbox[]{10}{%
\texttt{#1}% print end address
\\
% do some spacing
\vspace{#3\baselineskip}
\vspace{-2\baselineskip}
\vspace{-#3pt}
\texttt{#2}% print start address
}%
\bitbox{16}{#4}% print box with caption
}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{M}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}