\hypertarget{encoder_8c}{}\doxysection{encoder.\+c-\/Dateireferenz}
\label{encoder_8c}\index{encoder.c@{encoder.c}}


Drehencoder Library.  


{\ttfamily \#include $<$avr/io.\+h$>$}\newline
{\ttfamily \#include $<$avr/interrupt.\+h$>$}\newline
{\ttfamily \#include \char`\"{}encoder.\+h\char`\"{}}\newline
Include-\/\+Abhängigkeitsdiagramm für encoder.\+c\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=301pt]{encoder_8c__incl}
\end{center}
\end{figure}
\doxysubsection*{Typdefinitionen}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{encoder_8c_aedeed12448cdc285bc8c21763ae9f1a0}\label{encoder_8c_aedeed12448cdc285bc8c21763ae9f1a0}} 
typedef enum \mbox{\hyperlink{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4b}{EButton\+State}} {\bfseries t\+EButton\+State}
\end{DoxyCompactItemize}
\doxysubsection*{Aufzählungen}
\begin{DoxyCompactItemize}
\item 
enum \mbox{\hyperlink{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4b}{EButton\+State}} \{ \mbox{\hyperlink{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4baa6d3bd33730cea4d3d97c7bb97611d0f}{Button\+State\+\_\+\+Unpressed}}
, \mbox{\hyperlink{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4bab17e4582ae92a602546a5ed70116b344}{Button\+State\+\_\+\+Pressed}}
, \mbox{\hyperlink{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4ba1ed28d4e307eb4999f1deaf3fa07f4d9}{Button\+State\+\_\+\+Hold}}
, \mbox{\hyperlink{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4ba19d35c76d8d53f420fd3106123d67a16}{Button\+State\+\_\+\+Released}}
 \}
\end{DoxyCompactItemize}
\doxysubsection*{Funktionen}
\begin{DoxyCompactItemize}
\item 
void \mbox{\hyperlink{encoder_8c_a80ec2c177aa9c2636f797ca881381827}{Encoder\+Init}} (void)
\begin{DoxyCompactList}\small\item\em Initialisierung des Drehencoders und der Startwerte. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{encoder_8c_a660e5b11dce82f5b307f628def81d188}{Encoder\+Polling}} (void)
\begin{DoxyCompactList}\small\item\em Encoder\+Polling. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{encoder_8c_aaf6a92358a883c87b032984732655084}\label{encoder_8c_aaf6a92358a883c87b032984732655084}} 
int8\+\_\+t {\bfseries Encode\+Read} (void)
\item 
int8\+\_\+t \mbox{\hyperlink{encoder_8c_a9ec6df4b13c9134f1c61546b718cd563}{Encoder\+Read}} (char Ueberlauf)
\begin{DoxyCompactList}\small\item\em Liest die akt. Position des Drehencoders. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{encoder_8c_ac9e955efd05fd5f6579bb5e179b506c7}{Encoder\+Write}} (int8\+\_\+t \mbox{\hyperlink{globals_8h_a3a1db669858552a5c21490149c648e12}{Encoder\+Pos}})
\begin{DoxyCompactList}\small\item\em Setzt die aktuelle Position des Drehencoders. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{encoder_8c_ab5afede50bbce8aae40f3d02be64a374}{Encoder\+Min\+Max}} (int8\+\_\+t Encoder\+Min, int8\+\_\+t Encoder\+Max)
\begin{DoxyCompactList}\small\item\em Setzt den minimalen und maximalen Bereich des Drehencoders. \end{DoxyCompactList}\item 
t\+EButton\+Pressed\+State \mbox{\hyperlink{encoder_8c_a2de57e0e3c5f3e0ab176c11363a58bf1}{Encoder\+Get\+Button\+State}} (void)
\begin{DoxyCompactList}\small\item\em Liefert den Status des Tasters vom Drehencoder. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variablen}
\begin{DoxyCompactItemize}
\item 
int8\+\_\+t \mbox{\hyperlink{encoder_8c_abdbce2c910e9ca583dbbf74a99d50d72}{Drehgeber\+Position}}
\begin{DoxyCompactList}\small\item\em akt. Drehencoderposition \end{DoxyCompactList}\item 
int8\+\_\+t \mbox{\hyperlink{encoder_8c_aa7c6a2827b1cc4fcb2c5ff33d8d05300}{Drehgeber\+Max}} = 127
\begin{DoxyCompactList}\small\item\em maximaler Wert des Drehgebers \end{DoxyCompactList}\item 
int8\+\_\+t \mbox{\hyperlink{encoder_8c_af734dbab527768cb6207a4a5bd90bd1d}{Drehgeber\+Min}} = -\/127
\begin{DoxyCompactList}\small\item\em minimaler Wert des Drehgebers \end{DoxyCompactList}\item 
volatile int16\+\_\+t \mbox{\hyperlink{encoder_8c_a25f7e7becdadc23b1f28f301dbf0325d}{i\+Button\+Pressed\+Counter}} = 0
\begin{DoxyCompactList}\small\item\em Zähler für kurzen Tastendruck. \end{DoxyCompactList}\item 
volatile int16\+\_\+t \mbox{\hyperlink{encoder_8c_a93ec6852319d923e71003f50ad073327}{i\+Button\+Debounce\+Cycles}} = 0
\begin{DoxyCompactList}\small\item\em Zähler für Entprellung. \end{DoxyCompactList}\item 
volatile int16\+\_\+t \mbox{\hyperlink{encoder_8c_aa12d33a8833ab123443cfe09d8c385e8}{i\+Button\+Pressed\+Long\+Cycles}} = 0
\begin{DoxyCompactList}\small\item\em Zähler für langen Tastendruck. \end{DoxyCompactList}\item 
volatile int8\+\_\+t \mbox{\hyperlink{encoder_8c_a3f5ba1853e96736d1ffcc756e9138849}{enc\+\_\+delta}}
\begin{DoxyCompactList}\small\item\em Delta des Encoders bei Betätigung. \end{DoxyCompactList}\item 
static int8\+\_\+t \mbox{\hyperlink{encoder_8c_a904a7151d59a45adae73c4e0a68b5a1f}{last}}
\begin{DoxyCompactList}\small\item\em letzter Wert des Encoders \end{DoxyCompactList}\item 
\mbox{\Hypertarget{encoder_8c_a9031f1bbc45388b7f4d7a6d534114e64}\label{encoder_8c_a9031f1bbc45388b7f4d7a6d534114e64}} 
volatile t\+EButton\+State {\bfseries button\+State} = \mbox{\hyperlink{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4baa6d3bd33730cea4d3d97c7bb97611d0f}{Button\+State\+\_\+\+Unpressed}}
\item 
\mbox{\Hypertarget{encoder_8c_a32833c1bd4da805038b020ba58750218}\label{encoder_8c_a32833c1bd4da805038b020ba58750218}} 
volatile t\+EButton\+Pressed\+State {\bfseries button\+Pressed} = \mbox{\hyperlink{encoder_8h_a1f1601ea239948684d4b2a2f830bca26a7eda9605623092fc9f64c89f6126092d}{Button\+Pressed\+\_\+\+Unpressed}}
\end{DoxyCompactItemize}


