Basic example showing how to drive the Glass LCD.

Dependencies:   BSP_DISCO_L476VG LCD_DISCO_L476VG

main.cpp

Committer:
bcostm
Date:
2015-08-28
Revision:
0:0ecb0cbf4c30
Child:
2:16502e83726a

File content as of revision 0:0ecb0cbf4c30:

/* Copyright (c) 2010-2011 mbed.org, MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include "mbed.h"
#include "LCD_DISCO_L476VG.h"

LCD_DISCO_L476VG lcd;

DigitalOut led_green(LED1);

int main()
{
    uint32_t temp = 0;
    uint8_t stemp[7] = {0};
    uint8_t title[] = "      DISCOVERY STM32L476";
  
    printf("Hello\n");
    led_green = 1;
    lcd.Clear();
    lcd.DisplayString((uint8_t *)"HELLO");
    wait(1);
    
    printf("Scroll sequence\n");
    led_green = 0;
    lcd.Clear();
    lcd.ScrollSentence(title, 2, 200);
    lcd.Clear();
  
    while(1) {
        printf("BAR = %d\n", temp);
        sprintf((char *)stemp, "BAR %d", temp);
        lcd.DisplayString(stemp);
        lcd.BarLevelConfig((uint8_t)temp);
        temp++;
        if (temp > 4) temp = 0;
        led_green = !led_green;
        wait(1);
    }
}