йцв

Dependencies:   EPD_GDE021A1 mbed

Fork of DISCO-L053C8_ePD_demo by PAVEL ZAKHAROV

Committer:
flawless
Date:
Thu Jun 01 15:42:18 2017 +0000
Revision:
2:71b5f9a738f9
Parent:
1:842cd88170e2
adc

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);
flawless 2:71b5f9a738f9 16 AnalogIn temperature(ADC_TEMP);
flawless 2:71b5f9a738f9 17 AnalogIn vref(ADC_VREF);
flawless 0:306e008a65d3 18 //width 48
flawless 0:306e008a65d3 19 //height 26
flawless 0:306e008a65d3 20 static uint8_t Battery_img[] = {
flawless 0:306e008a65d3 21 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
flawless 0:306e008a65d3 22 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
flawless 0:306e008a65d3 23 0xfe, 0xff, 0xff, 0xff, 0xff, 0x0f,
flawless 0:306e008a65d3 24 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x0c,
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, 0x08,
flawless 0:306e008a65d3 29 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x18,
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, 0x10, 0x38,
flawless 0:306e008a65d3 33 0xfe, 0xff, 0xff, 0x3f, 0xff, 0x39,
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, 0x10, 0x38,
flawless 0:306e008a65d3 37 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x38,
flawless 0:306e008a65d3 38 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x18,
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, 0x08,
flawless 0:306e008a65d3 42 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x0c,
flawless 0:306e008a65d3 43 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x0c,
flawless 0:306e008a65d3 44 0xfe, 0xff, 0xff, 0xff, 0xff, 0x0f,
flawless 0:306e008a65d3 45 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
flawless 0:306e008a65d3 46 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
flawless 0:306e008a65d3 47 };
flawless 0:306e008a65d3 48
flawless 0:306e008a65d3 49 int main()
flawless 0:306e008a65d3 50 {
flawless 0:306e008a65d3 51 led1 = 1;
meta1 1:842cd88170e2 52 char tmpTemp[15] = "test";
flawless 2:71b5f9a738f9 53 char string1[15];
meta1 1:842cd88170e2 54 epd.SetFont(&Font20);
flawless 0:306e008a65d3 55 epd.Clear(EPD_COLOR_WHITE);
flawless 0:306e008a65d3 56 // epd.DisplayStringAtLine(5, (uint8_t*)"HUEMBED", CENTER_MODE);
flawless 0:306e008a65d3 57 // epd.DisplayStringAtLine(2, (uint8_t*)"demo", LEFT_MODE);
flawless 0:306e008a65d3 58 // epd.DrawImage(130, 0, 48, 26, Battery_img);
flawless 0:306e008a65d3 59 // epd.DrawRect(50, 4, 60, 4);
flawless 0:306e008a65d3 60 // epd.RefreshDisplay();
flawless 0:306e008a65d3 61 wait(2);
meta1 1:842cd88170e2 62 float i = 10.3;
flawless 0:306e008a65d3 63 while(1) {
meta1 1:842cd88170e2 64
flawless 0:306e008a65d3 65 led1 = !led1;
flawless 0:306e008a65d3 66 epd.Clear(EPD_COLOR_WHITE);
flawless 2:71b5f9a738f9 67 sprintf(tmpTemp, "P = %.1f", vref);
flawless 2:71b5f9a738f9 68 sprintf(string1, "IDLE %.1fV", vref.read());
meta1 1:842cd88170e2 69 epd.DisplayStringAtLine(0, (uint8_t*)tmpTemp, LEFT_MODE);
meta1 1:842cd88170e2 70 epd.DisplayStringAtLine(1, (uint8_t*)"0.5 1.0", LEFT_MODE);
flawless 2:71b5f9a738f9 71 epd.DisplayStringAtLine(2, (uint8_t*)string1, LEFT_MODE);
meta1 1:842cd88170e2 72 //epd.DrawImage(130, 0, 48, 26, Battery_img);
meta1 1:842cd88170e2 73 //epd.DisplayChar(1, 3, (uint8_t*)"HUEMBED");
flawless 0:306e008a65d3 74 epd.RefreshDisplay();
flawless 0:306e008a65d3 75 i++;
flawless 0:306e008a65d3 76 wait(2);
flawless 0:306e008a65d3 77 }
flawless 0:306e008a65d3 78 }