This is a MIDI synthesizer with touchpads used for playing the notes. mbed will capture the touchpad press and release events and sends the appropriate MIDI commands to the PC. By using the C# windows forms application created by us, one can compose songs as though they were composed on a piano. We support all types of standard MIDI piano types.

Dependencies:   mbed

Committer:
thejasvi3
Date:
Thu Oct 13 06:17:30 2011 +0000
Revision:
0:e33f18af0471

        

Who changed what in which revision?

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