Basic example showing how to use the ePaper Display (ePD) present on the STM32L053 Discovery (STM32L0538-DISCO) board.

Dependencies:   EPD_GDE021A1 mbed

Committer:
arostm
Date:
Wed Jun 07 11:56:39 2017 +0000
Revision:
2:5244899e767f
Parent:
0:e5732175b08b
Adding new mbed library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:e5732175b08b 1 #include "mbed.h"
bcostm 0:e5732175b08b 2 #include "EPD_GDE021A1.h"
bcostm 0:e5732175b08b 3
bcostm 0:e5732175b08b 4 #define EPD_CS PA_15
bcostm 0:e5732175b08b 5 #define EPD_DC PB_11
bcostm 0:e5732175b08b 6 #define EPD_RESET PB_2
bcostm 0:e5732175b08b 7 #define EPD_BUSY PA_8
bcostm 0:e5732175b08b 8 #define EPD_POWER PB_10
bcostm 0:e5732175b08b 9 #define EPD_SPI_MOSI PB_5
bcostm 0:e5732175b08b 10 #define EPD_SPI_MISO PB_4
bcostm 0:e5732175b08b 11 #define EPD_SPI_SCK PB_3
bcostm 0:e5732175b08b 12
bcostm 0:e5732175b08b 13 EPD_GDE021A1 epd(EPD_CS, EPD_DC, EPD_RESET, EPD_BUSY, EPD_POWER, EPD_SPI_MOSI, EPD_SPI_MISO, EPD_SPI_SCK);
bcostm 0:e5732175b08b 14
bcostm 0:e5732175b08b 15 DigitalOut led1(LED1);
bcostm 0:e5732175b08b 16
bcostm 0:e5732175b08b 17 //width 48
bcostm 0:e5732175b08b 18 //height 26
bcostm 0:e5732175b08b 19 static uint8_t Battery_img[] = {
bcostm 0:e5732175b08b 20 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
bcostm 0:e5732175b08b 21 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
bcostm 0:e5732175b08b 22 0xfe, 0xff, 0xff, 0xff, 0xff, 0x0f,
bcostm 0:e5732175b08b 23 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x0c,
bcostm 0:e5732175b08b 24 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08,
bcostm 0:e5732175b08b 25 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08,
bcostm 0:e5732175b08b 26 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08,
bcostm 0:e5732175b08b 27 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08,
bcostm 0:e5732175b08b 28 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x18,
bcostm 0:e5732175b08b 29 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38,
bcostm 0:e5732175b08b 30 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38,
bcostm 0:e5732175b08b 31 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38,
bcostm 0:e5732175b08b 32 0xfe, 0xff, 0xff, 0x3f, 0xff, 0x39,
bcostm 0:e5732175b08b 33 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38,
bcostm 0:e5732175b08b 34 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38,
bcostm 0:e5732175b08b 35 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38,
bcostm 0:e5732175b08b 36 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x38,
bcostm 0:e5732175b08b 37 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x18,
bcostm 0:e5732175b08b 38 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08,
bcostm 0:e5732175b08b 39 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08,
bcostm 0:e5732175b08b 40 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08,
bcostm 0:e5732175b08b 41 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x0c,
bcostm 0:e5732175b08b 42 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x0c,
bcostm 0:e5732175b08b 43 0xfe, 0xff, 0xff, 0xff, 0xff, 0x0f,
bcostm 0:e5732175b08b 44 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
bcostm 0:e5732175b08b 45 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
bcostm 0:e5732175b08b 46 };
bcostm 0:e5732175b08b 47
bcostm 0:e5732175b08b 48 int main()
bcostm 0:e5732175b08b 49 {
bcostm 0:e5732175b08b 50 led1 = 1;
bcostm 0:e5732175b08b 51
bcostm 0:e5732175b08b 52 epd.Clear(EPD_COLOR_WHITE);
bcostm 0:e5732175b08b 53 epd.DisplayStringAtLine(5, (uint8_t*)"MBED", CENTER_MODE);
bcostm 0:e5732175b08b 54 epd.DisplayStringAtLine(3, (uint8_t*)"Epaper display", LEFT_MODE);
bcostm 0:e5732175b08b 55 epd.DisplayStringAtLine(2, (uint8_t*)"demo", LEFT_MODE);
bcostm 0:e5732175b08b 56 epd.DrawImage(130, 0, 48, 26, Battery_img);
bcostm 0:e5732175b08b 57 epd.DrawRect(50, 4, 60, 4);
bcostm 0:e5732175b08b 58 epd.RefreshDisplay();
bcostm 0:e5732175b08b 59 wait(2);
bcostm 0:e5732175b08b 60
bcostm 0:e5732175b08b 61 while(1) {
bcostm 0:e5732175b08b 62 led1 = !led1;
bcostm 0:e5732175b08b 63 wait(1);
bcostm 0:e5732175b08b 64 }
bcostm 0:e5732175b08b 65 }