A demo for using the Sharp LCD display component.

Dependencies:   SharpLCD mbed-src

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2013 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #include "mbed.h"
00018 #include "SharpLCD.hpp"
00019 #include "font.h"
00020 
00021 DigitalOut led1(LED1);
00022 SharpLCD lcd(p9, p8, MBED_SPI0);
00023 
00024 uint8_t framebuffer[SharpLCD::SIZEOF_FRAMEBUFFER_FOR_ALLOC];
00025 
00026 int main(void)
00027 {
00028     SharpLCD::FrameBuffer fb(framebuffer);
00029 
00030     lcd.enableDisplay();
00031     lcd.clear();
00032     fb.printString(lookupFontFace("DejaVu Serif", 8),
00033                    20,
00034                    40,
00035                    BLACK,
00036                    "Rohit");
00037     lcd.drawFrameBuffer(fb);
00038 
00039     led1 = 1;
00040     while (true) {
00041         wait(0.5);
00042         led1 = !led1;
00043     }
00044 }