diff --git a/.gitignore b/.gitignore index b0b8666..61eedc4 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ config.h .vscode/extensions.json mySetup.h mySetup.cpp +myHal.cpp myAutomation.h myFilter.cpp myAutomation.h diff --git a/IODevice.cpp b/IODevice.cpp index c7ab7c0..63a6d8b 100644 --- a/IODevice.cpp +++ b/IODevice.cpp @@ -28,8 +28,9 @@ #define USE_FAST_IO #endif -// Link to mySetup function. If not defined, the function reference will be NULL. -extern __attribute__((weak)) void mySetup(); +// Link to halSetup function. If not defined, the function reference will be NULL. +extern __attribute__((weak)) void halSetup(); +extern __attribute__((weak)) void mySetup(); // Deprecated function name, output warning if it's declared //================================================================================================================== // Static methods @@ -61,12 +62,15 @@ void IODevice::begin() { } _initPhase = false; - // Call user's mySetup() function (if defined in the build in mySetup.cpp). + // Check for presence of deprecated mySetup() function, and output warning. + if (mySetup) + DIAG(F("WARNING: mySetup() function should be renamed to halSetup()")); + + // Call user's halSetup() function (if defined in the build in myHal.cpp). // The contents will depend on the user's system hardware configuration. - // The mySetup.cpp file is a standard C++ module so has access to all of the DCC++EX APIs. - if (mySetup) { - mySetup(); - } + // The myHal.cpp file is a standard C++ module so has access to all of the DCC++EX APIs. + if (halSetup) + halSetup(); } // Overarching static loop() method for the IODevice subsystem. Works through the diff --git a/mySetup.cpp_example.txt b/myHal.cpp_example.txt similarity index 97% rename from mySetup.cpp_example.txt rename to myHal.cpp_example.txt index e93ac53..6ea5c00 100644 --- a/mySetup.cpp_example.txt +++ b/myHal.cpp_example.txt @@ -1,10 +1,10 @@ -// Sample mySetup.cpp file. +// Sample myHal.cpp file. // -// To use this file, copy it to mySetup.cpp and uncomment the directives and/or +// To use this file, copy it to myHal.cpp and uncomment the directives and/or // edit them to satisfy your requirements. // Note that if the file has a .cpp extension it WILL be compiled into the build -// and the mySetup() function WILL be invoked. +// and the halSetup() function WILL be invoked. // // To prevent this, temporarily rename it to mySetup.txt or similar. // @@ -128,7 +128,7 @@ // referenced by commands in mySetup.h. //======================================================================= -void mySetup() { +void halSetup() { // Alternative way of creating a module driver, which has to be within the mySetup() function // The other devices can also be created in this way. The parameter lists for the