\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Claudiu (claudiunv)} \pdfinfo{ /Title (arduino-uno-to-avr-gcc-migration.pdf) /Creator (Cheatography) /Author (Claudiu (claudiunv)) /Subject (Arduino Uno to avr-gcc Migration Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{1B67CC} \definecolor{LightBackground}{HTML}{F0F5FB} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Arduino Uno to avr-gcc Migration Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Claudiu (claudiunv)} via \textcolor{DarkBackground}{\uline{cheatography.com/32377/cs/11264/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Claudiu (claudiunv) \\ \uline{cheatography.com/claudiunv} \\ \uline{\seqsplit{claudiunutu}.com} \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 26th March, 2017.\\ Updated 25th March, 2017.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{x{1.94103 cm} x{3.03597 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Digital I/O Mapping}} \tn % Row 0 \SetRowColor{LightBackground} D0 (Rx) & PD0 \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} D1 (Tx) & PD1 \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} D2 & PD2 (INT0) \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} D3 (PWM) & PD3 (INT1) \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} D4 & PD4 (XCK/T0) \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} D5 (PWM) & PD5 (T1) \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} D6 (PWM) & PD6 (AIN0) \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} D7 & PD7 (AIN2) \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} D8 & PB0 (ICP1) \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} D9 (PWM) & PB1 (OC1A) \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} D10 (PWM) & PB2 (SS/OC1B) \tn % Row Count 11 (+ 1) % Row 11 \SetRowColor{white} D11 (PWM) & PB3 (MOSI/OC2) \tn % Row Count 12 (+ 1) % Row 12 \SetRowColor{LightBackground} D12 & PB4 (MISO) \tn % Row Count 13 (+ 1) % Row 13 \SetRowColor{white} D13 & PB5 (SCK) \tn % Row Count 14 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Arduino UNO and ATmega328P microcontroller digital pin mapping.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.64701 cm} x{4.32999 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Analog I/O Mapping}} \tn % Row 0 \SetRowColor{LightBackground} A0 & PC0 (ADC0) \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} A1 & PC1 (ADC1) \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} A2 & PC2 (ADC2) \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} A3 & PC3 (ADC3) \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} A4 & PC4 (ADC4/SDA) \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} A5 & PC5 (ADC5/SCL) \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Arduino UNO and ATmega328P microcontroller analog pin mapping.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.59724 cm} x{4.37976 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Alternative PIN Functions}} \tn % Row 0 \SetRowColor{LightBackground} PB0 & PCINT0/CLKO/ICP1 \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} PB1 & OC1A/PCINT1 \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} PB2 & \textasciitilde{}SS/OC1B/PCINT2 \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} PB3 & (**) MOSI/OC2A/PCINT3 \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} PB4 & (**) MISO/PCINT4 \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} PB5 & (**) SCK/PCINT5 \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} PB6 & (*) PCINT6/XTAL1/TOSC1 \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} PB7 & (*) PCINT7/XTAL2/TOSC2 \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} PC0 & ADC0/PCINT8 \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} PC1 & ADC1/PCINT9 \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} PC2 & ADC2/PCINT10 \tn % Row Count 11 (+ 1) % Row 11 \SetRowColor{white} PC3 & ADC3/PCINT11 \tn % Row Count 12 (+ 1) % Row 12 \SetRowColor{LightBackground} PC4 & ADC4/SDA/PCINT12 \tn % Row Count 13 (+ 1) % Row 13 \SetRowColor{white} PC5 & ADC5/SCL/PCINT13 \tn % Row Count 14 (+ 1) % Row 14 \SetRowColor{LightBackground} PC6 & (*) PCINT14/\textasciitilde{}RESET \tn % Row Count 15 (+ 1) % Row 15 \SetRowColor{white} PD0 & PCINT16/RXD \tn % Row Count 16 (+ 1) % Row 16 \SetRowColor{LightBackground} PD1 & PCINT17/TXD \tn % Row Count 17 (+ 1) % Row 17 \SetRowColor{white} PD2 & PCINT18/INT0 \tn % Row Count 18 (+ 1) % Row 18 \SetRowColor{LightBackground} PD3 & PCINT19/OC2B/INT1 \tn % Row Count 19 (+ 1) % Row 19 \SetRowColor{white} PD4 & PCINT20/XCK/T0 \tn % Row Count 20 (+ 1) % Row 20 \SetRowColor{LightBackground} PD5 & PCINT6/XTAL1/TOSC1 \tn % Row Count 21 (+ 1) % Row 21 \SetRowColor{white} PD6 & PCINT22/OC0A/AIN0 \tn % Row Count 22 (+ 1) % Row 22 \SetRowColor{LightBackground} PD7 & PCINT23/AIN1 \tn % Row Count 23 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{(*) Already reserved on Arduino UNO for crystal (16MHz) and RESET. \newline (**) Shared with programmer's connector (see AVR910).} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Arduino UNO Q/A}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{What's the crystal frequency?} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}16MHz} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What's the default serial baud rate?} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}9600 baud} \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.14471 cm} x{3.83229 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{I/O Addressing}} \tn % Row 0 \SetRowColor{LightBackground} PINB (0x03) & \seqsplit{PINB0|PINB1|PINB2|PINB3|PINB4|PINB5|PINB6|PINB7} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} DDRB (0x04) & \seqsplit{DDB0|DDB1|DDB2|DDB3|DDB0|DDB4|DDB5|DDB6|DDB7} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} PORTB (0x05) & \seqsplit{PORTB0|PORTB1|PORTB2|PORTB3|PORTB4|PORTB5|PORTB6|PORTB7} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} PINC (0x06) & \seqsplit{PINC0|PINC1|PINC2|PINC3|PINC4|PINC5|PINC6} \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} DDRC (0x07) & \seqsplit{DDC0|DDC1|DDC2|DDC3|DDC4|DDC5|DDC6} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} PORTC (0x08) & \seqsplit{PORTC0|PORTC1|PORTC2|PORTC3|PORTC4|PORTC5|PORTC6} \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} PIND (0x09) & \seqsplit{PIND0|PIND1|PIND2|PIND3|PIND4|PIND5|PIND6|PIND7} \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} DDRD (0x0A) & \seqsplit{DDD0|DDD1|DDD2|DDD3|DDD4|DDD5|DDD6|DDD7} \tn % Row Count 16 (+ 2) % Row 8 \SetRowColor{LightBackground} PORTD (0x0B) & \seqsplit{PORTD0|PORTD1|PORTD2|PORTD3|PORTD4|PORTD5|PORTD6|PORTD7} \tn % Row Count 18 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.24425 cm} x{3.73275 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Generic GPIO}} \tn % Row 0 \SetRowColor{LightBackground} GPIOR0 (0x1E) & \seqsplit{GPIOR00|GPIOR01|GPIOR02|GPIOR03|GPIOR04|GPIOR05|GPIOR06|GPIOR07} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} GPIOR1 (0x2A) & \seqsplit{GPIOR10|GPIOR11|GPIOR12|GPIOR13|GPIOR14|GPIOR15|GPIOR16|GPIOR17} \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} GPIOR2 (0x2B) & \seqsplit{GPIOR20|GPIOR21|GPIOR22|GPIOR23|GPIOR24|GPIOR25|GPIOR26|GPIOR27} \tn % Row Count 9 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}