Skip to content

Commit

Permalink
Reworked structure of Arduino protocol library
Browse files Browse the repository at this point in the history
  • Loading branch information
lexus2k committed Mar 30, 2016
1 parent c340645 commit 8292678
Show file tree
Hide file tree
Showing 50 changed files with 87 additions and 4,401 deletions.
56 changes: 12 additions & 44 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ OS ?= os/linux
DESTDIR ?=
BLD ?= bld

VERSION=0.1.2
VERSION=0.2.0

ifeq ($(TINYCONF), nano)
CONFIG_ENABLE_FCS32 ?= n
Expand Down Expand Up @@ -88,7 +88,7 @@ ifeq ($(CONFIG_ENABLE_STATS),y)
endif

.PHONY: clean library examples all install install-lib doc \
arduino-nano arduino-micro arduino-full arduino-pkg
arduino-pkg

# ************* Compiling example ******************

Expand Down Expand Up @@ -146,55 +146,23 @@ examples: $(OBJ_EXAMPLE) $(OBJ_UART) library
$(CC) $(CCFLAGS) -o $(BLD)/$(TARGET_UART) $(OBJ_UART) $(LIBS_EXAMPLE)

#####################################################################################################
####################### arduino libraries #######################
####################### arduino library #######################
#####################################################################################################

ARDUINO_BASE_LIB=TinyProtocol
ARDUINO_NANO_LIB=TinyProto-Nano
ARDUINO_MICRO_LIB=TinyProto-Micro
ARDUINO_FULL_LIB=TinyProto-Full
ARDUINO_LIB=TinyProtocol

ARDUINO_BASE_DIR=./src/arduino
ARDUINO_NANO_DIR=./releases/arduino/$(ARDUINO_NANO_LIB)
ARDUINO_MICRO_DIR=./releases/arduino/$(ARDUINO_MICRO_LIB)
ARDUINO_FULL_DIR=./releases/arduino/$(ARDUINO_FULL_LIB)
ARDUINO_DIR=./releases/arduino/$(ARDUINO_LIB)
ARDUINO_BASE_URL=https://github.com/lexus2k/tinyproto/tree/master/releases/arduino

