Main Site Documentation

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


#1

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???

#else

#endif

Thank you!


#2

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.
 #if DOMINO
    Debug.Print("Domino");
 #elif PANDA
    Debug.Print("Panda");
 #endif

#3

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.


#4

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!

P.S.
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?


#5

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:

http://www.fezzer.com/project/60/24-tft-lcd-screen-module/


#6

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.


#7

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

This doc should get you started http://www.ghielectronics.com/downloads/USBizi/FEZ%20boards%20to%20evaluate%20USBizi%20chipsets.pdf


#8

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