X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=mtask.io.tex;h=b896da05a5142d162cea4a24071115017421408c;hb=cbc3fdf2cc344248d0e81505622ce1294c7d311e;hp=07eb3ea722ffd9a54b5a973292bb8cfeff8ef0fc;hpb=6548a5ec9ce8e0df67fc4019625ab5238eb1bf71;p=msc-thesis1617.git diff --git a/mtask.io.tex b/mtask.io.tex index 07eb3ea..b896da0 100644 --- a/mtask.io.tex +++ b/mtask.io.tex @@ -32,7 +32,7 @@ class assign v where One way of storing data in \gls{mTask}-\glspl{Task} is using \glspl{SDS}. \glspl{SDS} serve as variables in \gls{mTask} and maintain their value across executions. \glspl{SDS} can be used by multiple \glspl{Task} and can be used -to share data. The classes associated with \glspl{SDS} are listed in +to share data. The classes associated with \glspl{SDS} are listed in Listing~\ref{lst:sdsclass}. The \CI{Main} type is introduced to box an \gls{mTask} and make it recognizable by the type system by separating programs and decorations such as \glspl{SDS}. @@ -45,3 +45,36 @@ and decorations such as \glspl{SDS}. class sds v where sds :: ((v t Upd)->In t (Main (v c s))) -> (Main (v c s)) | ... \end{lstlisting} + +In the \emph{Arduino} ecosystem, shields are available to plug into the +microcontroller and add functionality. These shields range from Bluetooth, +WiFi, Ethernet, LoRa, LCD screens and much more. Often the functionality +available in these shields is housed in a \gls{C++} class. This functionality +is ported using little work to \gls{mTask} by just creating a corresponding +class with the same functions. As an example, Listing~\ref{lst:lcd} shows parts +of the \gls{LCD} class as an \gls{mTask} class functions and as +Listing~\ref{lst:lcdc} shown the corresponding \emph{Arduino} class functions. + +\begin{lstlisting}[label={lst:lcd},% + caption={Adding the \gls{LCD} to the \gls{mTask} language}] +:: LCD = ... + +class lcd v where + begin :: (v LCD Expr) (v Int p) (v Int q) -> v () Expr + ... + scrollLeft :: (v LCD Expr) -> v () Expr + scrollRight :: (v LCD Expr) -> v () Expr + ... +\end{lstlisting} + +\begin{lstlisting}[language=C++,label={lst:lcdc},% + caption={Functions from the \gls{Arduino} \gls{LCD} library}] +class LiquidCrystal { +public: + void begin(uint8_t cols, uint8_t rows); + ... + void scrollDisplayLeft(); + void scrollDisplayRight(); + ... +} +\end{lstlisting}