From 10a0cfcccb9a6c12670695d1d7df1c841338f00c Mon Sep 17 00:00:00 2001 From: Asbelos Date: Tue, 14 Jun 2022 15:28:13 +0100 Subject: [PATCH] change halSetup order --- IODevice.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/IODevice.cpp b/IODevice.cpp index de6b021..d320c09 100644 --- a/IODevice.cpp +++ b/IODevice.cpp @@ -32,7 +32,6 @@ // 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 @@ -47,7 +46,16 @@ extern __attribute__((weak)) void mySetup(); // Deprecated function name, outpu // Create any standard device instances that may be required, such as the Arduino pins // and PCA9685. void IODevice::begin() { - // Initialise the IO subsystem + // 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 myHal.cpp file is a standard C++ module so has access to all of the DCC++EX APIs. + + // This is done first so that the following defaults will detect an overlap and not + // create something that conflicts with the users vpin definitions. + if (halSetup) + halSetup(); + + // Initialise the IO subsystem defaults ArduinoPins::create(2, NUM_DIGITAL_PINS-2); // Reserve pins for direct access // Predefine two PCA9685 modules 0x40-0x41 // Allocates 32 pins 100-131 @@ -63,16 +71,6 @@ void IODevice::begin() { dev->_begin(); } _initPhase = false; - - // 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 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