\doxysubsection{Ausführliche Beschreibung}
Drehencoder Library. 

\begin{DoxyDate}{Datum}
2014-\/12-\/04 
\end{DoxyDate}
\begin{DoxyAuthor}{Autor}
Frank Klee \begin{DoxyVerb}    Basisroutinen zum Abfragen eines Drehencoders mittels Polling.
    Quelle: https://www.mikrocontroller.net/articles/Drehgeber
\end{DoxyVerb}

\end{DoxyAuthor}
Formatierungen und Umbenennungen der Funktionen \begin{DoxyAuthor}{Autor}
Tom, DL7\+BJ 
\end{DoxyAuthor}
\begin{DoxyDate}{Datum}
2023-\/03-\/23 
\end{DoxyDate}


\doxysubsection{Dokumentation der Aufzählungstypen}
\mbox{\Hypertarget{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4b}\label{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4b}} 
\index{encoder.c@{encoder.c}!EButtonState@{EButtonState}}
\index{EButtonState@{EButtonState}!encoder.c@{encoder.c}}
\doxysubsubsection{\texorpdfstring{EButtonState}{EButtonState}}
{\footnotesize\ttfamily enum \mbox{\hyperlink{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4b}{EButton\+State}}}

\begin{DoxyEnumFields}{Aufzählungswerte}
\raisebox{\heightof{T}}[0pt][0pt]{\index{ButtonState\_Unpressed@{ButtonState\_Unpressed}!encoder.c@{encoder.c}}\index{encoder.c@{encoder.c}!ButtonState\_Unpressed@{ButtonState\_Unpressed}}}\mbox{\Hypertarget{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4baa6d3bd33730cea4d3d97c7bb97611d0f}\label{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4baa6d3bd33730cea4d3d97c7bb97611d0f}} 
Button\+State\+\_\+\+Unpressed&Taster nicht gedrückt. \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{ButtonState\_Pressed@{ButtonState\_Pressed}!encoder.c@{encoder.c}}\index{encoder.c@{encoder.c}!ButtonState\_Pressed@{ButtonState\_Pressed}}}\mbox{\Hypertarget{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4bab17e4582ae92a602546a5ed70116b344}\label{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4bab17e4582ae92a602546a5ed70116b344}} 
Button\+State\+\_\+\+Pressed&Taster gedrückt. \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{ButtonState\_Hold@{ButtonState\_Hold}!encoder.c@{encoder.c}}\index{encoder.c@{encoder.c}!ButtonState\_Hold@{ButtonState\_Hold}}}\mbox{\Hypertarget{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4ba1ed28d4e307eb4999f1deaf3fa07f4d9}\label{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4ba1ed28d4e307eb4999f1deaf3fa07f4d9}} 
Button\+State\+\_\+\+Hold&Taster gehalten. \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{ButtonState\_Released@{ButtonState\_Released}!encoder.c@{encoder.c}}\index{encoder.c@{encoder.c}!ButtonState\_Released@{ButtonState\_Released}}}\mbox{\Hypertarget{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4ba19d35c76d8d53f420fd3106123d67a16}\label{encoder_8c_a7e7392f1e24ef55450099d5e7d095c4ba19d35c76d8d53f420fd3106123d67a16}} 
Button\+State\+\_\+\+Released&Taster geöffnet. \\
\hline

