1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-23 08:06:13 +01:00

Rename user module mySetup.cpp to myHal.cpp, and function mySetup() to halSetup() within it.

This commit is contained in:
Neil McKechnie 2021-11-15 12:50:02 +00:00
parent fb97ba11de
commit d08f14be3b
3 changed files with 16 additions and 11 deletions

1
.gitignore vendored
View File

@ -10,6 +10,7 @@ config.h
.vscode/extensions.json .vscode/extensions.json
mySetup.h mySetup.h
mySetup.cpp mySetup.cpp
myHal.cpp
myAutomation.h myAutomation.h
myFilter.cpp myFilter.cpp
myAutomation.h myAutomation.h

View File

@ -28,8 +28,9 @@
#define USE_FAST_IO #define USE_FAST_IO
#endif #endif
// Link to mySetup function. If not defined, the function reference will be NULL. // Link to halSetup function. If not defined, the function reference will be NULL.
extern __attribute__((weak)) void mySetup(); extern __attribute__((weak)) void halSetup();
extern __attribute__((weak)) void mySetup(); // Deprecated function name, output warning if it's declared
//================================================================================================================== //==================================================================================================================
// Static methods // Static methods
@ -61,12 +62,15 @@ void IODevice::begin() {
} }
_initPhase = false; _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 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. // The myHal.cpp file is a standard C++ module so has access to all of the DCC++EX APIs.
if (mySetup) { if (halSetup)
mySetup(); halSetup();
}
} }
// Overarching static loop() method for the IODevice subsystem. Works through the // Overarching static loop() method for the IODevice subsystem. Works through the

View File

@ -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. // edit them to satisfy your requirements.
// Note that if the file has a .cpp extension it WILL be compiled into the build // 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. // To prevent this, temporarily rename it to mySetup.txt or similar.
// //
@ -128,7 +128,7 @@
// referenced by commands in mySetup.h. // 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 // 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 // The other devices can also be created in this way. The parameter lists for the