Basic example showing how to drive the Glass LCD.

Dependencies:   BSP_DISCO_L476VG LCD_DISCO_L476VG

Committer:
bcostm
Date:
Fri Aug 28 13:03:53 2015 +0000
Revision:
0:0ecb0cbf4c30
Child:
2:16502e83726a
First release.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:0ecb0cbf4c30 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
bcostm 0:0ecb0cbf4c30 2 *
bcostm 0:0ecb0cbf4c30 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
bcostm 0:0ecb0cbf4c30 4 * and associated documentation files (the "Software"), to deal in the Software without
bcostm 0:0ecb0cbf4c30 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
bcostm 0:0ecb0cbf4c30 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
bcostm 0:0ecb0cbf4c30 7 * Software is furnished to do so, subject to the following conditions:
bcostm 0:0ecb0cbf4c30 8 *
bcostm 0:0ecb0cbf4c30 9 * The above copyright notice and this permission notice shall be included in all copies or
bcostm 0:0ecb0cbf4c30 10 * substantial portions of the Software.
bcostm 0:0ecb0cbf4c30 11 *
bcostm 0:0ecb0cbf4c30 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
bcostm 0:0ecb0cbf4c30 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
bcostm 0:0ecb0cbf4c30 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
bcostm 0:0ecb0cbf4c30 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
bcostm 0:0ecb0cbf4c30 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
bcostm 0:0ecb0cbf4c30 17 */
bcostm 0:0ecb0cbf4c30 18
bcostm 0:0ecb0cbf4c30 19 #include "mbed.h"
bcostm 0:0ecb0cbf4c30 20 #include "LCD_DISCO_L476VG.h"
bcostm 0:0ecb0cbf4c30 21
bcostm 0:0ecb0cbf4c30 22 LCD_DISCO_L476VG lcd;
bcostm 0:0ecb0cbf4c30 23
bcostm 0:0ecb0cbf4c30 24 DigitalOut led_green(LED1);
bcostm 0:0ecb0cbf4c30 25
bcostm 0:0ecb0cbf4c30 26 int main()
bcostm 0:0ecb0cbf4c30 27 {
bcostm 0:0ecb0cbf4c30 28 uint32_t temp = 0;
bcostm 0:0ecb0cbf4c30 29 uint8_t stemp[7] = {0};
bcostm 0:0ecb0cbf4c30 30 uint8_t title[] = " DISCOVERY STM32L476";
bcostm 0:0ecb0cbf4c30 31
bcostm 0:0ecb0cbf4c30 32 printf("Hello\n");
bcostm 0:0ecb0cbf4c30 33 led_green = 1;
bcostm 0:0ecb0cbf4c30 34 lcd.Clear();
bcostm 0:0ecb0cbf4c30 35 lcd.DisplayString((uint8_t *)"HELLO");
bcostm 0:0ecb0cbf4c30 36 wait(1);
bcostm 0:0ecb0cbf4c30 37
bcostm 0:0ecb0cbf4c30 38 printf("Scroll sequence\n");
bcostm 0:0ecb0cbf4c30 39 led_green = 0;
bcostm 0:0ecb0cbf4c30 40 lcd.Clear();
bcostm 0:0ecb0cbf4c30 41 lcd.ScrollSentence(title, 2, 200);
bcostm 0:0ecb0cbf4c30 42 lcd.Clear();
bcostm 0:0ecb0cbf4c30 43
bcostm 0:0ecb0cbf4c30 44 while(1) {
bcostm 0:0ecb0cbf4c30 45 printf("BAR = %d\n", temp);
bcostm 0:0ecb0cbf4c30 46 sprintf((char *)stemp, "BAR %d", temp);
bcostm 0:0ecb0cbf4c30 47 lcd.DisplayString(stemp);
bcostm 0:0ecb0cbf4c30 48 lcd.BarLevelConfig((uint8_t)temp);
bcostm 0:0ecb0cbf4c30 49 temp++;
bcostm 0:0ecb0cbf4c30 50 if (temp > 4) temp = 0;
bcostm 0:0ecb0cbf4c30 51 led_green = !led_green;
bcostm 0:0ecb0cbf4c30 52 wait(1);
bcostm 0:0ecb0cbf4c30 53 }
bcostm 0:0ecb0cbf4c30 54 }