Basic example showing how to drive the Glass LCD.
Dependencies: BSP_DISCO_L476VG LCD_DISCO_L476VG
main.cpp@6:d3f6c05a5ae0, 2019-09-25 (annotated)
- Committer:
- jeromecoutant
- Date:
- Wed Sep 25 10:01:01 2019 +0200
- Revision:
- 6:d3f6c05a5ae0
- Parent:
- 2:16502e83726a
Update with CubeL4 V1.14.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bcostm | 0:0ecb0cbf4c30 | 1 | #include "mbed.h" |
bcostm | 0:0ecb0cbf4c30 | 2 | #include "LCD_DISCO_L476VG.h" |
bcostm | 0:0ecb0cbf4c30 | 3 | |
bcostm | 0:0ecb0cbf4c30 | 4 | LCD_DISCO_L476VG lcd; |
bcostm | 0:0ecb0cbf4c30 | 5 | |
bcostm | 0:0ecb0cbf4c30 | 6 | DigitalOut led_green(LED1); |
bcostm | 0:0ecb0cbf4c30 | 7 | |
bcostm | 0:0ecb0cbf4c30 | 8 | int main() |
bcostm | 0:0ecb0cbf4c30 | 9 | { |
jeromecoutant | 6:d3f6c05a5ae0 | 10 | uint8_t DisplayedString[7] = {0}; |
bcostm | 0:0ecb0cbf4c30 | 11 | uint8_t title[] = " DISCOVERY STM32L476"; |
bcostm | 0:0ecb0cbf4c30 | 12 | |
jeromecoutant | 6:d3f6c05a5ae0 | 13 | printf("\nHello\n"); |
bcostm | 0:0ecb0cbf4c30 | 14 | led_green = 1; |
bcostm | 0:0ecb0cbf4c30 | 15 | lcd.Clear(); |
bcostm | 0:0ecb0cbf4c30 | 16 | lcd.DisplayString((uint8_t *)"HELLO"); |
jeromecoutant | 6:d3f6c05a5ae0 | 17 | ThisThread::sleep_for(5000); |
bcostm | 0:0ecb0cbf4c30 | 18 | led_green = 0; |
jeromecoutant | 6:d3f6c05a5ae0 | 19 | |
bcostm | 0:0ecb0cbf4c30 | 20 | while(1) { |
jeromecoutant | 6:d3f6c05a5ae0 | 21 | printf("Scroll sequence\n"); |
jeromecoutant | 6:d3f6c05a5ae0 | 22 | lcd.Clear(); |
jeromecoutant | 6:d3f6c05a5ae0 | 23 | lcd.ScrollSentence(title, 1, 400); |
jeromecoutant | 6:d3f6c05a5ae0 | 24 | lcd.Clear(); |
bcostm | 0:0ecb0cbf4c30 | 25 | led_green = !led_green; |
jeromecoutant | 6:d3f6c05a5ae0 | 26 | |
jeromecoutant | 6:d3f6c05a5ae0 | 27 | for(uint32_t BarNumber = 0; BarNumber <= 4; BarNumber++) { |
jeromecoutant | 6:d3f6c05a5ae0 | 28 | printf("BAR = %d\n", BarNumber); |
jeromecoutant | 6:d3f6c05a5ae0 | 29 | sprintf((char *)DisplayedString, "BAR %d", BarNumber); |
jeromecoutant | 6:d3f6c05a5ae0 | 30 | lcd.DisplayString(DisplayedString); |
jeromecoutant | 6:d3f6c05a5ae0 | 31 | lcd.BarLevelConfig((uint8_t)BarNumber); |
jeromecoutant | 6:d3f6c05a5ae0 | 32 | ThisThread::sleep_for(1000); |
jeromecoutant | 6:d3f6c05a5ae0 | 33 | } |
bcostm | 0:0ecb0cbf4c30 | 34 | } |
bcostm | 0:0ecb0cbf4c30 | 35 | } |