\end{DoxyEnumFields}


\doxysubsection{Dokumentation der Funktionen}
\mbox{\Hypertarget{encoder_8c_a2de57e0e3c5f3e0ab176c11363a58bf1}\label{encoder_8c_a2de57e0e3c5f3e0ab176c11363a58bf1}} 
\index{encoder.c@{encoder.c}!EncoderGetButtonState@{EncoderGetButtonState}}
\index{EncoderGetButtonState@{EncoderGetButtonState}!encoder.c@{encoder.c}}
\doxysubsubsection{\texorpdfstring{EncoderGetButtonState()}{EncoderGetButtonState()}}
{\footnotesize\ttfamily t\+EButton\+Pressed\+State Encoder\+Get\+Button\+State (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Liefert den Status des Tasters vom Drehencoder. 


\begin{DoxyParams}{Parameter}
{\em none} & \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Rückgabewerte}
{\em t\+EButton\+Pressed\+State} & \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{encoder_8c_a80ec2c177aa9c2636f797ca881381827}\label{encoder_8c_a80ec2c177aa9c2636f797ca881381827}} 
\index{encoder.c@{encoder.c}!EncoderInit@{EncoderInit}}
\index{EncoderInit@{EncoderInit}!encoder.c@{encoder.c}}
\doxysubsubsection{\texorpdfstring{EncoderInit()}{EncoderInit()}}
{\footnotesize\ttfamily void Encoder\+Init (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Initialisierung des Drehencoders und der Startwerte. 


\begin{DoxyParams}{Parameter}
{\em none} & \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Rückgabewerte}
{\em none} & \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{encoder_8c_ab5afede50bbce8aae40f3d02be64a374}\label{encoder_8c_ab5afede50bbce8aae40f3d02be64a374}} 
\index{encoder.c@{encoder.c}!EncoderMinMax@{EncoderMinMax}}
\index{EncoderMinMax@{EncoderMinMax}!encoder.c@{encoder.c}}
\doxysubsubsection{\texorpdfstring{EncoderMinMax()}{EncoderMinMax()}}
{\footnotesize\ttfamily void Encoder\+Min\+Max (\begin{DoxyParamCaption}\item[{int8\+\_\+t}]{Encoder\+Min,  }\item[{int8\+\_\+t}]{Encoder\+Max }\end{DoxyParamCaption})}



