Added example

This commit is contained in:
2021-03-20 02:40:27 +01:00
parent 16f0786122
commit 895ccfec8d
3 changed files with 89 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,39 @@
/*****************************************************************************
* | File : ImageData.h
* | Author : Waveshare team
* | Function :
*----------------
* | This version: V1.0
* | Date : 2018-10-23
* | Info :
*
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#ifndef _IMAGEDATA_H_
#define _IMAGEDATA_H_
extern const unsigned char gImage_4in2bc_b[];
extern const unsigned char gImage_4in2bc_ry[];
#endif
/* FILE END */

View File

@@ -0,0 +1,46 @@
#include "DEV_Config.h"
#include "EPD.h"
#include "GUI_Paint.h"
#include "imagedata.h"
#include <stdlib.h>
void setup() {
DEV_Module_Init();
printf("e-Paper Init and Clear...\r\n");
EPD_4IN2B_V2_Init();
EPD_4IN2B_V2_Clear();
//Create a new image cache named IMAGE_BW and fill it with white
UBYTE *BlackImage, *RYImage; // Red or Yellow
UWORD Imagesize = ((EPD_4IN2B_V2_WIDTH % 8 == 0) ? (EPD_4IN2B_V2_WIDTH / 8 ) : (EPD_4IN2B_V2_WIDTH / 8 + 1)) * EPD_4IN2B_V2_HEIGHT;
if ((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
while(1);
}
if ((RYImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for red memory...\r\n");
while(1);
}
printf("NewImage:BlackImage and RYImage\r\n");
Paint_NewImage(BlackImage, EPD_4IN2B_V2_WIDTH, EPD_4IN2B_V2_HEIGHT, 180, WHITE);
Paint_NewImage(RYImage, EPD_4IN2B_V2_WIDTH, EPD_4IN2B_V2_HEIGHT, 180, WHITE);
//Select Image
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_SelectImage(RYImage);
Paint_Clear(WHITE);
printf("show image for array\r\n");
EPD_4IN2B_V2_Display(gImage_4in2bc_b, gImage_4in2bc_ry);
printf("Goto Sleep...\r\n");
EPD_4IN2B_V2_Sleep();
free(BlackImage);
free(RYImage);
BlackImage = NULL;
RYImage = NULL;
}
void loop() {}