chipKIT® Development Platform

Inspired by Arduino™

Serial TFT connection issue

Created Sun, 21 Dec 2014 14:07:07 +0000 by GastonLagaffe


GastonLagaffe

Sun, 21 Dec 2014 14:07:07 +0000

Salut,

I use

#define LEFT 0
#define RIGHT 1
uint8_t nP[2][8] = {{0,17, 9,10,11,12,13,14},{18,17, 1, 2, 3, 6, 7, 8}};
#define LCD_MODEL TFT01_22SP // ElecFreaks TFT2.2SP Shield
#define LCD_SDA nP[RIGHT][4]

The last #define does not get resolved correctly, RIGHT does not get replaced by 1 (but by 0)

is this a feature of the pre-compiler or am I misunderstanding the handling of #defines?

Ciao, Mathias


madias

Mon, 22 Dec 2014 15:22:07 +0000

I don't think, that you can use defines inside defines in C++ http://stackoverflow.com/questions/3314032/is-there-a-way-to-do-a-define-inside-of-another-define Maybe it's better to use const instead of #define?


madias

Mon, 22 Dec 2014 18:57:02 +0000

similar thread here: (german) http://www.mikrocontroller.net/topic/353137#new


GastonLagaffe

Mon, 22 Dec 2014 21:08:22 +0000

Salut,

yes, nested #defines are not allowed - fixed it by using const declarations. Thanks

Ciao, Mathias PS: I got my final prototype of my PCB from OSH and all seems to work so far :P