Setzt den minimalen und maximalen Bereich des Drehencoders. 


\begin{DoxyParams}{Parameter}
{\em Encoder\+Min} & minimaler Wert des Drehencoders \\
\hline
{\em Encoder\+Max} & maximaler Wert des Drehencoders \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Rückgabewerte}
{\em none} & \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{encoder_8c_a660e5b11dce82f5b307f628def81d188}\label{encoder_8c_a660e5b11dce82f5b307f628def81d188}} 
\index{encoder.c@{encoder.c}!EncoderPolling@{EncoderPolling}}
\index{EncoderPolling@{EncoderPolling}!encoder.c@{encoder.c}}
\doxysubsubsection{\texorpdfstring{EncoderPolling()}{EncoderPolling()}}
{\footnotesize\ttfamily void Encoder\+Polling (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Encoder\+Polling. 

\begin{DoxyVerb}    Abfrage des Drehencoders und des Tasters
    Wird vom Timer 0 aufgerufen
\end{DoxyVerb}
 
\begin{DoxyParams}{Parameter}
{\em none} & \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Rückgabewerte}
{\em none} & \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{encoder_8c_a9ec6df4b13c9134f1c61546b718cd563}\label{encoder_8c_a9ec6df4b13c9134f1c61546b718cd563}} 
\index{encoder.c@{encoder.c}!EncoderRead@{EncoderRead}}
\index{EncoderRead@{EncoderRead}!encoder.c@{encoder.c}}
\doxysubsubsection{\texorpdfstring{EncoderRead()}{EncoderRead()}}
{\footnotesize\ttfamily int8\+\_\+t Encoder\+Read (\begin{DoxyParamCaption}\item[{char}]{Ueberlauf }\end{DoxyParamCaption})}



Liest die akt. Position des Drehencoders. 


\begin{DoxyParams}{Parameter}
{\em Ueberlauf} & größer +127, -\/127 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Rückgabewerte}
{\em Aktuelle} & Position des Drehencoders \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{encoder_8c_ac9e955efd05fd5f6579bb5e179b506c7}\label{encoder_8c_ac9e955efd05fd5f6579bb5e179b506c7}} 
\index{encoder.c@{encoder.c}!EncoderWrite@{EncoderWrite}}
\index{EncoderWrite@{EncoderWrite}!encoder.c@{encoder.c}}
\doxysubsubsection{\texorpdfstring{EncoderWrite()}{EncoderWrite()}}
{\footnotesize\ttfamily void Encoder\+Write (\begin{DoxyParamCaption}\item[{int8\+\_\+t}]{Encoder\+Pos }\end{DoxyParamCaption})}



Setzt die aktuelle Position des Drehencoders. 


\begin{DoxyParams}{Parameter}
{\em Encoder\+Pos} & -\/ die Position des Drehencoders \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Rückgabewerte}
{\em none} & \\
\hline
\end{DoxyRetVals}


\doxysubsection{Variablen-\/\+Dokumentation}
\mbox{\Hypertarget{encoder_8c_aa7c6a2827b1cc4fcb2c5ff33d8d05300}\label{encoder_8c_aa7c6a2827b1cc4fcb2c5ff33d8d05300}} 
\index{encoder.c@{encoder.c}!DrehgeberMax@{DrehgeberMax}}
\index{DrehgeberMax@{DrehgeberMax}!encoder.c@{encoder.c}}
\doxysubsubsection{\texorpdfstring{DrehgeberMax}{DrehgeberMax}}
{\footnotesize\ttfamily int8\+\_\+t Drehgeber\+Max = 127}



maximaler Wert des Drehgebers 

