diff --git a/doc/Doxyfile b/doc/Doxyfile index ba3f623..6552ba9 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -791,7 +791,8 @@ WARN_LOGFILE = # Note: If this tag is empty the current directory is searched. INPUT = ../src \ - ../README.md + ../README.md \ + example_list.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -874,7 +875,7 @@ RECURSIVE = YES # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = . +EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded @@ -890,15 +891,7 @@ EXCLUDE_SYMLINKS = NO # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* -EXCLUDE_PATTERNS = VisualGDB \ - VisualGDBCache \ - pybind11 \ - visualstudio \ - main.cpp \ - *.py \ - Debug \ - gcc_Debug.h \ - gcc_Release.h +EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the @@ -915,7 +908,8 @@ EXCLUDE_SYMBOLS = # that contain example code fragments that are included (see the \include # command). -EXAMPLE_PATH = +EXAMPLE_PATH = ../examples \ + ../knx-linux # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and @@ -929,7 +923,7 @@ EXAMPLE_PATTERNS = * # irrespective of the value of the RECURSIVE tag. # The default value is: NO. -EXAMPLE_RECURSIVE = NO +EXAMPLE_RECURSIVE = YES # The IMAGE_PATH tag can be used to specify one or more files or directories # that contain images that are to be included in the documentation (see the @@ -991,7 +985,7 @@ FILTER_SOURCE_PATTERNS = # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. -USE_MDFILE_AS_MAINPAGE = +USE_MDFILE_AS_MAINPAGE = ../README.md #--------------------------------------------------------------------------- # Configuration options related to source browsing @@ -2244,7 +2238,7 @@ HIDE_UNDOC_RELATIONS = YES # set to NO # The default value is: NO. -HAVE_DOT = YES +HAVE_DOT = NO # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed # to run in parallel. When set to 0 doxygen will base this on the number of diff --git a/doc/example_list.h b/doc/example_list.h new file mode 100644 index 0000000..a0fde7a --- /dev/null +++ b/doc/example_list.h @@ -0,0 +1,7 @@ +/** + * @example main.cpp + * @example knx-demo.ino + * @example knx-hdc1008.ino + * @example knx-bme680.ino + * +**/ \ No newline at end of file diff --git a/examples/knx-hdc1008/knx-hdc1008.ino b/examples/knx-hdc1008/knx-hdc1008.ino index 1037000..817e2c4 100644 --- a/examples/knx-hdc1008/knx-hdc1008.ino +++ b/examples/knx-hdc1008/knx-hdc1008.ino @@ -6,16 +6,9 @@ HDC100X HDC1(0x43); -// declare array of all groupobjects with their sizes in byte -GroupObject groupObjects[] -{ - GroupObject(2), - GroupObject(2) -}; - -// create named references for easy access to group objects -GroupObject& goTemperature = groupObjects[0]; -GroupObject& goHumidity = groupObjects[1]; +// create macros easy access to group objects +#define goTemperature knx.getGroupObject(1) +#define goHumidity knx.getGroupObject(2) long lastsend = 0; @@ -39,8 +32,6 @@ void setup(void) knx.ledPin(5); // Programming button on digital pin D7 knx.buttonPin(7); - // register group objects - knx.registerGroupObjects(groupObjects, 2); // read adress table, association table, groupobject table and parameters from eeprom knx.readMemory(); diff --git a/knx-linux/CMakeLists.txt b/knx-linux/CMakeLists.txt index 4b62690..2c2b136 100644 --- a/knx-linux/CMakeLists.txt +++ b/knx-linux/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 2.7) project(knx-linux) set(LIBRARIES_FROM_REFERENCES "") -add_executable(knx-linux ../src/knx/address_table_object.cpp ../src/knx/apdu.cpp ../src/knx/application_layer.cpp ../src/knx/application_program_object.cpp ../src/knx/association_table_object.cpp ../src/knx/bau.cpp ../src/knx/bau07B0.cpp ../src/knx/bau57B0.cpp ../src/knx/bau_systemB.cpp ../src/knx/bits.cpp ../src/knx/cemi_frame.cpp ../src/knx/data_link_layer.cpp ../src/knx/datapoint_types.cpp ../src/knx/device_object.cpp ../src/knx/group_object.cpp ../src/knx/group_object_table_object.cpp ../src/knx/interface_object.cpp ../src/knx/ip_data_link_layer.cpp ../src/knx/ip_parameter_object.cpp ../src/knx/memory.cpp ../src/knx/network_layer.cpp ../src/knx/npdu.cpp ../src/knx/table_object.cpp ../src/knx/tpdu.cpp ../src/knx/tpuart_data_link_layer.cpp ../src/knx/transport_layer.cpp ../src/knx/platform.cpp ../src/main.cpp ../src/linux_platform.cpp) +add_executable(knx-linux ../src/knx/address_table_object.cpp ../src/knx/apdu.cpp ../src/knx/application_layer.cpp ../src/knx/application_program_object.cpp ../src/knx/association_table_object.cpp ../src/knx/bau.cpp ../src/knx/bau07B0.cpp ../src/knx/bau57B0.cpp ../src/knx/bau_systemB.cpp ../src/knx/bits.cpp ../src/knx/cemi_frame.cpp ../src/knx/data_link_layer.cpp ../src/knx/datapoint_types.cpp ../src/knx/device_object.cpp ../src/knx/group_object.cpp ../src/knx/group_object_table_object.cpp ../src/knx/interface_object.cpp ../src/knx/ip_data_link_layer.cpp ../src/knx/ip_parameter_object.cpp ../src/knx/memory.cpp ../src/knx/network_layer.cpp ../src/knx/npdu.cpp ../src/knx/table_object.cpp ../src/knx/tpdu.cpp ../src/knx/tpuart_data_link_layer.cpp ../src/knx/transport_layer.cpp ../src/knx/platform.cpp main.cpp ../src/linux_platform.cpp) target_link_libraries(knx-linux "${LIBRARIES_FROM_REFERENCES}") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wno-unknown-pragmas -Wno-switch -g -O0") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wno-unknown-pragmas -Wno-switch -g -O0") diff --git a/knx-linux/ClassDiagram.cd b/knx-linux/ClassDiagram.cd index d736968..3781e62 100644 --- a/knx-linux/ClassDiagram.cd +++ b/knx-linux/ClassDiagram.cd @@ -1,12 +1,5 @@  - - - - IBAAAAEAQACAEAIAABAAAAgAAAAAAAgAAAAAAABAAEA= - C:\Users\tkunze\Source\knx\src\knx\address_table_object.h - - @@ -77,13 +70,6 @@ C:\Users\tkunze\Source\knx\src\linux_platform.h - - - - AAAAAAAAAACAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAA= - C:\Users\tkunze\Source\knx\src\knx\save_restore.h - - diff --git a/knx-linux/knx-linux.vcxproj b/knx-linux/knx-linux.vcxproj index 8efae98..efe1861 100644 --- a/knx-linux/knx-linux.vcxproj +++ b/knx-linux/knx-linux.vcxproj @@ -140,6 +140,6 @@ - + \ No newline at end of file diff --git a/knx-linux/knx-linux.vcxproj.filters b/knx-linux/knx-linux.vcxproj.filters index 56270a3..9044e94 100644 --- a/knx-linux/knx-linux.vcxproj.filters +++ b/knx-linux/knx-linux.vcxproj.filters @@ -212,10 +212,10 @@ Source files\knx - + Source files - + Source files diff --git a/src/main.cpp b/knx-linux/main.cpp similarity index 94% rename from src/main.cpp rename to knx-linux/main.cpp index 0afddd5..e3c468c 100644 --- a/src/main.cpp +++ b/knx-linux/main.cpp @@ -1,100 +1,97 @@ -#ifdef __linux__ - -#include "linux_platform.h" -#include "knx/bau57B0.h" -#include "knx/group_object_table_object.h" -#include -#include -#include - -LinuxPlatform platfrom; -Bau57B0 bau(platfrom); - -float currentValue = 0; -float maxValue = 0; -float minValue = RAND_MAX; -long lastsend = 0; - -#define CURR bau.groupObjectTable().get(1) -#define MAX bau.groupObjectTable().get(2) -#define MIN bau.groupObjectTable().get(3) -#define RESET bau.groupObjectTable().get(4) - -void measureTemp() -{ - long now = platfrom.millis(); - if ((now - lastsend) < 2000) - return; - - lastsend = now; - int r = rand(); - currentValue = (r * 1.0) / (RAND_MAX * 1.0); - currentValue *= 100 * 100; - - - CURR.objectWrite(currentValue); - - if (currentValue > maxValue) - { - maxValue = currentValue; - MAX.objectWrite(maxValue); - } - - if (currentValue < minValue) - { - minValue = currentValue; - MIN.objectWrite(minValue); - } -} - -void resetCallback(GroupObject& go) -{ - if (go.objectReadBool()) - { - maxValue = 0; - minValue = 10000; - } -} - -void appLoop() -{ - if (!bau.configured()) - return; - - measureTemp(); -} - -void setup() -{ - srand((unsigned int)time(NULL)); - bau.readMemory(); - - if (bau.configured()) - RESET.callback(resetCallback); - - if (bau.deviceObject().induvidualAddress() == 0) - bau.deviceObject().progMode(true); - - if (bau.parameters().loadState() == LS_LOADED) - { - printf("Timeout: %d\n", bau.parameters().getWord(0)); - printf("Zykl. senden: %d\n", bau.parameters().getByte(2)); - printf("Min/Max senden: %d\n", bau.parameters().getByte(3)); - printf("Aenderung senden: %d\n", bau.parameters().getByte(4)); - printf("Abgleich %d\n", bau.parameters().getByte(5)); - } - bau.enabled(true); -} - -int main(int argc, char **argv) -{ - setup(); - - while (1) - { - bau.loop(); - appLoop(); - platfrom.mdelay(100); - } -} -#endif \ No newline at end of file +#include "linux_platform.h" +#include "knx/bau57B0.h" +#include "knx/group_object_table_object.h" +#include +#include +#include + +LinuxPlatform platfrom; +Bau57B0 bau(platfrom); + +float currentValue = 0; +float maxValue = 0; +float minValue = RAND_MAX; +long lastsend = 0; + +#define CURR bau.groupObjectTable().get(1) +#define MAX bau.groupObjectTable().get(2) +#define MIN bau.groupObjectTable().get(3) +#define RESET bau.groupObjectTable().get(4) + +void measureTemp() +{ + long now = platfrom.millis(); + if ((now - lastsend) < 2000) + return; + + lastsend = now; + int r = rand(); + currentValue = (r * 1.0) / (RAND_MAX * 1.0); + currentValue *= 100 * 100; + + + CURR.objectWrite(currentValue); + + if (currentValue > maxValue) + { + maxValue = currentValue; + MAX.objectWrite(maxValue); + } + + if (currentValue < minValue) + { + minValue = currentValue; + MIN.objectWrite(minValue); + } +} + +void resetCallback(GroupObject& go) +{ + if (go.objectReadBool()) + { + maxValue = 0; + minValue = 10000; + } +} + +void appLoop() +{ + if (!bau.configured()) + return; + + measureTemp(); +} + +void setup() +{ + srand((unsigned int)time(NULL)); + bau.readMemory(); + + if (bau.configured()) + RESET.callback(resetCallback); + + if (bau.deviceObject().induvidualAddress() == 0) + bau.deviceObject().progMode(true); + + if (bau.parameters().loadState() == LS_LOADED) + { + printf("Timeout: %d\n", bau.parameters().getWord(0)); + printf("Zykl. senden: %d\n", bau.parameters().getByte(2)); + printf("Min/Max senden: %d\n", bau.parameters().getByte(3)); + printf("Aenderung senden: %d\n", bau.parameters().getByte(4)); + printf("Abgleich %d\n", bau.parameters().getByte(5)); + } + bau.enabled(true); +} + +int main(int argc, char **argv) +{ + setup(); + + while (1) + { + bau.loop(); + appLoop(); + platfrom.mdelay(100); + } +} \ No newline at end of file diff --git a/src/knx/save_restore.h b/src/knx/save_restore.h index 8a003db..8a83d14 100644 --- a/src/knx/save_restore.h +++ b/src/knx/save_restore.h @@ -1,10 +1,28 @@ #pragma once #include - +/** + *@brief Interface for classes that can save and restore data from a buffer. + */ class SaveRestore { public: + /** + * @brief This method is called when the object should save its state to the buffer. + * + * @param buffer The buffer the object should save its state to. + * + * @return The buffer plus the size of the object state. The next object will use this value as + * the start of its buffer. + */ virtual uint8_t* save(uint8_t* buffer) = 0; + /** + * @brief This method is called when the object should restore its state from the buffer. + * + * @param buffer The buffer the object should restore its state from. + * + * @return The buffer plus the size of the object state. The next object will use this value as + * the start of its buffer. + */ virtual uint8_t* restore(uint8_t* buffer) = 0; }; \ No newline at end of file