ST / Mbed 2 deprecated DISCO-L053C8_ePD_demo

Dependencies:   EPD_GDE021A1 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "EPD_GDE021A1.h"
00003 
00004 #define EPD_CS       PA_15
00005 #define EPD_DC       PB_11
00006 #define EPD_RESET    PB_2
00007 #define EPD_BUSY     PA_8
00008 #define EPD_POWER    PB_10
00009 #define EPD_SPI_MOSI PB_5
00010 #define EPD_SPI_MISO PB_4
00011 #define EPD_SPI_SCK  PB_3
00012 
00013 EPD_GDE021A1 epd(EPD_CS, EPD_DC, EPD_RESET, EPD_BUSY, EPD_POWER, EPD_SPI_MOSI, EPD_SPI_MISO, EPD_SPI_SCK);
00014 
00015 DigitalOut led1(LED1);
00016 
00017 //width 48
00018 //height 26
00019 static uint8_t Battery_img[] = {
00020 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
00021 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
00022 0xfe, 0xff, 0xff, 0xff, 0xff, 0x0f, 
00023 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x0c, 
00024 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08, 
00025 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08, 
00026 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08, 
00027 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08, 
00028 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x18, 
00029 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38, 
00030 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38, 
00031 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38, 
00032 0xfe, 0xff, 0xff, 0x3f, 0xff, 0x39, 
00033 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38, 
00034 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38, 
00035 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38, 
00036 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x38, 
00037 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x18, 
00038 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08, 
00039 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08, 
00040 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08, 
00041 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x0c, 
00042 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x0c, 
00043 0xfe, 0xff, 0xff, 0xff, 0xff, 0x0f, 
00044 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
00045 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
00046 };
00047 
00048 int main()
00049 {
00050     led1 = 1;
00051     
00052     epd.Clear(EPD_COLOR_WHITE);  
00053     epd.DisplayStringAtLine(5, (uint8_t*)"MBED", CENTER_MODE);
00054     epd.DisplayStringAtLine(3, (uint8_t*)"Epaper display", LEFT_MODE);
00055     epd.DisplayStringAtLine(2, (uint8_t*)"demo", LEFT_MODE);
00056     epd.DrawImage(130, 0, 48, 26, Battery_img);
00057     epd.DrawRect(50, 4, 60, 4);
00058     epd.RefreshDisplay();
00059     wait(2);
00060   
00061     while(1) {
00062         led1 = !led1;
00063         wait(1);
00064     }
00065 }