\mbox{\Hypertarget{encoder_8c_af734dbab527768cb6207a4a5bd90bd1d}\label{encoder_8c_af734dbab527768cb6207a4a5bd90bd1d}} 
\index{encoder.c@{encoder.c}!DrehgeberMin@{DrehgeberMin}}
\index{DrehgeberMin@{DrehgeberMin}!encoder.c@{encoder.c}}
\doxysubsubsection{\texorpdfstring{DrehgeberMin}{DrehgeberMin}}
{\footnotesize\ttfamily int8\+\_\+t Drehgeber\+Min = -\/127}



minimaler Wert des Drehgebers 

\mbox{\Hypertarget{encoder_8c_abdbce2c910e9ca583dbbf74a99d50d72}\label{encoder_8c_abdbce2c910e9ca583dbbf74a99d50d72}} 
\index{encoder.c@{encoder.c}!DrehgeberPosition@{DrehgeberPosition}}
\index{DrehgeberPosition@{DrehgeberPosition}!encoder.c@{encoder.c}}
\doxysubsubsection{\texorpdfstring{DrehgeberPosition}{DrehgeberPosition}}
{\footnotesize\ttfamily int8\+\_\+t Drehgeber\+Position}



akt. Drehencoderposition 

\mbox{\Hypertarget{encoder_8c_a3f5ba1853e96736d1ffcc756e9138849}\label{encoder_8c_a3f5ba1853e96736d1ffcc756e9138849}} 
\index{encoder.c@{encoder.c}!enc\_delta@{enc\_delta}}
\index{enc\_delta@{enc\_delta}!encoder.c@{encoder.c}}
\doxysubsubsection{\texorpdfstring{enc\_delta}{enc\_delta}}
{\footnotesize\ttfamily volatile int8\+\_\+t enc\+\_\+delta}



Delta des Encoders bei Betätigung. 

\mbox{\Hypertarget{encoder_8c_a93ec6852319d923e71003f50ad073327}\label{encoder_8c_a93ec6852319d923e71003f50ad073327}} 
\index{encoder.c@{encoder.c}!iButtonDebounceCycles@{iButtonDebounceCycles}}
\index{iButtonDebounceCycles@{iButtonDebounceCycles}!encoder.c@{encoder.c}}
\doxysubsubsection{\texorpdfstring{iButtonDebounceCycles}{iButtonDebounceCycles}}
{\footnotesize\ttfamily volatile int16\+\_\+t i\+Button\+Debounce\+Cycles = 0}



Zähler für Entprellung. 

\mbox{\Hypertarget{encoder_8c_a25f7e7becdadc23b1f28f301dbf0325d}\label{encoder_8c_a25f7e7becdadc23b1f28f301dbf0325d}} 
\index{encoder.c@{encoder.c}!iButtonPressedCounter@{iButtonPressedCounter}}
\index{iButtonPressedCounter@{iButtonPressedCounter}!encoder.c@{encoder.c}}
\doxysubsubsection{\texorpdfstring{iButtonPressedCounter}{iButtonPressedCounter}}
{\footnotesize\ttfamily volatile int16\+\_\+t i\+Button\+Pressed\+Counter = 0}



Zähler für kurzen Tastendruck. 

\mbox{\Hypertarget{encoder_8c_aa12d33a8833ab123443cfe09d8c385e8}\label{encoder_8c_aa12d33a8833ab123443cfe09d8c385e8}} 
\index{encoder.c@{encoder.c}!iButtonPressedLongCycles@{iButtonPressedLongCycles}}
\index{iButtonPressedLongCycles@{iButtonPressedLongCycles}!encoder.c@{encoder.c}}
\doxysubsubsection{\texorpdfstring{iButtonPressedLongCycles}{iButtonPressedLongCycles}}
{\footnotesize\ttfamily volatile int16\+\_\+t i\+Button\+Pressed\+Long\+Cycles = 0}



Zähler für langen Tastendruck. 

\mbox{\Hypertarget{encoder_8c_a904a7151d59a45adae73c4e0a68b5a1f}\label{encoder_8c_a904a7151d59a45adae73c4e0a68b5a1f}} 
\index{encoder.c@{encoder.c}!last@{last}}
\index{last@{last}!encoder.c@{encoder.c}}
\doxysubsubsection{\texorpdfstring{last}{last}}
{\footnotesize\ttfamily int8\+\_\+t last\hspace{0.3cm}{\ttfamily [static]}}



letzter Wert des Encoders 

