Closed Mikaka27 closed 8 years ago
This happens because DirectIO sets some preprocessor flags in ports.h before including the Arduino standard library headers. Specifically, it sets _SFR_ASM_COMPAT so that it can get the memory addresses of the I/O registers for the specific MCU model in use. After getting the values it needs (at the end of ports.h), we reset the flags to default and force the standard headers to be included again.
The fix may be to do the same cleanup/re-include trick at the top of ports.h. I will test that.
Hello, I have a strange problem with your library. Whenver the library isn't the first entry on the include list it throws errors.
If I have:
include DirectIO.h
include somethingElse.h (I had to remove < and > signs because github was deleting them somehow)
It's fine, but if I have it the other way around I get these errors: ports.h:48: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:48: error:
*' cannot appear in a constant-expression ports.h:48: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:48: error:
' cannot appear in a constant-expression ports.h:48: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:48: error: `' cannot appear in a constant-expression ports.h:52: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:52: error:*' cannot appear in a constant-expression ports.h:52: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:52: error:
' cannot appear in a constant-expression ports.h:52: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:52: error: `' cannot appear in a constant-expression ports.h:56: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:56: error:*' cannot appear in a constant-expression ports.h:56: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:56: error:
' cannot appear in a constant-expression ports.h:56: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:56: error: `' cannot appear in a constant-expression ports.h:60: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:60: error:*' cannot appear in a constant-expression ports.h:60: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:60: error:
' cannot appear in a constant-expression ports.h:60: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:60: error: `' cannot appear in a constant-expressionDue to my project's structure it's impossible for me to have your library as first thing included. How can I fix this?