I'm trying to define 2 Capacitive Discharge boards in a simple myHal.cpp file EXRAIL, and this is generating a compile error. I can't see what's wrong - maybe I'm looking right at it?? Error Generated: #define SEQUENCE(id) id, ^~ In file included from C:\Users\peter\ex-installer\CommandStation-EX\EXRAIL.h:33, from C:\Users\peter\ex-installer\CommandStation-EX\DCCEX.h:53, from C:\Users\peter\ex-installer\CommandStation-EX\CommandStation-EX.ino:52: C:\Users\peter\ex-installer\CommandStation-EX\EXRAILMacros.h:100:4: error: expected declaration before '}' token }; ^ This is the cpp file. Code: //myHal.cpp #include "IODevice.h" void halSetup() { PCF8574::create(200, 8, 0x20); PCF8574::create(208, 8, 0x21); }
I haven't used what your are trying to do but wonder if you need to include... //#include "IO_PCA9555.h" // 16-bit I/O expander (NXP & Texas Instruments). If that doesn't work I'd open a ticket on the Discord channel. Sumner
The include may work (though I think it would be #include "IO_PCF8574.h"). But I get a "'PCF8574' has not been declared" error instead of the one you get when I try to paste in your definitions. DCC-EX is changing the preferred method of creating devices. Instead of defining them in myHal.cpp, use the HAL() function in myAutomation.h (see here). One of the reasons the team is making that the preferred method is to avoid the need for the user to put in the includes. Also I think you may need to comment out the default MCP23017 expanders in IODevice.cpp, if you want to have a different I2c device at 0x20 or 0x21.