Micro template library A library for building device drivers
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

239 lignes
14 KiB

  1. \hypertarget{classutl_1_1spi__i}{}\section{utl\+:\+:spi\+\_\+i$<$ impl\+\_\+t $>$ Class Template Reference}
  2. \label{classutl_1_1spi__i}\index{utl\+::spi\+\_\+i$<$ impl\+\_\+t $>$@{utl\+::spi\+\_\+i$<$ impl\+\_\+t $>$}}
  3. {\ttfamily \#include $<$spi.\+h$>$}
  4. Inheritance diagram for utl\+:\+:spi\+\_\+i$<$ impl\+\_\+t $>$\+:\begin{figure}[H]
  5. \begin{center}
  6. \leavevmode
  7. \includegraphics[height=2.000000cm]{classutl_1_1spi__i}
  8. \end{center}
  9. \end{figure}
  10. \subsection*{Public Types}
  11. \begin{DoxyCompactItemize}
  12. \item
  13. using \mbox{\hyperlink{classutl_1_1spi__i_aff8ee0a2160cddbb52fce46611a6108f}{type}} = \mbox{\hyperlink{classutl_1_1spi__i}{spi\+\_\+i}}$<$ impl\+\_\+t $>$
  14. \begin{DoxyCompactList}\small\item\em Export type as identity meta-\/function. \end{DoxyCompactList}\end{DoxyCompactItemize}
  15. \subsection*{Public Member Functions}
  16. \begin{Indent}\textbf{ Get/\+Set functions provided by the interface}\par
  17. \begin{DoxyCompactItemize}
  18. \item
  19. uint32\+\_\+t \mbox{\hyperlink{classutl_1_1spi__i_a24cdd0c5ce4ed45a6c1b88ea43328634}{clock}} () const
  20. \item
  21. void \mbox{\hyperlink{classutl_1_1spi__i_a0ebb46a523ace45fd69950f90f9b3af4}{clock}} (uint32\+\_\+t c)
  22. \begin{DoxyCompactList}\small\item\em set clock frequency of the bus \end{DoxyCompactList}\end{DoxyCompactItemize}
  23. \end{Indent}
  24. \begin{Indent}\textbf{ I/O functions provided by the interface}\par
  25. \begin{DoxyCompactItemize}
  26. \item
  27. \mbox{\hyperlink{namespaceutl_a1427cb5a2b13313147a902173b91e3c1}{byte\+\_\+t}} \mbox{\hyperlink{classutl_1_1spi__i_ac8376d88480a992ac47699637e1a29a5}{tx\+\_\+data}} (\mbox{\hyperlink{namespaceutl_a1427cb5a2b13313147a902173b91e3c1}{byte\+\_\+t}} out)
  28. \item
  29. \mbox{\hyperlink{namespaceutl_a22cbecb50ee5c1032de66133e96cbac6}{size\+\_\+t}} \mbox{\hyperlink{classutl_1_1spi__i_af3e303c2982202261700044d31596248}{tx\+\_\+data}} (const \mbox{\hyperlink{namespaceutl_a1427cb5a2b13313147a902173b91e3c1}{byte\+\_\+t}} $\ast$out, \mbox{\hyperlink{namespaceutl_a1427cb5a2b13313147a902173b91e3c1}{byte\+\_\+t}} $\ast$in, \mbox{\hyperlink{namespaceutl_a22cbecb50ee5c1032de66133e96cbac6}{size\+\_\+t}} n)
  30. \begin{DoxyCompactList}\small\item\em Transmit a number of bytes to the spi bus and read the response. \end{DoxyCompactList}\item
  31. \mbox{\hyperlink{namespaceutl_a1427cb5a2b13313147a902173b91e3c1}{byte\+\_\+t}} \mbox{\hyperlink{classutl_1_1spi__i_a846dead32b91efcb48eed614daf68e8f}{rx\+\_\+data}} ()
  32. \item
  33. \mbox{\hyperlink{namespaceutl_a22cbecb50ee5c1032de66133e96cbac6}{size\+\_\+t}} \mbox{\hyperlink{classutl_1_1spi__i_a2053009da5364ead720aebd7cc537c21}{rx\+\_\+data}} (\mbox{\hyperlink{namespaceutl_a1427cb5a2b13313147a902173b91e3c1}{byte\+\_\+t}} $\ast$in, \mbox{\hyperlink{namespaceutl_a22cbecb50ee5c1032de66133e96cbac6}{size\+\_\+t}} n)
  34. \begin{DoxyCompactList}\small\item\em Receive a number of bytes from the spi bus while transmitting 0x\+F\+Fs. \end{DoxyCompactList}\end{DoxyCompactItemize}
  35. \end{Indent}
  36. \subsection*{Protected Member Functions}
  37. \begin{Indent}\textbf{ Object lifetime}\par
  38. \begin{DoxyCompactItemize}
  39. \item
  40. \mbox{\hyperlink{classutl_1_1spi__i_ad66605cdf90f6d24cad3dc5ecda94b77}{spi\+\_\+i}} ()=default
  41. \begin{DoxyCompactList}\small\item\em Allow constructor from derived only. \end{DoxyCompactList}\item
  42. \mbox{\hyperlink{classutl_1_1spi__i_ae77cb8be7d648a62a1ad252d829eccfb}{$\sim$spi\+\_\+i}} ()=default
  43. \begin{DoxyCompactList}\small\item\em Allow destructor from derived only. \end{DoxyCompactList}\item
  44. \mbox{\hyperlink{classutl_1_1spi__i_a1d6facb9b9adf91a6589fe029325bd55}{spi\+\_\+i}} (const \mbox{\hyperlink{classutl_1_1spi__i_aff8ee0a2160cddbb52fce46611a6108f}{type}} \&)=delete
  45. \begin{DoxyCompactList}\small\item\em No copies. \end{DoxyCompactList}\item
  46. \mbox{\hyperlink{classutl_1_1spi__i_aff8ee0a2160cddbb52fce46611a6108f}{type}} \& \mbox{\hyperlink{classutl_1_1spi__i_aa5cf05ce005cb23e6317b3eef70bf4b0}{operator=}} (const \mbox{\hyperlink{classutl_1_1spi__i_aff8ee0a2160cddbb52fce46611a6108f}{type}} \&)=delete
  47. \end{DoxyCompactItemize}
  48. \end{Indent}
  49. \subsection{Detailed Description}
  50. \subsubsection*{template$<$typename impl\+\_\+t$>$\newline
  51. class utl\+::spi\+\_\+i$<$ impl\+\_\+t $>$}
  52. Template base class for S\+PI communication interface using C\+R\+TP This class force a common interface for S\+PI communication protocol implementations.
  53. \begin{DoxyParams}{Parameters}
  54. {\em impl\+\_\+t} & The C\+R\+TP type (the derived/implementation class typename). \\
  55. \hline
  56. \end{DoxyParams}
  57. Definition at line 67 of file spi.\+h.
  58. \subsection{Member Typedef Documentation}
  59. \mbox{\Hypertarget{classutl_1_1spi__i_aff8ee0a2160cddbb52fce46611a6108f}\label{classutl_1_1spi__i_aff8ee0a2160cddbb52fce46611a6108f}}
  60. \index{utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}!type@{type}}
  61. \index{type@{type}!utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}}
  62. \subsubsection{\texorpdfstring{type}{type}}
  63. {\footnotesize\ttfamily template$<$typename impl\+\_\+t$>$ \\
  64. using \mbox{\hyperlink{classutl_1_1spi__i}{utl\+::spi\+\_\+i}}$<$ impl\+\_\+t $>$\+::\mbox{\hyperlink{classutl_1_1spi__i_aff8ee0a2160cddbb52fce46611a6108f}{type}} = \mbox{\hyperlink{classutl_1_1spi__i}{spi\+\_\+i}}$<$impl\+\_\+t$>$}
  65. Export type as identity meta-\/function.
  66. Definition at line 71 of file spi.\+h.
  67. \subsection{Constructor \& Destructor Documentation}
  68. \mbox{\Hypertarget{classutl_1_1spi__i_ad66605cdf90f6d24cad3dc5ecda94b77}\label{classutl_1_1spi__i_ad66605cdf90f6d24cad3dc5ecda94b77}}
  69. \index{utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}!spi\+\_\+i@{spi\+\_\+i}}
  70. \index{spi\+\_\+i@{spi\+\_\+i}!utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}}
  71. \subsubsection{\texorpdfstring{spi\+\_\+i()}{spi\_i()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
  72. {\footnotesize\ttfamily template$<$typename impl\+\_\+t$>$ \\
  73. \mbox{\hyperlink{classutl_1_1spi__i}{utl\+::spi\+\_\+i}}$<$ impl\+\_\+t $>$\+::\mbox{\hyperlink{classutl_1_1spi__i}{spi\+\_\+i}} (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [protected]}, {\ttfamily [default]}}
  74. Allow constructor from derived only.
  75. \mbox{\Hypertarget{classutl_1_1spi__i_ae77cb8be7d648a62a1ad252d829eccfb}\label{classutl_1_1spi__i_ae77cb8be7d648a62a1ad252d829eccfb}}
  76. \index{utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}!````~spi\+\_\+i@{$\sim$spi\+\_\+i}}
  77. \index{````~spi\+\_\+i@{$\sim$spi\+\_\+i}!utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}}
  78. \subsubsection{\texorpdfstring{$\sim$spi\+\_\+i()}{~spi\_i()}}
  79. {\footnotesize\ttfamily template$<$typename impl\+\_\+t$>$ \\
  80. \mbox{\hyperlink{classutl_1_1spi__i}{utl\+::spi\+\_\+i}}$<$ impl\+\_\+t $>$\+::$\sim$\mbox{\hyperlink{classutl_1_1spi__i}{spi\+\_\+i}} (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [protected]}, {\ttfamily [default]}}
  81. Allow destructor from derived only.
  82. \mbox{\Hypertarget{classutl_1_1spi__i_a1d6facb9b9adf91a6589fe029325bd55}\label{classutl_1_1spi__i_a1d6facb9b9adf91a6589fe029325bd55}}
  83. \index{utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}!spi\+\_\+i@{spi\+\_\+i}}
  84. \index{spi\+\_\+i@{spi\+\_\+i}!utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}}
  85. \subsubsection{\texorpdfstring{spi\+\_\+i()}{spi\_i()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
  86. {\footnotesize\ttfamily template$<$typename impl\+\_\+t$>$ \\
  87. \mbox{\hyperlink{classutl_1_1spi__i}{utl\+::spi\+\_\+i}}$<$ impl\+\_\+t $>$\+::\mbox{\hyperlink{classutl_1_1spi__i}{spi\+\_\+i}} (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classutl_1_1spi__i_aff8ee0a2160cddbb52fce46611a6108f}{type}} \&}]{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [protected]}, {\ttfamily [delete]}}
  88. No copies.
  89. \subsection{Member Function Documentation}
  90. \mbox{\Hypertarget{classutl_1_1spi__i_a24cdd0c5ce4ed45a6c1b88ea43328634}\label{classutl_1_1spi__i_a24cdd0c5ce4ed45a6c1b88ea43328634}}
  91. \index{utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}!clock@{clock}}
  92. \index{clock@{clock}!utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}}
  93. \subsubsection{\texorpdfstring{clock()}{clock()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
  94. {\footnotesize\ttfamily template$<$typename impl\+\_\+t$>$ \\
  95. uint32\+\_\+t \mbox{\hyperlink{classutl_1_1spi__i}{utl\+::spi\+\_\+i}}$<$ impl\+\_\+t $>$\+::clock (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}
  96. \begin{DoxyReturn}{Returns}
  97. clock frequency of the bus
  98. \end{DoxyReturn}
  99. Definition at line 102 of file spi.\+h.
  100. \mbox{\Hypertarget{classutl_1_1spi__i_a0ebb46a523ace45fd69950f90f9b3af4}\label{classutl_1_1spi__i_a0ebb46a523ace45fd69950f90f9b3af4}}
  101. \index{utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}!clock@{clock}}
  102. \index{clock@{clock}!utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}}
  103. \subsubsection{\texorpdfstring{clock()}{clock()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
  104. {\footnotesize\ttfamily template$<$typename impl\+\_\+t$>$ \\
  105. void \mbox{\hyperlink{classutl_1_1spi__i}{utl\+::spi\+\_\+i}}$<$ impl\+\_\+t $>$\+::clock (\begin{DoxyParamCaption}\item[{uint32\+\_\+t}]{c }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}
  106. set clock frequency of the bus
  107. Definition at line 103 of file spi.\+h.
  108. \mbox{\Hypertarget{classutl_1_1spi__i_aa5cf05ce005cb23e6317b3eef70bf4b0}\label{classutl_1_1spi__i_aa5cf05ce005cb23e6317b3eef70bf4b0}}
  109. \index{utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}!operator=@{operator=}}
  110. \index{operator=@{operator=}!utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}}
  111. \subsubsection{\texorpdfstring{operator=()}{operator=()}}
  112. {\footnotesize\ttfamily template$<$typename impl\+\_\+t$>$ \\
  113. \mbox{\hyperlink{classutl_1_1spi__i_aff8ee0a2160cddbb52fce46611a6108f}{type}}\& \mbox{\hyperlink{classutl_1_1spi__i}{utl\+::spi\+\_\+i}}$<$ impl\+\_\+t $>$\+::operator= (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classutl_1_1spi__i_aff8ee0a2160cddbb52fce46611a6108f}{type}} \&}]{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [protected]}, {\ttfamily [delete]}}
  114. \mbox{\Hypertarget{classutl_1_1spi__i_a846dead32b91efcb48eed614daf68e8f}\label{classutl_1_1spi__i_a846dead32b91efcb48eed614daf68e8f}}
  115. \index{utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}!rx\+\_\+data@{rx\+\_\+data}}
  116. \index{rx\+\_\+data@{rx\+\_\+data}!utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}}
  117. \subsubsection{\texorpdfstring{rx\+\_\+data()}{rx\_data()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
  118. {\footnotesize\ttfamily template$<$typename impl\+\_\+t$>$ \\
  119. \mbox{\hyperlink{namespaceutl_a1427cb5a2b13313147a902173b91e3c1}{byte\+\_\+t}} \mbox{\hyperlink{classutl_1_1spi__i}{utl\+::spi\+\_\+i}}$<$ impl\+\_\+t $>$\+::rx\+\_\+data (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}
  120. Receive a byte from spi bus while transmitting 0x\+FF
  121. Definition at line 129 of file spi.\+h.
  122. \mbox{\Hypertarget{classutl_1_1spi__i_a2053009da5364ead720aebd7cc537c21}\label{classutl_1_1spi__i_a2053009da5364ead720aebd7cc537c21}}
  123. \index{utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}!rx\+\_\+data@{rx\+\_\+data}}
  124. \index{rx\+\_\+data@{rx\+\_\+data}!utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}}
  125. \subsubsection{\texorpdfstring{rx\+\_\+data()}{rx\_data()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
  126. {\footnotesize\ttfamily template$<$typename \+\_\+I $>$ \\
  127. \mbox{\hyperlink{namespaceutl_a22cbecb50ee5c1032de66133e96cbac6}{size\+\_\+t}} \mbox{\hyperlink{classutl_1_1spi__i}{utl\+::spi\+\_\+i}}$<$ \+\_\+I $>$\+::rx\+\_\+data (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{namespaceutl_a1427cb5a2b13313147a902173b91e3c1}{byte\+\_\+t}} $\ast$}]{in, }\item[{\mbox{\hyperlink{namespaceutl_a22cbecb50ee5c1032de66133e96cbac6}{size\+\_\+t}}}]{n }\end{DoxyParamCaption})}
  128. Receive a number of bytes from the spi bus while transmitting 0x\+F\+Fs.
  129. \begin{DoxyParams}{Parameters}
  130. {\em in} & Pointer to buffer to store the data \\
  131. \hline
  132. {\em n} & The number of bytes to read \\
  133. \hline
  134. \end{DoxyParams}
  135. \begin{DoxyReturn}{Returns}
  136. The number of received bytes.
  137. \end{DoxyReturn}
  138. Definition at line 165 of file spi.\+h.
  139. \mbox{\Hypertarget{classutl_1_1spi__i_ac8376d88480a992ac47699637e1a29a5}\label{classutl_1_1spi__i_ac8376d88480a992ac47699637e1a29a5}}
  140. \index{utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}!tx\+\_\+data@{tx\+\_\+data}}
  141. \index{tx\+\_\+data@{tx\+\_\+data}!utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}}
  142. \subsubsection{\texorpdfstring{tx\+\_\+data()}{tx\_data()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
  143. {\footnotesize\ttfamily template$<$typename impl\+\_\+t$>$ \\
  144. \mbox{\hyperlink{namespaceutl_a1427cb5a2b13313147a902173b91e3c1}{byte\+\_\+t}} \mbox{\hyperlink{classutl_1_1spi__i}{utl\+::spi\+\_\+i}}$<$ impl\+\_\+t $>$\+::tx\+\_\+data (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{namespaceutl_a1427cb5a2b13313147a902173b91e3c1}{byte\+\_\+t}}}]{out }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}
  145. Transmit a byte to spi bus and return the response
  146. Definition at line 114 of file spi.\+h.
  147. \mbox{\Hypertarget{classutl_1_1spi__i_af3e303c2982202261700044d31596248}\label{classutl_1_1spi__i_af3e303c2982202261700044d31596248}}
  148. \index{utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}!tx\+\_\+data@{tx\+\_\+data}}
  149. \index{tx\+\_\+data@{tx\+\_\+data}!utl\+::spi\+\_\+i@{utl\+::spi\+\_\+i}}
  150. \subsubsection{\texorpdfstring{tx\+\_\+data()}{tx\_data()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
  151. {\footnotesize\ttfamily template$<$typename \+\_\+I $>$ \\
  152. \mbox{\hyperlink{namespaceutl_a22cbecb50ee5c1032de66133e96cbac6}{size\+\_\+t}} \mbox{\hyperlink{classutl_1_1spi__i}{utl\+::spi\+\_\+i}}$<$ \+\_\+I $>$\+::tx\+\_\+data (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{namespaceutl_a1427cb5a2b13313147a902173b91e3c1}{byte\+\_\+t}} $\ast$}]{out, }\item[{\mbox{\hyperlink{namespaceutl_a1427cb5a2b13313147a902173b91e3c1}{byte\+\_\+t}} $\ast$}]{in, }\item[{\mbox{\hyperlink{namespaceutl_a22cbecb50ee5c1032de66133e96cbac6}{size\+\_\+t}}}]{n }\end{DoxyParamCaption})}
  153. Transmit a number of bytes to the spi bus and read the response.
  154. \begin{DoxyParams}{Parameters}
  155. {\em out} & Pointer to data to send to the bus \\
  156. \hline
  157. {\em in} & Pointer to buffer to store the data from the bus \\
  158. \hline
  159. {\em n} & The number of bytes to transmit/receive \\
  160. \hline
  161. \end{DoxyParams}
  162. \begin{DoxyReturn}{Returns}
  163. The number of bytes.
  164. \end{DoxyReturn}
  165. Definition at line 152 of file spi.\+h.
  166. The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
  167. \item
  168. include/utl/com/\mbox{\hyperlink{spi_8h}{spi.\+h}}\end{DoxyCompactItemize}