Main Site Documentation

How do I declare #if #else #endif for DOMINO and PANDA boards?


My question is How do I declare #if #else #endif for DOMINO and PANDA boards?

I want to make my code compiled selectively for different boards I use.

What are the system titles for FEZ Domino and FEZ Panda II?

#if DOMINO???



Thank you!


Define your directive yourself up high in file, then test for it later.
You then have one place to change the directive as needed.

#define DOMINO // Place before "using" statements in main.cs
using ...

// Test for what is defined later in your program.
 #elif PANDA


By the way, the #define only works in a single code file if placed in the .cs files. If you want it declared globally for your code, you have to place it in the properties (double click the project properties on the project pane) on the Build tab.


I want my code compilation automatically compile depending on the library I want to use for particular device. In my case it is either FEZDomino_GHIElectronics.NETMF.FEZ or FEZPanda_GHIElectronics.NETMF.FEZ

Can you please explain more clear what I should write in my code?

Thank you!

Ron2, yes, I want to globally use it across my project, and main reason for that is Pins definitions difference between USBizi 144 and 100 chipsets.

I am programming my code, but what to test it on both Domino and PandaII chipsets.

Also, is the 4.1 SDK working OK in PandaII board with all extra features introduced there?


And the final resting place for defines (conditional compilation symbols) should be in the project settings for individual targets.

For example:

Create a target “Release Domino” and add DOMINO in the project setting dialog (Build tab -> Conditional compilation symbols).
Create another target “Release Panda” and do not add DOMINO there.

After that you can remove #define from code and just select appropriate target that you want to build.

I use this in my LCD driver project on Fezzer, you can take a look if you need an example:


Thank you guys!
Finally I clicked in there. Nice, it works as it should.

So, in order to work on my compilation, I need to switch between releases for different boards, thus triggering the #if statement.

Another thing, I have to add/remove appropriate libraries for DOMINO and PANDA, since they conflict is existing in the project side by side.


Instead of using Domino/Panda pin-mapping libraries, you can create your own based on USBizi pin-mapping

This doc should get you started


Sounds like a nice idea. Just a few copy and paste with the same sttements. :wink: