forked from trihedral/ArduinoLatexListing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharduinoLanguage.tex
157 lines (154 loc) · 9.51 KB
/
arduinoLanguage.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% ~ Arduino Language - Arduino IDE Colors ~ %%%
%%% %%%
%%% Kyle Rocha-Brownell | 10/2/2017 | No Licence %%%
%%% -------------------------------------------------------------------------- %%%
%%% %%%
%%% Place this file in your working directory (next to the latex file you're %%%
%%% working on). To add it to your project, place: %%%
%%% \input{arduinoLanguage.tex} %%%
%%% somewhere before \begin{document} in your latex file. %%%
%%% %%%
%%% In your document, place your arduino code between: %%%
%%% \begin{lstlisting}[language=Arduino] %%%
%%% and: %%%
%%% \end{lstlisting} %%%
%%% %%%
%%% Or create your own style to add non-built-in functions and variables. %%%
%%% %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{color}
\usepackage{listings}
\usepackage{courier}
%%% Define Custom IDE Colors %%%
\definecolor{arduinoGreen} {rgb} {0.17, 0.43, 0.01}
\definecolor{arduinoGrey} {rgb} {0.47, 0.47, 0.33}
\definecolor{arduinoOrange} {rgb} {0.8 , 0.4 , 0 }
\definecolor{arduinoBlue} {rgb} {0.01, 0.61, 0.98}
\definecolor{arduinoDarkBlue} {rgb} {0.0 , 0.2 , 0.5 }
%%% Define Arduino Language %%%
\lstdefinelanguage{Arduino}{
language=C++, % begin with default C++ settings
%
%
%%% Keyword Color Group 1 %%% (called KEYWORD3 by arduino)
keywordstyle=\color{arduinoGreen},
deletekeywords={ % remove all arduino keywords that might be in c++
break, case, override, final, continue, default, do, else, for,
if, return, goto, switch, throw, try, while, setup, loop, export,
not, or, and, xor, include, define, elif, else, error, if, ifdef,
ifndef, pragma, warning,
HIGH, LOW, INPUT, INPUT_PULLUP, OUTPUT, DEC, BIN, HEX, OCT, PI,
HALF_PI, TWO_PI, LSBFIRST, MSBFIRST, CHANGE, FALLING, RISING,
DEFAULT, EXTERNAL, INTERNAL, INTERNAL1V1, INTERNAL2V56, LED_BUILTIN,
LED_BUILTIN_RX, LED_BUILTIN_TX, DIGITAL_MESSAGE, FIRMATA_STRING,
ANALOG_MESSAGE, REPORT_DIGITAL, REPORT_ANALOG, SET_PIN_MODE,
SYSTEM_RESET, SYSEX_START, auto, int8_t, int16_t, int32_t, int64_t,
uint8_t, uint16_t, uint32_t, uint64_t, char16_t, char32_t, operator,
enum, delete, bool, boolean, byte, char, const, false, float, double,
null, NULL, int, long, new, private, protected, public, short,
signed, static, volatile, String, void, true, unsigned, word, array,
sizeof, dynamic_cast, typedef, const_cast, struct, static_cast, union,
friend, extern, class, reinterpret_cast, register, explicit, inline,
_Bool, complex, _Complex, _Imaginary, atomic_bool, atomic_char,
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int,
atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong,
virtual, PROGMEM,
Serial, Serial1, Serial2, Serial3, SerialUSB, Keyboard, Mouse,
abs, acos, asin, atan, atan2, ceil, constrain, cos, degrees, exp,
floor, log, map, max, min, radians, random, randomSeed, round, sin,
sq, sqrt, tan, pow, bitRead, bitWrite, bitSet, bitClear, bit,
highByte, lowByte, analogReference, analogRead,
analogReadResolution, analogWrite, analogWriteResolution,
attachInterrupt, detachInterrupt, digitalPinToInterrupt, delay,
delayMicroseconds, digitalWrite, digitalRead, interrupts, millis,
micros, noInterrupts, noTone, pinMode, pulseIn, pulseInLong, shiftIn,
shiftOut, tone, yield, Stream, begin, end, peek, read, print,
println, available, availableForWrite, flush, setTimeout, find,
findUntil, parseInt, parseFloat, readBytes, readBytesUntil, readString,
readStringUntil, trim, toUpperCase, toLowerCase, charAt, compareTo,
concat, endsWith, startsWith, equals, equalsIgnoreCase, getBytes,
indexOf, lastIndexOf, length, replace, setCharAt, substring,
toCharArray, toInt, press, release, releaseAll, accept, click, move,
isPressed, isAlphaNumeric, isAlpha, isAscii, isWhitespace, isControl,
isDigit, isGraph, isLowerCase, isPrintable, isPunct, isSpace,
isUpperCase, isHexadecimalDigit,
},
morekeywords={ % add arduino structures to group 1
break, case, override, final, continue, default, do, else, for,
if, return, goto, switch, throw, try, while, setup, loop, export,
not, or, and, xor, include, define, elif, else, error, if, ifdef,
ifndef, pragma, warning,
},
%
%
%%% Keyword Color Group 2 %%% (called LITERAL1 by arduino)
keywordstyle=[2]\color{arduinoBlue},
keywords=[2]{ % add variables and dataTypes as 2nd group
HIGH, LOW, INPUT, INPUT_PULLUP, OUTPUT, DEC, BIN, HEX, OCT, PI,
HALF_PI, TWO_PI, LSBFIRST, MSBFIRST, CHANGE, FALLING, RISING,
DEFAULT, EXTERNAL, INTERNAL, INTERNAL1V1, INTERNAL2V56, LED_BUILTIN,
LED_BUILTIN_RX, LED_BUILTIN_TX, DIGITAL_MESSAGE, FIRMATA_STRING,
ANALOG_MESSAGE, REPORT_DIGITAL, REPORT_ANALOG, SET_PIN_MODE,
SYSTEM_RESET, SYSEX_START, auto, int8_t, int16_t, int32_t, int64_t,
uint8_t, uint16_t, uint32_t, uint64_t, char16_t, char32_t, operator,
enum, delete, bool, boolean, byte, char, const, false, float, double,
null, NULL, int, long, new, private, protected, public, short,
signed, static, volatile, String, void, true, unsigned, word, array,
sizeof, dynamic_cast, typedef, const_cast, struct, static_cast, union,
friend, extern, class, reinterpret_cast, register, explicit, inline,
_Bool, complex, _Complex, _Imaginary, atomic_bool, atomic_char,
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int,
atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong,
virtual, PROGMEM,
},
%
%
%%% Keyword Color Group 3 %%% (called KEYWORD1 by arduino)
keywordstyle=[3]\bfseries\color{arduinoOrange},
keywords=[3]{ % add built-in functions as a 3rd group
Serial, Serial1, Serial2, Serial3, SerialUSB, Keyboard, Mouse,
},
%
%
%%% Keyword Color Group 4 %%% (called KEYWORD2 by arduino)
keywordstyle=[4]\color{arduinoOrange},
keywords=[4]{ % add more built-in functions as a 4th group
abs, acos, asin, atan, atan2, ceil, constrain, cos, degrees, exp,
floor, log, map, max, min, radians, random, randomSeed, round, sin,
sq, sqrt, tan, pow, bitRead, bitWrite, bitSet, bitClear, bit,
highByte, lowByte, analogReference, analogRead,
analogReadResolution, analogWrite, analogWriteResolution,
attachInterrupt, detachInterrupt, digitalPinToInterrupt, delay,
delayMicroseconds, digitalWrite, digitalRead, interrupts, millis,
micros, noInterrupts, noTone, pinMode, pulseIn, pulseInLong, shiftIn,
shiftOut, tone, yield, Stream, begin, end, peek, read, print,
println, available, availableForWrite, flush, setTimeout, find,
findUntil, parseInt, parseFloat, readBytes, readBytesUntil, readString,
readStringUntil, trim, toUpperCase, toLowerCase, charAt, compareTo,
concat, endsWith, startsWith, equals, equalsIgnoreCase, getBytes,
indexOf, lastIndexOf, length, replace, setCharAt, substring,
toCharArray, toInt, press, release, releaseAll, accept, click, move,
isPressed, isAlphaNumeric, isAlpha, isAscii, isWhitespace, isControl,
isDigit, isGraph, isLowerCase, isPrintable, isPunct, isSpace,
isUpperCase, isHexadecimalDigit,
},
%
%
%%% Set Other Colors %%%
stringstyle=\color{arduinoDarkBlue},
commentstyle=\color{arduinoGrey},
%
%
%%%% Line Numbering %%%%
numbers=left,
numbersep=5pt,
numberstyle=\color{arduinoGrey},
%stepnumber=2, % show every 2 line numbers
%
%
%%%% Code Box Style %%%%
breaklines=true, % wordwrapping
tabsize=2,
basicstyle=\ttfamily
}