From 829267866c34adfd87f799ee0caf6c2e8977e4de Mon Sep 17 00:00:00 2001 From: Alexey Dynda Date: Wed, 30 Mar 2016 21:16:14 +1000 Subject: [PATCH] Reworked structure of Arduino protocol library --- Makefile | 56 +- doc/html/classTiny_1_1Proto.html | 4 +- doc/html/tiny__config_8h_source.html | 15 +- doc/latex/classTiny_1_1Proto.tex | 4 +- doc/latex/refman.tex | 6 +- inc/os/arduino/tiny_config.h | 17 + .../sketch_tinyproto01/sketch_tinyproto01.ino | 57 -- .../arduino/TinyProto-Full/library.properties | 9 - .../TinyProto-Full/src/TinyProto-Full.h | 386 -------- .../TinyProto-Full/src/TinyProtocol.cpp | 92 -- .../TinyProto-Full/src/proto/tiny_config.h | 4 - releases/arduino/TinyProto-Micro/README.md | 27 - .../examples/sketch_echo/sketch_echo.ino | 47 - .../sketch_tinyproto01/sketch_tinyproto01.ino | 57 -- releases/arduino/TinyProto-Micro/keywords.txt | 28 - .../TinyProto-Micro/library.properties | 9 - .../TinyProto-Micro/src/TinyProtocol.cpp | 92 -- .../arduino/TinyProto-Micro/src/proto/crc.c | 193 ---- .../arduino/TinyProto-Micro/src/proto/crc.h | 48 - .../TinyProto-Micro/src/proto/tiny_config.h | 2 - .../TinyProto-Micro/src/proto/tiny_defines.h | 56 -- .../TinyProto-Micro/src/proto/tiny_layer2.c | 824 ------------------ .../TinyProto-Micro/src/proto/tiny_layer2.h | 394 --------- releases/arduino/TinyProto-Nano/README.md | 27 - .../examples/sketch_echo/sketch_echo.ino | 47 - releases/arduino/TinyProto-Nano/keywords.txt | 28 - .../TinyProto-Nano/src/TinyProto-Nano.h | 386 -------- .../arduino/TinyProto-Nano/src/proto/crc.c | 193 ---- .../arduino/TinyProto-Nano/src/proto/crc.h | 48 - .../TinyProto-Nano/src/proto/tiny_config.h | 1 - .../TinyProto-Nano/src/proto/tiny_defines.h | 56 -- .../TinyProto-Nano/src/proto/tiny_layer2.c | 824 ------------------ .../TinyProto-Nano/src/proto/tiny_layer2.h | 394 --------- .../README.md | 0 .../examples/sketch_echo/sketch_echo.ino | 8 +- .../sketch_tinyproto01/sketch_tinyproto01.ino | 4 +- .../keywords.txt | 0 .../library.properties | 6 +- .../src/TinyProtocol.cpp | 2 +- .../src/TinyProtocol.h} | 4 +- .../src/proto/crc.c | 0 .../src/proto/crc.h | 0 .../TinyProtocol/src/proto/tiny_config.h | 17 + .../src/proto/tiny_defines.h | 0 .../src/proto/tiny_layer2.c | 0 .../src/proto/tiny_layer2.h | 0 .../examples/sketch_echo/sketch_echo.ino | 8 +- .../sketch_tinyproto01/sketch_tinyproto01.ino | 4 +- ...brary.properties => library.properties.in} | 0 src/arduino/src/TinyProtocol.h | 4 +- 50 files changed, 87 insertions(+), 4401 deletions(-) delete mode 100755 releases/arduino/TinyProto-Full/examples/sketch_tinyproto01/sketch_tinyproto01.ino delete mode 100644 releases/arduino/TinyProto-Full/library.properties delete mode 100644 releases/arduino/TinyProto-Full/src/TinyProto-Full.h delete mode 100644 releases/arduino/TinyProto-Full/src/TinyProtocol.cpp delete mode 100644 releases/arduino/TinyProto-Full/src/proto/tiny_config.h delete mode 100644 releases/arduino/TinyProto-Micro/README.md delete mode 100755 releases/arduino/TinyProto-Micro/examples/sketch_echo/sketch_echo.ino delete mode 100755 releases/arduino/TinyProto-Micro/examples/sketch_tinyproto01/sketch_tinyproto01.ino delete mode 100644 releases/arduino/TinyProto-Micro/keywords.txt delete mode 100644 releases/arduino/TinyProto-Micro/library.properties delete mode 100644 releases/arduino/TinyProto-Micro/src/TinyProtocol.cpp delete mode 100644 releases/arduino/TinyProto-Micro/src/proto/crc.c delete mode 100644 releases/arduino/TinyProto-Micro/src/proto/crc.h delete mode 100644 releases/arduino/TinyProto-Micro/src/proto/tiny_config.h delete mode 100644 releases/arduino/TinyProto-Micro/src/proto/tiny_defines.h delete mode 100644 releases/arduino/TinyProto-Micro/src/proto/tiny_layer2.c delete mode 100644 releases/arduino/TinyProto-Micro/src/proto/tiny_layer2.h delete mode 100644 releases/arduino/TinyProto-Nano/README.md delete mode 100755 releases/arduino/TinyProto-Nano/examples/sketch_echo/sketch_echo.ino delete mode 100644 releases/arduino/TinyProto-Nano/keywords.txt delete mode 100644 releases/arduino/TinyProto-Nano/src/TinyProto-Nano.h delete mode 100644 releases/arduino/TinyProto-Nano/src/proto/crc.c delete mode 100644 releases/arduino/TinyProto-Nano/src/proto/crc.h delete mode 100644 releases/arduino/TinyProto-Nano/src/proto/tiny_config.h delete mode 100644 releases/arduino/TinyProto-Nano/src/proto/tiny_defines.h delete mode 100644 releases/arduino/TinyProto-Nano/src/proto/tiny_layer2.c delete mode 100644 releases/arduino/TinyProto-Nano/src/proto/tiny_layer2.h rename releases/arduino/{TinyProto-Full => TinyProtocol}/README.md (100%) rename releases/arduino/{TinyProto-Full => TinyProtocol}/examples/sketch_echo/sketch_echo.ino (94%) rename releases/arduino/{TinyProto-Nano => TinyProtocol}/examples/sketch_tinyproto01/sketch_tinyproto01.ino (98%) rename releases/arduino/{TinyProto-Full => TinyProtocol}/keywords.txt (100%) rename releases/arduino/{TinyProto-Nano => TinyProtocol}/library.properties (88%) rename releases/arduino/{TinyProto-Nano => TinyProtocol}/src/TinyProtocol.cpp (98%) rename releases/arduino/{TinyProto-Micro/src/TinyProto-Micro.h => TinyProtocol/src/TinyProtocol.h} (98%) rename releases/arduino/{TinyProto-Full => TinyProtocol}/src/proto/crc.c (100%) rename releases/arduino/{TinyProto-Full => TinyProtocol}/src/proto/crc.h (100%) create mode 100644 releases/arduino/TinyProtocol/src/proto/tiny_config.h rename releases/arduino/{TinyProto-Full => TinyProtocol}/src/proto/tiny_defines.h (100%) rename releases/arduino/{TinyProto-Full => TinyProtocol}/src/proto/tiny_layer2.c (100%) rename releases/arduino/{TinyProto-Full => TinyProtocol}/src/proto/tiny_layer2.h (100%) rename src/arduino/{library.properties => library.properties.in} (100%) diff --git a/Makefile b/Makefile index c93fc346..4d51bfb8 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 ****************** @@ -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]" diff --git a/doc/html/classTiny_1_1Proto.html b/doc/html/classTiny_1_1Proto.html index 9d9ae3d6..492e649e 100644 --- a/doc/html/classTiny_1_1Proto.html +++ b/doc/html/classTiny_1_1Proto.html @@ -318,7 +318,7 @@
-

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.

Returns
true if successful false in case of error.
+

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.

Returns
true if successful false in case of error.
@@ -350,7 +350,7 @@
-

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.

Returns
true if successful false in case of error.
+

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.

Returns
true if successful false in case of error.
diff --git a/doc/html/tiny__config_8h_source.html b/doc/html/tiny__config_8h_source.html index 6b27bcb2..0d59f2aa 100644 --- a/doc/html/tiny__config_8h_source.html +++ b/doc/html/tiny__config_8h_source.html @@ -91,7 +91,20 @@
tiny_config.h
-
+
1 #ifdef ARDUINO_AVR_NANO
+
2 // Tiny protocol configuration for Nano boards
+
5 
+
6 # define CONFIG_ENABLE_CHECKSUM
+
7 
+
8 #else
+
9 // Tiny protocol configuration for All other boards
+
12 
+
13 # define CONFIG_ENABLE_CHECKSUM
+
14 # define CONFIG_ENABLE_FCS16
+
15 # define CONFIG_ENABLE_FCS32
+
16 
+
17 #endif
+