checking temperature and display it on phant server.

Dependencies:   NetServices-Traffic mbed

Fork of Tweeting_Periodic_Room_Temperature by Priyanka Pashte

Committer:
priyankapashte
Date:
Sun Feb 22 12:02:41 2015 +0000
Revision:
1:c1df4cf13f16
Parent:
0:88e082c58797
final

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rrajan8 0:88e082c58797 1 /* mbed NokiaLCD Library, for a 130x130 Nokia colour LCD
rrajan8 0:88e082c58797 2 * Copyright (c) 2007-2010, sford
rrajan8 0:88e082c58797 3 *
rrajan8 0:88e082c58797 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
rrajan8 0:88e082c58797 5 * of this software and associated documentation files (the "Software"), to deal
rrajan8 0:88e082c58797 6 * in the Software without restriction, including without limitation the rights
rrajan8 0:88e082c58797 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
rrajan8 0:88e082c58797 8 * copies of the Software, and to permit persons to whom the Software is
rrajan8 0:88e082c58797 9 * furnished to do so, subject to the following conditions:
rrajan8 0:88e082c58797 10 *
rrajan8 0:88e082c58797 11 * The above copyright notice and this permission notice shall be included in
rrajan8 0:88e082c58797 12 * all copies or substantial portions of the Software.
rrajan8 0:88e082c58797 13 *
rrajan8 0:88e082c58797 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
rrajan8 0:88e082c58797 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
rrajan8 0:88e082c58797 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
rrajan8 0:88e082c58797 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
rrajan8 0:88e082c58797 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
rrajan8 0:88e082c58797 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
rrajan8 0:88e082c58797 20 * THE SOFTWARE.
rrajan8 0:88e082c58797 21 */
rrajan8 0:88e082c58797 22
rrajan8 0:88e082c58797 23 #ifndef MBED_NOKIALCD_H
rrajan8 0:88e082c58797 24 #define MBED_NOKIALCD_H
rrajan8 0:88e082c58797 25
rrajan8 0:88e082c58797 26 #include "mbed.h"
rrajan8 0:88e082c58797 27
rrajan8 0:88e082c58797 28 /** An interface for the 130x130 Nokia Mobile phone screens
rrajan8 0:88e082c58797 29 *
rrajan8 0:88e082c58797 30 * @code
rrajan8 0:88e082c58797 31 * #include "mbed.h"
rrajan8 0:88e082c58797 32 * #include "NokiaLCD.h"
rrajan8 0:88e082c58797 33 *
rrajan8 0:88e082c58797 34 * NokiaLCD lcd(p5, p7, p8, p9, NokiaLCD::6610); // mosi, sclk, cs, rst, type
rrajan8 0:88e082c58797 35 *
rrajan8 0:88e082c58797 36 * int main() {
rrajan8 0:88e082c58797 37 * lcd.printf("Hello World!");
rrajan8 0:88e082c58797 38 * }
rrajan8 0:88e082c58797 39 * @endcode
rrajan8 0:88e082c58797 40 */
rrajan8 0:88e082c58797 41 class NokiaLCD : public Stream {
rrajan8 0:88e082c58797 42
rrajan8 0:88e082c58797 43 public:
rrajan8 0:88e082c58797 44 /** LCD panel format */
rrajan8 0:88e082c58797 45 enum LCDType {
rrajan8 0:88e082c58797 46 LCD6100 /**< Nokia 6100, as found on sparkfun board (default) */
rrajan8 0:88e082c58797 47 , LCD6610 /**< Nokia 6610, as found on olimex board */
rrajan8 0:88e082c58797 48 , PCF8833
rrajan8 0:88e082c58797 49 };
rrajan8 0:88e082c58797 50
rrajan8 0:88e082c58797 51 /** Create and Nokia LCD interface, using a SPI and two DigitalOut interfaces
rrajan8 0:88e082c58797 52 *
rrajan8 0:88e082c58797 53 * @param mosi SPI data out
rrajan8 0:88e082c58797 54 * @param sclk SPI clock
rrajan8 0:88e082c58797 55 * @param cs Chip Select (DigitalOut)
rrajan8 0:88e082c58797 56 * @param rst Reset (DigitalOut)
rrajan8 0:88e082c58797 57 * @param type The LCDType to select driver chip variants
rrajan8 0:88e082c58797 58 */
rrajan8 0:88e082c58797 59 NokiaLCD(PinName mosi, PinName sclk, PinName cs, PinName rst, LCDType type = LCD6100);
rrajan8 0:88e082c58797 60
rrajan8 0:88e082c58797 61 #if DOXYGEN_ONLY
rrajan8 0:88e082c58797 62 /** Write a character to the LCD
rrajan8 0:88e082c58797 63 *
rrajan8 0:88e082c58797 64 * @param c The character to write to the display
rrajan8 0:88e082c58797 65 */
rrajan8 0:88e082c58797 66 int putc(int c);
rrajan8 0:88e082c58797 67
rrajan8 0:88e082c58797 68 /** Write a formated string to the LCD
rrajan8 0:88e082c58797 69 *
rrajan8 0:88e082c58797 70 * @param format A printf-style format string, followed by the
rrajan8 0:88e082c58797 71 * variables to use in formating the string.
rrajan8 0:88e082c58797 72 */
rrajan8 0:88e082c58797 73 int printf(const char* format, ...);
rrajan8 0:88e082c58797 74 #endif
rrajan8 0:88e082c58797 75
rrajan8 0:88e082c58797 76 /** Locate to a screen column and row
rrajan8 0:88e082c58797 77 *
rrajan8 0:88e082c58797 78 * @param column The horizontal position from the left, indexed from 0
rrajan8 0:88e082c58797 79 * @param row The vertical position from the top, indexed from 0
rrajan8 0:88e082c58797 80 */
rrajan8 0:88e082c58797 81 void locate(int column, int row);
rrajan8 0:88e082c58797 82
rrajan8 0:88e082c58797 83 /** Clear the screen and locate to 0,0 */
rrajan8 0:88e082c58797 84 void cls();
rrajan8 0:88e082c58797 85
rrajan8 0:88e082c58797 86 /** Set a pixel on te screen
rrajan8 0:88e082c58797 87 *
rrajan8 0:88e082c58797 88 * @param x horizontal position from left
rrajan8 0:88e082c58797 89 * @param y vertical position from top
rrajan8 0:88e082c58797 90 * @param colour 24-bit colour in format 0x00RRGGBB
rrajan8 0:88e082c58797 91 */
rrajan8 0:88e082c58797 92 void pixel(int x, int y, int colour);
rrajan8 0:88e082c58797 93
rrajan8 0:88e082c58797 94 /** Fill an area of the screen
rrajan8 0:88e082c58797 95 *
rrajan8 0:88e082c58797 96 * @param x horizontal position from left
rrajan8 0:88e082c58797 97 * @param y vertical position from top
rrajan8 0:88e082c58797 98 * @param width width in pixels
rrajan8 0:88e082c58797 99 * @param height height in pixels
rrajan8 0:88e082c58797 100 * @param colour 24-bit colour in format 0x00RRGGBB
rrajan8 0:88e082c58797 101 */
rrajan8 0:88e082c58797 102 void fill(int x, int y, int width, int height, int colour);
rrajan8 0:88e082c58797 103
rrajan8 0:88e082c58797 104 void blit(int x, int y, int width, int height, const int* colour);
rrajan8 0:88e082c58797 105 void bitblit(int x, int y, int width, int height, const char* bitstream);
rrajan8 0:88e082c58797 106
rrajan8 0:88e082c58797 107 int width();
rrajan8 0:88e082c58797 108 int height();
rrajan8 0:88e082c58797 109 int columns();
rrajan8 0:88e082c58797 110 int rows();
rrajan8 0:88e082c58797 111
rrajan8 0:88e082c58797 112 void reset();
rrajan8 0:88e082c58797 113
rrajan8 0:88e082c58797 114 /** Set the foreground colour
rrajan8 0:88e082c58797 115 *
rrajan8 0:88e082c58797 116 * @param c 24-bit colour
rrajan8 0:88e082c58797 117 */
rrajan8 0:88e082c58797 118 void foreground(int c);
rrajan8 0:88e082c58797 119
rrajan8 0:88e082c58797 120 /** Set the background colour
rrajan8 0:88e082c58797 121 *
rrajan8 0:88e082c58797 122 * @param c 24-bit colour
rrajan8 0:88e082c58797 123 */
rrajan8 0:88e082c58797 124 void background(int c);
rrajan8 0:88e082c58797 125
rrajan8 0:88e082c58797 126 protected:
rrajan8 0:88e082c58797 127 virtual void _window(int x, int y, int width, int height);
rrajan8 0:88e082c58797 128 virtual void _putp(int colour);
rrajan8 0:88e082c58797 129
rrajan8 0:88e082c58797 130 void command(int value);
rrajan8 0:88e082c58797 131 void data(int value);
rrajan8 0:88e082c58797 132
rrajan8 0:88e082c58797 133 void newline();
rrajan8 0:88e082c58797 134 virtual int _putc(int c);
rrajan8 0:88e082c58797 135 virtual int _getc() {
rrajan8 0:88e082c58797 136 return 0;
rrajan8 0:88e082c58797 137 }
rrajan8 0:88e082c58797 138 void putp(int v);
rrajan8 0:88e082c58797 139 void window(int x, int y, int width, int height);
rrajan8 0:88e082c58797 140
rrajan8 0:88e082c58797 141 SPI _spi;
rrajan8 0:88e082c58797 142 DigitalOut _rst;
rrajan8 0:88e082c58797 143 DigitalOut _cs;
rrajan8 0:88e082c58797 144
rrajan8 0:88e082c58797 145 LCDType _type;
rrajan8 0:88e082c58797 146 int _row, _column, _rows, _columns, _foreground, _background, _width, _height;
rrajan8 0:88e082c58797 147 };
rrajan8 0:88e082c58797 148
rrajan8 0:88e082c58797 149 #endif
rrajan8 0:88e082c58797 150
rrajan8 0:88e082c58797 151