mbed code for Farrari board

Dependencies:   DDRO_Farrari mbed

Fork of DDRO_Farrari by Liangzhen Lai

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers lcd.h Source File

lcd.h

00001     //*******************************************************************
00002     // * October, 2012
00003     // * Definitions for I2C LCD program
00004     // * 
00005     // *
00006     // * 
00007     /********************************************************************
00008      function protocol:
00009      0xFE, 0x41 - display on            
00010      0xFE, 0x42 - display off            
00011      0xFE, 0x45 - set cursor position      
00012      0xFE, 0x46 - home cursor            
00013      0xFE, 0x47 - underline cursor on      
00014      0xFE, 0x48 - underline cursor off      
00015      0xFE, 0x49 - move cursor left 1 space   
00016      0xFE, 0x4A - move cursor right 1 space   
00017      0xFE, 0x4B - blinking cursor on      
00018      0xFE, 0x4C - blinking curson off      
00019      0xFE, 0x4E - back space.
00020      0xFE, 0x51 - clear screen            
00021      0xFE, 0x52 - set contrast   (1-50)      
00022      0xFE, 0x53 - set backlight brightness    (1-16)
00023      0xFE, 0x54 - load custom characters   
00024      
00025      0xFE, 0x55 - move screen left 1 space   
00026      0xFE, 0x56 - move screen right 1 space   
00027 
00028      0xFE, 0x61 - change BAUD rate (1 - 8)   
00029      0xFE, 0x62 - change I2C address (0-255)
00030      0xFE, 0x70 - display version number   
00031      0xFE, 0x71 - display RS232 BAUD rate   
00032      0xFE, 0x72 - display I2C address      
00033      0xFE, 0xFE - send next byte to command register   
00034     ********************************************************************/
00035     #include "mbed.h"
00036     #include "pinout.h"
00037     
00038     // I2C Addr Pin
00039     #define LCDADDR 0x50
00040 
00041     #define LINE1_BEGIN 0x00
00042     #define LINE2_BEGIN 0x40
00043     #define LINE3_BEGIN 0x14
00044     #define LINE4_BEGIN 0x54
00045     
00046     #define LINE1_END 0x13
00047     #define LINE2_END 0x53
00048     #define LINE3_END 0x27
00049     #define LINE4_END 0x67
00050 
00051     // proto type functions
00052     void dual_printf(char* a);
00053     void lcd_default();
00054     void lcd_clear();
00055     void lcd_home();
00056     void lcd_clear_line(unsigned int line);
00057     void lcd_goto(unsigned int position);
00058     void lcd_set_contrast(unsigned int level);
00059     void lcd_backlight_level(unsigned int level);
00060     void lcd_shift_right();
00061     void lcd_shift_left();
00062     void lcd_cursor_right();
00063     void lcd_cursor_left();
00064     void lcd_backspace();
00065     void lcd_cursor_blink(bool blink);
00066     void lcd_printf(char* message);