This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Preprocessor gurus help requested!

Hello preprocessor masters/gurus,

I am trying to make a piece of software as easily configurable as possible, by only indicting which port/pin combination controls the hardware:

// SPI master/slave arbitration
#define SPI_MASTER_IO_PORT                      0
#define SPI_MASTER_IO_PIN                       19

#define FIO_PORT_PIN(x)                         FIO##x##PIN

#define SPI_MASTER_REQUEST_IO_BIT_STATUS          ( (FIO_PORT_PIN(SPI_MASTER_IO_PORT)>>SPI_MASTER_IO_PIN)&1)

The result I want is this:

((FIO0PIN>>19)&1)

but this yields the following error message:

..\src\spi.c(341): error:  #20: identifier "FIOSPI_MASTER_IO_PORTCLR" is undefined</ptr>

Are there ways around the apparent failure of the double replacement required here...?

Thanks in advance