User`s manual

RabbitFLEX User’s Manual www.rabbit.com 71
Note that the keypad’s software name is always flex_keypad.
Next, you should configure the keys on your keypad. This is what the flexKeyConfig() function
does. When a key is pressed, the flexKeyGet() function will get a specific key code before returning
which key was pressed. The keycode is calculated as follows:
[output #] * [num outputs] + [input #]
The flexKeyConfig() function takes the key code as a parameter to determine which key you are
configuring. The other parameters let you configure the actual char value that flexKeyGet() will
report when the corresponding key is pressed, as well as whether or not a key should repeat if held down.
To drive the keypad driver, you must continuously call the flexKeyProcess() function.
6.3.7 LCD
All LCD functions begin with “flexDisp.” To use the LCD software support, you must first initialize the
LCD. Use the flexDispInit() function. Here is an example:
flexDispInit(&flex_lcd, NULL);
Note that the LCD’s software name is always flex_lcd.
Also note the second parameter in flexDispInit(). Your LCD display may have different properties
from the standard LCDs that we support. The second parameter lets you configure some of the parameters
for your attached LCD. This initialization parameter is of type Flex_LCDConf. Here is the structure
definition for Flex_LCDConf:
typedef struct {
char num_cols; // Number of columns on the display
char num_rows; // Number of rows on the display
char row_addresses[4]; // Starting address of each row (up to 4 rows)
float anaout_contrast_min; // Minimum voltage for contrast control
float anaout_contrast_max; // Maximum voltage for contrast control
int pwm_contrast_min; // Minimum duty cycle for contrast control
int pwm_contrast_max; // Maximum duty cycle for contrast control
char def_contrast; // Default scaled value for contrast control (0-255)
} Flex_LCDConf;
If your display has a specific number of columns and rows, then you can set that with the num_cols and
num_rows parameters. The documentation for your LCD module should indicate at which address each
row begins—these can be specified with the row_addresses array. The anaout_contrast_min
and anaout_contrast_max parameters can be ignored—contrast on the RabbitFLEX BL300F is cur-
rently set via a PWM output. pwm_contrast_min and pwm_contrast_max can be used to restrict
the range of the contrast settings, whereas def_contrast can be used to set the default contrast value.
So, for a 2x20 display, you might initialize it as follows:
Flex_LCDConf my_lcd;
// Number of columns on the display
my_lcd.num_cols = 20;