Go Down

Topic: Standard libraries unknown in IDE V1.5.1r2 (Read 3 times) previous topic - next topic

Arctic_Eddie

That's a conditional assignment statement. My link to Wikipedia won't print correctly. Do a search for "C++ ?:"




Arctic_Eddie


Arctic_Eddie

Let's look at the line.

#define DIRECT_READ(base, mask)         (((*(base+0x3c)) & mask) ? 1 : 0)   /*(Pio Offset: 0x003C) Pin Data Status Register */


The line has four parts.

Part 1 is              #define DIRECT_READ(base, mask)  // The part receiving a value

Part 2 is              (((*(base+0x3c)) & mask) ?              // A conditional test, true or false

Part 3 is              1:                                                 // Value assigned if test is true

Part 4 is               0                                                 // Value assigned if test is false

This is what happens. If part 2 is true then part 1 receives part 3(1). If part 2 is false then part 1 receives part 4(0).

It's the same as:

if( part2 == true )
    Part 1 has a 1 appended to the end
else
    Part 1 has a 0 appended to the end


alvesjc

Ok, thank you for the explanation.

Well, this should work, I'm clueless...

I'll move for a simple test program with onewire and see what happen. Just in the event that the problem is my program and not the lib...

interrupts()
and
nointerrupts()

Are system functions to enable and disable interrupts at a given time, right?

Arctic_Eddie


Go Up