Wireless temperature transmitter with ER400TRS transceiver and MCP9700 temperature sensor.

Dependencies:   mbed

Committer:
lnadal
Date:
Wed Aug 31 04:08:11 2011 +0000
Revision:
0:407b38152be7

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lnadal 0:407b38152be7 1 /* mbed TextLCD Library, for a 4-bit LCD based on HD44780
lnadal 0:407b38152be7 2 * Copyright (c) 2007-2010, sford
lnadal 0:407b38152be7 3 *
lnadal 0:407b38152be7 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
lnadal 0:407b38152be7 5 * of this software and associated documentation files (the "Software"), to deal
lnadal 0:407b38152be7 6 * in the Software without restriction, including without limitation the rights
lnadal 0:407b38152be7 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
lnadal 0:407b38152be7 8 * copies of the Software, and to permit persons to whom the Software is
lnadal 0:407b38152be7 9 * furnished to do so, subject to the following conditions:
lnadal 0:407b38152be7 10 *
lnadal 0:407b38152be7 11 * The above copyright notice and this permission notice shall be included in
lnadal 0:407b38152be7 12 * all copies or substantial portions of the Software.
lnadal 0:407b38152be7 13 *
lnadal 0:407b38152be7 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
lnadal 0:407b38152be7 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
lnadal 0:407b38152be7 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
lnadal 0:407b38152be7 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
lnadal 0:407b38152be7 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
lnadal 0:407b38152be7 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
lnadal 0:407b38152be7 20 * THE SOFTWARE.
lnadal 0:407b38152be7 21 */
lnadal 0:407b38152be7 22
lnadal 0:407b38152be7 23 #ifndef MBED_TEXTLCD_H
lnadal 0:407b38152be7 24 #define MBED_TEXTLCD_H
lnadal 0:407b38152be7 25
lnadal 0:407b38152be7 26 #include "mbed.h"
lnadal 0:407b38152be7 27
lnadal 0:407b38152be7 28 /** A TextLCD interface for driving 4-bit HD44780-based LCDs
lnadal 0:407b38152be7 29 *
lnadal 0:407b38152be7 30 * Currently supports 16x2, 20x2 and 20x4 panels
lnadal 0:407b38152be7 31 *
lnadal 0:407b38152be7 32 * @code
lnadal 0:407b38152be7 33 * #include "mbed.h"
lnadal 0:407b38152be7 34 * #include "TextLCD.h"
lnadal 0:407b38152be7 35 *
lnadal 0:407b38152be7 36 * TextLCD lcd(p10, p12, p15, p16, p29, p30); // rs, e, d0-d3
lnadal 0:407b38152be7 37 *
lnadal 0:407b38152be7 38 * int main() {
lnadal 0:407b38152be7 39 * lcd.printf("Hello World!\n");
lnadal 0:407b38152be7 40 * }
lnadal 0:407b38152be7 41 * @endcode
lnadal 0:407b38152be7 42 */
lnadal 0:407b38152be7 43 class TextLCD : public Stream {
lnadal 0:407b38152be7 44 public:
lnadal 0:407b38152be7 45
lnadal 0:407b38152be7 46 /** LCD panel format */
lnadal 0:407b38152be7 47 enum LCDType {
lnadal 0:407b38152be7 48 LCD16x2 /**< 16x2 LCD panel (default) */
lnadal 0:407b38152be7 49 , LCD16x2B /**< 16x2 LCD panel alternate addressing */
lnadal 0:407b38152be7 50 , LCD20x2 /**< 20x2 LCD panel */
lnadal 0:407b38152be7 51 , LCD20x4 /**< 20x4 LCD panel */
lnadal 0:407b38152be7 52 };
lnadal 0:407b38152be7 53
lnadal 0:407b38152be7 54 /** Create a TextLCD interface
lnadal 0:407b38152be7 55 *
lnadal 0:407b38152be7 56 * @param rs Instruction/data control line
lnadal 0:407b38152be7 57 * @param e Enable line (clock)
lnadal 0:407b38152be7 58 * @param d0-d3 Data lines
lnadal 0:407b38152be7 59 * @param type Sets the panel size/addressing mode (default = LCD16x2)
lnadal 0:407b38152be7 60 */
lnadal 0:407b38152be7 61 TextLCD(PinName rs, PinName e, PinName d0, PinName d1, PinName d2, PinName d3, LCDType type = LCD16x2);
lnadal 0:407b38152be7 62
lnadal 0:407b38152be7 63 #if DOXYGEN_ONLY
lnadal 0:407b38152be7 64 /** Write a character to the LCD
lnadal 0:407b38152be7 65 *
lnadal 0:407b38152be7 66 * @param c The character to write to the display
lnadal 0:407b38152be7 67 */
lnadal 0:407b38152be7 68 int putc(int c);
lnadal 0:407b38152be7 69
lnadal 0:407b38152be7 70 /** Write a formated string to the LCD
lnadal 0:407b38152be7 71 *
lnadal 0:407b38152be7 72 * @param format A printf-style format string, followed by the
lnadal 0:407b38152be7 73 * variables to use in formating the string.
lnadal 0:407b38152be7 74 */
lnadal 0:407b38152be7 75 int printf(const char* format, ...);
lnadal 0:407b38152be7 76 #endif
lnadal 0:407b38152be7 77
lnadal 0:407b38152be7 78 /** Locate to a screen column and row
lnadal 0:407b38152be7 79 *
lnadal 0:407b38152be7 80 * @param column The horizontal position from the left, indexed from 0
lnadal 0:407b38152be7 81 * @param row The vertical position from the top, indexed from 0
lnadal 0:407b38152be7 82 */
lnadal 0:407b38152be7 83 void locate(int column, int row);
lnadal 0:407b38152be7 84
lnadal 0:407b38152be7 85 /** Clear the screen and locate to 0,0 */
lnadal 0:407b38152be7 86 void cls();
lnadal 0:407b38152be7 87
lnadal 0:407b38152be7 88 int rows();
lnadal 0:407b38152be7 89 int columns();
lnadal 0:407b38152be7 90
lnadal 0:407b38152be7 91 protected:
lnadal 0:407b38152be7 92
lnadal 0:407b38152be7 93 // Stream implementation functions
lnadal 0:407b38152be7 94 virtual int _putc(int value);
lnadal 0:407b38152be7 95 virtual int _getc();
lnadal 0:407b38152be7 96
lnadal 0:407b38152be7 97 int address(int column, int row);
lnadal 0:407b38152be7 98 void character(int column, int row, int c);
lnadal 0:407b38152be7 99 void writeByte(int value);
lnadal 0:407b38152be7 100 void writeCommand(int command);
lnadal 0:407b38152be7 101 void writeData(int data);
lnadal 0:407b38152be7 102
lnadal 0:407b38152be7 103 DigitalOut _rs, _e;
lnadal 0:407b38152be7 104 BusOut _d;
lnadal 0:407b38152be7 105 LCDType _type;
lnadal 0:407b38152be7 106
lnadal 0:407b38152be7 107 int _column;
lnadal 0:407b38152be7 108 int _row;
lnadal 0:407b38152be7 109 };
lnadal 0:407b38152be7 110
lnadal 0:407b38152be7 111 #endif