XBee Firmware Library  1.6.0
Functions
Character LCD

Functions

void char_lcd_clear (void)
 Clears the LCD display screen and sets the cursor position to 0,0. More...
 
void char_lcd_cmd_write (uint8_t cmd)
 Writes a command in the display instruction register. More...
 
void char_lcd_cursor_blink_on_off (bool_t on)
 Enables the cursor blink. More...
 
void char_lcd_cursor_on_off (bool_t on)
 Turns ON/OFF the display cursor. More...
 
int char_lcd_goto_xy (uint8_t x, uint8_t y)
 Sets the cursor position to the specified coordinates. More...
 
int char_lcd_init (uint8_t config)
 Initialices the LCD display. More...
 
void char_lcd_on_off (uint8_t on)
 Turns ON/OFF the entire display. When turned off, the data remains in the display DDRAM. More...
 
void char_lcd_putchar (uint8_t data)
 Writes data byte in the LCD display. More...
 
int char_lcd_read_data_xy (uint8_t x, uint8_t y)
 Reads a byte from the display memory, at the specified coordinates. More...
 
ssize_t char_lcd_write (const uint8_t *data, size_t len)
 Writes in the display len bytes from data buffer. More...
 

Detailed Description

Platform-specific layer provides a consistent API to upper layers of the driver.

Character LCD Overview

This API contains the functions to configure and control a character LCD based on the HD44780, KS0066U or equivalent display controller, with a programmable XBee device.

Character LCD Macros

The character LCD API needs to have defined the XBee pins that compose the data port and which XBee pins are used to control the LCD. For that purpose you have to define some macros before initialize the character LCD.

   - Macros to configure the data port of the character LCD:
           - \b CHAR_LCD_DATA_XPINS        : Indicates which XBee pins are used for
                                                                     the data port of the LCD.

   - Macros to configure the control lines of the character LCD:
           - \b CHAR_LCD_RS_XPIN           : Indicates which XBee pin will be
                                                                     configured for the RS line.
           - \b CHAR_LCD_RW_XPIN           : Indicates which XBee pin will be
                                                                     configured for the RW line.
           - \b CHAR_LCD_EN_XPIN           : Indicates which XBee pin will be 
                                                                     configured for the EN line.

Usage example:
#define CHAR_LCD_DATA_XPINS {XPIN_4, XPIN_7, XPIN_11, XPIN_12}
#define CHAR_LCD_RS_XPIN XPIN_16
#define CHAR_LCD_RW_XPIN XPIN_17
#define CHAR_LCD_EN_XPIN XPIN_18
Warning
It is recommended not to use these macros, they are used by the XBee Project Smart Editor of the XBee extensions.

There are other macros that configures the number of lines and columns (characters) of the display. This configuration macro must be also defined before initializing the LCD.

Usage example:

#define CHAR_LCD_CFG_2x16
Warning
It is recommended not to use these macros, they are used by the XBee Project Smart Editor of the XBee extensions.

Appart from the previous macros, the char_lcd_init() method of the character LCD API needs as argument a byte containing the initial configuration masks for the display. These masks are defined with macros and they are the following:

   - Macros to configure the \b LCD display:
                   - \b CHAR_LCD_DISP_ON           : The LCD display is ON.
           - \b CHAR_LCD_DISP_OFF          : The LCD display is OFF.

   - Macros to configure (show/hide) the LCD cursor:
           - \b CHAR_LCD_CURSOR_ON         : The LCD cursor is displayed.
           - \b CHAR_LCD_CURSOR_OFF        : The LCD cursor is hidden.

   - Macros to enable or disable the the LCD cursor blinking:
           - \b CHAR_LCD_CUR_BLINK_ON      : The LCD cursor blinking is enabled.
           - \b CHAR_LCD_CUR_BLINK_OFF     : The LCD cursor blinking is disabled.

Usage example:
char_lcd_init(CHAR_LCD_DISP_ON | CHAR_LCD_CURSOR_ON | CHAR_LCD_CUR_BLINK_OFF);
Warning
It is recommended not to use these macros, they are used by the XBee Project Smart Editor of the XBee extensions.

Function Documentation

void char_lcd_clear ( void  )

Clears the LCD display screen and sets the cursor position to 0,0.

Parameters
[in]None
Return values
None
void char_lcd_cmd_write ( uint8_t  cmd)

Writes a command in the display instruction register.

Parameters
[in]cmdthe value (command) to write.
Return values
None
void char_lcd_cursor_blink_on_off ( bool_t  on)

Enables the cursor blink.

Parameters
[in]onif equal to 1, enables the cursor blink
Return values
None
void char_lcd_cursor_on_off ( bool_t  on)

Turns ON/OFF the display cursor.

Parameters
[in]onif equal to 1, turns on the display cursor.
Return values
None
int char_lcd_goto_xy ( uint8_t  x,
uint8_t  y 
)

Sets the cursor position to the specified coordinates.

Parameters
[in]xset the cursor to column x
[in]yset the cursor to row y
Return values
int0 on success
-EINVALon error (invalid coordinates)
int char_lcd_init ( uint8_t  config)

Initialices the LCD display.

Parameters
[in]configa byte containing the Initial configuration for display on/off, cursor on/off and blink on/off. See Character LCD Macros for more information.
Return values
int0 on success
interror code on error
void char_lcd_on_off ( uint8_t  on)

Turns ON/OFF the entire display. When turned off, the data remains in the display DDRAM.

Parameters
[in]onif equal to 1, turns on the display.
Return values
None
void char_lcd_putchar ( uint8_t  data)

Writes data byte in the LCD display.

Parameters
[in]databyte that will be written
Return values
None
int char_lcd_read_data_xy ( uint8_t  x,
uint8_t  y 
)

Reads a byte from the display memory, at the specified coordinates.

Parameters
[in]xcolumn from where will be read the display character
[in]yrow from where will be read teh display character
Return values
intthe value read from teh display DDRAM
interror code on error
ssize_t char_lcd_write ( const uint8_t data,
size_t  len 
)

Writes in the display len bytes from data buffer.

Parameters
[in]databuffer that will be written in the display
[in]lennumber of bytes that will be written
Return values
ssize_tnumber of bytes written on success
errorcode on error