This commit is contained in:
tth 2018-12-20 17:53:18 +01:00
parent bb10042aae
commit 0c6f849310
4 changed files with 28 additions and 6 deletions

3
.gitignore vendored
View File

@ -9,4 +9,7 @@ doc/*.log
doc/*.aux doc/*.aux
doc/*.pdf doc/*.pdf
doc/*.idx doc/*.idx
doc/*.ilg
doc/*.ind

View File

@ -1,5 +1,5 @@
\documentclass[a4paper,12pt]{article} \documentclass[a4paper,11pt]{article}
% \listfiles % pour le debug % \listfiles % pour le debug
@ -8,6 +8,7 @@
\usepackage[T1]{fontenc} \usepackage[T1]{fontenc}
% XXX \usepackage{lipsum} % XXX \usepackage{lipsum}
\usepackage{makeidx} \usepackage{makeidx}
\usepackage{listings}
% \usepackage{color} % \usepackage{color}
% \usepackage{url} % \usepackage{url}
\usepackage{xspace} \usepackage{xspace}
@ -93,7 +94,7 @@ ne demande qu'à grandir.
\subsection{Exemples} \subsection{Exemples}
Promis, on va en mettre ! Promis, on va en mettre ! Dès que ça marche\dots
\subsection{Analyses} \subsection{Analyses}
@ -120,7 +121,19 @@ La première, que nous allons juste entrevoir, passera par le port
USB de la carte Arduino. La seconde passera par un port série USB de la carte Arduino. La seconde passera par un port série
auxiliaire\footnote{Il y en a 4 sur le 2560} de celle-ci. auxiliaire\footnote{Il y en a 4 sur le 2560} de celle-ci.
\begin{lstlisting}
tcgetattr(uart0, &options);
options.c_cflag = baudbits | CS8 | CLOCAL | CREAD;
options.c_iflag = IGNPAR;
options.c_oflag = 0;
options.c_lflag = 0;
tcflush(uart0, TCIFLUSH);
tcsetattr(uart0, TCSANOW, &options);
\end{lstlisting}
Et en fait, le \texttt{read} sur le \textsl{fd} du serial device
n'est pas bloquant, \texttt{perror} annonce \emph{success}, mais
rien ne marche. L'année 2019 va commencer sur du vaudou programming.
% ------------------------------------------------------------------- % -------------------------------------------------------------------

8
doc/mkdoc.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
pdflatex dd2-monitoring.tex
makeindex dd2-monitoring
pdflatex dd2-monitoring.tex

View File

@ -68,8 +68,6 @@ if (uart0 < 0)
perror("unable to open uart "); perror("unable to open uart ");
return -1; return -1;
} }
return uart0; /* WTF ??? */
// CONFIGURE THE UART // CONFIGURE THE UART
// The flags defined in /usr/include/termios.h - // The flags defined in /usr/include/termios.h -
@ -92,10 +90,10 @@ baudbits = baudrate2const(baudrate);
fprintf(stderr, "%d -> 0x%04x\n", baudrate, baudbits); fprintf(stderr, "%d -> 0x%04x\n", baudrate, baudbits);
#endif #endif
memset(&options, 0, sizeof(options)); memset(&options, 0, sizeof(options));
tcgetattr(uart0, &options); tcgetattr(uart0, &options);
options.c_cflag = baudbits | CS8 | CLOCAL | CREAD; //<Set baud rate options.c_cflag = baudbits | CS8 | CLOCAL | CREAD;
options.c_iflag = IGNPAR; options.c_iflag = IGNPAR;
options.c_oflag = 0; options.c_oflag = 0;
options.c_lflag = 0; options.c_lflag = 0;