RLP GPIO Pin access

Hi,

I’m trying to use RLP to get the state of a particular input pin. The code I have so far is as follows:


 #include "RLP.h"

int ReadDataInput(unsigned int *generalArray, void **args, unsigned int argsCount, unsigned int *argSize)
{
	if(RLPext->GPIO.ReadPin(27) == true)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}

When I try and compile it I get the following error:


C:\rlp>make
rm *.o ./Output/*.elf ./Output/*.map
rm: cannot remove `*.o': No such file or directory
make: [clean] Error 1 (ignored)
arm-none-eabi-gcc    -c -o RLP_GPIO.o RLP_GPIO.c
RLP_GPIO.c: In function 'ReadDataInput':
RLP_GPIO.c:10:5: error: 'RLP_ADDRESS' undeclared (first use in this function)
RLP_GPIO.c:10:5: note: each undeclared identifier is reported only once for each
 function it appears in
RLP_GPIO.c:10:5: error: 'RLP_SIZE' undeclared (first use in this function)
RLP_GPIO.c:10:33: error: 'true' undeclared (first use in this function)
make: *** [RLP_GPIO.o] Error 1

It seems to me that the RLPext structure maybe has to be initialised first before use? Does anyone know what I’m doing wrong?

Thanks

You have to edit RLP.h.

At the top of the file you’ll see this:

// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!   The user must set these settings according to the used platform    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Under there are a few #defines. Uncomment the lines that apply to the platform you’re using; so in my case, since I’m using a Panda II which uses the USBizi platform, I ended up with this:

// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!   The user must set these settings according to the used platform    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// ChipworkX
//#define RLP_ADDRESS		0xA0000000
//#define RLP_SIZE		0x001FB3FC

// EMX
//#define RLP_ADDRESS		0xA0F00000
//#define RLP_SIZE		0x000FFFFC

// USBizi
 #define RLP_ADDRESS		0x40000440
 #define RLP_SIZE		0x000027FC
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

If you’re using a Cobra for example, you’d uncomment the EMX lines as the Cobra is EMX-based. Hope that helps! :slight_smile: