User`s manual

RabbitFLEX User’s Manual www.rabbit.com 69
If you would like to change your pin software names after you have designed your board, then it is possi-
ble to modify your design-specific generated library. You must search the library for all references to the
name that you wish to change. Note, however, that if you do modify your design-specific library, you will
be responsible for maintaining that library. The version in your RabbitFLEX account will no longer be
synchronized with your modified version. A better way of renaming may be to use a macro define, like
this:
#define flex_greenled flex_c1p3
6.3.3 Pin Groups
One useful feature in the digital input and output software support is the concept of pin groups. A pin
group can be used to read a number of inputs or set a number of outputs with one function call.
First, the pin group must be defined. A pin group is an array of Flex_IOPin pointers
(Flex_IOPin *). The group must be terminated by an element called FLEX_GROUP_END.
For example:
static const Flex_IOPin *leds[] = {
&flex_c2p1,
&flex_c2p2,
&flex_c2p3,
FLEX_GROUP_END
};
This example creates a pin group of 3 digital outputs. To set these outputs, we could do the following:
flexDigOutGroup16(leds, 0x05);
The first parameter is the pin group, and the second parameter contains the values with which to set the
digital outputs. The least significant bit is written to the first pin in the pin group; the next least significant
bit is written to the second pin in the pin group; etc. The following diagram demonstrates this process:
A digital input group works similarly:
flexDigInGroup16(switches, &result);
In this case, the state of the first pin in the pin group is placed in the least significant bit of result; the state
of the second pin is placed in the next least significant bit of the result; etc.
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
&flex_c2p1
&flex_c2p2
&flex_c2p3
FLEX_GROUP_END