web server load-drive and reading sensors based on LPC1768

Dependencies:   DHT22 EthernetNetIf HTTPServer mbed

Committer:
douglasofranco
Date:
Mon Dec 07 14:06:24 2015 +0000
Revision:
0:3125f39d20b4
Web server load-drive and reading sensors based on LPC1768

Who changed what in which revision?

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