WebSocketServer test

Dependencies:   mbed

Committer:
gtk2k
Date:
Sun Apr 29 03:58:08 2012 +0000
Revision:
0:74be48b504a5
WebSocketServer

Who changed what in which revision?

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