Traditional LCD library that has been modified to be used with a 16x4 LCD display along with using the 16bit Timer wait function used in the 'LCD_Wait' library to measure Pulsewidth
Dependents: PulseWidthCapture_Program
Revision 1:6ad3406d5912, committed 2014-12-11
- Comitter:
- Ellor1
- Date:
- Thu Dec 11 08:59:57 2014 +0000
- Parent:
- 0:473988c75437
- Commit message:
- Library to include 16x4 LCD
Changed in this revision
TextLCD_16x4.cpp | Show annotated file Show diff for this revision Revisions of this file |
TextLCD_16x4.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/TextLCD_16x4.cpp Wed Dec 10 10:34:24 2014 +0000 +++ b/TextLCD_16x4.cpp Thu Dec 11 08:59:57 2014 +0000 @@ -1,31 +1,19 @@ -/* mbed TextLCD Library, for a 4-bit LCD based on HD44780 - * Copyright (c) 2007-2010, sford, http://mbed.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +/*********************************************************************************************************************** +This library is based upon the original TextLCD library. This library has been modified so it can be used with a 16x4 LCD +The traditional 'wait' function has been chnaged to use 16 bit Timer 1 rather than 32 bit Timer 0 which is what is set up +usually in the mbed library. The reason for this change is so that the new wait function and this library could be used +alongside a PulseWidthCapture program which needs to use the 32 bit timer. + +This program requires Library 'LCD_Wait' to work +Callum Ellor +**************************************************************************************************************************/ #include "TextLCD_16x4.h" #include "LCD_Wait.h" #include "mbed.h" -LCD_Wait lcd_wait; +LCD_Wait lcd_wait; // Use LCD_Wait library to replace standard wait function TextLCD::TextLCD(PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7, LCDType type) : _rs(rs), @@ -130,17 +118,16 @@ case 3: return 0xd4 + column; } - case LCD16x4: + case LCD16x4: // 16x4 LCD added switch (row) { case 0: return 0x80 + column; case 1: return 0xc0 + column; case 2: - return 0x90 + column; - // return 0x94 + column; + return 0x90 + column; //changed to work with 16x4 case 3: - return 0xd0 + column; + return 0xd0 + column; //changed to work with 16x4 } case LCD16x2B: return 0x80 + (row * 40) + column; @@ -158,7 +145,7 @@ return 20; case LCD16x2: case LCD16x2B: - case LCD16x4: + case LCD16x4: //added to work with 16x4 default: return 16; } @@ -167,7 +154,7 @@ int TextLCD::rows() { switch (_type) { case LCD20x4: - case LCD16x4: + case LCD16x4: //added to work with 16x4 return 4; case LCD16x2: case LCD16x2B:
--- a/TextLCD_16x4.h Wed Dec 10 10:34:24 2014 +0000 +++ b/TextLCD_16x4.h Thu Dec 11 08:59:57 2014 +0000 @@ -1,24 +1,12 @@ -/* mbed TextLCD Library, for a 4-bit LCD based on HD44780 - * Copyright (c) 2007-2010, sford, http://mbed.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +/*********************************************************************************************************************** +This library is based upon the original TextLCD library. This library has been modified so it can be used with a 16x4 LCD +The traditional 'wait' function has been chnaged to use 16 bit Timer 1 rather than 32 bit Timer 0 which is what is set up +usually in the mbed library. The reason for this change is so that the new wait function and this library could be used +alongside a PulseWidthCapture program which needs to use the 32 bit timer. + +This program requires Library 'LCD_Wait' to work +Callum Ellor +**************************************************************************************************************************/ #ifndef MBED_TEXTLCD_H #define MBED_TEXTLCD_H @@ -49,7 +37,7 @@ , LCD16x2B /**< 16x2 LCD panel alternate addressing */ , LCD20x2 /**< 20x2 LCD panel */ , LCD20x4 /**< 20x4 LCD panel */ - , LCD16x4 /**< 16x4 LCD panel */ + , LCD16x4 /**< 16x4 LCD panel */ //added to work with 16x4 }; /** Create a TextLCD interface