k

Dependencies:   EPD_GDE021A1 mbed

Fork of DISCO-L053C8_ePD_demo by Aleksandr Ushanov

Committer:
meta1
Date:
Thu Jun 01 15:20:03 2017 +0000
Revision:
1:842cd88170e2
Parent:
0:306e008a65d3
dasdad

Who changed what in which revision?

UserRevisionLine numberNew contents of line
flawless 0:306e008a65d3 1 #include "mbed.h"
flawless 0:306e008a65d3 2 #include "EPD_GDE021A1.h"
flawless 0:306e008a65d3 3
flawless 0:306e008a65d3 4 #define EPD_CS PA_15
flawless 0:306e008a65d3 5 #define EPD_DC PB_11
flawless 0:306e008a65d3 6 #define EPD_RESET PB_2
flawless 0:306e008a65d3 7 #define EPD_BUSY PA_8
flawless 0:306e008a65d3 8 #define EPD_POWER PB_10
flawless 0:306e008a65d3 9 #define EPD_SPI_MOSI PB_5
flawless 0:306e008a65d3 10 #define EPD_SPI_MISO PB_4
flawless 0:306e008a65d3 11 #define EPD_SPI_SCK PB_3
flawless 0:306e008a65d3 12
flawless 0:306e008a65d3 13 EPD_GDE021A1 epd(EPD_CS, EPD_DC, EPD_RESET, EPD_BUSY, EPD_POWER, EPD_SPI_MOSI, EPD_SPI_MISO, EPD_SPI_SCK);
flawless 0:306e008a65d3 14
flawless 0:306e008a65d3 15 DigitalOut led1(LED1);
meta1 1:842cd88170e2 16 AnalogIn temperature(A0);
flawless 0:306e008a65d3 17 //width 48
flawless 0:306e008a65d3 18 //height 26
flawless 0:306e008a65d3 19 static uint8_t Battery_img[] = {
flawless 0:306e008a65d3 20 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
flawless 0:306e008a65d3 21 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
flawless 0:306e008a65d3 22 0xfe, 0xff, 0xff, 0xff, 0xff, 0x0f,
flawless 0:306e008a65d3 23 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x0c,
flawless 0:306e008a65d3 24 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08,
flawless 0:306e008a65d3 25 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08,
flawless 0:306e008a65d3 26 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08,
flawless 0:306e008a65d3 27 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08,
flawless 0:306e008a65d3 28 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x18,
flawless 0:306e008a65d3 29 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38,
flawless 0:306e008a65d3 30 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38,
flawless 0:306e008a65d3 31 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38,
flawless 0:306e008a65d3 32 0xfe, 0xff, 0xff, 0x3f, 0xff, 0x39,
flawless 0:306e008a65d3 33 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38,
flawless 0:306e008a65d3 34 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38,
flawless 0:306e008a65d3 35 0xfe, 0xff, 0xff, 0x3f, 0x10, 0x38,
flawless 0:306e008a65d3 36 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x38,
flawless 0:306e008a65d3 37 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x18,
flawless 0:306e008a65d3 38 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08,
flawless 0:306e008a65d3 39 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08,
flawless 0:306e008a65d3 40 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x08,
flawless 0:306e008a65d3 41 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x0c,
flawless 0:306e008a65d3 42 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x0c,
flawless 0:306e008a65d3 43 0xfe, 0xff, 0xff, 0xff, 0xff, 0x0f,
flawless 0:306e008a65d3 44 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
flawless 0:306e008a65d3 45 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
flawless 0:306e008a65d3 46 };
flawless 0:306e008a65d3 47
flawless 0:306e008a65d3 48 int main()
flawless 0:306e008a65d3 49 {
flawless 0:306e008a65d3 50 led1 = 1;
meta1 1:842cd88170e2 51 char tmpTemp[15] = "test";
meta1 1:842cd88170e2 52 epd.SetFont(&Font20);
flawless 0:306e008a65d3 53 epd.Clear(EPD_COLOR_WHITE);
flawless 0:306e008a65d3 54 // epd.DisplayStringAtLine(5, (uint8_t*)"HUEMBED", CENTER_MODE);
flawless 0:306e008a65d3 55 // epd.DisplayStringAtLine(2, (uint8_t*)"demo", LEFT_MODE);
flawless 0:306e008a65d3 56 // epd.DrawImage(130, 0, 48, 26, Battery_img);
flawless 0:306e008a65d3 57 // epd.DrawRect(50, 4, 60, 4);
flawless 0:306e008a65d3 58 // epd.RefreshDisplay();
flawless 0:306e008a65d3 59 wait(2);
meta1 1:842cd88170e2 60 float i = 10.3;
flawless 0:306e008a65d3 61 while(1) {
meta1 1:842cd88170e2 62
flawless 0:306e008a65d3 63 led1 = !led1;
flawless 0:306e008a65d3 64 epd.Clear(EPD_COLOR_WHITE);
meta1 1:842cd88170e2 65 sprintf(tmpTemp, "P = %.1f", temperature.read());
meta1 1:842cd88170e2 66 epd.DisplayStringAtLine(0, (uint8_t*)tmpTemp, LEFT_MODE);
meta1 1:842cd88170e2 67 epd.DisplayStringAtLine(1, (uint8_t*)"0.5 1.0", LEFT_MODE);
meta1 1:842cd88170e2 68 epd.DisplayStringAtLine(2, (uint8_t*)"IDLE", LEFT_MODE);
meta1 1:842cd88170e2 69 //epd.DrawImage(130, 0, 48, 26, Battery_img);
meta1 1:842cd88170e2 70 //epd.DisplayChar(1, 3, (uint8_t*)"HUEMBED");
flawless 0:306e008a65d3 71 epd.RefreshDisplay();
flawless 0:306e008a65d3 72 i++;
flawless 0:306e008a65d3 73 wait(2);
flawless 0:306e008a65d3 74 }
flawless 0:306e008a65d3 75 }