Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 5, 3 & 1 Forum Discussions

Not applicable

Given that GPIOs are defined in PSoCGPIOINT.h as, e.g.:

#pragma ioport LED0_Data_ADDR:    0x0 BYTE           LED0_Data_ADDR; #define LED0_MASK 0x2



I tried doing something like this in my code:



void SetLED(BYTE *address, BYTE mask) {     *address |= mask; }  ...  SetLED(&LED0_Data_ADDR, LED0_MASK); 

That compiled fine, but did not have any effect. It seems like the variables with #pragma ioport can't be referenced and dereferenced like that.


I can't find any in-depth information about #pragma ioport and I/O memory. Is there any way I can qualify pointers to work as intended? Or do pointers to io memory not work in this compiler?

1 Reply
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome in the forum, Christopher!


Use pointers to functions instead. You can place some LED components into your design and use an array of pointers to that functions to control the LEDs, See here on how2


As a tip: Change to PSoC4. With debugging capabilities you can get a prototyping kit for few money.