arduino-nano:
@mkdir -p $(ARDUINO_NANO_DIR)
@cp -rf -L $(ARDUINO_BASE_DIR)/* $(ARDUINO_NANO_DIR)/
@echo "#define CONFIG_ENABLE_CHECKSUM" > $(ARDUINO_NANO_DIR)/src/proto/tiny_config.h
@sed -i "s/VERSION/$(VERSION)/" $(ARDUINO_NANO_DIR)/library.properties
@sed -i "s/LIBRARY/$(ARDUINO_NANO_LIB)/" $(ARDUINO_NANO_DIR)/library.properties
@sed -i "s,ADDRESS,$(ARDUINO_BASE_URL)/$(ARDUINO_NANO_LIB),g" $(ARDUINO_NANO_DIR)/library.properties
@mv $(ARDUINO_NANO_DIR)/src/$(ARDUINO_BASE_LIB).h $(ARDUINO_NANO_DIR)/src/$(ARDUINO_NANO_LIB).h
@sed -i "s/$(ARDUINO_BASE_LIB).h/$(ARDUINO_NANO_LIB).h/" $(ARDUINO_NANO_DIR)/src/TinyProtocol.cpp

arduino-micro:
@mkdir -p $(ARDUINO_MICRO_DIR)/
@cp -rf -L $(ARDUINO_BASE_DIR)/* $(ARDUINO_MICRO_DIR)/
@echo "#define CONFIG_ENABLE_CHECKSUM" > $(ARDUINO_MICRO_DIR)/src/proto/tiny_config.h
@echo "#define CONFIG_ENABLE_FCS16" >> $(ARDUINO_MICRO_DIR)/src/proto/tiny_config.h
@sed -i "s/VERSION/$(VERSION)/" $(ARDUINO_MICRO_DIR)/library.properties
@sed -i "s/LIBRARY/$(ARDUINO_MICRO_LIB)/" $(ARDUINO_MICRO_DIR)/library.properties
@sed -i "s,ADDRESS,$(ARDUINO_BASE_URL)/$(ARDUINO_MICRO_LIB),g" $(ARDUINO_MICRO_DIR)/library.properties
@mv $(ARDUINO_MICRO_DIR)/src/$(ARDUINO_BASE_LIB).h $(ARDUINO_MICRO_DIR)/src/$(ARDUINO_MICRO_LIB).h
@sed -i "s/$(ARDUINO_BASE_LIB).h/$(ARDUINO_MICRO_LIB).h/" $(ARDUINO_MICRO_DIR)/src/TinyProtocol.cpp

arduino-full:
@mkdir -p $(ARDUINO_FULL_DIR)/
@cp -rf -L $(ARDUINO_BASE_DIR)/* $(ARDUINO_FULL_DIR)/
@echo "#define CONFIG_ENABLE_CHECKSUM" > $(ARDUINO_FULL_DIR)/src/proto/tiny_config.h
@echo "#define CONFIG_ENABLE_FCS16" >> $(ARDUINO_FULL_DIR)/src/proto/tiny_config.h
@echo "#define CONFIG_ENABLE_FCS32" >> $(ARDUINO_FULL_DIR)/src/proto/tiny_config.h
@echo "#define CONFIG_ENABLE_STATS" >> $(ARDUINO_FULL_DIR)/src/proto/tiny_config.h
@sed -i "s/VERSION/$(VERSION)/" $(ARDUINO_FULL_DIR)/library.properties
@sed -i "s/LIBRARY/$(ARDUINO_FULL_LIB)/" $(ARDUINO_FULL_DIR)/library.properties
@sed -i "s,ADDRESS,$(ARDUINO_BASE_URL)/$(ARDUINO_FULL_LIB),g" $(ARDUINO_FULL_DIR)/library.properties
@mv $(ARDUINO_FULL_DIR)/src/$(ARDUINO_BASE_LIB).h $(ARDUINO_FULL_DIR)/src/$(ARDUINO_FULL_LIB).h
@sed -i "s/$(ARDUINO_BASE_LIB).h/$(ARDUINO_FULL_LIB).h/" $(ARDUINO_FULL_DIR)/src/TinyProtocol.cpp

arduino-pkg: arduino-nano arduino-micro arduino-full doc
arduino-pkg:
@mkdir -p $(ARDUINO_DIR)
@cp -rf -L $(ARDUINO_BASE_DIR)/* $(ARDUINO_DIR)/
@mv $(ARDUINO_DIR)/library.properties.in $(ARDUINO_DIR)/library.properties
@sed -i "s/VERSION/$(VERSION)/" $(ARDUINO_DIR)/library.properties
@sed -i "s/LIBRARY/$(ARDUINO_LIB)/" $(ARDUINO_DIR)/library.properties
@sed -i "s,ADDRESS,$(ARDUINO_BASE_URL)/$(ARDUINO_LIB),g" $(ARDUINO_DIR)/library.properties
@echo "arduino package build ... [DONE]"


Expand Down
4 changes: 2 additions & 2 deletions doc/html/classTiny_1_1Proto.html
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
</tr>
</table>
</div><div class="memdoc">
<p>Enables CRC 8-bit field in the protocol. This field contains sum of all data bytes in the packet. 8-bit field is not supported by Nano version of Tiny library. </p><dl class="section return"><dt>Returns</dt><dd>true if successful false in case of error. </dd></dl>
<p>Enables CRC 8-bit field in the protocol. This field contains sum of all data bytes in the packet. 8-bit field is supported by Nano version of Tiny library. </p><dl class="section return"><dt>Returns</dt><dd>true if successful false in case of error. </dd></dl>

</div>
</div>
Expand Down Expand Up @@ -350,7 +350,7 @@
</tr>
</table>
</div><div class="memdoc">
<p>Enables CRC 32-bit field in the protocol. This field contains FCS 32-bit CCITT like defined in RFC 1662. 32-bit field is not supported by Nano and Micro versions of Tiny library. </p><dl class="section return"><dt>Returns</dt><dd>true if successful false in case of error. </dd></dl>
<p>Enables CRC 32-bit field in the protocol. This field contains FCS 32-bit CCITT like defined in RFC 1662. 32-bit field is not supported by Nano version of Tiny library. </p><dl class="section return"><dt>Returns</dt><dd>true if successful false in case of error. </dd></dl>

</div>
</div>
Expand Down
15 changes: 14 additions & 1 deletion doc/html/tiny__config_8h_source.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,20 @@
<div class="title">tiny_config.h</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"></div><!-- fragment --></div><!-- contents -->
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="preprocessor">#ifdef ARDUINO_AVR_NANO</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment">// Tiny protocol configuration for Nano boards</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="preprocessor"># define CONFIG_ENABLE_CHECKSUM</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;</div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment">// Tiny protocol configuration for All other boards</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="preprocessor"># define CONFIG_ENABLE_CHECKSUM</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="preprocessor"># define CONFIG_ENABLE_FCS16</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="preprocessor"># define CONFIG_ENABLE_FCS32</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;</div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
Expand Down
4 changes: 2 additions & 2 deletions doc/latex/classTiny_1_1Proto.tex
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ \subsection{Member Function Documentation}
{}
\end{DoxyParamCaption}
)}\label{classTiny_1_1Proto_abb6cbae9a9944dc9ae0d756554f65a52}
Enables C\+R\+C 8-\/bit field in the protocol. This field contains sum of all data bytes in the packet. 8-\/bit field is not supported by Nano version of Tiny library. \begin{DoxyReturn}{Returns}
Enables C\+R\+C 8-\/bit field in the protocol. This field contains sum of all data bytes in the packet. 8-\/bit field is supported by Nano version of Tiny library. \begin{DoxyReturn}{Returns}
true if successful false in case of error.
\end{DoxyReturn}
\hypertarget{classTiny_1_1Proto_a794afcac2ca15544247c34b059bc1289}{}\index{Tiny\+::\+Proto@{Tiny\+::\+Proto}!enable\+Crc16@{enable\+Crc16}}
Expand All @@ -144,7 +144,7 @@ \subsection{Member Function Documentation}
{}
\end{DoxyParamCaption}
)}\label{classTiny_1_1Proto_a2ef1c80490d9343b896180ab8b8a6f77}
Enables C\+R\+C 32-\/bit field in the protocol. This field contains F\+C\+S 32-\/bit C\+C\+I\+T\+T like defined in R\+F\+C 1662. 32-\/bit field is not supported by Nano and Micro versions of Tiny library. \begin{DoxyReturn}{Returns}
Enables C\+R\+C 32-\/bit field in the protocol. This field contains F\+C\+S 32-\/bit C\+C\+I\+T\+T like defined in R\+F\+C 1662. 32-\/bit field is not supported by Nano version of Tiny library. \begin{DoxyReturn}{Returns}
true if successful false in case of error.
\end{DoxyReturn}
\hypertarget{classTiny_1_1Proto_a9fdd64b8296e27f3205cd0d3ea685eac}{}\index{Tiny\+::\+Proto@{Tiny\+::\+Proto}!enable\+Uid@{enable\+Uid}}
Expand Down
6 changes: 3 additions & 3 deletions doc/latex/refman.tex
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
\fancyhead[RO]{\fancyplain{}{\bfseries\thepage}}
\fancyfoot[LE]{\fancyplain{}{}}
\fancyfoot[CE]{\fancyplain{}{}}
\fancyfoot[RE]{\fancyplain{}{\bfseries\scriptsize Generated on Sat Mar 26 2016 20\+:04\+:50 for Tiny protocol by Doxygen }}
\fancyfoot[LO]{\fancyplain{}{\bfseries\scriptsize Generated on Sat Mar 26 2016 20\+:04\+:50 for Tiny protocol by Doxygen }}
\fancyfoot[RE]{\fancyplain{}{\bfseries\scriptsize Generated on Wed Mar 30 2016 21\+:07\+:28 for Tiny protocol by Doxygen }}
\fancyfoot[LO]{\fancyplain{}{\bfseries\scriptsize Generated on Wed Mar 30 2016 21\+:07\+:28 for Tiny protocol by Doxygen }}
\fancyfoot[CO]{\fancyplain{}{}}
\fancyfoot[RO]{\fancyplain{}{}}
\renewcommand{\footrulewidth}{0.4pt}
Expand Down Expand Up @@ -128,7 +128,7 @@
\vspace*{1cm}
{\large Generated by Doxygen 1.8.9.1}\\
\vspace*{0.5cm}
{\small Sat Mar 26 2016 20:04:50}\\
{\small Wed Mar 30 2016 21:07:28}\\
\end{center}
\end{titlepage}
\clearemptydoublepage
Expand Down
17 changes: 17 additions & 0 deletions inc/os/arduino/tiny_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifdef ARDUINO_AVR_NANO
/////////////////////////////////////////////////////////////////
// Tiny protocol configuration for Nano boards
/////////////////////////////////////////////////////////////////

# define CONFIG_ENABLE_CHECKSUM

#else
/////////////////////////////////////////////////////////////////
// Tiny protocol configuration for All other boards
/////////////////////////////////////////////////////////////////

# define CONFIG_ENABLE_CHECKSUM
# define CONFIG_ENABLE_FCS16
# define CONFIG_ENABLE_FCS32

#endif

This file was deleted.

9 changes: 0 additions & 9 deletions releases/arduino/TinyProto-Full/library.properties

This file was deleted.

Loading

0 comments on commit 8292678

Please sign in to comment.