Example: I have a 3-wire device (select, clock, data). I'd like to use 3 of the 4 pins on XS1_PORT_4A as input from this device.
I read in section C.3 of "Programing XC on XMOS Devices", "Specifying Port-to-Pin Mappings" section that "individual bits of the port are identified by means of a superscripted digit 0-31". No examples were given of how this indexing is declared. It's not making sense to me how to declare 3 port variables using specific pins of port 4A and I haven't come across any examples like what I'm looking for.
When I read the description I think of array indexes. I know this doesn't compile, but this is basically what I'm trying to do:
Code: Select all
on stdcore[IO_CORE] : port MY3WIRE_PORT = XS1_PORT_4A;
#define SEL MY3WIRE_PORT[0]
#define BCLK MY3WIRE_PORT[1]
#define DATA MY3WIRE_PORT[3]
My question is, how can I make 3 variables, even if they're not true variables but #defines, to emulate 3 1-bit ports from a 4-bit port?
I think I'm missing something in the XC description language that would let me index a specific bit on the port and associate it with a variable or #define. I know this is likely to be a "doh!" when I see the answer, but right now, I'd settle for a 'doh!' moment.
Landon