View previous topic :: View next topic |
Author |
Message |
Eduardo__
Joined: 23 Nov 2011 Posts: 197 Location: Brazil
|
How to detect if some stream is defined? |
Posted: Fri Nov 25, 2011 11:04 am |
|
|
How to detect if some stream is defined?
E.g.
Code: |
/*
This example not works.
#ifndef directive not detects RF24_SPI stream
*/
#USE SPI(SPI1, FORCE_HW, BAUD=4000000, STREAM=RF24_SPI)
#ifndef RF24_SPI
#USE SPI(SPI2, FORCE_HW, MASTER, BAUD=4000000, MODE=0, STREAM=RF24_SPI) //<-generate an error
#warning RF24_SPI initialized as SPI2 //<-this warning is shown-up
#endif
|
Thanks _________________ Eduardo Guilherme Brandt |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Nov 25, 2011 3:53 pm |
|
|
I'm not sure if the stream can be recognized outside of the #use rs232()
library. But you do everything you want with conditional define
statements, such as #ifdef, #else, #ifndef, etc., by just using normal
methods. |
|
|
Eduardo__
Joined: 23 Nov 2011 Posts: 197 Location: Brazil
|
|
Posted: Fri Nov 25, 2011 4:41 pm |
|
|
Dear Mr. PCM,
but, do you know how to detect if some STREAM was initialized or not? _________________ Eduardo Guilherme Brandt |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Nov 25, 2011 6:26 pm |
|
|
I just wanted to offer a small tip. I don't want to spend more time working
on this type of problem. |
|
|
|