2019.06.24
This commit is contained in:
parent
e945bfbbf3
commit
1f82e4a488
2990 changed files with 667957 additions and 444550 deletions
56
STM32/STM32-F103ZET6/User/Config/DEV_Config.c
Normal file
56
STM32/STM32-F103ZET6/User/Config/DEV_Config.c
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*****************************************************************************
|
||||
* | File : DEV_Config.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : Hardware underlying interface
|
||||
* | Info :
|
||||
* Used to shield the underlying layers of each master
|
||||
* and enhance portability
|
||||
*----------------
|
||||
* | This version: V2.0
|
||||
* | Date : 2018-10-30
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "DEV_Config.h"
|
||||
#include "stm32f1xx_hal_spi.h"
|
||||
|
||||
extern SPI_HandleTypeDef hspi1;
|
||||
void DEV_SPI_WriteByte(UBYTE value)
|
||||
{
|
||||
HAL_SPI_Transmit(&hspi1, &value, 1, 1000);
|
||||
}
|
||||
|
||||
void DEV_Module_Init(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
}
|
||||
|
||||
void DEV_Module_Exit(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
|
||||
//close 5V
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
}
|
||||
|
||||
86
STM32/STM32-F103ZET6/User/Config/DEV_Config.h
Normal file
86
STM32/STM32-F103ZET6/User/Config/DEV_Config.h
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
/*****************************************************************************
|
||||
* | File : DEV_Config.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : Hardware underlying interface
|
||||
* | Info :
|
||||
* Used to shield the underlying layers of each master
|
||||
* and enhance portability
|
||||
*----------------
|
||||
* | This version: V2.0
|
||||
* | Date : 2018-10-30
|
||||
* | Info :
|
||||
* 1.add:
|
||||
* UBYTE\UWORD\UDOUBLE
|
||||
* 2.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
* 3.Remote:
|
||||
* EPD_RST_1\EPD_RST_0
|
||||
* EPD_DC_1\EPD_DC_0
|
||||
* EPD_CS_1\EPD_CS_0
|
||||
* EPD_BUSY_1\EPD_BUSY_0
|
||||
* 3.add:
|
||||
* #define DEV_Digital_Write(_pin, _value) bcm2835_gpio_write(_pin, _value)
|
||||
* #define DEV_Digital_Read(_pin) bcm2835_gpio_lev(_pin)
|
||||
* #define DEV_SPI_WriteByte(__value) bcm2835_spi_transfer(__value)
|
||||
#
|
||||
# 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 _DEV_CONFIG_H_
|
||||
#define _DEV_CONFIG_H_
|
||||
|
||||
#include "main.h"
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "stm32f1xx_hal_gpio.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* data
|
||||
**/
|
||||
#define UBYTE uint8_t
|
||||
#define UWORD uint16_t
|
||||
#define UDOUBLE uint32_t
|
||||
|
||||
/**
|
||||
* e-Paper GPIO
|
||||
**/
|
||||
#define EPD_RST_PIN RST_GPIO_Port, RST_Pin
|
||||
#define EPD_DC_PIN DC_GPIO_Port, DC_Pin
|
||||
#define EPD_CS_PIN SPI_CS_GPIO_Port, SPI_CS_Pin
|
||||
#define EPD_BUSY_PIN BUSY_GPIO_Port, BUSY_Pin
|
||||
|
||||
/**
|
||||
* GPIO read and write
|
||||
**/
|
||||
#define DEV_Digital_Write(_pin, _value) HAL_GPIO_WritePin(_pin, _value == 0? GPIO_PIN_RESET:GPIO_PIN_SET)
|
||||
#define DEV_Digital_Read(_pin) HAL_GPIO_ReadPin(_pin)
|
||||
|
||||
/**
|
||||
* delay x ms
|
||||
**/
|
||||
#define DEV_Delay_ms(__xms) HAL_Delay(__xms);
|
||||
|
||||
void DEV_SPI_WriteByte(UBYTE value);
|
||||
|
||||
void DEV_Module_Init(void);
|
||||
void DEV_Module_Exit(void);
|
||||
#endif
|
||||
24
STM32/STM32-F103ZET6/User/Config/Debug.h
Normal file
24
STM32/STM32-F103ZET6/User/Config/Debug.h
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/*****************************************************************************
|
||||
* | File : Debug.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : debug with printf
|
||||
* | Info :
|
||||
* Image scanning
|
||||
* Please use progressive scanning to generate images or fonts
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2018-01-11
|
||||
* | Info : Basic version
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __DEBUG_H
|
||||
#define __DEBUG_H
|
||||
|
||||
#define DEBUG 1
|
||||
#if DEBUG
|
||||
#define Debug(__info,...) printf("Debug: " __info,##__VA_ARGS__)
|
||||
#else
|
||||
#define Debug(__info,...)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
152
STM32/STM32-F103ZET6/User/Examples/EPD_1in54_V2_test.c
Normal file
152
STM32/STM32-F103ZET6/User/Examples/EPD_1in54_V2_test.c
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-11
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_1in54_V2.h"
|
||||
|
||||
int EPD_1in54_V2_test(void)
|
||||
{
|
||||
printf("EPD_1in54_V2_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN54_V2_Init();
|
||||
EPD_1IN54_V2_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_1IN54_V2_WIDTH % 8 == 0)? (EPD_1IN54_V2_WIDTH / 8 ): (EPD_1IN54_V2_WIDTH / 8 + 1)) * EPD_1IN54_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN54_V2_WIDTH, EPD_1IN54_V2_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_1in54);
|
||||
|
||||
EPD_1IN54_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(170, 15, 170, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(150, 35, 190, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawCircle(170, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(170, 85, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 85, "waveshare", &Font20, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 110, 123456789, &Font20, BLACK, WHITE);
|
||||
|
||||
Paint_DrawString_CN(5, 135,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 155, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_1IN54_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
|
||||
// The image of the previous frame must be uploaded, otherwise the
|
||||
// first few seconds will display an exception.
|
||||
EPD_1IN54_V2_Init();
|
||||
EPD_1IN54_V2_DisplayPartBaseImage(BlackImage);
|
||||
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 20;
|
||||
for (;;) {
|
||||
sPaint_time.Sec = sPaint_time.Sec + 1;
|
||||
if (sPaint_time.Sec == 60) {
|
||||
sPaint_time.Min = sPaint_time.Min + 1;
|
||||
sPaint_time.Sec = 0;
|
||||
if (sPaint_time.Min == 60) {
|
||||
sPaint_time.Hour = sPaint_time.Hour + 1;
|
||||
sPaint_time.Min = 0;
|
||||
if (sPaint_time.Hour == 24) {
|
||||
sPaint_time.Hour = 0;
|
||||
sPaint_time.Min = 0;
|
||||
sPaint_time.Sec = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Paint_ClearWindows(15, 65, 15 + Font20.Width * 7, 65 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(15, 65, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_1IN54_V2_DisplayPart(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN54_V2_Init();
|
||||
EPD_1IN54_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN54_V2_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
147
STM32/STM32-F103ZET6/User/Examples/EPD_1in54_test.c
Normal file
147
STM32/STM32-F103ZET6/User/Examples/EPD_1in54_test.c
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1IN54_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-11
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_1in54.h"
|
||||
|
||||
int EPD_1in54_test(void)
|
||||
{
|
||||
printf("EPD_1IN54_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN54_Init(EPD_1IN54_FULL);
|
||||
EPD_1IN54_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_1IN54_WIDTH % 8 == 0)? (EPD_1IN54_WIDTH / 8 ): (EPD_1IN54_WIDTH / 8 + 1)) * EPD_1IN54_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN54_WIDTH, EPD_1IN54_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_1in54);
|
||||
|
||||
EPD_1IN54_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(170, 15, 170, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(150, 35, 190, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawCircle(170, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(170, 85, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 85, "waveshare", &Font20, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 110, 123456789, &Font20, BLACK, WHITE);
|
||||
|
||||
Paint_DrawString_CN(5, 135,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 155, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_1IN54_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
EPD_1IN54_Init(EPD_1IN54_PART);
|
||||
Paint_SelectImage(BlackImage);
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 20;
|
||||
for (;;) {
|
||||
sPaint_time.Sec = sPaint_time.Sec + 1;
|
||||
if (sPaint_time.Sec == 60) {
|
||||
sPaint_time.Min = sPaint_time.Min + 1;
|
||||
sPaint_time.Sec = 0;
|
||||
if (sPaint_time.Min == 60) {
|
||||
sPaint_time.Hour = sPaint_time.Hour + 1;
|
||||
sPaint_time.Min = 0;
|
||||
if (sPaint_time.Hour == 24) {
|
||||
sPaint_time.Hour = 0;
|
||||
sPaint_time.Min = 0;
|
||||
sPaint_time.Sec = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Paint_ClearWindows(15, 65, 15 + Font20.Width * 7, 65 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(15, 65, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_1IN54_Display(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN54_Init(EPD_1IN54_FULL);
|
||||
EPD_1IN54_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN54_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
115
STM32/STM32-F103ZET6/User/Examples/EPD_1in54b_test.c
Normal file
115
STM32/STM32-F103ZET6/User/Examples/EPD_1in54b_test.c
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54b_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch B e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-12
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_1in54b.h"
|
||||
|
||||
int EPD_1in54b_test(void)
|
||||
{
|
||||
printf("EPD_1in54b_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN54B_Init();
|
||||
EPD_1IN54B_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create new image
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
UWORD Imagesize = ((EPD_1IN54B_WIDTH % 8 == 0)? (EPD_1IN54B_WIDTH / 8 ): (EPD_1IN54B_WIDTH / 8 + 1)) * EPD_1IN54B_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RedImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN54B_WIDTH, EPD_1IN54B_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RedImage, EPD_1IN54B_WIDTH, EPD_1IN54B_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 //Drawing
|
||||
printf("Drawing------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(170, 85, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 70, "hello world", &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(5, 160, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(170, 15, 170, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(150, 35, 190, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(170, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawString_EN(5, 90, "waveshare", &Font20, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 120, 123456789, &Font20, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 135,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
|
||||
EPD_1IN54B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_DrawBitMap(gImage_1in54b_Black);
|
||||
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_DrawBitMap(gImage_1in54b_Red);
|
||||
|
||||
EPD_1IN54B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN54B_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN54B_Sleep();
|
||||
free(BlackImage);
|
||||
free(RedImage);
|
||||
BlackImage = NULL;
|
||||
RedImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
113
STM32/STM32-F103ZET6/User/Examples/EPD_1in54c_test.c
Normal file
113
STM32/STM32-F103ZET6/User/Examples/EPD_1in54c_test.c
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54c_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-12
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_1in54c.h"
|
||||
|
||||
int EPD_1in54c_test(void)
|
||||
{
|
||||
printf("EPD_1IN54C_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN54C_Init();
|
||||
EPD_1IN54C_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create new image
|
||||
UBYTE *BlackImage, *YellowImage;
|
||||
UWORD Imagesize = ((EPD_1IN54C_WIDTH % 8 == 0)? (EPD_1IN54C_WIDTH / 8 ): (EPD_1IN54C_WIDTH / 8 + 1)) * EPD_1IN54C_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((YellowImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and YellowImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN54C_WIDTH, EPD_1IN54C_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(YellowImage, EPD_1IN54C_WIDTH, EPD_1IN54C_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 //Drawing
|
||||
printf("Drawing------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_SelectImage(YellowImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(170, 15, 170, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(150, 35, 190, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawCircle(45, 35, 15, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 30, 15, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 70, "waveshare", &Font20, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 95, 123456789, &Font20, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 120,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
|
||||
EPD_1IN54C_Display(BlackImage, YellowImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_DrawBitMap(gImage_1in54c_Black);
|
||||
|
||||
Paint_SelectImage(YellowImage);
|
||||
Paint_DrawBitMap(gImage_1in54c_Yellow);
|
||||
|
||||
EPD_1IN54C_Display(BlackImage, YellowImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN54C_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN54C_Sleep();
|
||||
free(BlackImage);
|
||||
free(YellowImage);
|
||||
BlackImage = NULL;
|
||||
YellowImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
157
STM32/STM32-F103ZET6/User/Examples/EPD_2in13_V2_test.c
Normal file
157
STM32/STM32-F103ZET6/User/Examples/EPD_2in13_V2_test.c
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN13_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper(V2) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2IN13_V2.h"
|
||||
|
||||
int EPD_2in13_V2_test(void)
|
||||
{
|
||||
printf("EPD_2IN13_V2_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
|
||||
EPD_2IN13_V2_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1)) * EPD_2IN13_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN13_V2_WIDTH, EPD_2IN13_V2_HEIGHT, 270, WHITE);
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_SetMirroring(MIRROR_HORIZONTAL); //
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in13);
|
||||
|
||||
EPD_2IN13_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 135, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawLine(45, 15, 45, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(25, 35, 70, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawCircle(45, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(110, 35, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawString_EN(140, 15, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawNum(140, 40, 123456789, &Font16, BLACK, WHITE);
|
||||
|
||||
Paint_DrawString_CN(140, 60, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 65, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN13_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
|
||||
EPD_2IN13_V2_DisplayPartBaseImage(BlackImage);
|
||||
|
||||
EPD_2IN13_V2_Init(EPD_2IN13_V2_PART);
|
||||
Paint_SelectImage(BlackImage);
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 20;
|
||||
for (;;) {
|
||||
sPaint_time.Sec = sPaint_time.Sec + 1;
|
||||
if (sPaint_time.Sec == 60) {
|
||||
sPaint_time.Min = sPaint_time.Min + 1;
|
||||
sPaint_time.Sec = 0;
|
||||
if (sPaint_time.Min == 60) {
|
||||
sPaint_time.Hour = sPaint_time.Hour + 1;
|
||||
sPaint_time.Min = 0;
|
||||
if (sPaint_time.Hour == 24) {
|
||||
sPaint_time.Hour = 0;
|
||||
sPaint_time.Min = 0;
|
||||
sPaint_time.Sec = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Paint_ClearWindows(140, 90, 140 + Font20.Width * 7, 90 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(140, 90, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_2IN13_V2_DisplayPart(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
|
||||
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
|
||||
EPD_2IN13_V2_Clear();
|
||||
DEV_Delay_ms(2000);//Analog clock 1s
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13_V2_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(1000);//Analog clock 1s
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
147
STM32/STM32-F103ZET6/User/Examples/EPD_2in13_test.c
Normal file
147
STM32/STM32-F103ZET6/User/Examples/EPD_2in13_test.c
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN13_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-11
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in13.h"
|
||||
|
||||
int EPD_2in13_test(void)
|
||||
{
|
||||
printf("EPD_2IN13_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13_Init(EPD_2IN13_FULL);
|
||||
EPD_2IN13_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN13_WIDTH % 8 == 0)? (EPD_2IN13_WIDTH / 8 ): (EPD_2IN13_WIDTH / 8 + 1)) * EPD_2IN13_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN13_WIDTH, EPD_2IN13_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in13);
|
||||
|
||||
EPD_2IN13_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 135, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawLine(45, 15, 45, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(25, 35, 70, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawCircle(45, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(110, 35, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawString_EN(140, 15, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawNum(140, 40, 123456789, &Font16, BLACK, WHITE);
|
||||
|
||||
Paint_DrawString_CN(140, 60, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 65, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN13_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
EPD_2IN13_Init(EPD_2IN13_PART);
|
||||
Paint_SelectImage(BlackImage);
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 20;
|
||||
for (;;) {
|
||||
sPaint_time.Sec = sPaint_time.Sec + 1;
|
||||
if (sPaint_time.Sec == 60) {
|
||||
sPaint_time.Min = sPaint_time.Min + 1;
|
||||
sPaint_time.Sec = 0;
|
||||
if (sPaint_time.Min == 60) {
|
||||
sPaint_time.Hour = sPaint_time.Hour + 1;
|
||||
sPaint_time.Min = 0;
|
||||
if (sPaint_time.Hour == 24) {
|
||||
sPaint_time.Hour = 0;
|
||||
sPaint_time.Min = 0;
|
||||
sPaint_time.Sec = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Paint_ClearWindows(140, 90, 140 + Font20.Width * 7, 90 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(140, 90, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_2IN13_Display(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN13_Init(EPD_2IN13_FULL);
|
||||
EPD_2IN13_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
120
STM32/STM32-F103ZET6/User/Examples/EPD_2in13bc_test.c
Normal file
120
STM32/STM32-F103ZET6/User/Examples/EPD_2in13bc_test.c
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13bc_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2IN13BC.h"
|
||||
|
||||
int EPD_2in13bc_test(void)
|
||||
{
|
||||
printf("EPD_2IN13BC_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13BC_Init();
|
||||
EPD_2IN13BC_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage; // Red or Yellow
|
||||
UWORD Imagesize = ((EPD_2IN13BC_WIDTH % 8 == 0)? (EPD_2IN13BC_WIDTH / 8 ): (EPD_2IN13BC_WIDTH / 8 + 1)) * EPD_2IN13BC_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RYImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RYImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN13BC_WIDTH, EPD_2IN13BC_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_2IN13BC_WIDTH, EPD_2IN13BC_HEIGHT, 270, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
// EPD_2IN13BC_Display(gImage_2in13b_b, gImage_2in13b_r);
|
||||
|
||||
EPD_2IN13BC_Display(gImage_2in13c_b, gImage_2in13c_y);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
printf("Draw black image\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 70, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 80, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 50, 100, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(50, 70, 20, 100, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(60, 70, 90, 100, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(125, 85, 15, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawString_CN(5, 15, "ÄãºÃabc", &Font12CN, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
printf("Draw red image\r\n");
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 90, RED, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 100, RED, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(125, 70, 125, 100, RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(110, 85, 140, 85, RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawRectangle(20, 70, 50, 100, RED, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(165, 85, 15, RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 0, "waveshare Electronics", &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 50, 987654321, &Font16, WHITE, RED);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN13BC_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN13BC_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13BC_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
147
STM32/STM32-F103ZET6/User/Examples/EPD_2in13d_test.c
Normal file
147
STM32/STM32-F103ZET6/User/Examples/EPD_2in13d_test.c
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13d_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in13d.h"
|
||||
|
||||
int EPD_2in13d_test(void)
|
||||
{
|
||||
printf("EPD_2IN13D_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13D_Init();
|
||||
EPD_2IN13D_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN13D_WIDTH % 8 == 0)? (EPD_2IN13D_WIDTH / 8 ): (EPD_2IN13D_WIDTH / 8 + 1)) * EPD_2IN13D_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN13D_WIDTH, EPD_2IN13D_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in13d);
|
||||
|
||||
EPD_2IN13D_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
Paint_DrawString_EN(5, 5, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 25, 123456789, &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 45,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 65,"΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
EPD_2IN13D_Display(BlackImage);
|
||||
DEV_Delay_ms(1000);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(170, 15, 170, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(150, 35, 190, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(170, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(170, 80, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
EPD_2IN13D_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 20;
|
||||
for (;;) {
|
||||
sPaint_time.Sec = sPaint_time.Sec + 1;
|
||||
if (sPaint_time.Sec == 60) {
|
||||
sPaint_time.Min = sPaint_time.Min + 1;
|
||||
sPaint_time.Sec = 0;
|
||||
if (sPaint_time.Min == 60) {
|
||||
sPaint_time.Hour = sPaint_time.Hour + 1;
|
||||
sPaint_time.Min = 0;
|
||||
if (sPaint_time.Hour == 24) {
|
||||
sPaint_time.Hour = 0;
|
||||
sPaint_time.Min = 0;
|
||||
sPaint_time.Sec = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Paint_ClearWindows(15, 65, 15 + Font20.Width * 7, 65 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(15, 65, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_2IN13D_DisplayPart(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
// Paint_Clear(WHITE);
|
||||
// EPD_2IN13D_DisplayPart(BlackImage);
|
||||
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
// EPD_2IN13D_Init();
|
||||
EPD_2IN13D_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13D_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
108
STM32/STM32-F103ZET6/User/Examples/EPD_2in7_test.c
Normal file
108
STM32/STM32-F103ZET6/User/Examples/EPD_2in7_test.c
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN7_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-11
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in7.h"
|
||||
|
||||
int EPD_2in7_test(void)
|
||||
{
|
||||
printf("EPD_2IN7_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN7_Init();
|
||||
EPD_2IN7_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN7_WIDTH % 8 == 0)? (EPD_2IN7_WIDTH / 8 ): (EPD_2IN7_WIDTH / 8 + 1)) * EPD_2IN7_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_WIDTH, EPD_2IN7_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in7);
|
||||
EPD_2IN7_Display(BlackImage);
|
||||
DEV_Delay_ms(500);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN7_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN7_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN7_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
121
STM32/STM32-F103ZET6/User/Examples/EPD_2in7b_test.c
Normal file
121
STM32/STM32-F103ZET6/User/Examples/EPD_2in7b_test.c
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN7b_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.7inch e-paper b test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-11
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2IN7b.h"
|
||||
|
||||
int EPD_2in7b_test(void)
|
||||
{
|
||||
printf("EPD_2IN7B_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN7B_Init();
|
||||
EPD_2IN7B_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
UWORD Imagesize = ((EPD_2IN7B_WIDTH % 8 == 0)? (EPD_2IN7B_WIDTH / 8 ): (EPD_2IN7B_WIDTH / 8 + 1)) * EPD_2IN7B_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RedImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN7B_WIDTH, EPD_2IN7B_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RedImage, EPD_2IN7B_WIDTH, EPD_2IN7B_HEIGHT, 270, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_DrawBitMap(gImage_2in7b_Black);
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_DrawBitMap(gImage_2in7b_Red);
|
||||
EPD_2IN7B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN7B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN7B_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN7B_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
152
STM32/STM32-F103ZET6/User/Examples/EPD_2in9_test.c
Normal file
152
STM32/STM32-F103ZET6/User/Examples/EPD_2in9_test.c
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN9_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-11
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in9.h"
|
||||
|
||||
int EPD_2in9_test(void)
|
||||
{
|
||||
printf("EPD_2IN9_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9_Init(EPD_2IN9_FULL);
|
||||
EPD_2IN9_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN9_WIDTH % 8 == 0)? (EPD_2IN9_WIDTH / 8 ): (EPD_2IN9_WIDTH / 8 + 1)) * EPD_2IN9_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_WIDTH, EPD_2IN9_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in9);
|
||||
|
||||
EPD_2IN9_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN9_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
EPD_2IN9_Init(EPD_2IN9_PART);
|
||||
Paint_SelectImage(BlackImage);
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 20;
|
||||
for (;;) {
|
||||
sPaint_time.Sec = sPaint_time.Sec + 1;
|
||||
if (sPaint_time.Sec == 60) {
|
||||
sPaint_time.Min = sPaint_time.Min + 1;
|
||||
sPaint_time.Sec = 0;
|
||||
if (sPaint_time.Min == 60) {
|
||||
sPaint_time.Hour = sPaint_time.Hour + 1;
|
||||
sPaint_time.Min = 0;
|
||||
if (sPaint_time.Hour == 24) {
|
||||
sPaint_time.Hour = 0;
|
||||
sPaint_time.Min = 0;
|
||||
sPaint_time.Sec = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Paint_ClearWindows(150, 80, 150 + Font20.Width * 7, 80 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(150, 80, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_2IN9_Display(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN9_Init(EPD_2IN9_FULL);
|
||||
EPD_2IN9_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
119
STM32/STM32-F103ZET6/User/Examples/EPD_2in9bc_test.c
Normal file
119
STM32/STM32-F103ZET6/User/Examples/EPD_2in9bc_test.c
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9bc_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-12
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2IN9BC.h"
|
||||
|
||||
int EPD_2in9bc_test(void)
|
||||
{
|
||||
printf("EPD_2IN9BC_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9BC_Init();
|
||||
EPD_2IN9BC_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage; // Red or Yellow
|
||||
UWORD Imagesize = ((EPD_2IN9BC_WIDTH % 8 == 0)? (EPD_2IN9BC_WIDTH / 8 ): (EPD_2IN9BC_WIDTH / 8 + 1)) * EPD_2IN9BC_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RYImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RYImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN9BC_WIDTH, EPD_2IN9BC_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_2IN9BC_WIDTH, EPD_2IN9BC_HEIGHT, 270, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_2IN9BC_Display(gImage_2in9bc_b, gImage_2in9bc_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN9BC_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN9BC_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9BC_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
144
STM32/STM32-F103ZET6/User/Examples/EPD_2in9d_test.c
Normal file
144
STM32/STM32-F103ZET6/User/Examples/EPD_2in9d_test.c
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9d_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper d test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in9d.h"
|
||||
|
||||
int EPD_2in9d_test(void)
|
||||
{
|
||||
printf("EPD_2IN9D_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9D_Init();
|
||||
EPD_2IN9D_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN9D_WIDTH % 8 == 0)? (EPD_2IN9D_WIDTH / 8 ): (EPD_2IN9D_WIDTH / 8 + 1)) * EPD_2IN9D_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN9D_WIDTH, EPD_2IN9D_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in9);
|
||||
|
||||
EPD_2IN9D_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(130, 0, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN9D_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 20;
|
||||
for (;;) {
|
||||
sPaint_time.Sec = sPaint_time.Sec + 1;
|
||||
if (sPaint_time.Sec == 60) {
|
||||
sPaint_time.Min = sPaint_time.Min + 1;
|
||||
sPaint_time.Sec = 0;
|
||||
if (sPaint_time.Min == 60) {
|
||||
sPaint_time.Hour = sPaint_time.Hour + 1;
|
||||
sPaint_time.Min = 0;
|
||||
if (sPaint_time.Hour == 24) {
|
||||
sPaint_time.Hour = 0;
|
||||
sPaint_time.Min = 0;
|
||||
sPaint_time.Sec = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Paint_ClearWindows(150, 80, 150 + Font20.Width * 7, 80 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(150, 80, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_2IN9D_DisplayPart(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
// EPD_2IN9D_Init();
|
||||
EPD_2IN9D_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9D_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
109
STM32/STM32-F103ZET6/User/Examples/EPD_4in2_test.c
Normal file
109
STM32/STM32-F103ZET6/User/Examples/EPD_4in2_test.c
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.2inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_4in2.h"
|
||||
|
||||
int EPD_4in2_test(void)
|
||||
{
|
||||
printf("EPD_4IN2_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN2_Init();
|
||||
EPD_4IN2_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1)) * EPD_4IN2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_4IN2_WIDTH, EPD_4IN2_HEIGHT, 0, WHITE);
|
||||
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_4in2);
|
||||
EPD_4IN2_Display(BlackImage);
|
||||
DEV_Delay_ms(500);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(130, 0, " ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_4IN2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_4IN2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4IN2_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
121
STM32/STM32-F103ZET6/User/Examples/EPD_4in2bc_test.c
Normal file
121
STM32/STM32-F103ZET6/User/Examples/EPD_4in2bc_test.c
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in2bc_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.2inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_4in2bc.h"
|
||||
|
||||
int EPD_4in2bc_test(void)
|
||||
{
|
||||
printf("EPD_4IN2BC_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN2BC_Init();
|
||||
EPD_4IN2BC_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage; // Red or Yellow
|
||||
UWORD Imagesize = ((EPD_4IN2BC_WIDTH % 8 == 0)? (EPD_4IN2BC_WIDTH / 8 ): (EPD_4IN2BC_WIDTH / 8 + 1)) * EPD_4IN2BC_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RYImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RYImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_4IN2BC_WIDTH, EPD_4IN2BC_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_4IN2BC_WIDTH, EPD_4IN2BC_HEIGHT, 270, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_4IN2BC_Display(gImage_4in2bc_b, gImage_4in2bc_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
printf("Draw black image\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
printf("Draw red image\r\n");
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_4IN2BC_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_4IN2BC_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4IN2BC_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
109
STM32/STM32-F103ZET6/User/Examples/EPD_5in83_test.c
Normal file
109
STM32/STM32-F103ZET6/User/Examples/EPD_5in83_test.c
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in83_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_5in83.h"
|
||||
|
||||
int EPD_5in83_test(void)
|
||||
{
|
||||
printf("EPD_5IN83_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5IN83_Init();
|
||||
EPD_5IN83_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_5IN83_WIDTH % 8 == 0)? (EPD_5IN83_WIDTH / 8 ): (EPD_5IN83_WIDTH / 8 + 1)) * EPD_5IN83_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_5IN83_WIDTH, EPD_5IN83_HEIGHT, 0, WHITE);
|
||||
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_5in83);
|
||||
EPD_5IN83_Display(BlackImage);
|
||||
DEV_Delay_ms(500);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(130, 0, " ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_5IN83_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_5IN83_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_5IN83_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
119
STM32/STM32-F103ZET6/User/Examples/EPD_5in83bc_test.c
Normal file
119
STM32/STM32-F103ZET6/User/Examples/EPD_5in83bc_test.c
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in83bc_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_5in83bc.h"
|
||||
|
||||
int EPD_5in83bc_test(void)
|
||||
{
|
||||
printf("EPD_5IN83BC_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5IN83BC_Init();
|
||||
EPD_5IN83BC_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage;
|
||||
UWORD Imagesize = ((EPD_5IN83BC_WIDTH % 8 == 0)? (EPD_5IN83BC_WIDTH / 8 ): (EPD_5IN83BC_WIDTH / 8 + 1)) * EPD_5IN83BC_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize / 2)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RYImage = (UBYTE *)malloc(Imagesize / 2)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RYImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_5IN83BC_WIDTH, EPD_5IN83BC_HEIGHT / 2, 0, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_5IN83BC_WIDTH, EPD_5IN83BC_HEIGHT / 2, 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_5IN83BC_Display(gImage_5in83bc_b, gImage_5in83bc_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75,+ 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_5IN83BC_DisplayHalfScreen(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_5IN83BC_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_5IN83BC_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
109
STM32/STM32-F103ZET6/User/Examples/EPD_7in5_test.c
Normal file
109
STM32/STM32-F103ZET6/User/Examples/EPD_7in5_test.c
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.5inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_7in5.h"
|
||||
|
||||
int EPD_7in5_test(void)
|
||||
{
|
||||
printf("EPD_7IN5_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5_Init();
|
||||
EPD_7IN5_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_7IN5_WIDTH % 8 == 0)? (EPD_7IN5_WIDTH / 8 ): (EPD_7IN5_WIDTH / 8 + 1)) * EPD_7IN5_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN5_WIDTH, EPD_7IN5_HEIGHT, 0, WHITE);
|
||||
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_7in5);
|
||||
EPD_7IN5_Display(BlackImage);
|
||||
DEV_Delay_ms(500);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(130, 0, " ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN5_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
119
STM32/STM32-F103ZET6/User/Examples/EPD_7in5bc_test.c
Normal file
119
STM32/STM32-F103ZET6/User/Examples/EPD_7in5bc_test.c
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5bc_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_7in5bc.h"
|
||||
|
||||
int EPD_7in5bc_test(void)
|
||||
{
|
||||
printf("EPD_7IN5BC_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5BC_Init();
|
||||
EPD_7IN5BC_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage;
|
||||
UWORD Imagesize = ((EPD_7IN5BC_WIDTH % 8 == 0)? (EPD_7IN5BC_WIDTH / 8 ): (EPD_7IN5BC_WIDTH / 8 + 1)) * EPD_7IN5BC_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize / 2)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RYImage = (UBYTE *)malloc(Imagesize / 2)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RYImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN5BC_WIDTH, EPD_7IN5BC_HEIGHT / 2, 0, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_7IN5BC_WIDTH, EPD_7IN5BC_HEIGHT / 2, 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_7IN5BC_Display(gImage_7in5bc_b, gImage_7in5bc_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN5BC_DisplayHalfScreen(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5BC_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5BC_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
64
STM32/STM32-F103ZET6/User/Examples/EPD_Test.h
Normal file
64
STM32/STM32-F103ZET6/User/Examples/EPD_Test.h
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_Test.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : e-Paper test Demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-11
|
||||
* | 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 _EPD_TEST_H_
|
||||
#define _EPD_TEST_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
#include "GUI_Paint.h"
|
||||
#include "imagedata.h"
|
||||
#include "Debug.h"
|
||||
#include <stdlib.h> // malloc() free()
|
||||
|
||||
int EPD_1in54_test(void);
|
||||
int EPD_1in54_V2_test(void);
|
||||
int EPD_1in54b_test(void);
|
||||
int EPD_1in54c_test(void);
|
||||
|
||||
int EPD_2in7_test(void);
|
||||
int EPD_2in7b_test(void);
|
||||
|
||||
int EPD_2in9_test(void);
|
||||
int EPD_2in9bc_test(void);
|
||||
int EPD_2in9d_test(void);
|
||||
|
||||
int EPD_2in13_test(void);
|
||||
int EPD_2in13_V2_test(void);
|
||||
int EPD_2in13bc_test(void);
|
||||
int EPD_2in13d_test(void);
|
||||
|
||||
int EPD_4in2_test(void);
|
||||
int EPD_4in2bc_test(void);
|
||||
|
||||
int EPD_5in83_test(void);
|
||||
int EPD_5in83bc_test(void);
|
||||
|
||||
int EPD_7in5_test(void);
|
||||
int EPD_7in5bc_test(void);
|
||||
#endif
|
||||
19388
STM32/STM32-F103ZET6/User/Examples/ImageData.c
Normal file
19388
STM32/STM32-F103ZET6/User/Examples/ImageData.c
Normal file
File diff suppressed because it is too large
Load diff
70
STM32/STM32-F103ZET6/User/Examples/ImageData.h
Normal file
70
STM32/STM32-F103ZET6/User/Examples/ImageData.h
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/*****************************************************************************
|
||||
* | 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_1in54[];
|
||||
extern const unsigned char gImage_1in54b_Black[];
|
||||
extern const unsigned char gImage_1in54b_Red[];
|
||||
extern const unsigned char gImage_1in54c_Black[];
|
||||
extern const unsigned char gImage_1in54c_Yellow[];
|
||||
|
||||
extern const unsigned char gImage_2in7[];
|
||||
extern const unsigned char gImage_2in7b_Black[5808];
|
||||
extern const unsigned char gImage_2in7b_Red[5808];
|
||||
|
||||
extern const unsigned char gImage_2in9[];
|
||||
extern const unsigned char gImage_2in9bc_b[];
|
||||
extern const unsigned char gImage_2in9bc_ry[];
|
||||
|
||||
extern const unsigned char gImage_2in13[];
|
||||
extern const unsigned char gImage_2in13b_b[];
|
||||
extern const unsigned char gImage_2in13b_r[];
|
||||
extern const unsigned char gImage_2in13c_b[];
|
||||
extern const unsigned char gImage_2in13c_y[];
|
||||
extern const unsigned char gImage_2in13d[];
|
||||
|
||||
extern const unsigned char gImage_4in2[];
|
||||
extern const unsigned char gImage_4in2bc_b[];
|
||||
extern const unsigned char gImage_4in2bc_ry[];
|
||||
|
||||
extern const unsigned char gImage_5in83[];
|
||||
extern const unsigned char gImage_5in83bc_b[];
|
||||
extern const unsigned char gImage_5in83bc_ry[];
|
||||
|
||||
extern const unsigned char gImage_7in5[];
|
||||
extern const unsigned char gImage_7in5bc_b[];
|
||||
extern const unsigned char gImage_7in5bc_ry[];
|
||||
#endif
|
||||
/* FILE END */
|
||||
|
||||
|
||||
1384
STM32/STM32-F103ZET6/User/Fonts/font12.c
Normal file
1384
STM32/STM32-F103ZET6/User/Fonts/font12.c
Normal file
File diff suppressed because it is too large
Load diff
120
STM32/STM32-F103ZET6/User/Fonts/font12CN.c
Normal file
120
STM32/STM32-F103ZET6/User/Fonts/font12CN.c
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file Font12.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 18-February-2014
|
||||
* @brief This file provides text Font12 for STM32xx-EVAL's LCD driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "fonts.h"
|
||||
|
||||
|
||||
//
|
||||
// Font data for Courier New 12pt
|
||||
//
|
||||
|
||||
const CH_CN Font12CN_Table[] =
|
||||
{
|
||||
/*-- 文字: 你 --*/
|
||||
/*-- 微软雅黑12; 此字体下对应的点阵为:宽x高=16x21 --*/
|
||||
{"你",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1D,0xC0,0x1D,0x80,0x3B,0xFF,0x3B,0x07,
|
||||
0x3F,0x77,0x7E,0x76,0xF8,0x70,0xFB,0xFE,0xFB,0xFE,0x3F,0x77,0x3F,0x77,0x3E,0x73,
|
||||
0x38,0x70,0x38,0x70,0x3B,0xE0,0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 好 --*/
|
||||
/*-- 微软雅黑12; 此字体下对应的点阵为:宽x高=16x21 --*/
|
||||
{"好",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x73,0xFF,0x70,0x0F,0xFE,0x1E,
|
||||
0x7E,0x3C,0x6E,0x38,0xEE,0x30,0xEF,0xFF,0xFC,0x30,0x7C,0x30,0x38,0x30,0x3E,0x30,
|
||||
0x7E,0x30,0xE0,0x30,0xC1,0xF0,0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 树 --*/
|
||||
/*-- 微软雅黑12; 此字体下对应的点阵为:宽x高=16x21 --*/
|
||||
{"树",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x0E,0x30,0x0E,0x3F,0xEE,0x30,0xEE,
|
||||
0xFC,0xFF,0x76,0xCE,0x77,0xFE,0x7B,0xFE,0xFF,0xFE,0xF3,0xDE,0xF3,0xCE,0x37,0xEE,
|
||||
0x3E,0x6E,0x3C,0x0E,0x30,0x3E,0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 莓 --*/
|
||||
/*-- 微软雅黑12; 此字体下对应的点阵为:宽x高=16x21 --*/
|
||||
{"莓",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x70,0xFF,0xFF,0x3E,0x70,0x38,0x00,
|
||||
0x7F,0xFF,0xE0,0x00,0xFF,0xFC,0x3B,0x8C,0x39,0xCC,0xFF,0xFF,0x73,0x9C,0x71,0xDC,
|
||||
0x7F,0xFF,0x00,0x1C,0x01,0xF8,0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 派 --*/
|
||||
/*-- 微软雅黑12; 此字体下对应的点阵为:宽x高=16x21 --*/
|
||||
{"派",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x1F,0xFF,0xF0,0x3E,0x00,0x0E,0x1F,
|
||||
0xCF,0xFB,0xFF,0xF8,0x3F,0xFF,0x0F,0xFF,0x7F,0xD8,0x7F,0xDC,0x6F,0xCE,0xED,0xFF,
|
||||
0xFD,0xF7,0xF9,0xC0,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: a --*/
|
||||
/*-- 微软雅黑12; 此字体下对应的点阵为:宽x高=16x21 --*/
|
||||
{"a",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x3E,0x00,0x67,0x00,0x07,0x80,0x0F,0x80,0x7F,0x80,0xE3,0x80,0xE7,0x80,0xE7,0x80,
|
||||
0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: b --*/
|
||||
/*-- 微软雅黑12; 此字体下对应的点阵为:宽x高=16x21 --*/
|
||||
{"b",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,
|
||||
0x7F,0x00,0x7B,0x80,0x71,0xC0,0x71,0xC0,0x71,0xC0,0x71,0xC0,0x71,0xC0,0x7B,0x80,
|
||||
0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: c --*/
|
||||
/*-- 微软雅黑12; 此字体下对应的点阵为:宽x高=16x21 --*/
|
||||
{"c",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x3F,0x00,0x73,0x00,0xF0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xF0,0x00,0x73,0x00,
|
||||
0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: A --*/
|
||||
/*-- 微软雅黑12; 此字体下对应的点阵为:宽x高=16x21 --*/
|
||||
{"A",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x1F,0x00,0x1F,0x00,
|
||||
0x1F,0x00,0x3B,0x80,0x3B,0x80,0x71,0x80,0x7F,0xC0,0x71,0xC0,0xE0,0xE0,0xE0,0xE0,
|
||||
0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
};
|
||||
|
||||
cFONT Font12CN = {
|
||||
Font12CN_Table,
|
||||
sizeof(Font12CN_Table)/sizeof(CH_CN), /*size of table*/
|
||||
11, /* ASCII Width */
|
||||
16, /* Width */
|
||||
21, /* Height */
|
||||
};
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
1764
STM32/STM32-F103ZET6/User/Fonts/font16.c
Normal file
1764
STM32/STM32-F103ZET6/User/Fonts/font16.c
Normal file
File diff suppressed because it is too large
Load diff
2142
STM32/STM32-F103ZET6/User/Fonts/font20.c
Normal file
2142
STM32/STM32-F103ZET6/User/Fonts/font20.c
Normal file
File diff suppressed because it is too large
Load diff
2520
STM32/STM32-F103ZET6/User/Fonts/font24.c
Normal file
2520
STM32/STM32-F103ZET6/User/Fonts/font24.c
Normal file
File diff suppressed because it is too large
Load diff
465
STM32/STM32-F103ZET6/User/Fonts/font24CN.c
Normal file
465
STM32/STM32-F103ZET6/User/Fonts/font24CN.c
Normal file
|
|
@ -0,0 +1,465 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file Font12.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 18-February-2014
|
||||
* @brief This file provides text Font12 for STM32xx-EVAL's LCD driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "fonts.h"
|
||||
|
||||
|
||||
//
|
||||
// Font data for Courier New 12pt
|
||||
//
|
||||
|
||||
const CH_CN Font24CN_Table[] =
|
||||
{
|
||||
/*-- 文字: 你 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"你",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xC1,0xC0,0x00,
|
||||
0x01,0xE3,0xE0,0x00,0x03,0xE3,0xC0,0x00,0x03,0xC7,0x80,0x00,0x03,0xC7,0xFF,0xFF,
|
||||
0x07,0x8F,0xFF,0xFF,0x07,0x8F,0x00,0x0F,0x0F,0x1E,0x00,0x1E,0x0F,0x3C,0x1E,0x1E,
|
||||
0x1F,0x3C,0x1E,0x3E,0x1F,0x18,0x1E,0x3C,0x3F,0x00,0x1E,0x1C,0x7F,0x00,0x1E,0x00,
|
||||
0x7F,0x07,0x9E,0x70,0xFF,0x07,0x9E,0xF0,0xEF,0x0F,0x9E,0x78,0x6F,0x0F,0x1E,0x78,
|
||||
0x0F,0x0F,0x1E,0x3C,0x0F,0x1E,0x1E,0x3C,0x0F,0x1E,0x1E,0x1E,0x0F,0x3C,0x1E,0x1E,
|
||||
0x0F,0x3C,0x1E,0x1F,0x0F,0x7C,0x1E,0x0F,0x0F,0x78,0x1E,0x0E,0x0F,0x00,0x1E,0x00,
|
||||
0x0F,0x00,0x1E,0x00,0x0F,0x00,0x3C,0x00,0x0F,0x07,0xFC,0x00,0x0F,0x07,0xF8,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 好 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"好",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,
|
||||
0x0F,0x07,0xFF,0xFE,0x0F,0x07,0xFF,0xFE,0x0F,0x00,0x00,0x3E,0x1E,0x00,0x00,0xFC,
|
||||
0xFF,0xF8,0x01,0xF0,0xFF,0xF8,0x03,0xE0,0x1E,0x78,0x07,0xC0,0x1E,0x78,0x0F,0x80,
|
||||
0x3C,0x78,0x0F,0x00,0x3C,0x78,0x0F,0x00,0x3C,0x78,0x0F,0x00,0x3C,0x78,0x0F,0x00,
|
||||
0x3C,0x7F,0xFF,0xFF,0x78,0xFF,0xFF,0xFF,0x78,0xF0,0x0F,0x00,0x78,0xF0,0x0F,0x00,
|
||||
0x3D,0xE0,0x0F,0x00,0x1F,0xE0,0x0F,0x00,0x0F,0xE0,0x0F,0x00,0x07,0xC0,0x0F,0x00,
|
||||
0x07,0xE0,0x0F,0x00,0x07,0xF0,0x0F,0x00,0x0F,0xF8,0x0F,0x00,0x1E,0x7C,0x0F,0x00,
|
||||
0x3C,0x38,0x0F,0x00,0x78,0x00,0x0F,0x00,0xF0,0x03,0xFF,0x00,0x60,0x01,0xFE,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 微 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"微",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x01,0xE0,0x07,0x87,0x01,0xE0,
|
||||
0x07,0x07,0x01,0xC0,0x0F,0xF7,0x79,0xC0,0x1E,0xF7,0x7B,0xC0,0x1E,0xF7,0x7B,0x80,
|
||||
0x3C,0xF7,0x7B,0xFF,0x78,0xF7,0x7B,0xFF,0xF8,0xF7,0x7F,0x9E,0xF7,0xFF,0xFF,0x9E,
|
||||
0x67,0xFF,0xFF,0x9E,0x07,0x00,0x7F,0x9C,0x0F,0x00,0x0F,0x9C,0x1E,0x00,0x1F,0x9C,
|
||||
0x1E,0x7F,0xFF,0xBC,0x3E,0x7F,0xF3,0xFC,0x3E,0x00,0x03,0xFC,0x7E,0x00,0x01,0xF8,
|
||||
0xFE,0x00,0x01,0xF8,0xFE,0x7F,0xE1,0xF8,0xDE,0x7F,0xE1,0xF8,0x1E,0x78,0xE0,0xF0,
|
||||
0x1E,0x78,0xEE,0xF0,0x1E,0x78,0xFF,0xF0,0x1E,0x78,0xFD,0xF8,0x1E,0x79,0xFB,0xFC,
|
||||
0x1E,0xF1,0xF7,0xBC,0x1E,0xF0,0xEF,0x9E,0x1F,0xE0,0x0F,0x0F,0x1E,0xC0,0x1E,0x0F,
|
||||
0x1E,0x00,0x0C,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 软 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"软",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x03,0xC0,0x78,0x00,0x07,0x80,0x78,0x00,0x07,0x80,0x78,0x00,
|
||||
0x07,0x80,0xF0,0x00,0x0F,0x00,0xF0,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
0x1E,0x03,0xC0,0x1F,0x1E,0x03,0xC0,0x1E,0x1F,0xE7,0x8F,0x3E,0x3D,0xE7,0x8F,0x3C,
|
||||
0x3D,0xEF,0x0F,0x7C,0x3D,0xE7,0x0F,0x78,0x79,0xE0,0x0F,0x00,0x79,0xE0,0x0E,0x00,
|
||||
0x7F,0xFE,0x0E,0x00,0x7F,0xFE,0x1F,0x00,0x01,0xE0,0x1F,0x00,0x01,0xE0,0x1F,0x00,
|
||||
0x01,0xE0,0x1F,0x80,0x01,0xE0,0x1F,0x80,0x01,0xE0,0x3F,0x80,0x01,0xFF,0x3F,0xC0,
|
||||
0x0F,0xFF,0x7B,0xC0,0xFF,0xF0,0x79,0xE0,0xF9,0xE0,0xF1,0xF0,0x01,0xE1,0xF0,0xF0,
|
||||
0x01,0xE3,0xE0,0xF8,0x01,0xE7,0xC0,0x7C,0x01,0xFF,0x80,0x3F,0x01,0xFF,0x00,0x1F,
|
||||
0x01,0xEC,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 雅 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"雅",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x77,0x00,0x00,0x00,0xFF,0x00,
|
||||
0x7F,0xFC,0xF7,0x80,0x7F,0xFD,0xE3,0xC0,0x01,0xC1,0xE3,0xC0,0x01,0xC3,0xC1,0x80,
|
||||
0x3D,0xC7,0xFF,0xFF,0x39,0xC7,0xFF,0xFF,0x39,0xCF,0x83,0x80,0x79,0xDF,0x83,0x80,
|
||||
0x79,0xFF,0x83,0x80,0x79,0xDF,0x83,0x80,0x71,0xC3,0x83,0x80,0x7F,0xFF,0xFF,0xFE,
|
||||
0x7F,0xFF,0xFF,0xFE,0x03,0xC3,0x83,0x80,0x07,0xC3,0x83,0x80,0x07,0xC3,0x83,0x80,
|
||||
0x0F,0xC3,0x83,0x80,0x0F,0xC3,0x83,0x80,0x1F,0xC3,0xFF,0xFE,0x1D,0xC3,0xFF,0xFE,
|
||||
0x3D,0xC3,0x83,0x80,0x79,0xC3,0x83,0x80,0xF1,0xC3,0x83,0x80,0xF1,0xC3,0x83,0x80,
|
||||
0x61,0xC3,0x83,0x80,0x01,0xC3,0xFF,0xFF,0x03,0xC3,0xFF,0xFF,0x1F,0xC3,0x80,0x00,
|
||||
0x1F,0x83,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 黑 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"黑",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x1F,0xFF,0xFF,0xFC,0x1F,0xFF,0xFF,0xFC,0x1E,0x03,0xC0,0x3C,0x1E,0xC3,0xC7,0x3C,
|
||||
0x1F,0xE3,0xC7,0xBC,0x1E,0xF3,0xCF,0x3C,0x1E,0xFB,0xDF,0x3C,0x1E,0x7B,0xDE,0x3C,
|
||||
0x1E,0x33,0xDC,0x3C,0x1E,0x03,0xC0,0x3C,0x1F,0xFF,0xFF,0xFC,0x1F,0xFF,0xFF,0xFC,
|
||||
0x1E,0x03,0xC0,0x3C,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x3F,0xFF,0xFF,0xFC,
|
||||
0x3F,0xFF,0xFF,0xFC,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x1C,0x38,0x70,0x70,
|
||||
0x3E,0x78,0xF8,0xF8,0x3C,0x7C,0x78,0x7C,0x7C,0x3C,0x3C,0x3E,0xF8,0x3E,0x3C,0x1F,
|
||||
0xF0,0x1C,0x18,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 此 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"此",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x3C,0x00,
|
||||
0x00,0x78,0x3C,0x00,0x00,0x78,0x3C,0x00,0x00,0x78,0x3C,0x00,0x00,0x78,0x3C,0x00,
|
||||
0x00,0x78,0x3C,0x0C,0x3C,0x78,0x3C,0x1E,0x3C,0x78,0x3C,0x3F,0x3C,0x78,0x3C,0xF8,
|
||||
0x3C,0x7F,0xFD,0xF0,0x3C,0x7F,0xFF,0xE0,0x3C,0x78,0x3F,0x80,0x3C,0x78,0x3E,0x00,
|
||||
0x3C,0x78,0x3C,0x00,0x3C,0x78,0x3C,0x00,0x3C,0x78,0x3C,0x00,0x3C,0x78,0x3C,0x00,
|
||||
0x3C,0x78,0x3C,0x00,0x3C,0x78,0x3C,0x00,0x3C,0x78,0x3C,0x0E,0x3C,0x78,0x3C,0x0F,
|
||||
0x3C,0x78,0x3C,0x0F,0x3C,0x79,0xFC,0x0F,0x3C,0x7F,0xFC,0x0F,0x3F,0xFF,0x3C,0x0F,
|
||||
0x3F,0xF0,0x3E,0x1E,0xFF,0x00,0x1F,0xFE,0xF0,0x00,0x0F,0xFC,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 字 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"字",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x03,0xC0,0x00,
|
||||
0x00,0x03,0xE0,0x00,0x00,0x01,0xE0,0x00,0x7F,0xFF,0xFF,0xFE,0x7F,0xFF,0xFF,0xFE,
|
||||
0x78,0x00,0x00,0x1E,0x78,0x00,0x00,0x1E,0x78,0x00,0x00,0x1E,0x78,0x00,0x00,0x1E,
|
||||
0x7B,0xFF,0xFF,0xDE,0x03,0xFF,0xFF,0xC0,0x00,0x00,0x0F,0xC0,0x00,0x00,0x3F,0x00,
|
||||
0x00,0x00,0x7E,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xE0,0x00,0x00,0x01,0xE0,0x00,
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x01,0xE0,0x00,0x00,0x01,0xE0,0x00,
|
||||
0x00,0x01,0xE0,0x00,0x00,0x01,0xE0,0x00,0x00,0x01,0xE0,0x00,0x00,0x01,0xE0,0x00,
|
||||
0x00,0x03,0xE0,0x00,0x00,0x03,0xC0,0x00,0x00,0xFF,0xC0,0x00,0x00,0xFF,0x80,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 体 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"体",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x3C,0x00,
|
||||
0x03,0xC0,0x3C,0x00,0x03,0xC0,0x3C,0x00,0x07,0x80,0x3C,0x00,0x07,0x80,0x3C,0x00,
|
||||
0x07,0x80,0x3C,0x00,0x0F,0xFF,0xFF,0xFF,0x0F,0xFF,0xFF,0xFF,0x1F,0x01,0xFE,0x00,
|
||||
0x1F,0x01,0xFF,0x00,0x3F,0x01,0xFF,0x00,0x3F,0x03,0xFF,0x00,0x7F,0x03,0xFF,0x80,
|
||||
0x7F,0x07,0xBF,0x80,0xFF,0x07,0xBF,0xC0,0xEF,0x0F,0x3D,0xC0,0xCF,0x0F,0x3D,0xE0,
|
||||
0x0F,0x1E,0x3D,0xE0,0x0F,0x1E,0x3C,0xF0,0x0F,0x3C,0x3C,0x78,0x0F,0x7C,0x3C,0x7C,
|
||||
0x0F,0xF8,0x3C,0x3E,0x0F,0xF7,0xFF,0xDF,0x0F,0xE7,0xFF,0xCF,0x0F,0xC0,0x3C,0x06,
|
||||
0x0F,0x00,0x3C,0x00,0x0F,0x00,0x3C,0x00,0x0F,0x00,0x3C,0x00,0x0F,0x00,0x3C,0x00,
|
||||
0x0F,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 下 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"下",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,
|
||||
0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,
|
||||
0x00,0x0F,0xE0,0x00,0x00,0x0F,0xF8,0x00,0x00,0x0F,0xFC,0x00,0x00,0x0F,0xBF,0x00,
|
||||
0x00,0x0F,0x9F,0x80,0x00,0x0F,0x87,0xE0,0x00,0x0F,0x83,0xF0,0x00,0x0F,0x80,0xF8,
|
||||
0x00,0x0F,0x80,0x7C,0x00,0x0F,0x80,0x38,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,
|
||||
0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,
|
||||
0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 对 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"对",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,
|
||||
0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x7F,0xFC,0x00,0x78,0x7F,0xFC,0x00,0x78,
|
||||
0x00,0x3C,0x00,0x78,0x00,0x3F,0xFF,0xFF,0x30,0x3F,0xFF,0xFF,0x78,0x3C,0x00,0x78,
|
||||
0x3C,0x38,0x00,0x78,0x3E,0x78,0x00,0x78,0x1E,0x78,0xC0,0x78,0x0F,0x79,0xE0,0x78,
|
||||
0x0F,0xF0,0xF0,0x78,0x07,0xF0,0xF8,0x78,0x03,0xF0,0x78,0x78,0x01,0xE0,0x3C,0x78,
|
||||
0x03,0xF0,0x3E,0x78,0x03,0xF0,0x18,0x78,0x07,0xF8,0x00,0x78,0x07,0xFC,0x00,0x78,
|
||||
0x0F,0x3E,0x00,0x78,0x1F,0x1E,0x00,0x78,0x3E,0x1F,0x00,0x78,0x7C,0x0E,0x00,0xF8,
|
||||
0xF8,0x00,0x00,0xF0,0xF0,0x00,0x3F,0xF0,0x60,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 应 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"应",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x03,0xE0,0x00,0x00,0x01,0xE0,0x00,
|
||||
0x00,0x01,0xF0,0x00,0x00,0x00,0xF0,0x00,0x1F,0xFF,0xFF,0xFF,0x1F,0xFF,0xFF,0xFF,
|
||||
0x1E,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x1E,0x01,0xE0,0x78,0x1E,0x01,0xE0,0x78,
|
||||
0x1E,0xE1,0xE0,0x78,0x1F,0xF1,0xF0,0xF8,0x1E,0xF0,0xF0,0xF0,0x1E,0xF0,0xF0,0xF0,
|
||||
0x1E,0xF8,0xF0,0xF0,0x1E,0x78,0xF1,0xF0,0x1E,0x78,0xF9,0xE0,0x1E,0x78,0x79,0xE0,
|
||||
0x1E,0x7C,0x7B,0xE0,0x1E,0x3C,0x7B,0xC0,0x1E,0x3C,0x7B,0xC0,0x1E,0x3C,0x7B,0xC0,
|
||||
0x3C,0x3E,0x07,0x80,0x3C,0x1C,0x07,0x80,0x3C,0x00,0x07,0x80,0x3C,0x00,0x0F,0x00,
|
||||
0x78,0x00,0x0F,0x00,0x7B,0xFF,0xFF,0xFF,0xF3,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,
|
||||
0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 的 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"的",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x3C,0x00,0x07,0xC0,0x3E,0x00,
|
||||
0x07,0x80,0x3C,0x00,0x07,0x80,0x7C,0x00,0x0F,0x00,0x78,0x00,0x7F,0xFE,0x7F,0xFE,
|
||||
0x7F,0xFE,0xFF,0xFE,0x78,0x1E,0xF0,0x1E,0x78,0x1F,0xE0,0x1E,0x78,0x1F,0xE0,0x1E,
|
||||
0x78,0x1F,0xC0,0x1E,0x78,0x1F,0xC0,0x1E,0x78,0x1F,0xF0,0x1E,0x78,0x1E,0xF8,0x1E,
|
||||
0x78,0x1E,0x7C,0x1E,0x7F,0xFE,0x3C,0x1E,0x7F,0xFE,0x1E,0x1E,0x78,0x1E,0x1F,0x1E,
|
||||
0x78,0x1E,0x0F,0x9E,0x78,0x1E,0x07,0x9E,0x78,0x1E,0x07,0x1E,0x78,0x1E,0x00,0x1E,
|
||||
0x78,0x1E,0x00,0x1E,0x78,0x1E,0x00,0x3E,0x78,0x1E,0x00,0x3C,0x78,0x1E,0x00,0x3C,
|
||||
0x7F,0xFE,0x00,0x3C,0x7F,0xFE,0x00,0x7C,0x78,0x1E,0x3F,0xF8,0x78,0x1E,0x3F,0xF0,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 点 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"点",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
|
||||
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xFF,0xFF,0x00,0x03,0xFF,0xFF,
|
||||
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
|
||||
0x0F,0xFF,0xFF,0xF8,0x0F,0xFF,0xFF,0xF8,0x0F,0x00,0x00,0x78,0x0F,0x00,0x00,0x78,
|
||||
0x0F,0x00,0x00,0x78,0x0F,0x00,0x00,0x78,0x0F,0x00,0x00,0x78,0x0F,0x00,0x00,0x78,
|
||||
0x0F,0xFF,0xFF,0xF8,0x0F,0xFF,0xFF,0xF8,0x0F,0x00,0x00,0x78,0x00,0x00,0x00,0x00,
|
||||
0x0C,0x38,0x38,0x30,0x1E,0x7C,0x78,0x78,0x3E,0x3C,0x78,0x78,0x3C,0x3C,0x3C,0x3C,
|
||||
0x7C,0x3E,0x3C,0x3E,0xF8,0x1E,0x3C,0x1E,0xF0,0x1E,0x1E,0x1F,0x70,0x1E,0x1C,0x0E,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 阵 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"阵",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x78,0x00,
|
||||
0x7F,0xF0,0x78,0x00,0x7F,0xF0,0x78,0x00,0x79,0xFF,0xFF,0xFF,0x79,0xFF,0xFF,0xFF,
|
||||
0x79,0xE1,0xE0,0x00,0x79,0xE1,0xE0,0x00,0x7B,0xC1,0xEF,0x80,0x7B,0xC3,0xCF,0x80,
|
||||
0x7B,0xC3,0xCF,0x80,0x7F,0x87,0xCF,0x80,0x7F,0x87,0x8F,0x80,0x7F,0x87,0x8F,0x80,
|
||||
0x7B,0xCF,0x0F,0x80,0x7B,0xCF,0xFF,0xFE,0x79,0xEF,0xFF,0xFE,0x79,0xE0,0x0F,0x80,
|
||||
0x78,0xE0,0x0F,0x80,0x78,0xF0,0x0F,0x80,0x78,0xF0,0x0F,0x80,0x78,0xF0,0x0F,0x80,
|
||||
0x78,0xFF,0xFF,0xFF,0x79,0xFF,0xFF,0xFF,0x7F,0xE0,0x0F,0x80,0x7F,0xC0,0x0F,0x80,
|
||||
0x78,0x00,0x0F,0x80,0x78,0x00,0x0F,0x80,0x78,0x00,0x0F,0x80,0x78,0x00,0x0F,0x80,
|
||||
0x78,0x00,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 为 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"为",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,
|
||||
0x0E,0x07,0x80,0x00,0x1F,0x07,0x80,0x00,0x0F,0x87,0x80,0x00,0x07,0xC7,0x80,0x00,
|
||||
0x01,0xE7,0x80,0x00,0x00,0xC7,0x80,0x00,0x00,0x07,0x80,0x00,0x7F,0xFF,0xFF,0xFC,
|
||||
0x7F,0xFF,0xFF,0xFC,0x00,0x07,0x80,0x3C,0x00,0x0F,0x80,0x3C,0x00,0x0F,0x00,0x3C,
|
||||
0x00,0x0F,0x00,0x3C,0x00,0x0F,0x60,0x3C,0x00,0x1F,0xF0,0x3C,0x00,0x1E,0x78,0x3C,
|
||||
0x00,0x3E,0x3C,0x3C,0x00,0x3C,0x3E,0x3C,0x00,0x7C,0x1F,0x3C,0x00,0x78,0x0F,0x3C,
|
||||
0x00,0xF8,0x06,0x3C,0x01,0xF0,0x00,0x3C,0x03,0xE0,0x00,0x7C,0x07,0xC0,0x00,0x7C,
|
||||
0x0F,0x80,0x00,0x78,0x1F,0x00,0x00,0xF8,0x3E,0x00,0xFF,0xF0,0x7C,0x00,0xFF,0xE0,
|
||||
0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 树 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"树",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x38,
|
||||
0x0F,0x00,0x00,0x38,0x0F,0x00,0x00,0x38,0x0F,0x3F,0xF8,0x38,0x0F,0x3F,0xF8,0x38,
|
||||
0x0F,0x00,0x78,0x38,0xFF,0xE0,0x7F,0xFF,0xFF,0xE0,0x7F,0xFF,0x0F,0x00,0x70,0x38,
|
||||
0x0F,0x18,0xF0,0x38,0x1F,0x3C,0xF0,0x38,0x1F,0x1C,0xFE,0x38,0x1F,0xDE,0xFE,0x38,
|
||||
0x3F,0xEF,0xEF,0x38,0x3F,0xFF,0xEF,0x38,0x3F,0xF7,0xE7,0xB8,0x7F,0x67,0xC7,0xB8,
|
||||
0x7F,0x03,0xC3,0xB8,0xFF,0x07,0xE0,0x38,0xEF,0x07,0xE0,0x38,0xEF,0x0F,0xF0,0x38,
|
||||
0xCF,0x1F,0xF0,0x38,0x0F,0x1E,0x78,0x38,0x0F,0x3C,0x7C,0x38,0x0F,0x78,0x3C,0x38,
|
||||
0x0F,0xF8,0x38,0x38,0x0F,0x60,0x00,0x78,0x0F,0x00,0x0F,0xF8,0x0F,0x00,0x07,0xF0,
|
||||
0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 莓 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"莓",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x1E,0x00,0x00,0x3C,0x1E,0x00,
|
||||
0x00,0x3C,0x1E,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x3C,0x1E,0x00,
|
||||
0x07,0xBC,0x1E,0x00,0x07,0x80,0x00,0x00,0x0F,0xFF,0xFF,0xFC,0x0F,0xFF,0xFF,0xFC,
|
||||
0x1E,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xF0,
|
||||
0xF7,0xFF,0xFF,0xF0,0x37,0x83,0x80,0xF0,0x07,0x87,0xC0,0xF0,0x07,0x83,0xF0,0xF0,
|
||||
0x07,0x00,0xE0,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x0F,0x00,0xE0,
|
||||
0x0F,0x0F,0x81,0xE0,0x0E,0x03,0xE1,0xE0,0x1E,0x01,0xC1,0xE0,0x1F,0xFF,0xFF,0xFE,
|
||||
0x1F,0xFF,0xFF,0xFE,0x00,0x00,0x01,0xE0,0x00,0x00,0x03,0xC0,0x00,0x00,0xFF,0xC0,
|
||||
0x00,0x00,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 派 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"派",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x3E,
|
||||
0x7C,0x00,0x3F,0xFE,0x3F,0x3F,0xFF,0xF0,0x1F,0xBF,0xE0,0x00,0x07,0xBC,0x00,0x00,
|
||||
0x03,0x3C,0x00,0x00,0x00,0x3C,0x00,0x3C,0x00,0x3C,0x0F,0xFE,0x70,0x3D,0xFF,0xF8,
|
||||
0xF8,0x3D,0xFF,0x00,0x7C,0x3D,0xE7,0x80,0x3F,0x3D,0xE7,0x80,0x1F,0x3D,0xE7,0x8E,
|
||||
0x0E,0x3D,0xE7,0x9F,0x00,0x3D,0xE7,0xFE,0x00,0x39,0xE7,0xF8,0x00,0x39,0xE3,0xF0,
|
||||
0x1C,0x39,0xE3,0xC0,0x1E,0x79,0xE3,0xC0,0x1E,0x79,0xE1,0xE0,0x1E,0x79,0xE1,0xE0,
|
||||
0x3C,0x79,0xE0,0xF0,0x3C,0x79,0xE0,0xF8,0x3C,0xF1,0xE0,0x7C,0x3C,0xF1,0xE3,0x7C,
|
||||
0x7D,0xF1,0xEF,0x3F,0x79,0xE1,0xFE,0x1F,0x7B,0xE1,0xF8,0x0E,0x7B,0xC3,0xE0,0x00,
|
||||
0x79,0x81,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: A --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{
|
||||
"A",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x7C,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xFE,0x00,0x00,
|
||||
0x01,0xFF,0x00,0x00,0x01,0xFF,0x00,0x00,0x01,0xEF,0x00,0x00,0x03,0xEF,0x80,0x00,
|
||||
0x03,0xCF,0x80,0x00,0x07,0xC7,0x80,0x00,0x07,0xC7,0xC0,0x00,0x07,0x87,0xC0,0x00,
|
||||
0x0F,0x83,0xE0,0x00,0x0F,0x83,0xE0,0x00,0x0F,0x01,0xE0,0x00,0x1F,0xFF,0xF0,0x00,
|
||||
0x1F,0xFF,0xF0,0x00,0x3F,0xFF,0xF8,0x00,0x3E,0x00,0xF8,0x00,0x3C,0x00,0xF8,0x00,
|
||||
0x7C,0x00,0x7C,0x00,0x7C,0x00,0x7C,0x00,0x78,0x00,0x3C,0x00,0xF8,0x00,0x3E,0x00,
|
||||
0xF8,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: a --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"a",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xF8,0x00,0x00,
|
||||
0x1F,0xFE,0x00,0x00,0x3F,0xFE,0x00,0x00,0x3E,0x3F,0x00,0x00,0x38,0x1F,0x00,0x00,
|
||||
0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x03,0xFF,0x00,0x00,0x1F,0xFF,0x00,0x00,
|
||||
0x3F,0x8F,0x00,0x00,0x7C,0x0F,0x00,0x00,0x7C,0x0F,0x00,0x00,0x78,0x1F,0x00,0x00,
|
||||
0x7C,0x1F,0x00,0x00,0x7E,0x7F,0x00,0x00,0x7F,0xFF,0x00,0x00,0x3F,0xFF,0x00,0x00,
|
||||
0x0F,0xCF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: b --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"b",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,
|
||||
0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,
|
||||
0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0xFE,0x00,0x00,
|
||||
0x3D,0xFF,0x80,0x00,0x3F,0xFF,0xC0,0x00,0x3F,0x8F,0xC0,0x00,0x3F,0x07,0xE0,0x00,
|
||||
0x3E,0x03,0xE0,0x00,0x3E,0x03,0xE0,0x00,0x3C,0x01,0xE0,0x00,0x3C,0x01,0xE0,0x00,
|
||||
0x3C,0x01,0xE0,0x00,0x3C,0x03,0xE0,0x00,0x3E,0x03,0xE0,0x00,0x3E,0x03,0xE0,0x00,
|
||||
0x3F,0x07,0xC0,0x00,0x3F,0x8F,0xC0,0x00,0x3F,0xFF,0x80,0x00,0x3F,0xFF,0x00,0x00,
|
||||
0x3C,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: c --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"c",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFC,0x00,0x00,
|
||||
0x07,0xFE,0x00,0x00,0x1F,0xFE,0x00,0x00,0x3F,0x86,0x00,0x00,0x3E,0x00,0x00,0x00,
|
||||
0x7C,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x78,0x00,0x00,0x00,
|
||||
0x78,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,
|
||||
0x3E,0x00,0x00,0x00,0x3F,0x86,0x00,0x00,0x1F,0xFE,0x00,0x00,0x0F,0xFE,0x00,0x00,
|
||||
0x03,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 微 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"微",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x01,0xE0,0x07,0x87,0x01,0xE0,
|
||||
0x07,0x07,0x01,0xC0,0x0F,0xF7,0x79,0xC0,0x1E,0xF7,0x7B,0xC0,0x1E,0xF7,0x7B,0x80,
|
||||
0x3C,0xF7,0x7B,0xFF,0x78,0xF7,0x7B,0xFF,0xF8,0xF7,0x7F,0x9E,0xF7,0xFF,0xFF,0x9E,
|
||||
0x67,0xFF,0xFF,0x9E,0x07,0x00,0x7F,0x9C,0x0F,0x00,0x0F,0x9C,0x1E,0x00,0x1F,0x9C,
|
||||
0x1E,0x7F,0xFF,0xBC,0x3E,0x7F,0xF3,0xFC,0x3E,0x00,0x03,0xFC,0x7E,0x00,0x01,0xF8,
|
||||
0xFE,0x00,0x01,0xF8,0xFE,0x7F,0xE1,0xF8,0xDE,0x7F,0xE1,0xF8,0x1E,0x78,0xE0,0xF0,
|
||||
0x1E,0x78,0xEE,0xF0,0x1E,0x78,0xFF,0xF0,0x1E,0x78,0xFD,0xF8,0x1E,0x79,0xFB,0xFC,
|
||||
0x1E,0xF1,0xF7,0xBC,0x1E,0xF0,0xEF,0x9E,0x1F,0xE0,0x0F,0x0F,0x1E,0xC0,0x1E,0x0F,
|
||||
0x1E,0x00,0x0C,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 雪 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"雪",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x1F,0xFF,0xFF,0xF8,0x1F,0xFF,0xFF,0xF8,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
|
||||
0x7F,0xFF,0xFF,0xFE,0x7F,0xFF,0xFF,0xFE,0x78,0x03,0xC0,0x1E,0x78,0x03,0xC0,0x1E,
|
||||
0x7F,0xFF,0xFF,0xFE,0x7F,0xFF,0xFF,0xFE,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
|
||||
0x07,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xE0,0x00,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,
|
||||
0x1F,0xFF,0xFF,0xF8,0x1F,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,
|
||||
0x1F,0xFF,0xFF,0xF8,0x1F,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,
|
||||
0x00,0x00,0x00,0x78,0x3F,0xFF,0xFF,0xF8,0x3F,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x78,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 电 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"电",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,
|
||||
0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x7F,0xFF,0xFF,0xF8,0x7F,0xFF,0xFF,0xF8,
|
||||
0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,
|
||||
0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x7F,0xFF,0xFF,0xF8,0x7F,0xFF,0xFF,0xF8,
|
||||
0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,
|
||||
0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x7F,0xFF,0xFF,0xF8,0x7F,0xFF,0xFF,0xF8,
|
||||
0x78,0x07,0x80,0x0E,0x78,0x07,0x80,0x0F,0x00,0x07,0x80,0x0F,0x00,0x07,0x80,0x0F,
|
||||
0x00,0x07,0x80,0x1F,0x00,0x07,0x80,0x1E,0x00,0x03,0xFF,0xFE,0x00,0x01,0xFF,0xFC,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 子 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"子",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x1F,0xFF,0xFF,0xF8,0x1F,0xFF,0xFF,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x07,0xE0,
|
||||
0x00,0x00,0x0F,0xC0,0x00,0x00,0x1F,0x80,0x00,0x00,0x3E,0x00,0x00,0x00,0xFC,0x00,
|
||||
0x00,0x01,0xF8,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,
|
||||
0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,
|
||||
0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,
|
||||
0x00,0x03,0xE0,0x00,0x00,0x03,0xC0,0x00,0x01,0xFF,0xC0,0x00,0x00,0xFF,0x80,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
|
||||
};
|
||||
|
||||
cFONT Font24CN = {
|
||||
Font24CN_Table,
|
||||
sizeof(Font24CN_Table)/sizeof(CH_CN), /*size of table*/
|
||||
24, /* ASCII Width */
|
||||
32, /* Width */
|
||||
41, /* Height */
|
||||
};
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
1004
STM32/STM32-F103ZET6/User/Fonts/font8.c
Normal file
1004
STM32/STM32-F103ZET6/User/Fonts/font8.c
Normal file
File diff suppressed because it is too large
Load diff
97
STM32/STM32-F103ZET6/User/Fonts/fonts.h
Normal file
97
STM32/STM32-F103ZET6/User/Fonts/fonts.h
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file fonts.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 18-February-2014
|
||||
* @brief Header for fonts.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __FONTS_H
|
||||
#define __FONTS_H
|
||||
|
||||
/*最大字体微软雅黑24 (32x41) */
|
||||
#define MAX_HEIGHT_FONT 41
|
||||
#define MAX_WIDTH_FONT 32
|
||||
#define OFFSET_BITMAP
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
|
||||
//ASCII
|
||||
typedef struct _tFont
|
||||
{
|
||||
const uint8_t *table;
|
||||
uint16_t Width;
|
||||
uint16_t Height;
|
||||
|
||||
} sFONT;
|
||||
|
||||
|
||||
//GB2312
|
||||
typedef struct // 汉字字模数据结构
|
||||
{
|
||||
unsigned char index[2]; // 汉字内码索引
|
||||
const char matrix[MAX_HEIGHT_FONT*MAX_WIDTH_FONT/8]; // 点阵码数据
|
||||
}CH_CN;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const CH_CN *table;
|
||||
uint16_t size;
|
||||
uint16_t ASCII_Width;
|
||||
uint16_t Width;
|
||||
uint16_t Height;
|
||||
|
||||
}cFONT;
|
||||
|
||||
extern sFONT Font24;
|
||||
extern sFONT Font20;
|
||||
extern sFONT Font16;
|
||||
extern sFONT Font12;
|
||||
extern sFONT Font8;
|
||||
|
||||
extern cFONT Font12CN;
|
||||
extern cFONT Font24CN;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __FONTS_H */
|
||||
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
725
STM32/STM32-F103ZET6/User/GUI/GUI_Paint.c
Normal file
725
STM32/STM32-F103ZET6/User/GUI/GUI_Paint.c
Normal file
|
|
@ -0,0 +1,725 @@
|
|||
/******************************************************************************
|
||||
* | File : GUI_Paint.c
|
||||
* | Author : Waveshare electronics
|
||||
* | Function : Achieve drawing: draw points, lines, boxes, circles and
|
||||
* their size, solid dotted line, solid rectangle hollow
|
||||
* rectangle, solid circle hollow circle.
|
||||
* | Info :
|
||||
* Achieve display characters: Display a single character, string, number
|
||||
* Achieve time display: adaptive size display time minutes and seconds
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-04-18
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-04-18):
|
||||
* 1.Change:
|
||||
* Paint_DrawPoint(..., DOT_STYLE DOT_STYLE)
|
||||
* => Paint_DrawPoint(..., DOT_STYLE Dot_Style)
|
||||
* Paint_DrawLine(..., LINE_STYLE Line_Style, DOT_PIXEL Dot_Pixel)
|
||||
* => Paint_DrawLine(..., DOT_PIXEL Line_width, LINE_STYLE Line_Style)
|
||||
* Paint_DrawRectangle(..., DRAW_FILL Filled, DOT_PIXEL Dot_Pixel)
|
||||
* => Paint_DrawRectangle(..., DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
|
||||
* Paint_DrawCircle(..., DRAW_FILL Draw_Fill, DOT_PIXEL Dot_Pixel)
|
||||
* => Paint_DrawCircle(..., DOT_PIXEL Line_width, DRAW_FILL Draw_Filll)
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-15):
|
||||
* 1.add: Paint_NewImage()
|
||||
* Create an image's properties
|
||||
* 2.add: Paint_SelectImage()
|
||||
* Select the picture to be drawn
|
||||
* 3.add: Paint_SetRotate()
|
||||
* Set the direction of the cache
|
||||
* 4.add: Paint_RotateImage()
|
||||
* Can flip the picture, Support 0-360 degrees,
|
||||
* but only 90.180.270 rotation is better
|
||||
* 4.add: Paint_SetMirroring()
|
||||
* Can Mirroring the picture, horizontal, vertical, origin
|
||||
* 5.add: Paint_DrawString_CN()
|
||||
* Can display Chinese(GB1312)
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
* V1.0(2018-07-17):
|
||||
* Create library
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#include "GUI_Paint.h"
|
||||
#include "DEV_Config.h"
|
||||
#include "Debug.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h> //memset()
|
||||
#include <math.h>
|
||||
|
||||
PAINT Paint;
|
||||
|
||||
/******************************************************************************
|
||||
function: Create Image
|
||||
parameter:
|
||||
image : Pointer to the image cache
|
||||
width : The width of the picture
|
||||
Height : The height of the picture
|
||||
Color : Whether the picture is inverted
|
||||
******************************************************************************/
|
||||
void Paint_NewImage(UBYTE *image, UWORD Width, UWORD Height, UWORD Rotate, UWORD Color)
|
||||
{
|
||||
Paint.Image = NULL;
|
||||
Paint.Image = image;
|
||||
|
||||
Paint.WidthMemory = Width;
|
||||
Paint.HeightMemory = Height;
|
||||
Paint.Color = Color;
|
||||
Paint.WidthByte = (Width % 8 == 0)? (Width / 8 ): (Width / 8 + 1);
|
||||
Paint.HeightByte = Height;
|
||||
// printf("WidthByte = %d, HeightByte = %d\r\n", Paint.WidthByte, Paint.HeightByte);
|
||||
// printf(" EPD_WIDTH / 8 = %d\r\n", 122 / 8);
|
||||
|
||||
Paint.Rotate = Rotate;
|
||||
Paint.Mirror = MIRROR_NONE;
|
||||
|
||||
if(Rotate == ROTATE_0 || Rotate == ROTATE_180) {
|
||||
Paint.Width = Width;
|
||||
Paint.Height = Height;
|
||||
} else {
|
||||
Paint.Width = Height;
|
||||
Paint.Height = Width;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Select Image
|
||||
parameter:
|
||||
image : Pointer to the image cache
|
||||
******************************************************************************/
|
||||
void Paint_SelectImage(UBYTE *image)
|
||||
{
|
||||
Paint.Image = image;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Select Image Rotate
|
||||
parameter:
|
||||
Rotate : 0,90,180,270
|
||||
******************************************************************************/
|
||||
void Paint_SetRotate(UWORD Rotate)
|
||||
{
|
||||
if(Rotate == ROTATE_0 || Rotate == ROTATE_90 || Rotate == ROTATE_180 || Rotate == ROTATE_270) {
|
||||
Debug("Set image Rotate %d\r\n", Rotate);
|
||||
Paint.Rotate = Rotate;
|
||||
} else {
|
||||
Debug("rotate = 0, 90, 180, 270\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Select Image mirror
|
||||
parameter:
|
||||
mirror :Not mirror,Horizontal mirror,Vertical mirror,Origin mirror
|
||||
******************************************************************************/
|
||||
void Paint_SetMirroring(UBYTE mirror)
|
||||
{
|
||||
if(mirror == MIRROR_NONE || mirror == MIRROR_HORIZONTAL ||
|
||||
mirror == MIRROR_VERTICAL || mirror == MIRROR_ORIGIN) {
|
||||
Debug("mirror image x:%s, y:%s\r\n",(mirror & 0x01)? "mirror":"none", ((mirror >> 1) & 0x01)? "mirror":"none");
|
||||
Paint.Mirror = mirror;
|
||||
} else {
|
||||
Debug("mirror should be MIRROR_NONE, MIRROR_HORIZONTAL, \
|
||||
MIRROR_VERTICAL or MIRROR_ORIGIN\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Draw Pixels
|
||||
parameter:
|
||||
Xpoint : At point X
|
||||
Ypoint : At point Y
|
||||
Color : Painted colors
|
||||
******************************************************************************/
|
||||
void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
|
||||
{
|
||||
if(Xpoint > Paint.Width || Ypoint > Paint.Height){
|
||||
Debug("Exceeding display boundaries\r\n");
|
||||
return;
|
||||
}
|
||||
UWORD X, Y;
|
||||
|
||||
switch(Paint.Rotate) {
|
||||
case 0:
|
||||
X = Xpoint;
|
||||
Y = Ypoint;
|
||||
break;
|
||||
case 90:
|
||||
X = Paint.WidthMemory - Ypoint - 1;
|
||||
Y = Xpoint;
|
||||
break;
|
||||
case 180:
|
||||
X = Paint.WidthMemory - Xpoint - 1;
|
||||
Y = Paint.HeightMemory - Ypoint - 1;
|
||||
break;
|
||||
case 270:
|
||||
X = Ypoint;
|
||||
Y = Paint.HeightMemory - Xpoint - 1;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
switch(Paint.Mirror) {
|
||||
case MIRROR_NONE:
|
||||
break;
|
||||
case MIRROR_HORIZONTAL:
|
||||
X = Paint.WidthMemory - X - 1;
|
||||
break;
|
||||
case MIRROR_VERTICAL:
|
||||
Y = Paint.HeightMemory - Y - 1;
|
||||
break;
|
||||
case MIRROR_ORIGIN:
|
||||
X = Paint.WidthMemory - X - 1;
|
||||
Y = Paint.HeightMemory - Y - 1;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if(X > Paint.WidthMemory || Y > Paint.HeightMemory){
|
||||
Debug("Exceeding display boundaries\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
UDOUBLE Addr = X / 8 + Y * Paint.WidthByte;
|
||||
UBYTE Rdata = Paint.Image[Addr];
|
||||
if(Color == BLACK)
|
||||
Paint.Image[Addr] = Rdata & ~(0x80 >> (X % 8));
|
||||
else
|
||||
Paint.Image[Addr] = Rdata | (0x80 >> (X % 8));
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Clear the color of the picture
|
||||
parameter:
|
||||
Color : Painted colors
|
||||
******************************************************************************/
|
||||
void Paint_Clear(UWORD Color)
|
||||
{
|
||||
for (UWORD Y = 0; Y < Paint.HeightByte; Y++) {
|
||||
for (UWORD X = 0; X < Paint.WidthByte; X++ ) {//8 pixel = 1 byte
|
||||
UDOUBLE Addr = X + Y*Paint.WidthByte;
|
||||
Paint.Image[Addr] = Color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Clear the color of a window
|
||||
parameter:
|
||||
Xstart : x starting point
|
||||
Ystart : Y starting point
|
||||
Xend : x end point
|
||||
Yend : y end point
|
||||
Color : Painted colors
|
||||
******************************************************************************/
|
||||
void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color)
|
||||
{
|
||||
UWORD X, Y;
|
||||
for (Y = Ystart; Y < Yend; Y++) {
|
||||
for (X = Xstart; X < Xend; X++) {//8 pixel = 1 byte
|
||||
Paint_SetPixel(X, Y, Color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Draw Point(Xpoint, Ypoint) Fill the color
|
||||
parameter:
|
||||
Xpoint : The Xpoint coordinate of the point
|
||||
Ypoint : The Ypoint coordinate of the point
|
||||
Color : Painted color
|
||||
Dot_Pixel : point size
|
||||
Dot_Style : point Style
|
||||
******************************************************************************/
|
||||
void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color,
|
||||
DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_Style)
|
||||
{
|
||||
if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
|
||||
Debug("Paint_DrawPoint Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
int16_t XDir_Num , YDir_Num;
|
||||
if (Dot_Style == DOT_FILL_AROUND) {
|
||||
for (XDir_Num = 0; XDir_Num < 2 * Dot_Pixel - 1; XDir_Num++) {
|
||||
for (YDir_Num = 0; YDir_Num < 2 * Dot_Pixel - 1; YDir_Num++) {
|
||||
if(Xpoint + XDir_Num - Dot_Pixel < 0 || Ypoint + YDir_Num - Dot_Pixel < 0)
|
||||
break;
|
||||
// printf("x = %d, y = %d\r\n", Xpoint + XDir_Num - Dot_Pixel, Ypoint + YDir_Num - Dot_Pixel);
|
||||
Paint_SetPixel(Xpoint + XDir_Num - Dot_Pixel, Ypoint + YDir_Num - Dot_Pixel, Color);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (XDir_Num = 0; XDir_Num < Dot_Pixel; XDir_Num++) {
|
||||
for (YDir_Num = 0; YDir_Num < Dot_Pixel; YDir_Num++) {
|
||||
Paint_SetPixel(Xpoint + XDir_Num - 1, Ypoint + YDir_Num - 1, Color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Draw a line of arbitrary slope
|
||||
parameter:
|
||||
Xstart :Starting Xpoint point coordinates
|
||||
Ystart :Starting Xpoint point coordinates
|
||||
Xend :End point Xpoint coordinate
|
||||
Yend :End point Ypoint coordinate
|
||||
Color :The color of the line segment
|
||||
Line_width : Line width
|
||||
Line_Style: Solid and dotted lines
|
||||
******************************************************************************/
|
||||
void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend,
|
||||
UWORD Color, DOT_PIXEL Line_width, LINE_STYLE Line_Style)
|
||||
{
|
||||
if (Xstart > Paint.Width || Ystart > Paint.Height ||
|
||||
Xend > Paint.Width || Yend > Paint.Height) {
|
||||
Debug("Paint_DrawLine Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
UWORD Xpoint = Xstart;
|
||||
UWORD Ypoint = Ystart;
|
||||
int dx = (int)Xend - (int)Xstart >= 0 ? Xend - Xstart : Xstart - Xend;
|
||||
int dy = (int)Yend - (int)Ystart <= 0 ? Yend - Ystart : Ystart - Yend;
|
||||
|
||||
// Increment direction, 1 is positive, -1 is counter;
|
||||
int XAddway = Xstart < Xend ? 1 : -1;
|
||||
int YAddway = Ystart < Yend ? 1 : -1;
|
||||
|
||||
//Cumulative error
|
||||
int Esp = dx + dy;
|
||||
char Dotted_Len = 0;
|
||||
|
||||
for (;;) {
|
||||
Dotted_Len++;
|
||||
//Painted dotted line, 2 point is really virtual
|
||||
if (Line_Style == LINE_STYLE_DOTTED && Dotted_Len % 3 == 0) {
|
||||
//Debug("LINE_DOTTED\r\n");
|
||||
Paint_DrawPoint(Xpoint, Ypoint, IMAGE_BACKGROUND, Line_width, DOT_STYLE_DFT);
|
||||
Dotted_Len = 0;
|
||||
} else {
|
||||
Paint_DrawPoint(Xpoint, Ypoint, Color, Line_width, DOT_STYLE_DFT);
|
||||
}
|
||||
if (2 * Esp >= dy) {
|
||||
if (Xpoint == Xend)
|
||||
break;
|
||||
Esp += dy;
|
||||
Xpoint += XAddway;
|
||||
}
|
||||
if (2 * Esp <= dx) {
|
||||
if (Ypoint == Yend)
|
||||
break;
|
||||
Esp += dx;
|
||||
Ypoint += YAddway;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Draw a rectangle
|
||||
parameter:
|
||||
Xstart :Rectangular Starting Xpoint point coordinates
|
||||
Ystart :Rectangular Starting Xpoint point coordinates
|
||||
Xend :Rectangular End point Xpoint coordinate
|
||||
Yend :Rectangular End point Ypoint coordinate
|
||||
Color :The color of the Rectangular segment
|
||||
Line_width: Line width
|
||||
Draw_Fill : Whether to fill the inside of the rectangle
|
||||
******************************************************************************/
|
||||
void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend,
|
||||
UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
|
||||
{
|
||||
if (Xstart > Paint.Width || Ystart > Paint.Height ||
|
||||
Xend > Paint.Width || Yend > Paint.Height) {
|
||||
Debug("Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Draw_Fill) {
|
||||
UWORD Ypoint;
|
||||
for(Ypoint = Ystart; Ypoint < Yend; Ypoint++) {
|
||||
Paint_DrawLine(Xstart, Ypoint, Xend, Ypoint, Color , Line_width, LINE_STYLE_SOLID);
|
||||
}
|
||||
} else {
|
||||
Paint_DrawLine(Xstart, Ystart, Xend, Ystart, Color, Line_width, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(Xstart, Ystart, Xstart, Yend, Color, Line_width, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(Xend, Yend, Xend, Ystart, Color, Line_width, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(Xend, Yend, Xstart, Yend, Color, Line_width, LINE_STYLE_SOLID);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Use the 8-point method to draw a circle of the
|
||||
specified size at the specified position->
|
||||
parameter:
|
||||
X_Center :Center X coordinate
|
||||
Y_Center :Center Y coordinate
|
||||
Radius :circle Radius
|
||||
Color :The color of the :circle segment
|
||||
Line_width: Line width
|
||||
Draw_Fill : Whether to fill the inside of the Circle
|
||||
******************************************************************************/
|
||||
void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius,
|
||||
UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
|
||||
{
|
||||
if (X_Center > Paint.Width || Y_Center >= Paint.Height) {
|
||||
Debug("Paint_DrawCircle Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//Draw a circle from(0, R) as a starting point
|
||||
int16_t XCurrent, YCurrent;
|
||||
XCurrent = 0;
|
||||
YCurrent = Radius;
|
||||
|
||||
//Cumulative error,judge the next point of the logo
|
||||
int16_t Esp = 3 - (Radius << 1 );
|
||||
|
||||
int16_t sCountY;
|
||||
if (Draw_Fill == DRAW_FILL_FULL) {
|
||||
while (XCurrent <= YCurrent ) { //Realistic circles
|
||||
for (sCountY = XCurrent; sCountY <= YCurrent; sCountY ++ ) {
|
||||
Paint_DrawPoint(X_Center + XCurrent, Y_Center + sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//1
|
||||
Paint_DrawPoint(X_Center - XCurrent, Y_Center + sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//2
|
||||
Paint_DrawPoint(X_Center - sCountY, Y_Center + XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//3
|
||||
Paint_DrawPoint(X_Center - sCountY, Y_Center - XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//4
|
||||
Paint_DrawPoint(X_Center - XCurrent, Y_Center - sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//5
|
||||
Paint_DrawPoint(X_Center + XCurrent, Y_Center - sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//6
|
||||
Paint_DrawPoint(X_Center + sCountY, Y_Center - XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//7
|
||||
Paint_DrawPoint(X_Center + sCountY, Y_Center + XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
}
|
||||
if (Esp < 0 )
|
||||
Esp += 4 * XCurrent + 6;
|
||||
else {
|
||||
Esp += 10 + 4 * (XCurrent - YCurrent );
|
||||
YCurrent --;
|
||||
}
|
||||
XCurrent ++;
|
||||
}
|
||||
} else { //Draw a hollow circle
|
||||
while (XCurrent <= YCurrent ) {
|
||||
Paint_DrawPoint(X_Center + XCurrent, Y_Center + YCurrent, Color, Line_width, DOT_STYLE_DFT);//1
|
||||
Paint_DrawPoint(X_Center - XCurrent, Y_Center + YCurrent, Color, Line_width, DOT_STYLE_DFT);//2
|
||||
Paint_DrawPoint(X_Center - YCurrent, Y_Center + XCurrent, Color, Line_width, DOT_STYLE_DFT);//3
|
||||
Paint_DrawPoint(X_Center - YCurrent, Y_Center - XCurrent, Color, Line_width, DOT_STYLE_DFT);//4
|
||||
Paint_DrawPoint(X_Center - XCurrent, Y_Center - YCurrent, Color, Line_width, DOT_STYLE_DFT);//5
|
||||
Paint_DrawPoint(X_Center + XCurrent, Y_Center - YCurrent, Color, Line_width, DOT_STYLE_DFT);//6
|
||||
Paint_DrawPoint(X_Center + YCurrent, Y_Center - XCurrent, Color, Line_width, DOT_STYLE_DFT);//7
|
||||
Paint_DrawPoint(X_Center + YCurrent, Y_Center + XCurrent, Color, Line_width, DOT_STYLE_DFT);//0
|
||||
|
||||
if (Esp < 0 )
|
||||
Esp += 4 * XCurrent + 6;
|
||||
else {
|
||||
Esp += 10 + 4 * (XCurrent - YCurrent );
|
||||
YCurrent --;
|
||||
}
|
||||
XCurrent ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Show English characters
|
||||
parameter:
|
||||
Xpoint :X coordinate
|
||||
Ypoint :Y coordinate
|
||||
Acsii_Char :To display the English characters
|
||||
Font :A structure pointer that displays a character size
|
||||
Color_Foreground : Select the foreground color
|
||||
Color_Background : Select the background color
|
||||
******************************************************************************/
|
||||
void Paint_DrawChar(UWORD Xpoint, UWORD Ypoint, const char Acsii_Char,
|
||||
sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
|
||||
{
|
||||
UWORD Page, Column;
|
||||
|
||||
if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
|
||||
Debug("Paint_DrawChar Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t Char_Offset = (Acsii_Char - ' ') * Font->Height * (Font->Width / 8 + (Font->Width % 8 ? 1 : 0));
|
||||
const unsigned char *ptr = &Font->table[Char_Offset];
|
||||
|
||||
for (Page = 0; Page < Font->Height; Page ++ ) {
|
||||
for (Column = 0; Column < Font->Width; Column ++ ) {
|
||||
|
||||
//To determine whether the font background color and screen background color is consistent
|
||||
if (FONT_BACKGROUND == Color_Background) { //this process is to speed up the scan
|
||||
if (*ptr & (0x80 >> (Column % 8)))
|
||||
Paint_SetPixel(Xpoint + Column, Ypoint + Page, Color_Foreground);
|
||||
// Paint_DrawPoint(Xpoint + Column, Ypoint + Page, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
} else {
|
||||
if (*ptr & (0x80 >> (Column % 8))) {
|
||||
Paint_SetPixel(Xpoint + Column, Ypoint + Page, Color_Foreground);
|
||||
// Paint_DrawPoint(Xpoint + Column, Ypoint + Page, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
} else {
|
||||
Paint_SetPixel(Xpoint + Column, Ypoint + Page, Color_Background);
|
||||
// Paint_DrawPoint(Xpoint + Column, Ypoint + Page, Color_Background, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
}
|
||||
}
|
||||
//One pixel is 8 bits
|
||||
if (Column % 8 == 7)
|
||||
ptr++;
|
||||
}// Write a line
|
||||
if (Font->Width % 8 != 0)
|
||||
ptr++;
|
||||
}// Write all
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Display the string
|
||||
parameter:
|
||||
Xstart :X coordinate
|
||||
Ystart :Y coordinate
|
||||
pString :The first address of the English string to be displayed
|
||||
Font :A structure pointer that displays a character size
|
||||
Color_Foreground : Select the foreground color
|
||||
Color_Background : Select the background color
|
||||
******************************************************************************/
|
||||
void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString,
|
||||
sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
|
||||
{
|
||||
UWORD Xpoint = Xstart;
|
||||
UWORD Ypoint = Ystart;
|
||||
|
||||
if (Xstart > Paint.Width || Ystart > Paint.Height) {
|
||||
Debug("Paint_DrawString_EN Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
while (* pString != '\0') {
|
||||
//if X direction filled , reposition to(Xstart,Ypoint),Ypoint is Y direction plus the Height of the character
|
||||
if ((Xpoint + Font->Width ) > Paint.Width ) {
|
||||
Xpoint = Xstart;
|
||||
Ypoint += Font->Height;
|
||||
}
|
||||
|
||||
// If the Y direction is full, reposition to(Xstart, Ystart)
|
||||
if ((Ypoint + Font->Height ) > Paint.Height ) {
|
||||
Xpoint = Xstart;
|
||||
Ypoint = Ystart;
|
||||
}
|
||||
Paint_DrawChar(Xpoint, Ypoint, * pString, Font, Color_Background, Color_Foreground);
|
||||
|
||||
//The next character of the address
|
||||
pString ++;
|
||||
|
||||
//The next word of the abscissa increases the font of the broadband
|
||||
Xpoint += Font->Width;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function: Display the string
|
||||
parameter:
|
||||
Xstart :X coordinate
|
||||
Ystart :Y coordinate
|
||||
pString :The first address of the Chinese string and English
|
||||
string to be displayed
|
||||
Font :A structure pointer that displays a character size
|
||||
Color_Foreground : Select the foreground color
|
||||
Color_Background : Select the background color
|
||||
******************************************************************************/
|
||||
void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font,
|
||||
UWORD Color_Foreground, UWORD Color_Background)
|
||||
{
|
||||
const char* p_text = pString;
|
||||
int x = Xstart, y = Ystart;
|
||||
int i, j,Num;
|
||||
|
||||
/* Send the string character by character on EPD */
|
||||
while (*p_text != 0) {
|
||||
if(*p_text <= 0x7F) { //ASCII < 126
|
||||
for(Num = 0; Num < font->size; Num++) {
|
||||
if(*p_text== font->table[Num].index[0]) {
|
||||
const char* ptr = &font->table[Num].matrix[0];
|
||||
|
||||
for (j = 0; j < font->Height; j++) {
|
||||
for (i = 0; i < font->Width; i++) {
|
||||
if (FONT_BACKGROUND == Color_Background) { //this process is to speed up the scan
|
||||
if (*ptr & (0x80 >> (i % 8))) {
|
||||
Paint_SetPixel(x + i, y + j, Color_Foreground);
|
||||
// Paint_DrawPoint(x + i, y + j, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
}
|
||||
} else {
|
||||
if (*ptr & (0x80 >> (i % 8))) {
|
||||
Paint_SetPixel(x + i, y + j, Color_Foreground);
|
||||
// Paint_DrawPoint(x + i, y + j, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
} else {
|
||||
Paint_SetPixel(x + i, y + j, Color_Background);
|
||||
// Paint_DrawPoint(x + i, y + j, Color_Background, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
}
|
||||
}
|
||||
if (i % 8 == 7) {
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
if (font->Width % 8 != 0) {
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Point on the next character */
|
||||
p_text += 1;
|
||||
/* Decrement the column position by 16 */
|
||||
x += font->ASCII_Width;
|
||||
} else { //Chinese
|
||||
for(Num = 0; Num < font->size; Num++) {
|
||||
if((*p_text== font->table[Num].index[0]) && (*(p_text+1) == font->table[Num].index[1])) {
|
||||
const char* ptr = &font->table[Num].matrix[0];
|
||||
|
||||
for (j = 0; j < font->Height; j++) {
|
||||
for (i = 0; i < font->Width; i++) {
|
||||
if (FONT_BACKGROUND == Color_Background) { //this process is to speed up the scan
|
||||
if (*ptr & (0x80 >> (i % 8))) {
|
||||
Paint_SetPixel(x + i, y + j, Color_Foreground);
|
||||
// Paint_DrawPoint(x + i, y + j, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
}
|
||||
} else {
|
||||
if (*ptr & (0x80 >> (i % 8))) {
|
||||
Paint_SetPixel(x + i, y + j, Color_Foreground);
|
||||
// Paint_DrawPoint(x + i, y + j, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
} else {
|
||||
Paint_SetPixel(x + i, y + j, Color_Background);
|
||||
// Paint_DrawPoint(x + i, y + j, Color_Background, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
}
|
||||
}
|
||||
if (i % 8 == 7) {
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
if (font->Width % 8 != 0) {
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Point on the next character */
|
||||
p_text += 2;
|
||||
/* Decrement the column position by 16 */
|
||||
x += font->Width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Display nummber
|
||||
parameter:
|
||||
Xstart :X coordinate
|
||||
Ystart : Y coordinate
|
||||
Nummber : The number displayed
|
||||
Font :A structure pointer that displays a character size
|
||||
Color_Foreground : Select the foreground color
|
||||
Color_Background : Select the background color
|
||||
******************************************************************************/
|
||||
#define ARRAY_LEN 255
|
||||
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, int32_t Nummber,
|
||||
sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
|
||||
{
|
||||
|
||||
int16_t Num_Bit = 0, Str_Bit = 0;
|
||||
uint8_t Str_Array[ARRAY_LEN] = {0}, Num_Array[ARRAY_LEN] = {0};
|
||||
uint8_t *pStr = Str_Array;
|
||||
|
||||
if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
|
||||
Debug("Paint_DisNum Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//Converts a number to a string
|
||||
while (Nummber) {
|
||||
Num_Array[Num_Bit] = Nummber % 10 + '0';
|
||||
Num_Bit++;
|
||||
Nummber /= 10;
|
||||
}
|
||||
|
||||
//The string is inverted
|
||||
while (Num_Bit > 0) {
|
||||
Str_Array[Str_Bit] = Num_Array[Num_Bit - 1];
|
||||
Str_Bit ++;
|
||||
Num_Bit --;
|
||||
}
|
||||
|
||||
//show
|
||||
Paint_DrawString_EN(Xpoint, Ypoint, (const char*)pStr, Font, Color_Background, Color_Foreground);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Display time
|
||||
parameter:
|
||||
Xstart :X coordinate
|
||||
Ystart : Y coordinate
|
||||
pTime : Time-related structures
|
||||
Font :A structure pointer that displays a character size
|
||||
Color_Foreground : Select the foreground color
|
||||
Color_Background : Select the background color
|
||||
******************************************************************************/
|
||||
void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font,
|
||||
UWORD Color_Foreground, UWORD Color_Background)
|
||||
{
|
||||
uint8_t value[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
|
||||
|
||||
UWORD Dx = Font->Width;
|
||||
|
||||
//Write data into the cache
|
||||
Paint_DrawChar(Xstart , Ystart, value[pTime->Hour / 10], Font, Color_Background, Color_Foreground);
|
||||
Paint_DrawChar(Xstart + Dx , Ystart, value[pTime->Hour % 10], Font, Color_Background, Color_Foreground);
|
||||
Paint_DrawChar(Xstart + Dx + Dx / 4 + Dx / 2 , Ystart, ':' , Font, Color_Background, Color_Foreground);
|
||||
Paint_DrawChar(Xstart + Dx * 2 + Dx / 2 , Ystart, value[pTime->Min / 10] , Font, Color_Background, Color_Foreground);
|
||||
Paint_DrawChar(Xstart + Dx * 3 + Dx / 2 , Ystart, value[pTime->Min % 10] , Font, Color_Background, Color_Foreground);
|
||||
Paint_DrawChar(Xstart + Dx * 4 + Dx / 2 - Dx / 4, Ystart, ':' , Font, Color_Background, Color_Foreground);
|
||||
Paint_DrawChar(Xstart + Dx * 5 , Ystart, value[pTime->Sec / 10] , Font, Color_Background, Color_Foreground);
|
||||
Paint_DrawChar(Xstart + Dx * 6 , Ystart, value[pTime->Sec % 10] , Font, Color_Background, Color_Foreground);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Display monochrome bitmap
|
||||
parameter:
|
||||
image_buffer :A picture data converted to a bitmap
|
||||
info:
|
||||
Use a computer to convert the image into a corresponding array,
|
||||
and then embed the array directly into Imagedata.cpp as a .c file.
|
||||
******************************************************************************/
|
||||
void Paint_DrawBitMap(const unsigned char* image_buffer)
|
||||
{
|
||||
UWORD x, y;
|
||||
UDOUBLE Addr = 0;
|
||||
|
||||
for (y = 0; y < Paint.HeightByte; y++) {
|
||||
for (x = 0; x < Paint.WidthByte; x++) {//8 pixel = 1 byte
|
||||
Addr = x + y * Paint.WidthByte;
|
||||
Paint.Image[Addr] = (unsigned char)image_buffer[Addr];
|
||||
}
|
||||
}
|
||||
}
|
||||
203
STM32/STM32-F103ZET6/User/GUI/GUI_Paint.h
Normal file
203
STM32/STM32-F103ZET6/User/GUI/GUI_Paint.h
Normal file
|
|
@ -0,0 +1,203 @@
|
|||
/******************************************************************************
|
||||
* | File : GUI_Paint.h
|
||||
* | Author : Waveshare electronics
|
||||
* | Function : Achieve drawing: draw points, lines, boxes, circles and
|
||||
* their size, solid dotted line, solid rectangle hollow
|
||||
* rectangle, solid circle hollow circle.
|
||||
* | Info :
|
||||
* Achieve display characters: Display a single character, string, number
|
||||
* Achieve time display: adaptive size display time minutes and seconds
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-04-18
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-04-18):
|
||||
* 1.Change:
|
||||
* Paint_DrawPoint(..., DOT_STYLE DOT_STYLE)
|
||||
* => Paint_DrawPoint(..., DOT_STYLE Dot_Style)
|
||||
* Paint_DrawLine(..., LINE_STYLE Line_Style, DOT_PIXEL Dot_Pixel)
|
||||
* => Paint_DrawLine(..., DOT_PIXEL Line_width, LINE_STYLE Line_Style)
|
||||
* Paint_DrawRectangle(..., DRAW_FILL Filled, DOT_PIXEL Dot_Pixel)
|
||||
* => Paint_DrawRectangle(..., DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
|
||||
* Paint_DrawCircle(..., DRAW_FILL Draw_Fill, DOT_PIXEL Dot_Pixel)
|
||||
* => Paint_DrawCircle(..., DOT_PIXEL Line_width, DRAW_FILL Draw_Filll)
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-15):
|
||||
* 1.add: Paint_NewImage()
|
||||
* Create an image's properties
|
||||
* 2.add: Paint_SelectImage()
|
||||
* Select the picture to be drawn
|
||||
* 3.add: Paint_SetRotate()
|
||||
* Set the direction of the cache
|
||||
* 4.add: Paint_RotateImage()
|
||||
* Can flip the picture, Support 0-360 degrees,
|
||||
* but only 90.180.270 rotation is better
|
||||
* 4.add: Paint_SetMirroring()
|
||||
* Can Mirroring the picture, horizontal, vertical, origin
|
||||
* 5.add: Paint_DrawString_CN()
|
||||
* Can display Chinese(GB1312)
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
* V1.0(2018-07-17):
|
||||
* Create library
|
||||
*
|
||||
* 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 __GUI_PAINT_H
|
||||
#define __GUI_PAINT_H
|
||||
|
||||
#include "DEV_Config.h"
|
||||
#include "../Fonts/fonts.h"
|
||||
|
||||
/**
|
||||
* Image attributes
|
||||
**/
|
||||
typedef struct {
|
||||
UBYTE *Image;
|
||||
UWORD Width;
|
||||
UWORD Height;
|
||||
UWORD WidthMemory;
|
||||
UWORD HeightMemory;
|
||||
UWORD Color;
|
||||
UWORD Rotate;
|
||||
UWORD Mirror;
|
||||
UWORD WidthByte;
|
||||
UWORD HeightByte;
|
||||
} PAINT;
|
||||
extern PAINT Paint;
|
||||
|
||||
/**
|
||||
* Display rotate
|
||||
**/
|
||||
#define ROTATE_0 0
|
||||
#define ROTATE_90 90
|
||||
#define ROTATE_180 180
|
||||
#define ROTATE_270 270
|
||||
|
||||
/**
|
||||
* Display Flip
|
||||
**/
|
||||
typedef enum {
|
||||
MIRROR_NONE = 0x00,
|
||||
MIRROR_HORIZONTAL = 0x01,
|
||||
MIRROR_VERTICAL = 0x02,
|
||||
MIRROR_ORIGIN = 0x03,
|
||||
} MIRROR_IMAGE;
|
||||
#define MIRROR_IMAGE_DFT MIRROR_NONE
|
||||
|
||||
/**
|
||||
* image color
|
||||
**/
|
||||
#define WHITE 0xFF
|
||||
#define BLACK 0x00
|
||||
#define RED BLACK
|
||||
|
||||
#define IMAGE_BACKGROUND WHITE
|
||||
#define FONT_FOREGROUND BLACK
|
||||
#define FONT_BACKGROUND WHITE
|
||||
|
||||
/**
|
||||
* The size of the point
|
||||
**/
|
||||
typedef enum {
|
||||
DOT_PIXEL_1X1 = 1, // 1 x 1
|
||||
DOT_PIXEL_2X2 , // 2 X 2
|
||||
DOT_PIXEL_3X3 , // 3 X 3
|
||||
DOT_PIXEL_4X4 , // 4 X 4
|
||||
DOT_PIXEL_5X5 , // 5 X 5
|
||||
DOT_PIXEL_6X6 , // 6 X 6
|
||||
DOT_PIXEL_7X7 , // 7 X 7
|
||||
DOT_PIXEL_8X8 , // 8 X 8
|
||||
} DOT_PIXEL;
|
||||
#define DOT_PIXEL_DFT DOT_PIXEL_1X1 //Default dot pilex
|
||||
|
||||
/**
|
||||
* Point size fill style
|
||||
**/
|
||||
typedef enum {
|
||||
DOT_FILL_AROUND = 1, // dot pixel 1 x 1
|
||||
DOT_FILL_RIGHTUP , // dot pixel 2 X 2
|
||||
} DOT_STYLE;
|
||||
#define DOT_STYLE_DFT DOT_FILL_AROUND //Default dot pilex
|
||||
|
||||
/**
|
||||
* Line style, solid or dashed
|
||||
**/
|
||||
typedef enum {
|
||||
LINE_STYLE_SOLID = 0,
|
||||
LINE_STYLE_DOTTED,
|
||||
} LINE_STYLE;
|
||||
|
||||
/**
|
||||
* Whether the graphic is filled
|
||||
**/
|
||||
typedef enum {
|
||||
DRAW_FILL_EMPTY = 0,
|
||||
DRAW_FILL_FULL,
|
||||
} DRAW_FILL;
|
||||
|
||||
/**
|
||||
* Custom structure of a time attribute
|
||||
**/
|
||||
typedef struct {
|
||||
UWORD Year; //0000
|
||||
UBYTE Month; //1 - 12
|
||||
UBYTE Day; //1 - 30
|
||||
UBYTE Hour; //0 - 23
|
||||
UBYTE Min; //0 - 59
|
||||
UBYTE Sec; //0 - 59
|
||||
} PAINT_TIME;
|
||||
extern PAINT_TIME sPaint_time;
|
||||
|
||||
//init and Clear
|
||||
void Paint_NewImage(UBYTE *image, UWORD Width, UWORD Height, UWORD Rotate, UWORD Color);
|
||||
void Paint_SelectImage(UBYTE *image);
|
||||
void Paint_SetRotate(UWORD Rotate);
|
||||
void Paint_SetMirroring(UBYTE mirror);
|
||||
void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color);
|
||||
|
||||
void Paint_Clear(UWORD Color);
|
||||
void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color);
|
||||
|
||||
//Drawing
|
||||
void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_FillWay);
|
||||
void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DOT_PIXEL Line_width, LINE_STYLE Line_Style);
|
||||
void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill);
|
||||
void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill);
|
||||
|
||||
//Display string
|
||||
void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Acsii_Char, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
|
||||
void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
|
||||
void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Foreground, UWORD Color_Background);
|
||||
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, int32_t Nummber, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
|
||||
void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
|
||||
|
||||
//pic
|
||||
void Paint_DrawBitMap(const unsigned char* image_buffer);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
95
STM32/STM32-F103ZET6/User/Readme_CN.txt
Normal file
95
STM32/STM32-F103ZET6/User/Readme_CN.txt
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/*****************************************************************************
|
||||
* | File : Readme_CN.txt
|
||||
* | Author : Waveshare team
|
||||
* | Function : Help with use
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-14
|
||||
* | Info : 在这里提供一个中文版本的使用文档,以便你的快速使用
|
||||
******************************************************************************/
|
||||
这个文件是帮助您使用本例程。
|
||||
由于我们的墨水屏越来越多,不便于我们的维护,因此把所有的墨水屏程序做成一个工程。
|
||||
在这里简略的描述本工程的使用:
|
||||
|
||||
1.基本信息:
|
||||
本例程是基于HAL库进行开发的,对应的HAL固件版本为:STM32Cube_FW_F1_V1.6.1;
|
||||
本例程是基于STM32F103ZETx进行开发的,例程均在我们的Open103Z开发板进行了验证;
|
||||
本例程使用e-paper Driver HAT模块进行了验证,你可以在工程的Examples\中查看对应的测试例程;
|
||||
|
||||
2.管脚连接:
|
||||
管脚连接你可以在Config\目录下查看DEV_Config.h中查看,这里也再重述一次:
|
||||
EPD => STM32f103Z
|
||||
VCC -> 3.3
|
||||
GND -> GND
|
||||
DIN -> PA7(MOSI)
|
||||
CLK -> PA5(SCLK)
|
||||
CS -> PA4
|
||||
DC -> PA2
|
||||
RST -> PA1
|
||||
BUSY -> PA3
|
||||
|
||||
3.基本使用:
|
||||
由于本工程是一个综合工程,对于使用而言,你可能需要阅读以下内容:
|
||||
你可以在main.c中的73行到97行看到已经进行了注释的19个函数,
|
||||
请注意你购买的是哪一款的墨水屏。
|
||||
栗子1:
|
||||
如果你购买的5.83inch e-paper,那么你应该把对应的93行代码的注释去掉,即:
|
||||
// EPD_5in83_test();
|
||||
修改成:
|
||||
EPD_5in83_test();
|
||||
栗子2:
|
||||
如果你购买的2.9inch e-paper (B),由于2.9寸的B型和C型是公用的驱动代码,
|
||||
那么你应该把对应的82行代码的注释去掉,即:
|
||||
// EPD_2in9bc_test();
|
||||
修改成:
|
||||
EPD_2in9bc_test();
|
||||
注意:对于EPD_1in54_V2_test()和EPD_2in13_V2_test()请注意你的屏幕背面是否贴有V2标识。
|
||||
|
||||
4.目录结构(选读):
|
||||
如果你经常使用我们的产品,对我们的程序目录结构会十分熟悉,关于具体的函数的我们有一份
|
||||
函数的API手册,你可以在我们的WIKI上下载或像售后客服索取,这里简单介绍一次:
|
||||
Config\:此目录为硬件接口层文件,在DEV_Config.c(.h)可以看到很多定义,包括:
|
||||
数据类型:
|
||||
#define UBYTE uint8_t
|
||||
#define UWORD uint16_t
|
||||
#define UDOUBLE uint32_t
|
||||
GPIO:
|
||||
#define EPD_RST_PIN RST_GPIO_Port, RST_Pin
|
||||
#define EPD_DC_PIN DC_GPIO_Port, DC_Pin
|
||||
#define EPD_CS_PIN SPI_CS_GPIO_Port, SPI_CS_Pin
|
||||
#define EPD_BUSY_PIN BUSY_GPIO_Port, BUSY_Pin
|
||||
注意:这里没有定义DIN与CLK,因为它是硬件SPI做的处理。
|
||||
读写GPIO:
|
||||
#define DEV_Digital_Write(_pin, _value) HAL_GPIO_WritePin(_pin, _value == 0? GPIO_PIN_RESET:GPIO_PIN_SET)
|
||||
#define DEV_Digital_Read(_pin) HAL_GPIO_ReadPin(_pin)
|
||||
SPI传输数据:
|
||||
void DEV_SPI_WriteByte(UBYTE value);
|
||||
延时:
|
||||
#define DEV_Delay_ms(__xms) HAL_Delay(__xms);
|
||||
注意:此延时函数并未使用示波器测量具体数值
|
||||
模块初始化与退出的处理:
|
||||
void DEV_Module_Init(void);
|
||||
void DEV_Module_Exit(void);
|
||||
注意:1.这里是处理使用墨水屏前与使用完之后一些GPIO的处理。
|
||||
2.对于PCB带有Rev2.1的,DEV_Module_Exit()之后整个模块会进入低功耗,经过测试这个功耗基本为0;
|
||||
|
||||
GUI\:此目录为一些基本的图像处理函数,在GUI_Paint.c(.h)中:
|
||||
常用图像处理:创建图形、翻转图形、镜像图形、设置像素点、清屏等;
|
||||
常用画图处理:画点、线、框、圆、中文字符、英文字符、数字等;
|
||||
常用时间显示:提供一个常用的显示时间函数;
|
||||
常用显示图片:提供一个显示位图的函数;
|
||||
|
||||
Fonts\:为一些常用的字体:
|
||||
Ascii:
|
||||
font8: 5*8
|
||||
font12: 7*12
|
||||
font16: 11*16
|
||||
font20: 14*20
|
||||
font24: 17*24
|
||||
中文:
|
||||
font12CN: 16*21
|
||||
font24CN: 32*41
|
||||
|
||||
e-paper\:此目录下为墨水屏驱动函数;
|
||||
Examples\:此目录下为墨水屏的测试程序,你可在其中看到具体的使用方法;
|
||||
96
STM32/STM32-F103ZET6/User/Readme_EN.txt
Normal file
96
STM32/STM32-F103ZET6/User/Readme_EN.txt
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
/*****************************************************************************
|
||||
* | File : Readme_CN.txt
|
||||
* | Author : Waveshare team
|
||||
* | Function : Help with use
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-14
|
||||
* | Info : Here is an English version of the documentation for your quick use.
|
||||
******************************************************************************/
|
||||
This file is to help you use this routine.
|
||||
Since our ink screens are getting more and more, it is not convenient for our maintenance, so all the ink screen programs are made into one project.
|
||||
A brief description of the use of this project is here:
|
||||
|
||||
1. Basic information:
|
||||
This routine is developed based on the HAL library, and the corresponding HAL firmware version is: STM32Cube_FW_F1_V1.6.1;
|
||||
This routine was developed based on STM32F103ZETx, and the routines were verified on our Open103Z development board;
|
||||
This routine has been verified using the e-paper Driver HAT module. You can view the corresponding test routines in the
|
||||
Examples\ of the project;
|
||||
|
||||
2. Pin connection:
|
||||
Pin connection You can view it in DEV_Config.h in the Config\ directory, and repeat it here:
|
||||
EPD => STM32f103Z
|
||||
VCC -> 3.3
|
||||
GND -> GND
|
||||
DIN -> PA7(MOSI)
|
||||
CLK -> PA5(SCLK)
|
||||
CS -> PA4
|
||||
DC -> PA2
|
||||
RST -> PA1
|
||||
BUSY -> PA3
|
||||
|
||||
3. Basic use:
|
||||
Since this project is a comprehensive project, you may need to read the following for use:
|
||||
You can see the 19 functions that have been annotated in lines 73 through 97 of main.c.
|
||||
Please note which ink screen you purchased.
|
||||
example 1:
|
||||
If you purchased 5.83inch e-paper, then you should remove the comment for the corresponding 93 lines of code, ie:
|
||||
// EPD_5in83_test();
|
||||
changed to:
|
||||
EPD_5in83_test();
|
||||
example 2:
|
||||
If you buy a 2.9inch e-paper (B), since the 2.9-inch Type B and Type C are common driver codes,
|
||||
Then you should remove the comment for the corresponding 82 lines of code, ie:
|
||||
// EPD_2in9bc_test();
|
||||
changed to:
|
||||
EPD_2in9bc_test();
|
||||
Note: For EPD_1in54_V2_test() and EPD_2in13_V2_test(), please note that the V2 logo is attached to the back of your screen.
|
||||
|
||||
4. Directory structure (selection):
|
||||
If you use our products frequently, we will be very familiar with our program directory structure. We have a copy of the specific function.
|
||||
The API manual for the function, you can download it on our WIKI or request it as an after-sales customer service. Here is a brief introduction:
|
||||
Config\: This directory is a hardware interface layer file. You can see many definitions in DEV_Config.c(.h), including:
|
||||
type of data:
|
||||
#define UBYTE uint8_t
|
||||
#define UWORD uint16_t
|
||||
#define UDOUBLE uint32_t
|
||||
GPIO:
|
||||
#define EPD_RST_PIN RST_GPIO_Port, RST_Pin
|
||||
#define EPD_DC_PIN DC_GPIO_Port, DC_Pin
|
||||
#define EPD_CS_PIN SPI_CS_GPIO_Port, SPI_CS_Pin
|
||||
#define EPD_BUSY_PIN BUSY_GPIO_Port, BUSY_Pin
|
||||
Note: DIN and CLK are not defined here because it is handled by the hardware SPI.
|
||||
Read and write GPIO:
|
||||
#define DEV_Digital_Write(_pin, _value) HAL_GPIO_WritePin(_pin, _value == 0? GPIO_PIN_RESET: GPIO_PIN_SET)
|
||||
#define DEV_Digital_Read(_pin) HAL_GPIO_ReadPin(_pin)
|
||||
SPI transfer data:
|
||||
Void DEV_SPI_WriteByte(UBYTE value);
|
||||
Delay:
|
||||
#define DEV_Delay_ms(__xms) HAL_Delay(__xms);
|
||||
Note: This delay function does not use an oscilloscope to measure specific values.
|
||||
Module Init and exit processing:
|
||||
Void DEV_Module_Init(void);
|
||||
Void DEV_Module_Exit(void);
|
||||
Note: 1. Here is the processing of some GPIOs before and after using the ink screen.
|
||||
2. For the PCB with Rev2.1, the entire module will enter low power consumption after DEV_Module_Exit(). After testing, the power consumption is basically 0;
|
||||
|
||||
GUI\: This directory is some basic image processing functions, in GUI_Paint.c(.h):
|
||||
Common image processing: creating graphics, flipping graphics, mirroring graphics, setting pixels, clearing screens, etc.
|
||||
Common drawing processing: drawing points, lines, boxes, circles, Chinese characters, English characters, numbers, etc.;
|
||||
Common time display: Provide a common display time function;
|
||||
Commonly used display pictures: provide a function to display bitmaps;
|
||||
|
||||
Fonts\: for some commonly used fonts:
|
||||
Ascii:
|
||||
Font8: 5*8
|
||||
Font12: 7*12
|
||||
Font16: 11*16
|
||||
Font20: 14*20
|
||||
Font24: 17*24
|
||||
Chinese:
|
||||
font12CN: 16*21
|
||||
font24CN: 32*41
|
||||
|
||||
E-paper\: This screen is the ink screen driver function;
|
||||
Examples\: This is the test program for the ink screen. You can see the specific usage method in it.
|
||||
300
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54.c
Normal file
300
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54.c
Normal file
|
|
@ -0,0 +1,300 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54.C
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* 1.Change:
|
||||
* lut_full_update[] => EPD_1IN54_lut_full_update[]
|
||||
* lut_partial_update[] => EPD_1IN54_lut_partial_update[]
|
||||
* EPD_Reset() => EPD_1IN54_Reset()
|
||||
* EPD_SendCommand() => EPD_1IN54_SendCommand()
|
||||
* EPD_SendData() => EPD_1IN54_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_1IN54_ReadBusy()
|
||||
* EPD_SetLut() => EPD_1IN54_SetLut()
|
||||
* EPD_SetWindow() => EPD_1IN54_SetWindow()
|
||||
* EPD_SetCursor() => EPD_1IN54_SetCursor()
|
||||
* EPD_TurnOnDisplay() => EPD_1IN54_TurnOnDisplay()
|
||||
* EPD_Init() => EPD_1IN54_Init()
|
||||
* EPD_Clear() => EPD_1IN54_Clear()
|
||||
* EPD_Display() => EPD_1IN54_Display()
|
||||
* EPD_Sleep() => EPD_1IN54_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define SOURCE_AND_GATE_START_SETTING 0x62
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING_REGISTER 0x82
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-10-30):
|
||||
* 1.Remove:ImageBuff[EPD_1IN54_HEIGHT * EPD_1IN54_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_1in54.h"
|
||||
#include "Debug.h"
|
||||
|
||||
static const unsigned char EPD_1IN54_lut_full_update[] = {
|
||||
0x02, 0x02, 0x01, 0x11, 0x12, 0x12, 0x22, 0x22,
|
||||
0x66, 0x69, 0x69, 0x59, 0x58, 0x99, 0x99, 0x88,
|
||||
0x00, 0x00, 0x00, 0x00, 0xF8, 0xB4, 0x13, 0x51,
|
||||
0x35, 0x51, 0x51, 0x19, 0x01, 0x00
|
||||
};
|
||||
|
||||
static const unsigned char EPD_1IN54_lut_partial_update[] = {
|
||||
0x10, 0x18, 0x18, 0x08, 0x18, 0x18, 0x08, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Setting the display window
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_SetWindow(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
EPD_1IN54_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
EPD_1IN54_SendData((Xstart >> 3) & 0xFF);
|
||||
EPD_1IN54_SendData((Xend >> 3) & 0xFF);
|
||||
|
||||
EPD_1IN54_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
EPD_1IN54_SendData(Ystart & 0xFF);
|
||||
EPD_1IN54_SendData((Ystart >> 8) & 0xFF);
|
||||
EPD_1IN54_SendData(Yend & 0xFF);
|
||||
EPD_1IN54_SendData((Yend >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Set Cursor
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_SetCursor(UWORD Xstart, UWORD Ystart)
|
||||
{
|
||||
EPD_1IN54_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
EPD_1IN54_SendData((Xstart >> 3) & 0xFF);
|
||||
|
||||
EPD_1IN54_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
|
||||
EPD_1IN54_SendData(Ystart & 0xFF);
|
||||
EPD_1IN54_SendData((Ystart >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_1IN54_SendCommand(0x22); // DISPLAY_UPDATE_CONTROL_2
|
||||
EPD_1IN54_SendData(0xC4);
|
||||
EPD_1IN54_SendCommand(0x20); // MASTER_ACTIVATION
|
||||
EPD_1IN54_SendCommand(0xFF); // TERMINATE_FRAME_READ_WRITE
|
||||
|
||||
EPD_1IN54_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_Init(UBYTE Mode)
|
||||
{
|
||||
EPD_1IN54_Reset();
|
||||
|
||||
EPD_1IN54_SendCommand(0x01); // DRIVER_OUTPUT_CONTROL
|
||||
EPD_1IN54_SendData((EPD_1IN54_HEIGHT - 1) & 0xFF);
|
||||
EPD_1IN54_SendData(((EPD_1IN54_HEIGHT - 1) >> 8) & 0xFF);
|
||||
EPD_1IN54_SendData(0x00); // GD = 0; SM = 0; TB = 0;
|
||||
|
||||
EPD_1IN54_SendCommand(0x0C); // BOOSTER_SOFT_START_CONTROL
|
||||
EPD_1IN54_SendData(0xD7);
|
||||
EPD_1IN54_SendData(0xD6);
|
||||
EPD_1IN54_SendData(0x9D);
|
||||
|
||||
EPD_1IN54_SendCommand(0x2C); // WRITE_VCOM_REGISTER
|
||||
EPD_1IN54_SendData(0xA8); // VCOM 7C
|
||||
|
||||
EPD_1IN54_SendCommand(0x3A); // SET_DUMMY_LINE_PERIOD
|
||||
EPD_1IN54_SendData(0x1A); // 4 dummy lines per gate
|
||||
|
||||
EPD_1IN54_SendCommand(0x3B); // SET_GATE_TIME
|
||||
EPD_1IN54_SendData(0x08); // 2us per line
|
||||
|
||||
EPD_1IN54_SendCommand(0x11);
|
||||
EPD_1IN54_SendData(0x03);
|
||||
|
||||
//set the look-up table register
|
||||
EPD_1IN54_SendCommand(0x32);
|
||||
if(Mode == EPD_1IN54_FULL){
|
||||
for (UWORD i = 0; i < 30; i++) {
|
||||
EPD_1IN54_SendData(EPD_1IN54_lut_full_update[i]);
|
||||
}
|
||||
}else if(Mode == EPD_1IN54_PART){
|
||||
for (UWORD i = 0; i < 30; i++) {
|
||||
EPD_1IN54_SendData(EPD_1IN54_lut_partial_update[i]);
|
||||
}
|
||||
}else{
|
||||
Debug("error, the Mode is EPD_1IN54_FULL or EPD_1IN54_PART");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_1IN54_WIDTH % 8 == 0)? (EPD_1IN54_WIDTH / 8 ): (EPD_1IN54_WIDTH / 8 + 1);
|
||||
Height = EPD_1IN54_HEIGHT;
|
||||
EPD_1IN54_SetWindow(0, 0, EPD_1IN54_WIDTH, EPD_1IN54_HEIGHT);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
EPD_1IN54_SetCursor(0, j);
|
||||
EPD_1IN54_SendCommand(0x24);
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_1IN54_SendData(0XFF);
|
||||
}
|
||||
}
|
||||
EPD_1IN54_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_1IN54_WIDTH % 8 == 0)? (EPD_1IN54_WIDTH / 8 ): (EPD_1IN54_WIDTH / 8 + 1);
|
||||
Height = EPD_1IN54_HEIGHT;
|
||||
|
||||
UDOUBLE Addr = 0;
|
||||
// UDOUBLE Offset = ImageName;
|
||||
EPD_1IN54_SetWindow(0, 0, EPD_1IN54_WIDTH, EPD_1IN54_HEIGHT);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
EPD_1IN54_SetCursor(0, j);
|
||||
EPD_1IN54_SendCommand(0x24);
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
Addr = i + j * Width;
|
||||
EPD_1IN54_SendData(Image[Addr]);
|
||||
}
|
||||
}
|
||||
EPD_1IN54_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_Sleep(void)
|
||||
{
|
||||
EPD_1IN54_SendCommand(0x10);
|
||||
EPD_1IN54_SendData(0x01);
|
||||
}
|
||||
104
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54.h
Normal file
104
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54.h
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.1
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.1(2019-06-12):
|
||||
* 1.Change:
|
||||
* lut_full_update[] => EPD_1IN54_lut_full_update[]
|
||||
* lut_partial_update[] => EPD_1IN54_lut_partial_update[]
|
||||
* EPD_Reset() => EPD_1IN54_Reset()
|
||||
* EPD_SendCommand() => EPD_1IN54_SendCommand()
|
||||
* EPD_SendData() => EPD_1IN54_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_1IN54_ReadBusy()
|
||||
* EPD_SetLut() => EPD_1IN54_SetLut()
|
||||
* EPD_SetWindow() => EPD_1IN54_SetWindow()
|
||||
* EPD_SetCursor() => EPD_1IN54_SetCursor()
|
||||
* EPD_TurnOnDisplay() => EPD_1IN54_TurnOnDisplay()
|
||||
* EPD_Init() => EPD_1IN54_Init()
|
||||
* EPD_Clear() => EPD_1IN54_Clear()
|
||||
* EPD_Display() => EPD_1IN54_Display()
|
||||
* EPD_Sleep() => EPD_1IN54_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define SOURCE_AND_GATE_START_SETTING 0x62
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING_REGISTER 0x82
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-10-30):
|
||||
* 1.Remove:ImageBuff[EPD_1IN54_HEIGHT * EPD_1IN54_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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 __EPD_1IN54_H_
|
||||
#define __EPD_1IN54_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_1IN54_WIDTH 200
|
||||
#define EPD_1IN54_HEIGHT 200
|
||||
|
||||
#define EPD_1IN54_FULL 0
|
||||
#define EPD_1IN54_PART 1
|
||||
|
||||
void EPD_1IN54_Init(UBYTE Mode);
|
||||
void EPD_1IN54_Clear(void);
|
||||
void EPD_1IN54_Display(UBYTE *Image);
|
||||
void EPD_1IN54_Sleep(void);
|
||||
|
||||
#endif
|
||||
263
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54_V2.c
Normal file
263
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54_V2.c
Normal file
|
|
@ -0,0 +1,263 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54_V2.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper V2
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-11
|
||||
* | 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_1in54_V2.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_V2_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_V2_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_V2_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_V2_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
// UBYTE busy;
|
||||
// do {
|
||||
// EPD_1IN54_V2_SendCommand(0x71);
|
||||
// busy = DEV_Digital_Read(EPD_BUSY_PIN);
|
||||
// busy = !(busy & 0x01);
|
||||
// } while(busy);
|
||||
// DEV_Delay_ms(200);
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display full
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_V2_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_1IN54_V2_SendCommand(0x22);
|
||||
EPD_1IN54_V2_SendData(0xF7);
|
||||
EPD_1IN54_V2_SendCommand(0x20);
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display part
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_V2_TurnOnDisplayPart(void)
|
||||
{
|
||||
EPD_1IN54_V2_SendCommand(0x22);
|
||||
EPD_1IN54_V2_SendData(0xFF);
|
||||
EPD_1IN54_V2_SendCommand(0x20);
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_V2_Init(void)
|
||||
{
|
||||
EPD_1IN54_V2_Reset();
|
||||
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
EPD_1IN54_V2_SendCommand(0x12); //SWRESET
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x01); //Driver output control
|
||||
EPD_1IN54_V2_SendData(0xC7);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x01);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x11); //data entry mode
|
||||
EPD_1IN54_V2_SendData(0x01);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x44); //set Ram-X address start/end position
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x18); //0x0C-->(18+1)*8=200
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x45); //set Ram-Y address start/end position
|
||||
EPD_1IN54_V2_SendData(0xC7); //0xC7-->(199+1)=200
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_1IN54_V2_SendData(0x01);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x18);
|
||||
EPD_1IN54_V2_SendData(0x80);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x22); // //Load Temperature and waveform setting.
|
||||
EPD_1IN54_V2_SendData(0XB1);
|
||||
EPD_1IN54_V2_SendCommand(0x20);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x4E); // set RAM x address count to 0;
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendCommand(0x4F); // set RAM y address count to 0X199;
|
||||
EPD_1IN54_V2_SendData(0xC7);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_V2_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_1IN54_V2_WIDTH % 8 == 0)? (EPD_1IN54_V2_WIDTH / 8 ): (EPD_1IN54_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_1IN54_V2_HEIGHT;
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_1IN54_V2_SendData(0XFF);
|
||||
}
|
||||
}
|
||||
EPD_1IN54_V2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_V2_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_1IN54_V2_WIDTH % 8 == 0)? (EPD_1IN54_V2_WIDTH / 8 ): (EPD_1IN54_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_1IN54_V2_HEIGHT;
|
||||
|
||||
UDOUBLE Addr = 0;
|
||||
EPD_1IN54_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
Addr = i + j * Width;
|
||||
EPD_1IN54_V2_SendData(Image[Addr]);
|
||||
}
|
||||
}
|
||||
EPD_1IN54_V2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : The image of the previous frame must be uploaded, otherwise the
|
||||
first few seconds will display an exception.
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_V2_DisplayPartBaseImage(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_1IN54_V2_WIDTH % 8 == 0)? (EPD_1IN54_V2_WIDTH / 8 ): (EPD_1IN54_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_1IN54_V2_HEIGHT;
|
||||
|
||||
UDOUBLE Addr = 0;
|
||||
EPD_1IN54_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
Addr = i + j * Width;
|
||||
EPD_1IN54_V2_SendData(Image[Addr]);
|
||||
}
|
||||
}
|
||||
EPD_1IN54_V2_SendCommand(0x26);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
Addr = i + j * Width;
|
||||
EPD_1IN54_V2_SendData(Image[Addr]);
|
||||
}
|
||||
}
|
||||
EPD_1IN54_V2_TurnOnDisplayPart();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_V2_DisplayPart(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_1IN54_V2_WIDTH % 8 == 0)? (EPD_1IN54_V2_WIDTH / 8 ): (EPD_1IN54_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_1IN54_V2_HEIGHT;
|
||||
|
||||
UDOUBLE Addr = 0;
|
||||
EPD_1IN54_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
Addr = i + j * Width;
|
||||
EPD_1IN54_V2_SendData(Image[Addr]);
|
||||
}
|
||||
}
|
||||
EPD_1IN54_V2_TurnOnDisplayPart();
|
||||
}
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_V2_Sleep(void)
|
||||
{
|
||||
EPD_1IN54_V2_SendCommand(0x10); //enter deep sleep
|
||||
EPD_1IN54_V2_SendData(0x01);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
46
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54_V2.h
Normal file
46
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54_V2.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54_V2.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper V2
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-11
|
||||
* | 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 __EPD_1IN54_V2_H_
|
||||
#define __EPD_1IN54_V2_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_1IN54_V2_WIDTH 200
|
||||
#define EPD_1IN54_V2_HEIGHT 200
|
||||
|
||||
void EPD_1IN54_V2_Init(void);
|
||||
void EPD_1IN54_V2_Clear(void);
|
||||
void EPD_1IN54_V2_Display(UBYTE *Image);
|
||||
void EPD_1IN54_V2_DisplayPartBaseImage(UBYTE *Image);
|
||||
void EPD_1IN54_V2_DisplayPart(UBYTE *Image);
|
||||
void EPD_1IN54_V2_Sleep(void);
|
||||
|
||||
#endif
|
||||
348
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54b.c
Normal file
348
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54b.c
Normal file
|
|
@ -0,0 +1,348 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54b.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper b
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.1
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.1(2019-06-12):
|
||||
* 1.Change:
|
||||
* lut_vcom0[] => EPD_1IN54_lut_vcom0[]
|
||||
* lut_w[] => EPD_1IN54_lut_w[]
|
||||
* lut_b[] => EPD_1IN54B_lut_b[]
|
||||
* lut_g1[] => EPD_1IN54B_lut_g1[]
|
||||
* lut_g2[] => EPD_1IN54B_lut_g2[]
|
||||
* lut_vcom1[] => EPD_1IN54B_lut_vcom1[]
|
||||
* lut_red0[] => EPD_1IN54B_lut_red0[]
|
||||
* lut_red1[] => EPD_1IN54B_lut_red1[]
|
||||
* EPD_Reset() => EPD_1IN54B_Reset()
|
||||
* EPD_SendCommand() => EPD_1IN54B_SendCommand()
|
||||
* EPD_SendData() => EPD_1IN54B_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_1IN54B_ReadBusy()
|
||||
* EPD_SetLutBw() => EPD_1IN54B_SetLutBw()
|
||||
* EPD_SetLutBw => EPD_1IN54B_SetLutBw()
|
||||
* EPD_Init() => EPD_1IN54B_Init()
|
||||
* EPD_Clear() => EPD_1IN54B_Clear()
|
||||
* EPD_Display() => EPD_1IN54B_Display()
|
||||
* EPD_Sleep() => EPD_1IN54B_Sleep()
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-04-24):
|
||||
* 1.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define SOURCE_AND_GATE_START_SETTING 0x62
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING_REGISTER 0x82
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-10-30):
|
||||
* 1.Remove:ImageBuff[EPD_1IN54B_HEIGHT * EPD_1IN54B_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_1in54b.h"
|
||||
#include "Debug.h"
|
||||
|
||||
const unsigned char EPD_1IN54B_lut_vcom0[] = {0x0E, 0x14, 0x01, 0x0A, 0x06, 0x04, 0x0A, 0x0A, 0x0F, 0x03, 0x03, 0x0C, 0x06, 0x0A, 0x00};
|
||||
const unsigned char EPD_1IN54B_lut_w[] = {0x0E, 0x14, 0x01, 0x0A, 0x46, 0x04, 0x8A, 0x4A, 0x0F, 0x83, 0x43, 0x0C, 0x86, 0x0A, 0x04};
|
||||
const unsigned char EPD_1IN54B_lut_b[] = {0x0E, 0x14, 0x01, 0x8A, 0x06, 0x04, 0x8A, 0x4A, 0x0F, 0x83, 0x43, 0x0C, 0x06, 0x4A, 0x04};
|
||||
const unsigned char EPD_1IN54B_lut_g1[] = {0x8E, 0x94, 0x01, 0x8A, 0x06, 0x04, 0x8A, 0x4A, 0x0F, 0x83, 0x43, 0x0C, 0x06, 0x0A, 0x04};
|
||||
const unsigned char EPD_1IN54B_lut_g2[] = {0x8E, 0x94, 0x01, 0x8A, 0x06, 0x04, 0x8A, 0x4A, 0x0F, 0x83, 0x43, 0x0C, 0x06, 0x0A, 0x04};
|
||||
const unsigned char EPD_1IN54B_lut_vcom1[] = {0x03, 0x1D, 0x01, 0x01, 0x08, 0x23, 0x37, 0x37, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
const unsigned char EPD_1IN54B_lut_red0[] = {0x83, 0x5D, 0x01, 0x81, 0x48, 0x23, 0x77, 0x77, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
const unsigned char EPD_1IN54B_lut_red1[] = {0x03, 0x1D, 0x01, 0x01, 0x08, 0x23, 0x37, 0x37, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54B_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54B_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54B_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54B_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(1) {
|
||||
if(DEV_Digital_Read(EPD_BUSY_PIN) == 1)
|
||||
break;
|
||||
}
|
||||
DEV_Delay_ms(200);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Set the look-up black and white tables
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54B_SetLutBw(void)
|
||||
{
|
||||
UWORD count;
|
||||
EPD_1IN54B_SendCommand(0x20);// g vcom
|
||||
for(count = 0; count < 15; count++) {
|
||||
EPD_1IN54B_SendData(EPD_1IN54B_lut_vcom0[count]);
|
||||
}
|
||||
EPD_1IN54B_SendCommand(0x21);// g ww --
|
||||
for(count = 0; count < 15; count++) {
|
||||
EPD_1IN54B_SendData(EPD_1IN54B_lut_w[count]);
|
||||
}
|
||||
EPD_1IN54B_SendCommand(0x22);// g bw r
|
||||
for(count = 0; count < 15; count++) {
|
||||
EPD_1IN54B_SendData(EPD_1IN54B_lut_b[count]);
|
||||
}
|
||||
EPD_1IN54B_SendCommand(0x23);// g wb w
|
||||
for(count = 0; count < 15; count++) {
|
||||
EPD_1IN54B_SendData(EPD_1IN54B_lut_g1[count]);
|
||||
}
|
||||
EPD_1IN54B_SendCommand(0x24);// g bb b
|
||||
for(count = 0; count < 15; count++) {
|
||||
EPD_1IN54B_SendData(EPD_1IN54B_lut_g2[count]);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Set the look-up red tables
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54B_SetLutRed(void)
|
||||
{
|
||||
UWORD count;
|
||||
EPD_1IN54B_SendCommand(0x25);
|
||||
for(count = 0; count < 15; count++) {
|
||||
EPD_1IN54B_SendData(EPD_1IN54B_lut_vcom1[count]);
|
||||
}
|
||||
EPD_1IN54B_SendCommand(0x26);
|
||||
for(count = 0; count < 15; count++) {
|
||||
EPD_1IN54B_SendData(EPD_1IN54B_lut_red0[count]);
|
||||
}
|
||||
EPD_1IN54B_SendCommand(0x27);
|
||||
for(count = 0; count < 15; count++) {
|
||||
EPD_1IN54B_SendData(EPD_1IN54B_lut_red1[count]);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54B_Init(void)
|
||||
{
|
||||
EPD_1IN54B_Reset();
|
||||
|
||||
EPD_1IN54B_SendCommand(0x01);// POWER_SETTING
|
||||
EPD_1IN54B_SendData(0x07);
|
||||
EPD_1IN54B_SendData(0x00);
|
||||
EPD_1IN54B_SendData(0x08);
|
||||
EPD_1IN54B_SendData(0x00);
|
||||
EPD_1IN54B_SendCommand(0x06);// BOOSTER_SOFT_START
|
||||
EPD_1IN54B_SendData(0x07);
|
||||
EPD_1IN54B_SendData(0x07);
|
||||
EPD_1IN54B_SendData(0x07);
|
||||
EPD_1IN54B_SendCommand(0x04);// POWER_ON
|
||||
|
||||
EPD_1IN54B_ReadBusy();
|
||||
|
||||
EPD_1IN54B_SendCommand(0X00);// PANEL_SETTING
|
||||
EPD_1IN54B_SendData(0xcf);
|
||||
EPD_1IN54B_SendCommand(0X50);// VCOM_AND_DATA_INTERVAL_SETTING
|
||||
EPD_1IN54B_SendData(0x37);// 0xF0
|
||||
EPD_1IN54B_SendCommand(0x30);// PLL_CONTROL
|
||||
EPD_1IN54B_SendData(0x39);
|
||||
EPD_1IN54B_SendCommand(0x61);// TCON_RESOLUTION set x and y
|
||||
EPD_1IN54B_SendData(0xC8);// 200
|
||||
EPD_1IN54B_SendData(0x00);// y High eight: 0
|
||||
EPD_1IN54B_SendData(0xC8);// y Low eight: 200
|
||||
EPD_1IN54B_SendCommand(0x82);// VCM_DC_SETTING_REGISTER
|
||||
EPD_1IN54B_SendData(0x0E);
|
||||
|
||||
EPD_1IN54B_SetLutBw();
|
||||
EPD_1IN54B_SetLutRed();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54B_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_1IN54B_WIDTH % 8 == 0)? (EPD_1IN54B_WIDTH / 8 ): (EPD_1IN54B_WIDTH / 8 + 1);
|
||||
Height = EPD_1IN54B_HEIGHT;
|
||||
|
||||
//send black data
|
||||
EPD_1IN54B_SendCommand(0x10);// DATA_START_TRANSMISSION_1
|
||||
DEV_Delay_ms(2);
|
||||
for(UWORD i = 0; i < Height; i++) {
|
||||
for(UWORD i = 0; i < Width; i++) {
|
||||
EPD_1IN54B_SendData(0xFF);
|
||||
EPD_1IN54B_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
DEV_Delay_ms(2);
|
||||
|
||||
//send red data
|
||||
EPD_1IN54B_SendCommand(0x13);// DATA_START_TRANSMISSION_2
|
||||
DEV_Delay_ms(2);
|
||||
for(UWORD i = 0; i < Height; i++) {
|
||||
for(UWORD i = 0; i < Width; i++) {
|
||||
EPD_1IN54B_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
DEV_Delay_ms(2);
|
||||
|
||||
EPD_1IN54B_SendCommand(0x12);// DISPLAY_REFRESH
|
||||
EPD_1IN54B_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54B_Display(const UBYTE *blackimage, const UBYTE *redimage)
|
||||
{
|
||||
UBYTE Temp = 0x00;
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_1IN54B_WIDTH % 8 == 0)? (EPD_1IN54B_WIDTH / 8 ): (EPD_1IN54B_WIDTH / 8 + 1);
|
||||
Height = EPD_1IN54B_HEIGHT;
|
||||
|
||||
EPD_1IN54B_SendCommand(0x10);// DATA_START_TRANSMISSION_1
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
Temp = 0x00;
|
||||
for (int bit = 0; bit < 4; bit++) {
|
||||
if ((blackimage[i + j * Width] & (0x80 >> bit)) != 0) {
|
||||
Temp |= 0xC0 >> (bit * 2);
|
||||
}
|
||||
}
|
||||
EPD_1IN54B_SendData(Temp);
|
||||
Temp = 0x00;
|
||||
for (int bit = 4; bit < 8; bit++) {
|
||||
if ((blackimage[i + j * Width] & (0x80 >> bit)) != 0) {
|
||||
Temp |= 0xC0 >> ((bit - 4) * 2);
|
||||
}
|
||||
}
|
||||
EPD_1IN54B_SendData(Temp);
|
||||
}
|
||||
}
|
||||
DEV_Delay_ms(2);
|
||||
|
||||
EPD_1IN54B_SendCommand(0x13);// DATA_START_TRANSMISSION_2
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_1IN54B_SendData(redimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
DEV_Delay_ms(2);
|
||||
|
||||
//Display refresh
|
||||
EPD_1IN54B_SendCommand(0x12);// DISPLAY_REFRESH
|
||||
EPD_1IN54B_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54B_Sleep(void)
|
||||
{
|
||||
EPD_1IN54B_SendCommand(0x50);// VCOM_AND_DATA_INTERVAL_SETTING
|
||||
EPD_1IN54B_SendData(0x17);
|
||||
EPD_1IN54B_SendCommand(0x82);// VCM_DC_SETTING_REGISTER
|
||||
EPD_1IN54B_SendData(0x00);
|
||||
EPD_1IN54B_SendCommand(0x01);// POWER_SETTING
|
||||
EPD_1IN54B_SendData(0x02);
|
||||
EPD_1IN54B_SendData(0x00);
|
||||
EPD_1IN54B_SendData(0x00);
|
||||
EPD_1IN54B_SendData(0x00);
|
||||
EPD_1IN54B_ReadBusy();
|
||||
DEV_Delay_ms(1000);
|
||||
|
||||
EPD_1IN54B_SendCommand(0x02);// POWER_OFF
|
||||
}
|
||||
108
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54b.h
Normal file
108
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54b.h
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54b.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper b
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.1
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.1(2019-06-12):
|
||||
* 1.Change:
|
||||
* lut_vcom0[] => EPD_1IN54_lut_vcom0[]
|
||||
* lut_w[] => EPD_1IN54_lut_w[]
|
||||
* lut_b[] => EPD_1IN54B_lut_b[]
|
||||
* lut_g1[] => EPD_1IN54B_lut_g1[]
|
||||
* lut_g2[] => EPD_1IN54B_lut_g2[]
|
||||
* lut_vcom1[] => EPD_1IN54B_lut_vcom1[]
|
||||
* lut_red0[] => EPD_1IN54B_lut_red0[]
|
||||
* lut_red1[] => EPD_1IN54B_lut_red1[]
|
||||
* EPD_Reset() => EPD_1IN54B_Reset()
|
||||
* EPD_SendCommand() => EPD_1IN54B_SendCommand()
|
||||
* EPD_SendData() => EPD_1IN54B_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_1IN54B_ReadBusy()
|
||||
* EPD_SetLutBw() => EPD_1IN54B_SetLutBw()
|
||||
* EPD_SetLutBw => EPD_1IN54B_SetLutBw()
|
||||
* EPD_Init() => EPD_1IN54B_Init()
|
||||
* EPD_Clear() => EPD_1IN54B_Clear()
|
||||
* EPD_Display() => EPD_1IN54B_Display()
|
||||
* EPD_Sleep() => EPD_1IN54B_Sleep()
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-04-24):
|
||||
* 1.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define SOURCE_AND_GATE_START_SETTING 0x62
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING_REGISTER 0x82
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-10-30):
|
||||
* 1.Remove:ImageBuff[EPD_1IN54B_HEIGHT * EPD_1IN54B_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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 __EPD_1IN54B_H_
|
||||
#define __EPD_1IN54B_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_1IN54B_WIDTH 200
|
||||
#define EPD_1IN54B_HEIGHT 200
|
||||
|
||||
void EPD_1IN54B_Init(void);
|
||||
void EPD_1IN54B_Clear(void);
|
||||
void EPD_1IN54B_Display(const UBYTE *blackimage, const UBYTE *redimage);
|
||||
void EPD_1IN54B_Sleep(void);
|
||||
|
||||
#endif
|
||||
240
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54c.c
Normal file
240
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54c.c
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54c.C
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper c
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.1
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.1(2019-06-12):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_1IN54C_Reset()
|
||||
* EPD_SendCommand() => EPD_1IN54C_SendCommand()
|
||||
* EPD_SendData() => EPD_1IN54C_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_1IN54C_ReadBusy()
|
||||
* EPD_Init() => EPD_1IN54C_Init()
|
||||
* EPD_Clear() => EPD_1IN54C_Clear()
|
||||
* EPD_Display() => EPD_1IN54C_Display()
|
||||
* EPD_Sleep() => EPD_1IN54C_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define SOURCE_AND_GATE_START_SETTING 0x62
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING_REGISTER 0x82
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-14):
|
||||
* 1.Remove:ImageBuff[EPD_1IN54C_HEIGHT * EPD_1IN54C_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_1in54c.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54C_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(10);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54C_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54C_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54C_ReadBusy(void)
|
||||
{
|
||||
unsigned char busy;
|
||||
do {
|
||||
EPD_1IN54C_SendCommand(0x71);
|
||||
busy = DEV_Digital_Read(EPD_BUSY_PIN);
|
||||
busy =!(busy & 0x01);
|
||||
} while(busy);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54C_Init(void)
|
||||
{
|
||||
EPD_1IN54C_Reset();
|
||||
|
||||
EPD_1IN54C_SendCommand(0x06); //boost soft start
|
||||
EPD_1IN54C_SendData(0x17);
|
||||
EPD_1IN54C_SendData(0x17);
|
||||
EPD_1IN54C_SendData(0x17);
|
||||
EPD_1IN54C_SendCommand(0x04);
|
||||
|
||||
EPD_1IN54C_ReadBusy();
|
||||
|
||||
EPD_1IN54C_SendCommand(0x00); //panel setting
|
||||
EPD_1IN54C_SendData(0x0f); //LUT from OTP£¬160x296
|
||||
EPD_1IN54C_SendData(0x0d); //VCOM to 0V fast
|
||||
|
||||
EPD_1IN54C_SendCommand(0x61); //resolution setting
|
||||
EPD_1IN54C_SendData(0x98); //152
|
||||
EPD_1IN54C_SendData(0x00); //152
|
||||
EPD_1IN54C_SendData(0x98);
|
||||
|
||||
EPD_1IN54C_SendCommand(0X50); //VCOM AND DATA INTERVAL SETTING
|
||||
EPD_1IN54C_SendData(0x77); //WBmode:VBDF 17|D7 VBDW 97 VBDB 57 WBRmode:VBDF F7 VBDW 77 VBDB 37 VBDR B7
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54C_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_1IN54C_WIDTH % 8 == 0)? (EPD_1IN54C_WIDTH / 8 ): (EPD_1IN54C_WIDTH / 8 + 1);
|
||||
Height = EPD_1IN54C_HEIGHT;
|
||||
|
||||
//send black data
|
||||
EPD_1IN54C_SendCommand(0x10);
|
||||
for(UWORD i = 0; i < Height; i++) {
|
||||
for(UWORD i = 0; i < Width; i++) {
|
||||
EPD_1IN54C_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
//send red data
|
||||
EPD_1IN54C_SendCommand(0x13);
|
||||
for(UWORD i = 0; i < Height; i++) {
|
||||
for(UWORD i = 0; i < Width; i++) {
|
||||
EPD_1IN54C_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
//Display refresh
|
||||
EPD_1IN54C_SendCommand(0x12);
|
||||
EPD_1IN54C_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54C_Display(const UBYTE *blackimage, const UBYTE *redimage)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_1IN54C_WIDTH % 8 == 0)? (EPD_1IN54C_WIDTH / 8 ): (EPD_1IN54C_WIDTH / 8 + 1);
|
||||
Height = EPD_1IN54C_HEIGHT;
|
||||
|
||||
//send black data
|
||||
EPD_1IN54C_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_1IN54C_SendData(blackimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
//send red data
|
||||
EPD_1IN54C_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_1IN54C_SendData(redimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
//Display refresh
|
||||
EPD_1IN54C_SendCommand(0x12);
|
||||
EPD_1IN54C_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54C_Sleep(void)
|
||||
{
|
||||
EPD_1IN54C_SendCommand(0X02); //power off
|
||||
EPD_1IN54C_ReadBusy();
|
||||
EPD_1IN54C_SendCommand(0X07); //deep sleep
|
||||
EPD_1IN54C_SendData(0xA5);
|
||||
}
|
||||
95
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54c.h
Normal file
95
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54c.h
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54c.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper c
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.1
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.1(2019-06-12):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_1IN54C_Reset()
|
||||
* EPD_SendCommand() => EPD_1IN54C_SendCommand()
|
||||
* EPD_SendData() => EPD_1IN54C_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_1IN54C_ReadBusy()
|
||||
* EPD_Init() => EPD_1IN54C_Init()
|
||||
* EPD_Clear() => EPD_1IN54C_Clear()
|
||||
* EPD_Display() => EPD_1IN54C_Display()
|
||||
* EPD_Sleep() => EPD_1IN54C_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define SOURCE_AND_GATE_START_SETTING 0x62
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING_REGISTER 0x82
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-14):
|
||||
* 1.Remove:ImageBuff[EPD_1IN54C_HEIGHT * EPD_1IN54C_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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 __EPD_1IN54C_H_
|
||||
#define __EPD_1IN54C_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_1IN54C_WIDTH 152
|
||||
#define EPD_1IN54C_HEIGHT 152
|
||||
|
||||
void EPD_1IN54C_Init(void);
|
||||
void EPD_1IN54C_Clear(void);
|
||||
void EPD_1IN54C_Display(const UBYTE *blackimage, const UBYTE *redimage);
|
||||
void EPD_1IN54C_Sleep(void);
|
||||
|
||||
#endif
|
||||
255
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13.c
Normal file
255
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13.c
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN13.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_2IN13_Reset()
|
||||
* EPD_SendCommand() => EPD_2IN13_SendCommand()
|
||||
* EPD_SendData() => EPD_2IN13_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2IN13_ReadBusy()
|
||||
* EPD_Init() => EPD_2IN13_Init()
|
||||
* EPD_Clear() => EPD_2IN13_Clear()
|
||||
* EPD_Display() => EPD_2IN13_Display()
|
||||
* EPD_Sleep() => EPD_2IN13_Sleep()
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2019-01-03):
|
||||
* 1.Remove:ImageBuff[EPD_2IN13_HEIGHT * EPD_2IN13_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_2in13.h"
|
||||
#include "Debug.h"
|
||||
|
||||
const unsigned char EPD_2IN13_lut_full_update[] = {
|
||||
0x22, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x11,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
const unsigned char EPD_2IN13_lut_partial_update[] = {
|
||||
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN13_SendCommand(0x22); // DISPLAY_UPDATE_CONTROL_2
|
||||
EPD_2IN13_SendData(0xC4);
|
||||
EPD_2IN13_SendCommand(0X20); // MASTER_ACTIVATION
|
||||
EPD_2IN13_SendCommand(0xFF); // TERMINATE_FRAME_READ_WRITE
|
||||
|
||||
EPD_2IN13_ReadBusy();
|
||||
}
|
||||
|
||||
static void EPD_2IN13_SetWindows(int x_start, int y_start, int x_end, int y_end)
|
||||
{
|
||||
EPD_2IN13_SendCommand(0x44);
|
||||
/* x point must be the multiple of 8 or the last 3 bits will be ignored */
|
||||
EPD_2IN13_SendData((x_start >> 3) & 0xFF);
|
||||
EPD_2IN13_SendData((x_end >> 3) & 0xFF);
|
||||
EPD_2IN13_SendCommand(0x45);
|
||||
EPD_2IN13_SendData(y_start & 0xFF);
|
||||
EPD_2IN13_SendData((y_start >> 8) & 0xFF);
|
||||
EPD_2IN13_SendData(y_end & 0xFF);
|
||||
EPD_2IN13_SendData((y_end >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
static void EPD_2IN13_SetCursor(int x, int y)
|
||||
{
|
||||
EPD_2IN13_SendCommand(0x4E);
|
||||
/* x point must be the multiple of 8 or the last 3 bits will be ignored */
|
||||
EPD_2IN13_SendData((x >> 3) & 0xFF);
|
||||
EPD_2IN13_SendCommand(0x4F);
|
||||
EPD_2IN13_SendData(y & 0xFF);
|
||||
EPD_2IN13_SendData((y >> 8) & 0xFF);
|
||||
// EPD_2IN13_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_Init(UBYTE Mode)
|
||||
{
|
||||
EPD_2IN13_Reset();
|
||||
|
||||
EPD_2IN13_SendCommand(0x01); // DRIVER_OUTPUT_CONTROL
|
||||
EPD_2IN13_SendData((EPD_2IN13_HEIGHT - 1) & 0xFF);
|
||||
EPD_2IN13_SendData(((EPD_2IN13_HEIGHT - 1) >> 8) & 0xFF);
|
||||
EPD_2IN13_SendData(0x00); // GD = 0; SM = 0; TB = 0;
|
||||
|
||||
EPD_2IN13_SendCommand(0x0C); // BOOSTER_SOFT_START_CONTROL
|
||||
EPD_2IN13_SendData(0xD7);
|
||||
EPD_2IN13_SendData(0xD6);
|
||||
EPD_2IN13_SendData(0x9D);
|
||||
|
||||
EPD_2IN13_SendCommand(0x2C); // WRITE_VCOM_REGISTER
|
||||
EPD_2IN13_SendData(0xA8); // VCOM 7C
|
||||
|
||||
EPD_2IN13_SendCommand(0x3A); // SET_DUMMY_LINE_PERIOD
|
||||
EPD_2IN13_SendData(0x1A); // 4 dummy lines per gate
|
||||
|
||||
EPD_2IN13_SendCommand(0x3B); // SET_GATE_TIME
|
||||
EPD_2IN13_SendData(0x08); // 2us per line
|
||||
|
||||
EPD_2IN13_SendCommand(0X3C); // BORDER_WAVEFORM_CONTROL
|
||||
EPD_2IN13_SendData(0x03);
|
||||
|
||||
EPD_2IN13_SendCommand(0X11); // DATA_ENTRY_MODE_SETTING
|
||||
EPD_2IN13_SendData(0x03); // X increment; Y increment
|
||||
|
||||
//set the look-up table register
|
||||
EPD_2IN13_SendCommand(0x32);
|
||||
if(Mode == EPD_2IN13_FULL) {
|
||||
for (UWORD i = 0; i < 30; i++) {
|
||||
EPD_2IN13_SendData(EPD_2IN13_lut_full_update[i]);
|
||||
}
|
||||
} else if(Mode == EPD_2IN13_PART) {
|
||||
for (UWORD i = 0; i < 30; i++) {
|
||||
EPD_2IN13_SendData(EPD_2IN13_lut_partial_update[i]);
|
||||
}
|
||||
} else {
|
||||
Debug("error, the Mode is EPD_2IN13_FULL or EPD_2IN13_PART");
|
||||
}
|
||||
}
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN13_WIDTH % 8 == 0)? (EPD_2IN13_WIDTH / 8 ): (EPD_2IN13_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN13_HEIGHT;
|
||||
|
||||
EPD_2IN13_SetWindows(0, 0, EPD_2IN13_WIDTH, EPD_2IN13_HEIGHT);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
EPD_2IN13_SetCursor(0, j);
|
||||
EPD_2IN13_SendCommand(0x24);
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13_SendData(0Xff);
|
||||
}
|
||||
}
|
||||
EPD_2IN13_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN13_WIDTH % 8 == 0)? (EPD_2IN13_WIDTH / 8 ): (EPD_2IN13_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN13_HEIGHT;
|
||||
|
||||
EPD_2IN13_SetWindows(0, 0, EPD_2IN13_WIDTH, EPD_2IN13_HEIGHT);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
EPD_2IN13_SetCursor(0, j);
|
||||
EPD_2IN13_SendCommand(0x24);
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2IN13_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_Sleep(void)
|
||||
{
|
||||
EPD_2IN13_SendCommand(0x10); //DEEP_SLEEP_MODE
|
||||
EPD_2IN13_SendData(0x01);
|
||||
}
|
||||
68
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13.h
Normal file
68
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN13.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_2IN13_Reset()
|
||||
* EPD_SendCommand() => EPD_2IN13_SendCommand()
|
||||
* EPD_SendData() => EPD_2IN13_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2IN13_ReadBusy()
|
||||
* EPD_Init() => EPD_2IN13_Init()
|
||||
* EPD_Clear() => EPD_2IN13_Clear()
|
||||
* EPD_Display() => EPD_2IN13_Display()
|
||||
* EPD_Sleep() => EPD_2IN13_Sleep()
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2019-01-03):
|
||||
* 1.Remove:ImageBuff[EPD_2IN13_HEIGHT * EPD_2IN13_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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 _EPD2IN13_H
|
||||
#define _EPD2IN13_H
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN13_WIDTH 122
|
||||
#define EPD_2IN13_HEIGHT 250
|
||||
|
||||
#define EPD_2IN13_FULL 0
|
||||
#define EPD_2IN13_PART 1
|
||||
|
||||
void EPD_2IN13_Init(UBYTE Mode);
|
||||
void EPD_2IN13_Clear(void);
|
||||
void EPD_2IN13_Display(UBYTE *Image);
|
||||
void EPD_2IN13_Sleep(void);
|
||||
|
||||
#endif
|
||||
364
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13_V2.c
Normal file
364
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13_V2.c
Normal file
|
|
@ -0,0 +1,364 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13_V2.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper V2
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change name:
|
||||
* EPD_Reset() => EPD_2IN13_V2_Reset()
|
||||
* EPD_SendCommand() => EPD_2IN13_V2_SendCommand()
|
||||
* EPD_SendData() => EPD_2IN13_V2_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2IN13_V2_ReadBusy()
|
||||
* EPD_Init() => EPD_2IN13_V2_Init()
|
||||
* EPD_Clear() => EPD_2IN13_V2_Clear()
|
||||
* EPD_Display() => EPD_2IN13_V2_Display()
|
||||
* EPD_Sleep() => EPD_2IN13_V2_Sleep()
|
||||
* 2.add:
|
||||
* EPD_2IN13_V2_DisplayPartBaseImage()
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-14):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_2IN13_V2_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_2in13_V2.h"
|
||||
#include "Debug.h"
|
||||
|
||||
const unsigned char EPD_2IN13_V2_lut_full_update[]= {
|
||||
0x80,0x60,0x40,0x00,0x00,0x00,0x00, //LUT0: BB: VS 0 ~7
|
||||
0x10,0x60,0x20,0x00,0x00,0x00,0x00, //LUT1: BW: VS 0 ~7
|
||||
0x80,0x60,0x40,0x00,0x00,0x00,0x00, //LUT2: WB: VS 0 ~7
|
||||
0x10,0x60,0x20,0x00,0x00,0x00,0x00, //LUT3: WW: VS 0 ~7
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00, //LUT4: VCOM: VS 0 ~7
|
||||
|
||||
0x03,0x03,0x00,0x00,0x02, // TP0 A~D RP0
|
||||
0x09,0x09,0x00,0x00,0x02, // TP1 A~D RP1
|
||||
0x03,0x03,0x00,0x00,0x02, // TP2 A~D RP2
|
||||
0x00,0x00,0x00,0x00,0x00, // TP3 A~D RP3
|
||||
0x00,0x00,0x00,0x00,0x00, // TP4 A~D RP4
|
||||
0x00,0x00,0x00,0x00,0x00, // TP5 A~D RP5
|
||||
0x00,0x00,0x00,0x00,0x00, // TP6 A~D RP6
|
||||
|
||||
0x15,0x41,0xA8,0x32,0x30,0x0A,
|
||||
};
|
||||
|
||||
const unsigned char EPD_2IN13_V2_lut_partial_update[]= { //20 bytes
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00, //LUT0: BB: VS 0 ~7
|
||||
0x80,0x00,0x00,0x00,0x00,0x00,0x00, //LUT1: BW: VS 0 ~7
|
||||
0x40,0x00,0x00,0x00,0x00,0x00,0x00, //LUT2: WB: VS 0 ~7
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00, //LUT3: WW: VS 0 ~7
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00, //LUT4: VCOM: VS 0 ~7
|
||||
|
||||
0x0A,0x00,0x00,0x00,0x00, // TP0 A~D RP0
|
||||
0x00,0x00,0x00,0x00,0x00, // TP1 A~D RP1
|
||||
0x00,0x00,0x00,0x00,0x00, // TP2 A~D RP2
|
||||
0x00,0x00,0x00,0x00,0x00, // TP3 A~D RP3
|
||||
0x00,0x00,0x00,0x00,0x00, // TP4 A~D RP4
|
||||
0x00,0x00,0x00,0x00,0x00, // TP5 A~D RP5
|
||||
0x00,0x00,0x00,0x00,0x00, // TP6 A~D RP6
|
||||
|
||||
0x15,0x41,0xA8,0x32,0x30,0x0A,
|
||||
};
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_V2_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_V2_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_V2_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_V2_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_V2_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN13_V2_SendCommand(0x22);
|
||||
EPD_2IN13_V2_SendData(0xC7);
|
||||
EPD_2IN13_V2_SendCommand(0x20);
|
||||
EPD_2IN13_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_V2_TurnOnDisplayPart(void)
|
||||
{
|
||||
EPD_2IN13_V2_SendCommand(0x22);
|
||||
EPD_2IN13_V2_SendData(0x0C);
|
||||
EPD_2IN13_V2_SendCommand(0x20);
|
||||
EPD_2IN13_V2_ReadBusy();
|
||||
}
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_V2_Init(UBYTE Mode)
|
||||
{
|
||||
UBYTE count;
|
||||
EPD_2IN13_V2_Reset();
|
||||
|
||||
if(Mode == EPD_2IN13_V2_FULL) {
|
||||
EPD_2IN13_V2_ReadBusy();
|
||||
EPD_2IN13_V2_SendCommand(0x12); // soft reset
|
||||
EPD_2IN13_V2_ReadBusy();
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x74); //set analog block control
|
||||
EPD_2IN13_V2_SendData(0x54);
|
||||
EPD_2IN13_V2_SendCommand(0x7E); //set digital block control
|
||||
EPD_2IN13_V2_SendData(0x3B);
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x01); //Driver output control
|
||||
EPD_2IN13_V2_SendData(0xF9);
|
||||
EPD_2IN13_V2_SendData(0x00);
|
||||
EPD_2IN13_V2_SendData(0x00);
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x11); //data entry mode
|
||||
EPD_2IN13_V2_SendData(0x01);
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x44); //set Ram-X address start/end position
|
||||
EPD_2IN13_V2_SendData(0x00);
|
||||
EPD_2IN13_V2_SendData(0x0F); //0x0C-->(15+1)*8=128
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x45); //set Ram-Y address start/end position
|
||||
EPD_2IN13_V2_SendData(0xF9); //0xF9-->(249+1)=250
|
||||
EPD_2IN13_V2_SendData(0x00);
|
||||
EPD_2IN13_V2_SendData(0x00);
|
||||
EPD_2IN13_V2_SendData(0x00);
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_2IN13_V2_SendData(0x03);
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x2C); //VCOM Voltage
|
||||
EPD_2IN13_V2_SendData(0x55); //
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x03);
|
||||
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[70]);
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x04); //
|
||||
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[71]);
|
||||
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[72]);
|
||||
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[73]);
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x3A); //Dummy Line
|
||||
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[74]);
|
||||
EPD_2IN13_V2_SendCommand(0x3B); //Gate time
|
||||
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[75]);
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x32);
|
||||
for(count = 0; count < 70; count++) {
|
||||
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[count]);
|
||||
}
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x4E); // set RAM x address count to 0;
|
||||
EPD_2IN13_V2_SendData(0x00);
|
||||
EPD_2IN13_V2_SendCommand(0x4F); // set RAM y address count to 0X127;
|
||||
EPD_2IN13_V2_SendData(0xF9);
|
||||
EPD_2IN13_V2_SendData(0x00);
|
||||
EPD_2IN13_V2_ReadBusy();
|
||||
} else if(Mode == EPD_2IN13_V2_PART) {
|
||||
EPD_2IN13_V2_SendCommand(0x2C); //VCOM Voltage
|
||||
EPD_2IN13_V2_SendData(0x26);
|
||||
|
||||
EPD_2IN13_V2_ReadBusy();
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x32);
|
||||
for(count = 0; count < 70; count++) {
|
||||
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_partial_update[count]);
|
||||
}
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x37);
|
||||
EPD_2IN13_V2_SendData(0x00);
|
||||
EPD_2IN13_V2_SendData(0x00);
|
||||
EPD_2IN13_V2_SendData(0x00);
|
||||
EPD_2IN13_V2_SendData(0x00);
|
||||
EPD_2IN13_V2_SendData(0x40);
|
||||
EPD_2IN13_V2_SendData(0x00);
|
||||
EPD_2IN13_V2_SendData(0x00);
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x22);
|
||||
EPD_2IN13_V2_SendData(0xC0);
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x20);
|
||||
EPD_2IN13_V2_ReadBusy();
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_2IN13_V2_SendData(0x01);
|
||||
} else {
|
||||
Debug("error, the Mode is EPD_2IN13_FULL or EPD_2IN13_PART");
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_V2_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN13_V2_HEIGHT;
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13_V2_SendData(0XFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN13_V2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_V2_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN13_V2_HEIGHT;
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13_V2_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2IN13_V2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : The image of the previous frame must be uploaded, otherwise the
|
||||
first few seconds will display an exception.
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_V2_DisplayPartBaseImage(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN13_V2_HEIGHT;
|
||||
|
||||
UDOUBLE Addr = 0;
|
||||
EPD_2IN13_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
Addr = i + j * Width;
|
||||
EPD_2IN13_V2_SendData(Image[Addr]);
|
||||
}
|
||||
}
|
||||
EPD_2IN13_V2_SendCommand(0x26);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
Addr = i + j * Width;
|
||||
EPD_2IN13_V2_SendData(Image[Addr]);
|
||||
}
|
||||
}
|
||||
EPD_2IN13_V2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
|
||||
void EPD_2IN13_V2_DisplayPart(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN13_V2_HEIGHT;
|
||||
EPD_2IN13_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13_V2_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN13_V2_TurnOnDisplayPart();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_V2_Sleep(void)
|
||||
{
|
||||
EPD_2IN13_V2_SendCommand(0x22); //POWER OFF
|
||||
EPD_2IN13_V2_SendData(0xC3);
|
||||
EPD_2IN13_V2_SendCommand(0x20);
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x10); //enter deep sleep
|
||||
EPD_2IN13_V2_SendData(0x01);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
72
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13_V2.h
Normal file
72
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13_V2.h
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13_V2.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper V2
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change name:
|
||||
* EPD_Reset() => EPD_2IN13_V2_Reset()
|
||||
* EPD_SendCommand() => EPD_2IN13_V2_SendCommand()
|
||||
* EPD_SendData() => EPD_2IN13_V2_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2IN13_V2_ReadBusy()
|
||||
* EPD_Init() => EPD_2IN13_V2_Init()
|
||||
* EPD_Clear() => EPD_2IN13_V2_Clear()
|
||||
* EPD_Display() => EPD_2IN13_V2_Display()
|
||||
* EPD_Sleep() => EPD_2IN13_V2_Sleep()
|
||||
* 2.add:
|
||||
* EPD_2IN13_V2_DisplayPartBaseImage()
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-14):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_2IN13_V2_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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 _EPD_2IN13_V2_H_
|
||||
#define _EPD_2IN13_V2_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN13_V2_WIDTH 122
|
||||
#define EPD_2IN13_V2_HEIGHT 250
|
||||
|
||||
#define EPD_2IN13_V2_FULL 0
|
||||
#define EPD_2IN13_V2_PART 1
|
||||
|
||||
void EPD_2IN13_V2_Init(UBYTE Mode);
|
||||
void EPD_2IN13_V2_Clear(void);
|
||||
void EPD_2IN13_V2_Display(UBYTE *Image);
|
||||
void EPD_2IN13_V2_DisplayPart(UBYTE *Image);
|
||||
void EPD_2IN13_V2_DisplayPartBaseImage(UBYTE *Image);
|
||||
void EPD_2IN13_V2_Sleep(void);
|
||||
|
||||
#endif
|
||||
247
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13bc.c
Normal file
247
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13bc.c
Normal file
|
|
@ -0,0 +1,247 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13bc.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper b&c
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_2IN13BC_Reset()
|
||||
* EPD_SendCommand() => EPD_2IN13BC_SendCommand()
|
||||
* EPD_SendData() => EPD_2IN13BC_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2IN13BC_ReadBusy()
|
||||
* EPD_Init() => EPD_2IN13BC_Init()
|
||||
* EPD_Clear() => EPD_2IN13BC_Clear()
|
||||
* EPD_Display() => EPD_2IN13BC_Display()
|
||||
* EPD_Sleep() => EPD_2IN13BC_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define VCOM_LUT 0x20
|
||||
* #define W2W_LUT 0x21
|
||||
* #define B2W_LUT 0x22
|
||||
* #define W2B_LUT 0x23
|
||||
* #define B2B_LUT 0x24
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x40
|
||||
* #define TEMPERATURE_SENSOR_SELECTION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define RESOLUTION_SETTING 0x61
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define READ_VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING 0x82
|
||||
* #define PARTIAL_WINDOW 0x90
|
||||
* #define PARTIAL_IN 0x91
|
||||
* #define PARTIAL_OUT 0x92
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* #define POWER_SAVING 0xE3
|
||||
* V2.0(2018-11-13):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_2in13bc.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13BC_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13BC_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13BC_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13BC_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) {
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13BC_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN13BC_SendCommand(0x12); //DISPLAY REFRESH
|
||||
DEV_Delay_ms(10);
|
||||
|
||||
EPD_2IN13BC_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13BC_Init(void)
|
||||
{
|
||||
EPD_2IN13BC_Reset();
|
||||
|
||||
EPD_2IN13BC_SendCommand(0x06); // BOOSTER_SOFT_START
|
||||
EPD_2IN13BC_SendData(0x17);
|
||||
EPD_2IN13BC_SendData(0x17);
|
||||
EPD_2IN13BC_SendData(0x17);
|
||||
|
||||
EPD_2IN13BC_SendCommand(0x04); // POWER_ON
|
||||
EPD_2IN13BC_ReadBusy();
|
||||
|
||||
EPD_2IN13BC_SendCommand(0x00); // PANEL_SETTING
|
||||
EPD_2IN13BC_SendData(0x8F);
|
||||
|
||||
EPD_2IN13BC_SendCommand(0x50); // VCOM_AND_DATA_INTERVAL_SETTING
|
||||
EPD_2IN13BC_SendData(0xF0);
|
||||
EPD_2IN13BC_SendCommand(0x61); // RESOLUTION_SETTING
|
||||
EPD_2IN13BC_SendData(EPD_2IN13BC_WIDTH); // width: 104
|
||||
EPD_2IN13BC_SendData(EPD_2IN13BC_HEIGHT >> 8); // height: 212
|
||||
EPD_2IN13BC_SendData(EPD_2IN13BC_HEIGHT & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13BC_Clear(void)
|
||||
{
|
||||
UWORD Width = (EPD_2IN13BC_WIDTH % 8 == 0)? (EPD_2IN13BC_WIDTH / 8 ): (EPD_2IN13BC_WIDTH / 8 + 1);
|
||||
UWORD Height = EPD_2IN13BC_HEIGHT;
|
||||
|
||||
//send black data
|
||||
EPD_2IN13BC_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13BC_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
EPD_2IN13BC_SendCommand(0x92);
|
||||
|
||||
//send red data
|
||||
EPD_2IN13BC_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13BC_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
EPD_2IN13BC_SendCommand(0x92);
|
||||
|
||||
EPD_2IN13BC_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13BC_Display(const UBYTE *blackimage, const UBYTE *ryimage)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN13BC_WIDTH % 8 == 0)? (EPD_2IN13BC_WIDTH / 8 ): (EPD_2IN13BC_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN13BC_HEIGHT;
|
||||
|
||||
EPD_2IN13BC_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13BC_SendData(blackimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2IN13BC_SendCommand(0x92);
|
||||
|
||||
EPD_2IN13BC_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13BC_SendData(ryimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2IN13BC_SendCommand(0x92);
|
||||
|
||||
EPD_2IN13BC_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13BC_Sleep(void)
|
||||
{
|
||||
EPD_2IN13BC_SendCommand(0x02); // POWER_OFF
|
||||
EPD_2IN13BC_ReadBusy();
|
||||
EPD_2IN13BC_SendCommand(0x07); // DEEP_SLEEP
|
||||
EPD_2IN13BC_SendData(0xA5); // check code
|
||||
}
|
||||
97
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13bc.h
Normal file
97
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13bc.h
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13bc.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper b&c
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_2IN13BC_Reset()
|
||||
* EPD_SendCommand() => EPD_2IN13BC_SendCommand()
|
||||
* EPD_SendData() => EPD_2IN13BC_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2IN13BC_ReadBusy()
|
||||
* EPD_Init() => EPD_2IN13BC_Init()
|
||||
* EPD_Clear() => EPD_2IN13BC_Clear()
|
||||
* EPD_Display() => EPD_2IN13BC_Display()
|
||||
* EPD_Sleep() => EPD_2IN13BC_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define VCOM_LUT 0x20
|
||||
* #define W2W_LUT 0x21
|
||||
* #define B2W_LUT 0x22
|
||||
* #define W2B_LUT 0x23
|
||||
* #define B2B_LUT 0x24
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x40
|
||||
* #define TEMPERATURE_SENSOR_SELECTION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define RESOLUTION_SETTING 0x61
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define READ_VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING 0x82
|
||||
* #define PARTIAL_WINDOW 0x90
|
||||
* #define PARTIAL_IN 0x91
|
||||
* #define PARTIAL_OUT 0x92
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* #define POWER_SAVING 0xE3
|
||||
* V2.0(2018-11-13):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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 __EPD_2IN13BC_H_
|
||||
#define __EPD_2IN13BC_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN13BC_WIDTH 104
|
||||
#define EPD_2IN13BC_HEIGHT 212
|
||||
|
||||
void EPD_2IN13BC_Init(void);
|
||||
void EPD_2IN13BC_Clear(void);
|
||||
void EPD_2IN13BC_Display(const UBYTE *blackimage, const UBYTE *ryimage);
|
||||
void EPD_2IN13BC_Sleep(void);
|
||||
|
||||
#endif
|
||||
461
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13d.c
Normal file
461
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13d.c
Normal file
|
|
@ -0,0 +1,461 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13d.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper d
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* 1.Change:
|
||||
* lut_vcomDC[] => EPD_2IN13D_lut_vcomDC[]
|
||||
* lut_ww[] => EPD_2IN13D_lut_ww[]
|
||||
* lut_bw[] => EPD_2IN13D_lut_bw[]
|
||||
* lut_wb[] => EPD_2IN13D_lut_wb[]
|
||||
* lut_bb[] => EPD_2IN13D_lut_bb[]
|
||||
* lut_vcom1[] => EPD_2IN13D_lut_vcom1[]
|
||||
* lut_ww1[] => EPD_2IN13D_lut_ww1[]
|
||||
* lut_bw1[] => EPD_2IN13D_lut_bw1[]
|
||||
* lut_wb1[] => EPD_2IN13D_lut_wb1[]
|
||||
* lut_bb1[] => EPD_2IN13D_lut_bb1[]
|
||||
* EPD_Reset() => EPD_2IN13D_Reset()
|
||||
* EPD_SendCommand() => EPD_2IN13D_SendCommand()
|
||||
* EPD_SendData() => EPD_2IN13D_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2IN13D_ReadBusy()
|
||||
* EPD_SetFullReg() => EPD_2IN13D_SetFullReg()
|
||||
* EPD_SetPartReg() => EPD_2IN13D_SetPartReg()
|
||||
* EPD_TurnOnDisplay() => EPD_2IN13D_TurnOnDisplay()
|
||||
* EPD_Init() => EPD_2IN13D_Init()
|
||||
* EPD_Clear() => EPD_2IN13D_Clear()
|
||||
* EPD_Display() => EPD_2IN13D_Display()
|
||||
* EPD_Sleep() => EPD_2IN13D_Sleep()
|
||||
* V2.0(2018-11-13):
|
||||
* 1.Remove:ImageBuff[EPD_2IN13D_HEIGHT * EPD_2IN13D_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_2in13d.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/**
|
||||
* full screen update LUT
|
||||
**/
|
||||
static const unsigned char EPD_2IN13D_lut_vcomDC[] = {
|
||||
0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
};
|
||||
static const unsigned char EPD_2IN13D_lut_ww[] = {
|
||||
0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
static const unsigned char EPD_2IN13D_lut_bw[] = {
|
||||
0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x0F, 0x0F, 0x00, 0x00, 0x03,
|
||||
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01,
|
||||
0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
static const unsigned char EPD_2IN13D_lut_wb[] = {
|
||||
0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
static const unsigned char EPD_2IN13D_lut_bb[] = {
|
||||
0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* partial screen update LUT
|
||||
**/
|
||||
static const unsigned char EPD_2IN13D_lut_vcom1[] = {
|
||||
0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
,0x00, 0x00,
|
||||
};
|
||||
static const unsigned char EPD_2IN13D_lut_ww1[] = {
|
||||
0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
static const unsigned char EPD_2IN13D_lut_bw1[] = {
|
||||
0x80, 0x19, 0x01, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
static const unsigned char EPD_2IN13D_lut_wb1[] = {
|
||||
0x40, 0x19, 0x01, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
static const unsigned char EPD_2IN13D_lut_bb1[] = {
|
||||
0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13D_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13D_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13D_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13D_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
UBYTE busy;
|
||||
do {
|
||||
EPD_2IN13D_SendCommand(0x71);
|
||||
busy = DEV_Digital_Read(EPD_BUSY_PIN);
|
||||
busy =!(busy & 0x01);
|
||||
} while(busy);
|
||||
DEV_Delay_ms(200);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : LUT download
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13D_SetFullReg(void)
|
||||
{
|
||||
EPD_2IN13D_SendCommand(0X50); //VCOM AND DATA INTERVAL SETTING
|
||||
EPD_2IN13D_SendData(0xb7); //WBmode:VBDF 17|D7 VBDW 97 VBDB 57 WBRmode:VBDF F7 VBDW 77 VBDB 37 VBDR B7
|
||||
|
||||
unsigned int count;
|
||||
EPD_2IN13D_SendCommand(0x20);
|
||||
for(count=0; count<44; count++) {
|
||||
EPD_2IN13D_SendData(EPD_2IN13D_lut_vcomDC[count]);
|
||||
}
|
||||
|
||||
EPD_2IN13D_SendCommand(0x21);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN13D_SendData(EPD_2IN13D_lut_ww[count]);
|
||||
}
|
||||
|
||||
EPD_2IN13D_SendCommand(0x22);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN13D_SendData(EPD_2IN13D_lut_bw[count]);
|
||||
}
|
||||
|
||||
EPD_2IN13D_SendCommand(0x23);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN13D_SendData(EPD_2IN13D_lut_wb[count]);
|
||||
}
|
||||
|
||||
EPD_2IN13D_SendCommand(0x24);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN13D_SendData(EPD_2IN13D_lut_bb[count]);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : LUT download
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13D_SetPartReg(void)
|
||||
{
|
||||
EPD_2IN13D_SendCommand(0x82); //vcom_DC setting
|
||||
EPD_2IN13D_SendData(0x00);
|
||||
EPD_2IN13D_SendCommand(0X50);
|
||||
EPD_2IN13D_SendData(0xb7);
|
||||
|
||||
unsigned int count;
|
||||
EPD_2IN13D_SendCommand(0x20);
|
||||
for(count=0; count<44; count++) {
|
||||
EPD_2IN13D_SendData(EPD_2IN13D_lut_vcom1[count]);
|
||||
}
|
||||
|
||||
EPD_2IN13D_SendCommand(0x21);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN13D_SendData(EPD_2IN13D_lut_ww1[count]);
|
||||
}
|
||||
|
||||
EPD_2IN13D_SendCommand(0x22);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN13D_SendData(EPD_2IN13D_lut_bw1[count]);
|
||||
}
|
||||
|
||||
EPD_2IN13D_SendCommand(0x23);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN13D_SendData(EPD_2IN13D_lut_wb1[count]);
|
||||
}
|
||||
|
||||
EPD_2IN13D_SendCommand(0x24);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN13D_SendData(EPD_2IN13D_lut_bb1[count]);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13D_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN13D_SendCommand(0x12); //DISPLAY REFRESH
|
||||
DEV_Delay_ms(10); //!!!The delay here is necessary, 200uS at least!!!
|
||||
|
||||
EPD_2IN13D_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13D_Init()
|
||||
{
|
||||
EPD_2IN13D_Reset();
|
||||
|
||||
EPD_2IN13D_SendCommand(0x01); //POWER SETTING
|
||||
EPD_2IN13D_SendData(0x03);
|
||||
EPD_2IN13D_SendData(0x00);
|
||||
EPD_2IN13D_SendData(0x2b);
|
||||
EPD_2IN13D_SendData(0x2b);
|
||||
EPD_2IN13D_SendData(0x03);
|
||||
|
||||
EPD_2IN13D_SendCommand(0x06); //boost soft start
|
||||
EPD_2IN13D_SendData(0x17); //A
|
||||
EPD_2IN13D_SendData(0x17); //B
|
||||
EPD_2IN13D_SendData(0x17); //C
|
||||
|
||||
EPD_2IN13D_SendCommand(0x04);
|
||||
EPD_2IN13D_ReadBusy();
|
||||
|
||||
EPD_2IN13D_SendCommand(0x00); //panel setting
|
||||
EPD_2IN13D_SendData(0xbf); //LUT from OTP,128x296
|
||||
EPD_2IN13D_SendData(0x0e); //VCOM to 0V fast
|
||||
|
||||
EPD_2IN13D_SendCommand(0x30); //PLL setting
|
||||
EPD_2IN13D_SendData(0x3a); // 3a 100HZ 29 150Hz 39 200HZ 31 171HZ
|
||||
|
||||
EPD_2IN13D_SendCommand(0x61); //resolution setting
|
||||
EPD_2IN13D_SendData(EPD_2IN13D_WIDTH);
|
||||
EPD_2IN13D_SendData((EPD_2IN13D_HEIGHT >> 8) & 0xff);
|
||||
EPD_2IN13D_SendData(EPD_2IN13D_HEIGHT& 0xff);
|
||||
|
||||
EPD_2IN13D_SendCommand(0x82); //vcom_DC setting
|
||||
EPD_2IN13D_SendData(0x28);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13D_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN13D_WIDTH % 8 == 0)? (EPD_2IN13D_WIDTH / 8 ): (EPD_2IN13D_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN13D_HEIGHT;
|
||||
|
||||
EPD_2IN13D_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13D_SendData(0x00);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN13D_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13D_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN13D_SetFullReg();
|
||||
EPD_2IN13D_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13D_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN13D_WIDTH % 8 == 0)? (EPD_2IN13D_WIDTH / 8 ): (EPD_2IN13D_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN13D_HEIGHT;
|
||||
|
||||
EPD_2IN13D_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13D_SendData(0x00);
|
||||
}
|
||||
}
|
||||
// Dev_Delay_ms(10);
|
||||
|
||||
EPD_2IN13D_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13D_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
// Dev_Delay_ms(10);
|
||||
|
||||
EPD_2IN13D_SetFullReg();
|
||||
EPD_2IN13D_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13D_DisplayPart(UBYTE *Image)
|
||||
{
|
||||
/* Set partial Windows */
|
||||
EPD_2IN13D_SetPartReg();
|
||||
EPD_2IN13D_SendCommand(0x91); //This command makes the display enter partial mode
|
||||
EPD_2IN13D_SendCommand(0x90); //resolution setting
|
||||
EPD_2IN13D_SendData(0); //x-start
|
||||
EPD_2IN13D_SendData(EPD_2IN13D_WIDTH - 1); //x-end
|
||||
|
||||
EPD_2IN13D_SendData(0);
|
||||
EPD_2IN13D_SendData(0); //y-start
|
||||
EPD_2IN13D_SendData(EPD_2IN13D_HEIGHT / 256);
|
||||
EPD_2IN13D_SendData(EPD_2IN13D_HEIGHT % 256 - 1); //y-end
|
||||
EPD_2IN13D_SendData(0x28);
|
||||
|
||||
UWORD Width;
|
||||
Width = (EPD_2IN13D_WIDTH % 8 == 0)? (EPD_2IN13D_WIDTH / 8 ): (EPD_2IN13D_WIDTH / 8 + 1);
|
||||
|
||||
/* send data */
|
||||
EPD_2IN13D_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < EPD_2IN13D_HEIGHT; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13D_SendData(~Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN13D_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < EPD_2IN13D_HEIGHT; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13D_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set partial refresh */
|
||||
EPD_2IN13D_TurnOnDisplay();
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13D_Sleep(void)
|
||||
{
|
||||
EPD_2IN13D_SendCommand(0X50);
|
||||
EPD_2IN13D_SendData(0xf7);
|
||||
EPD_2IN13D_SendCommand(0X02); //power off
|
||||
EPD_2IN13D_SendCommand(0X07); //deep sleep
|
||||
EPD_2IN13D_SendData(0xA5);
|
||||
}
|
||||
78
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13d.h
Normal file
78
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13d.h
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13d.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper d
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* 1.Change:
|
||||
* lut_vcomDC[] => EPD_2IN13D_lut_vcomDC[]
|
||||
* lut_ww[] => EPD_2IN13D_lut_ww[]
|
||||
* lut_bw[] => EPD_2IN13D_lut_bw[]
|
||||
* lut_wb[] => EPD_2IN13D_lut_wb[]
|
||||
* lut_bb[] => EPD_2IN13D_lut_bb[]
|
||||
* lut_vcom1[] => EPD_2IN13D_lut_vcom1[]
|
||||
* lut_ww1[] => EPD_2IN13D_lut_ww1[]
|
||||
* lut_bw1[] => EPD_2IN13D_lut_bw1[]
|
||||
* lut_wb1[] => EPD_2IN13D_lut_wb1[]
|
||||
* lut_bb1[] => EPD_2IN13D_lut_bb1[]
|
||||
* EPD_Reset() => EPD_2IN13D_Reset()
|
||||
* EPD_SendCommand() => EPD_2IN13D_SendCommand()
|
||||
* EPD_SendData() => EPD_2IN13D_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2IN13D_ReadBusy()
|
||||
* EPD_SetFullReg() => EPD_2IN13D_SetFullReg()
|
||||
* EPD_SetPartReg() => EPD_2IN13D_SetPartReg()
|
||||
* EPD_TurnOnDisplay() => EPD_2IN13D_TurnOnDisplay()
|
||||
* EPD_Init() => EPD_2IN13D_Init()
|
||||
* EPD_Clear() => EPD_2IN13D_Clear()
|
||||
* EPD_Display() => EPD_2IN13D_Display()
|
||||
* EPD_Sleep() => EPD_2IN13D_Sleep()
|
||||
* V2.0(2018-11-13):
|
||||
* 1.Remove:ImageBuff[EPD_2IN13D_HEIGHT * EPD_2IN13D_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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 __EPD_2IN13D_H_
|
||||
#define __EPD_2IN13D_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN13D_WIDTH 104
|
||||
#define EPD_2IN13D_HEIGHT 212
|
||||
|
||||
void EPD_2IN13D_Init(void);
|
||||
void EPD_2IN13D_Clear(void);
|
||||
void EPD_2IN13D_Display(UBYTE *Image);
|
||||
void EPD_2IN13D_DisplayPart(UBYTE *Image);
|
||||
void EPD_2IN13D_Sleep(void);
|
||||
|
||||
#endif
|
||||
359
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in7.c
Normal file
359
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in7.c
Normal file
|
|
@ -0,0 +1,359 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in7.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.7inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* 1.Change:
|
||||
* lut_vcom_dc[] => EPD_2in7_lut_vcom_dc[]
|
||||
* lut_ww[] => EPD_2in7_lut_ww[]
|
||||
* lut_bw[] => EPD_2in7_lut_bw[]
|
||||
* lut_bb[] => EPD_2in7_lut_bb[]
|
||||
* lut_wb[] => EPD_2in7_lut_wb[]
|
||||
* EPD_Reset() => EPD_2in7_Reset()
|
||||
* EPD_SendCommand() => EPD_2in7_SendCommand()
|
||||
* EPD_SendData() => EPD_2in7_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2in7_ReadBusy()
|
||||
* EPD_SetLut() => EPD_2in7_SetLut()
|
||||
* EPD_Init() => EPD_2in7_Init()
|
||||
* EPD_Clear() => EPD_2in7_Clear()
|
||||
* EPD_Display() => EPD_2in7_Display()
|
||||
* EPD_Sleep() => EPD_2in7_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define SOURCE_AND_GATE_START_SETTING 0x62
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING_REGISTER 0x82
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-06):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_2in7.h"
|
||||
#include "Debug.h"
|
||||
|
||||
static const unsigned char EPD_2in7_lut_vcom_dc[] = {
|
||||
0x00 ,0x00,
|
||||
0x00 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02,
|
||||
0x60 ,0x28 ,0x28 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00
|
||||
};
|
||||
static const unsigned char EPD_2in7_lut_ww[] = {
|
||||
0x40 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02,
|
||||
0x90 ,0x28 ,0x28 ,0x00 ,0x00 ,0x01,
|
||||
0x40 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0xA0 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
};
|
||||
static const unsigned char EPD_2in7_lut_bw[] = {
|
||||
0x40 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02,
|
||||
0x90 ,0x28 ,0x28 ,0x00 ,0x00 ,0x01,
|
||||
0x40 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0xA0 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
};
|
||||
static const unsigned char EPD_2in7_lut_bb[] = {
|
||||
0x80 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02,
|
||||
0x90 ,0x28 ,0x28 ,0x00 ,0x00 ,0x01,
|
||||
0x80 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x50 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
};
|
||||
static const unsigned char EPD_2in7_lut_wb[] = {
|
||||
0x80 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02,
|
||||
0x90 ,0x28 ,0x28 ,0x00 ,0x00 ,0x01,
|
||||
0x80 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x50 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2in7_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2in7_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2in7_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2in7_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
UBYTE busy;
|
||||
do {
|
||||
EPD_2in7_SendCommand(0x71);
|
||||
busy = DEV_Digital_Read(EPD_BUSY_PIN);
|
||||
busy =!(busy & 0x01);
|
||||
} while(busy);
|
||||
DEV_Delay_ms(200);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : set the look-up tables
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2in7_SetLut(void)
|
||||
{
|
||||
unsigned int count;
|
||||
EPD_2in7_SendCommand(0x20); //vcom
|
||||
for(count = 0; count < 44; count++) {
|
||||
EPD_2in7_SendData(EPD_2in7_lut_vcom_dc[count]);
|
||||
}
|
||||
|
||||
EPD_2in7_SendCommand(0x21); //ww --
|
||||
for(count = 0; count < 42; count++) {
|
||||
EPD_2in7_SendData(EPD_2in7_lut_ww[count]);
|
||||
}
|
||||
|
||||
EPD_2in7_SendCommand(0x22); //bw r
|
||||
for(count = 0; count < 42; count++) {
|
||||
EPD_2in7_SendData(EPD_2in7_lut_bw[count]);
|
||||
}
|
||||
|
||||
EPD_2in7_SendCommand(0x23); //wb w
|
||||
for(count = 0; count < 42; count++) {
|
||||
EPD_2in7_SendData(EPD_2in7_lut_bb[count]);
|
||||
}
|
||||
|
||||
EPD_2in7_SendCommand(0x24); //bb b
|
||||
for(count = 0; count < 42; count++) {
|
||||
EPD_2in7_SendData(EPD_2in7_lut_wb[count]);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN7_Init(void)
|
||||
{
|
||||
EPD_2in7_Reset();
|
||||
|
||||
EPD_2in7_SendCommand(0x01); // POWER_SETTING
|
||||
EPD_2in7_SendData(0x03); // VDS_EN, VDG_EN
|
||||
EPD_2in7_SendData(0x00); // VCOM_HV, VGHL_LV[1], VGHL_LV[0]
|
||||
EPD_2in7_SendData(0x2b); // VDH
|
||||
EPD_2in7_SendData(0x2b); // VDL
|
||||
EPD_2in7_SendData(0x09); // VDHR
|
||||
|
||||
EPD_2in7_SendCommand(0x06); // BOOSTER_SOFT_START
|
||||
EPD_2in7_SendData(0x07);
|
||||
EPD_2in7_SendData(0x07);
|
||||
EPD_2in7_SendData(0x17);
|
||||
|
||||
// Power optimization
|
||||
EPD_2in7_SendCommand(0xF8);
|
||||
EPD_2in7_SendData(0x60);
|
||||
EPD_2in7_SendData(0xA5);
|
||||
|
||||
// Power optimization
|
||||
EPD_2in7_SendCommand(0xF8);
|
||||
EPD_2in7_SendData(0x89);
|
||||
EPD_2in7_SendData(0xA5);
|
||||
|
||||
// Power optimization
|
||||
EPD_2in7_SendCommand(0xF8);
|
||||
EPD_2in7_SendData(0x90);
|
||||
EPD_2in7_SendData(0x00);
|
||||
|
||||
// Power optimization
|
||||
EPD_2in7_SendCommand(0xF8);
|
||||
EPD_2in7_SendData(0x93);
|
||||
EPD_2in7_SendData(0x2A);
|
||||
|
||||
// Power optimization
|
||||
EPD_2in7_SendCommand(0xF8);
|
||||
EPD_2in7_SendData(0xA0);
|
||||
EPD_2in7_SendData(0xA5);
|
||||
|
||||
// Power optimization
|
||||
EPD_2in7_SendCommand(0xF8);
|
||||
EPD_2in7_SendData(0xA1);
|
||||
EPD_2in7_SendData(0x00);
|
||||
|
||||
// Power optimization
|
||||
EPD_2in7_SendCommand(0xF8);
|
||||
EPD_2in7_SendData(0x73);
|
||||
EPD_2in7_SendData(0x41);
|
||||
|
||||
EPD_2in7_SendCommand(0x16); // PARTIAL_DISPLAY_REFRESH
|
||||
EPD_2in7_SendData(0x00);
|
||||
|
||||
EPD_2in7_SendCommand(0x04); // POWER_ON
|
||||
EPD_2in7_ReadBusy();
|
||||
|
||||
EPD_2in7_SendCommand(0x00); // PANEL_SETTING
|
||||
EPD_2in7_SendData(0xAF); // KW-BF KWR-AF BWROTP 0f
|
||||
EPD_2in7_SendCommand(0x30); // PLL_CONTROL
|
||||
EPD_2in7_SendData(0x3A); // 3A 100HZ 29 150Hz 39 200HZ 31 171HZ
|
||||
EPD_2in7_SendCommand(0x82); // VCM_DC_SETTING_REGISTER
|
||||
EPD_2in7_SendData(0x12);
|
||||
|
||||
EPD_2in7_SetLut();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN7_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN7_WIDTH % 8 == 0)? (EPD_2IN7_WIDTH / 8 ): (EPD_2IN7_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN7_HEIGHT;
|
||||
|
||||
EPD_2in7_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2in7_SendData(0XFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2in7_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2in7_SendData(0XFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2in7_SendCommand(0x12);
|
||||
EPD_2in7_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN7_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN7_WIDTH % 8 == 0)? (EPD_2IN7_WIDTH / 8 ): (EPD_2IN7_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN7_HEIGHT;
|
||||
|
||||
EPD_2in7_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2in7_SendData(0XFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2in7_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2in7_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2in7_SendCommand(0x12);
|
||||
EPD_2in7_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN7_Sleep(void)
|
||||
{
|
||||
EPD_2in7_SendCommand(0X50);
|
||||
EPD_2in7_SendData(0xf7);
|
||||
EPD_2in7_SendCommand(0X02); //power off
|
||||
EPD_2in7_SendCommand(0X07); //deep sleep
|
||||
EPD_2in7_SendData(0xA5);
|
||||
}
|
||||
96
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in7.h
Normal file
96
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in7.h
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in7.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.7inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* 1.Change:
|
||||
* lut_vcom_dc[] => EPD_2in7_lut_vcom_dc[]
|
||||
* lut_ww[] => EPD_2in7_lut_ww[]
|
||||
* lut_bw[] => EPD_2in7_lut_bw[]
|
||||
* lut_bb[] => EPD_2in7_lut_bb[]
|
||||
* lut_wb[] => EPD_2in7_lut_wb[]
|
||||
* EPD_Reset() => EPD_2in7_Reset()
|
||||
* EPD_SendCommand() => EPD_2in7_SendCommand()
|
||||
* EPD_SendData() => EPD_2in7_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2in7_ReadBusy()
|
||||
* EPD_SetLut() => EPD_2in7_SetLut()
|
||||
* EPD_Init() => EPD_2in7_Init()
|
||||
* EPD_Clear() => EPD_2in7_Clear()
|
||||
* EPD_Display() => EPD_2in7_Display()
|
||||
* EPD_Sleep() => EPD_2in7_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define SOURCE_AND_GATE_START_SETTING 0x62
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING_REGISTER 0x82
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-06):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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 __EPD_2IN7_H_
|
||||
#define __EPD_2IN7_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN7_WIDTH 176
|
||||
#define EPD_2IN7_HEIGHT 264
|
||||
|
||||
void EPD_2IN7_Init(void);
|
||||
void EPD_2IN7_Clear(void);
|
||||
void EPD_2IN7_Display(UBYTE *Image);
|
||||
void EPD_2IN7_Sleep(void);
|
||||
|
||||
#endif
|
||||
369
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in7b.c
Normal file
369
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in7b.c
Normal file
|
|
@ -0,0 +1,369 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in7b.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.7inch e-paper b
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* lut_vcom_dc[] => EPD_2in7B_lut_vcom_dc[]
|
||||
* lut_ww[] => EPD_2in7B_lut_ww[]
|
||||
* lut_bw[] => EPD_2in7B_lut_bw[]
|
||||
* lut_bb[] => EPD_2in7B_lut_bb[]
|
||||
* lut_wb[] => EPD_2in7B_lut_wb[]
|
||||
* EPD_Reset() => EPD_2in7B_Reset()
|
||||
* EPD_SendCommand() => EPD_2in7B_SendCommand()
|
||||
* EPD_SendData() => EPD_2in7B_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2in7B_ReadBusy()
|
||||
* EPD_SetLut() => EPD_2in7B_SetLut()
|
||||
* EPD_Init() => EPD_2in7B_Init()
|
||||
* EPD_Clear() => EPD_2in7B_Clear()
|
||||
* EPD_Display() => EPD_2in7B_Display()
|
||||
* EPD_Sleep() => EPD_2in7B_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define PARTIAL_DATA_START_TRANSMISSION_1 0x14
|
||||
* #define PARTIAL_DATA_START_TRANSMISSION_2 0x15
|
||||
* #define PARTIAL_DISPLAY_REFRESH 0x16
|
||||
* #define LUT_FOR_VCOM 0x20
|
||||
* #define LUT_WHITE_TO_WHITE 0x21
|
||||
* #define LUT_BLACK_TO_WHITE 0x22
|
||||
* #define LUT_WHITE_TO_BLACK 0x23
|
||||
* #define LUT_BLACK_TO_BLACK 0x24
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define SOURCE_AND_GATE_START_SETTING 0x62
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING_REGISTER 0x82
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-10-30):
|
||||
* 1.Remove:ImageBuff[EPD_2IN7B_HEIGHT * EPD_2IN7B_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_2in7b.h"
|
||||
#include "Debug.h"
|
||||
|
||||
static const unsigned char EPD_2IN7B_lut_vcom_dc[] = {
|
||||
0x00, 0x00,
|
||||
0x00, 0x1A, 0x1A, 0x00, 0x00, 0x01,
|
||||
0x00, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x00, 0x0E, 0x01, 0x0E, 0x01, 0x10,
|
||||
0x00, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x00, 0x04, 0x10, 0x00, 0x00, 0x05,
|
||||
0x00, 0x03, 0x0E, 0x00, 0x00, 0x0A,
|
||||
0x00, 0x23, 0x00, 0x00, 0x00, 0x01
|
||||
};
|
||||
|
||||
//R21H
|
||||
static const unsigned char EPD_2IN7B_lut_ww[] = {
|
||||
0x90, 0x1A, 0x1A, 0x00, 0x00, 0x01,
|
||||
0x40, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x84, 0x0E, 0x01, 0x0E, 0x01, 0x10,
|
||||
0x80, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x00, 0x04, 0x10, 0x00, 0x00, 0x05,
|
||||
0x00, 0x03, 0x0E, 0x00, 0x00, 0x0A,
|
||||
0x00, 0x23, 0x00, 0x00, 0x00, 0x01
|
||||
};
|
||||
|
||||
//R22H r
|
||||
static const unsigned char EPD_2IN7B_lut_bw[] = {
|
||||
0xA0, 0x1A, 0x1A, 0x00, 0x00, 0x01,
|
||||
0x00, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x84, 0x0E, 0x01, 0x0E, 0x01, 0x10,
|
||||
0x90, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0xB0, 0x04, 0x10, 0x00, 0x00, 0x05,
|
||||
0xB0, 0x03, 0x0E, 0x00, 0x00, 0x0A,
|
||||
0xC0, 0x23, 0x00, 0x00, 0x00, 0x01
|
||||
};
|
||||
|
||||
//R23H w
|
||||
static const unsigned char EPD_2IN7B_lut_bb[] = {
|
||||
0x90, 0x1A, 0x1A, 0x00, 0x00, 0x01,
|
||||
0x40, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x84, 0x0E, 0x01, 0x0E, 0x01, 0x10,
|
||||
0x80, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x00, 0x04, 0x10, 0x00, 0x00, 0x05,
|
||||
0x00, 0x03, 0x0E, 0x00, 0x00, 0x0A,
|
||||
0x00, 0x23, 0x00, 0x00, 0x00, 0x01
|
||||
};
|
||||
|
||||
//R24H b
|
||||
static const unsigned char EPD_2IN7B_lut_wb[] = {
|
||||
0x90, 0x1A, 0x1A, 0x00, 0x00, 0x01,
|
||||
0x20, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x84, 0x0E, 0x01, 0x0E, 0x01, 0x10,
|
||||
0x10, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x00, 0x04, 0x10, 0x00, 0x00, 0x05,
|
||||
0x00, 0x03, 0x0E, 0x00, 0x00, 0x0A,
|
||||
0x00, 0x23, 0x00, 0x00, 0x00, 0x01
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7B_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7B_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7B_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7B_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) { //0: busy, 1: idle
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : set the look-up tables
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7B_SetLut(void)
|
||||
{
|
||||
unsigned int count;
|
||||
EPD_2IN7B_SendCommand(0x20); //vcom
|
||||
for(count = 0; count < 44; count++) {
|
||||
EPD_2IN7B_SendData(EPD_2IN7B_lut_vcom_dc[count]);
|
||||
}
|
||||
|
||||
EPD_2IN7B_SendCommand(0x21); //ww --
|
||||
for(count = 0; count < 42; count++) {
|
||||
EPD_2IN7B_SendData(EPD_2IN7B_lut_ww[count]);
|
||||
}
|
||||
|
||||
EPD_2IN7B_SendCommand(0x22); //bw r
|
||||
for(count = 0; count < 42; count++) {
|
||||
EPD_2IN7B_SendData(EPD_2IN7B_lut_bw[count]);
|
||||
}
|
||||
|
||||
EPD_2IN7B_SendCommand(0x23); //wb w
|
||||
for(count = 0; count < 42; count++) {
|
||||
EPD_2IN7B_SendData(EPD_2IN7B_lut_bb[count]);
|
||||
}
|
||||
|
||||
EPD_2IN7B_SendCommand(0x24); //bb b
|
||||
for(count = 0; count < 42; count++) {
|
||||
EPD_2IN7B_SendData(EPD_2IN7B_lut_wb[count]);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN7B_Init(void)
|
||||
{
|
||||
EPD_2IN7B_Reset();
|
||||
|
||||
EPD_2IN7B_SendCommand(0x04); // POWER_ON
|
||||
EPD_2IN7B_ReadBusy();
|
||||
|
||||
EPD_2IN7B_SendCommand(0x00); // PANEL_SETTING
|
||||
EPD_2IN7B_SendData(0xaf); // KW-BF KWR-AF BWROTP 0f
|
||||
|
||||
EPD_2IN7B_SendCommand(0x30); // PLL_CONTROL
|
||||
EPD_2IN7B_SendData(0x3a); //3A 100HZ 29 150Hz 39 200HZ 31 171HZ
|
||||
|
||||
EPD_2IN7B_SendCommand(0x01); // PANEL_SETTING
|
||||
EPD_2IN7B_SendData(0x03); // VDS_EN, VDG_EN
|
||||
EPD_2IN7B_SendData(0x00); // VCOM_HV, VGHL_LV[1], VGHL_LV[0]
|
||||
EPD_2IN7B_SendData(0x2b); // VDH
|
||||
EPD_2IN7B_SendData(0x2b); // VDL
|
||||
EPD_2IN7B_SendData(0x09); // VDHR
|
||||
|
||||
EPD_2IN7B_SendCommand(0x06); // BOOSTER_SOFT_START
|
||||
EPD_2IN7B_SendData(0x07);
|
||||
EPD_2IN7B_SendData(0x07);
|
||||
EPD_2IN7B_SendData(0x17);
|
||||
|
||||
// Power optimization
|
||||
EPD_2IN7B_SendCommand(0xF8);
|
||||
EPD_2IN7B_SendData(0x60);
|
||||
EPD_2IN7B_SendData(0xA5);
|
||||
|
||||
// Power optimization
|
||||
EPD_2IN7B_SendCommand(0xF8);
|
||||
EPD_2IN7B_SendData(0x89);
|
||||
EPD_2IN7B_SendData(0xA5);
|
||||
|
||||
// Power optimization
|
||||
EPD_2IN7B_SendCommand(0xF8);
|
||||
EPD_2IN7B_SendData(0x90);
|
||||
EPD_2IN7B_SendData(0x00);
|
||||
|
||||
// Power optimization
|
||||
EPD_2IN7B_SendCommand(0xF8);
|
||||
EPD_2IN7B_SendData(0x93);
|
||||
EPD_2IN7B_SendData(0x2A);
|
||||
|
||||
// Power optimization
|
||||
EPD_2IN7B_SendCommand(0xF8);
|
||||
EPD_2IN7B_SendData(0x73);
|
||||
EPD_2IN7B_SendData(0x41);
|
||||
|
||||
EPD_2IN7B_SendCommand(0x82); // VCM_DC_SETTING_REGISTER
|
||||
EPD_2IN7B_SendData(0x12);
|
||||
EPD_2IN7B_SendCommand(0x50); // VCOM_AND_DATA_INTERVAL_SETTING
|
||||
EPD_2IN7B_SendData(0x87); // define by OTP
|
||||
|
||||
EPD_2IN7B_SetLut();
|
||||
|
||||
EPD_2IN7B_SendCommand(0x16); // PARTIAL_DISPLAY_REFRESH
|
||||
EPD_2IN7B_SendData(0x00);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN7B_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN7B_WIDTH % 8 == 0)? (EPD_2IN7B_WIDTH / 8 ): (EPD_2IN7B_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN7B_HEIGHT;
|
||||
|
||||
EPD_2IN7B_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7B_SendData(0X00);
|
||||
}
|
||||
}
|
||||
EPD_2IN7B_SendCommand(0x11); // DATA_STOP
|
||||
|
||||
EPD_2IN7B_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7B_SendData(0X00);
|
||||
}
|
||||
}
|
||||
EPD_2IN7B_SendCommand(0x11); // DATA_STOP
|
||||
|
||||
EPD_2IN7B_SendCommand(0x12);
|
||||
EPD_2IN7B_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN7B_Display(UBYTE *Imageblack, UBYTE *Imagered)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN7B_WIDTH % 8 == 0)? (EPD_2IN7B_WIDTH / 8 ): (EPD_2IN7B_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN7B_HEIGHT;
|
||||
|
||||
EPD_2IN7B_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7B_SendData(~Imageblack[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2IN7B_SendCommand(0x11); // DATA_STOP
|
||||
|
||||
EPD_2IN7B_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7B_SendData(~Imagered[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2IN7B_SendCommand(0x11); // DATA_STOP
|
||||
|
||||
EPD_2IN7B_SendCommand(0x12);
|
||||
EPD_2IN7B_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN7B_Sleep(void)
|
||||
{
|
||||
EPD_2IN7B_SendCommand(0X50);
|
||||
EPD_2IN7B_SendData(0xf7);
|
||||
EPD_2IN7B_SendCommand(0X02); //power off
|
||||
EPD_2IN7B_SendCommand(0X07); //deep sleep
|
||||
EPD_2IN7B_SendData(0xA5);
|
||||
}
|
||||
103
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in7b.h
Normal file
103
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in7b.h
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in7b.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.7inch e-paper b
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* lut_vcom_dc[] => EPD_2in7B_lut_vcom_dc[]
|
||||
* lut_ww[] => EPD_2in7B_lut_ww[]
|
||||
* lut_bw[] => EPD_2in7B_lut_bw[]
|
||||
* lut_bb[] => EPD_2in7B_lut_bb[]
|
||||
* lut_wb[] => EPD_2in7B_lut_wb[]
|
||||
* EPD_Reset() => EPD_2in7B_Reset()
|
||||
* EPD_SendCommand() => EPD_2in7B_SendCommand()
|
||||
* EPD_SendData() => EPD_2in7B_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2in7B_ReadBusy()
|
||||
* EPD_SetLut() => EPD_2in7B_SetLut()
|
||||
* EPD_Init() => EPD_2in7B_Init()
|
||||
* EPD_Clear() => EPD_2in7B_Clear()
|
||||
* EPD_Display() => EPD_2in7B_Display()
|
||||
* EPD_Sleep() => EPD_2in7B_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define PARTIAL_DATA_START_TRANSMISSION_1 0x14
|
||||
* #define PARTIAL_DATA_START_TRANSMISSION_2 0x15
|
||||
* #define PARTIAL_DISPLAY_REFRESH 0x16
|
||||
* #define LUT_FOR_VCOM 0x20
|
||||
* #define LUT_WHITE_TO_WHITE 0x21
|
||||
* #define LUT_BLACK_TO_WHITE 0x22
|
||||
* #define LUT_WHITE_TO_BLACK 0x23
|
||||
* #define LUT_BLACK_TO_BLACK 0x24
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define SOURCE_AND_GATE_START_SETTING 0x62
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING_REGISTER 0x82
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-10-30):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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 __EPD_2IN7B_H_
|
||||
#define __EPD_2IN7B_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN7B_WIDTH 176
|
||||
#define EPD_2IN7B_HEIGHT 264
|
||||
|
||||
void EPD_2IN7B_Init(void);
|
||||
void EPD_2IN7B_Clear(void);
|
||||
void EPD_2IN7B_Display(UBYTE *Imageblack, UBYTE *Imagered);
|
||||
void EPD_2IN7B_Sleep(void);
|
||||
|
||||
#endif
|
||||
294
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9.c
Normal file
294
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9.c
Normal file
|
|
@ -0,0 +1,294 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* 1.Change:
|
||||
* lut_full_update[] => EPD_2IN9_lut_full_update[]
|
||||
* lut_partial_update[] => EPD_2IN9_lut_partial_update[]
|
||||
* EPD_Reset() => EPD_2IN9_Reset()
|
||||
* EPD_SendCommand() => EPD_2IN9_SendCommand()
|
||||
* EPD_SendData() => EPD_2IN9_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2IN9_ReadBusy()
|
||||
* EPD_SetLut() => EPD_2IN9_SetLut()
|
||||
* EPD_SetWindow() => EPD_2IN9_SetWindow()
|
||||
* EPD_SetCursor() => EPD_2IN9_SetCursor()
|
||||
* EPD_TurnOnDisplay() => EPD_2IN9_TurnOnDisplay()
|
||||
* EPD_Init() => EPD_2IN9_Init()
|
||||
* EPD_Clear() => EPD_2IN9_Clear()
|
||||
* EPD_Display() => EPD_2IN9_Display()
|
||||
* EPD_Sleep() => EPD_2IN9_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define DRIVER_OUTPUT_CONTROL 0x01
|
||||
* #define BOOSTER_SOFT_START_CONTROL 0x0C
|
||||
* #define GATE_SCAN_START_POSITION 0x0F
|
||||
* #define DEEP_SLEEP_MODE 0x10
|
||||
* #define DATA_ENTRY_MODE_SETTING 0x11
|
||||
* #define SW_RESET 0x12
|
||||
* #define TEMPERATURE_SENSOR_CONTROL 0x1A
|
||||
* #define MASTER_ACTIVATION 0x20
|
||||
* #define DISPLAY_UPDATE_CONTROL_1 0x21
|
||||
* #define DISPLAY_UPDATE_CONTROL_2 0x22
|
||||
* #define WRITE_RAM 0x24
|
||||
* #define WRITE_VCOM_REGISTER 0x2C
|
||||
* #define WRITE_LUT_REGISTER 0x32
|
||||
* #define SET_DUMMY_LINE_PERIOD 0x3A
|
||||
* #define SET_GATE_TIME 0x3B
|
||||
* #define BORDER_WAVEFORM_CONTROL 0x3C
|
||||
* #define SET_RAM_X_ADDRESS_START_END_POSITION 0x44
|
||||
* #define SET_RAM_Y_ADDRESS_START_END_POSITION 0x45
|
||||
* #define SET_RAM_X_ADDRESS_COUNTER 0x4E
|
||||
* #define SET_RAM_Y_ADDRESS_COUNTER 0x4F
|
||||
* #define TERMINATE_FRAME_READ_WRITE 0xFF
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-06):
|
||||
* 1.Remove:ImageBuff[EPD_2IN9_HEIGHT * EPD_2IN9_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_2in9.h"
|
||||
#include "Debug.h"
|
||||
|
||||
const unsigned char EPD_2IN9_lut_full_update[] = {
|
||||
0x02, 0x02, 0x01, 0x11, 0x12, 0x12, 0x22, 0x22,
|
||||
0x66, 0x69, 0x69, 0x59, 0x58, 0x99, 0x99, 0x88,
|
||||
0x00, 0x00, 0x00, 0x00, 0xF8, 0xB4, 0x13, 0x51,
|
||||
0x35, 0x51, 0x51, 0x19, 0x01, 0x00
|
||||
};
|
||||
|
||||
const unsigned char EPD_2IN9_lut_partial_update[] = {
|
||||
0x10, 0x18, 0x18, 0x08, 0x18, 0x18, 0x08, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Setting the display window
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
EPD_2IN9_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
EPD_2IN9_SendData((Xstart >> 3) & 0xFF);
|
||||
EPD_2IN9_SendData((Xend >> 3) & 0xFF);
|
||||
|
||||
EPD_2IN9_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
EPD_2IN9_SendData(Ystart & 0xFF);
|
||||
EPD_2IN9_SendData((Ystart >> 8) & 0xFF);
|
||||
EPD_2IN9_SendData(Yend & 0xFF);
|
||||
EPD_2IN9_SendData((Yend >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Set Cursor
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9_SetCursor(UWORD Xstart, UWORD Ystart)
|
||||
{
|
||||
EPD_2IN9_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
EPD_2IN9_SendData((Xstart >> 3) & 0xFF);
|
||||
|
||||
EPD_2IN9_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
|
||||
EPD_2IN9_SendData(Ystart & 0xFF);
|
||||
EPD_2IN9_SendData((Ystart >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN9_SendCommand(0x22); // DISPLAY_UPDATE_CONTROL_2
|
||||
EPD_2IN9_SendData(0xC4);
|
||||
EPD_2IN9_SendCommand(0x20); // MASTER_ACTIVATION
|
||||
EPD_2IN9_SendCommand(0xFF); // TERMINATE_FRAME_READ_WRITE
|
||||
|
||||
EPD_2IN9_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9_Init(UBYTE Mode)
|
||||
{
|
||||
EPD_2IN9_Reset();
|
||||
|
||||
EPD_2IN9_SendCommand(0x01); // DRIVER_OUTPUT_CONTROL
|
||||
EPD_2IN9_SendData((EPD_2IN9_HEIGHT - 1) & 0xFF);
|
||||
EPD_2IN9_SendData(((EPD_2IN9_HEIGHT - 1) >> 8) & 0xFF);
|
||||
EPD_2IN9_SendData(0x00); // GD = 0; SM = 0; TB = 0;
|
||||
|
||||
EPD_2IN9_SendCommand(0x0C); // BOOSTER_SOFT_START_CONTROL
|
||||
EPD_2IN9_SendData(0xD7);
|
||||
EPD_2IN9_SendData(0xD6);
|
||||
EPD_2IN9_SendData(0x9D);
|
||||
|
||||
EPD_2IN9_SendCommand(0x2C); // WRITE_VCOM_REGISTER
|
||||
EPD_2IN9_SendData(0xA8); // VCOM 7C
|
||||
|
||||
EPD_2IN9_SendCommand(0x3A); // SET_DUMMY_LINE_PERIOD
|
||||
EPD_2IN9_SendData(0x1A); // 4 dummy lines per gate
|
||||
|
||||
EPD_2IN9_SendCommand(0x3B); // SET_GATE_TIME
|
||||
EPD_2IN9_SendData(0x08); // 2us per line
|
||||
|
||||
EPD_2IN9_SendCommand(0x3C); // BORDER_WAVEFORM_CONTROL
|
||||
EPD_2IN9_SendData(0x03);
|
||||
EPD_2IN9_SendCommand(0x11); // DATA_ENTRY_MODE_SETTING
|
||||
EPD_2IN9_SendData(0x03);
|
||||
|
||||
//set the look-up table register
|
||||
EPD_2IN9_SendCommand(0x32); // WRITE_LUT_REGISTER
|
||||
if(Mode == EPD_2IN9_FULL){
|
||||
for (UWORD i = 0; i < 30; i++) {
|
||||
EPD_2IN9_SendData(EPD_2IN9_lut_full_update[i]);
|
||||
}
|
||||
}else if(Mode == EPD_2IN9_PART){
|
||||
for (UWORD i = 0; i < 30; i++) {
|
||||
EPD_2IN9_SendData(EPD_2IN9_lut_partial_update[i]);
|
||||
}
|
||||
}else{
|
||||
Debug("error, the Mode is EPD_2IN9_FULL or EPD_2IN9_PART");
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN9_WIDTH % 8 == 0)? (EPD_2IN9_WIDTH / 8 ): (EPD_2IN9_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN9_HEIGHT;
|
||||
EPD_2IN9_SetWindows(0, 0, EPD_2IN9_WIDTH, EPD_2IN9_HEIGHT);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
EPD_2IN9_SetCursor(0, j);
|
||||
EPD_2IN9_SendCommand(0x24);
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN9_SendData(0XFF);
|
||||
}
|
||||
}
|
||||
EPD_2IN9_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN9_WIDTH % 8 == 0)? (EPD_2IN9_WIDTH / 8 ): (EPD_2IN9_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN9_HEIGHT;
|
||||
|
||||
UDOUBLE Addr = 0;
|
||||
// UDOUBLE Offset = ImageName;
|
||||
EPD_2IN9_SetWindows(0, 0, EPD_2IN9_WIDTH, EPD_2IN9_HEIGHT);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
EPD_2IN9_SetCursor(0, j);
|
||||
EPD_2IN9_SendCommand(0x24);
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
Addr = i + j * Width;
|
||||
EPD_2IN9_SendData(Image[Addr]);
|
||||
}
|
||||
}
|
||||
EPD_2IN9_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9_Sleep(void)
|
||||
{
|
||||
EPD_2IN9_SendCommand(0x10);
|
||||
EPD_2IN9_SendData(0x01);
|
||||
// EPD_2IN9_ReadBusy();
|
||||
}
|
||||
96
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9.h
Normal file
96
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9.h
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* 1.Change:
|
||||
* lut_full_update[] => EPD_2IN9_lut_full_update[]
|
||||
* lut_partial_update[] => EPD_2IN9_lut_partial_update[]
|
||||
* EPD_Reset() => EPD_2IN9_Reset()
|
||||
* EPD_SendCommand() => EPD_2IN9_SendCommand()
|
||||
* EPD_SendData() => EPD_2IN9_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2IN9_ReadBusy()
|
||||
* EPD_SetLut() => EPD_2IN9_SetLut()
|
||||
* EPD_SetWindow() => EPD_2IN9_SetWindow()
|
||||
* EPD_SetCursor() => EPD_2IN9_SetCursor()
|
||||
* EPD_TurnOnDisplay() => EPD_2IN9_TurnOnDisplay()
|
||||
* EPD_Init() => EPD_2IN9_Init()
|
||||
* EPD_Clear() => EPD_2IN9_Clear()
|
||||
* EPD_Display() => EPD_2IN9_Display()
|
||||
* EPD_Sleep() => EPD_2IN9_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define DRIVER_OUTPUT_CONTROL 0x01
|
||||
* #define BOOSTER_SOFT_START_CONTROL 0x0C
|
||||
* #define GATE_SCAN_START_POSITION 0x0F
|
||||
* #define DEEP_SLEEP_MODE 0x10
|
||||
* #define DATA_ENTRY_MODE_SETTING 0x11
|
||||
* #define SW_RESET 0x12
|
||||
* #define TEMPERATURE_SENSOR_CONTROL 0x1A
|
||||
* #define MASTER_ACTIVATION 0x20
|
||||
* #define DISPLAY_UPDATE_CONTROL_1 0x21
|
||||
* #define DISPLAY_UPDATE_CONTROL_2 0x22
|
||||
* #define WRITE_RAM 0x24
|
||||
* #define WRITE_VCOM_REGISTER 0x2C
|
||||
* #define WRITE_LUT_REGISTER 0x32
|
||||
* #define SET_DUMMY_LINE_PERIOD 0x3A
|
||||
* #define SET_GATE_TIME 0x3B
|
||||
* #define BORDER_WAVEFORM_CONTROL 0x3C
|
||||
* #define SET_RAM_X_ADDRESS_START_END_POSITION 0x44
|
||||
* #define SET_RAM_Y_ADDRESS_START_END_POSITION 0x45
|
||||
* #define SET_RAM_X_ADDRESS_COUNTER 0x4E
|
||||
* #define SET_RAM_Y_ADDRESS_COUNTER 0x4F
|
||||
* #define TERMINATE_FRAME_READ_WRITE 0xFF
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-06):
|
||||
* 1.Remove:ImageBuff[EPD_2IN9_HEIGHT * EPD_2IN9_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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 __EPD_2IN9_H_
|
||||
#define __EPD_2IN9_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN9_WIDTH 128
|
||||
#define EPD_2IN9_HEIGHT 296
|
||||
|
||||
#define EPD_2IN9_FULL 0
|
||||
#define EPD_2IN9_PART 1
|
||||
|
||||
void EPD_2IN9_Init(UBYTE Mode);
|
||||
void EPD_2IN9_Clear(void);
|
||||
void EPD_2IN9_Display(UBYTE *Image);
|
||||
void EPD_2IN9_Sleep(void);
|
||||
|
||||
#endif
|
||||
240
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9bc.c
Normal file
240
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9bc.c
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9bc.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper b&c
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_2IN9BC_Reset()
|
||||
* EPD_SendCommand() => EPD_2IN9BC_SendCommand()
|
||||
* EPD_SendData() => EPD_2IN9BC_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2IN9BC_ReadBusy()
|
||||
* EPD_Init() => EPD_2IN9BC_Init()
|
||||
* EPD_Clear() => EPD_2IN9BC_Clear()
|
||||
* EPD_Display() => EPD_2IN9BC_Display()
|
||||
* EPD_Sleep() => EPD_2IN9BC_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING_REGISTER 0x82
|
||||
* #define PARTIAL_WINDOW 0x90
|
||||
* #define PARTIAL_IN 0x91
|
||||
* #define PARTIAL_OUT 0x92
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* #define POWER_SAVING 0xE3
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-06):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_2in9bc.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9BC_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9BC_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9BC_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9BC_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) { //LOW: idle, HIGH: busy
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9BC_Init(void)
|
||||
{
|
||||
EPD_2IN9BC_Reset();
|
||||
|
||||
EPD_2IN9BC_SendCommand(0x06); // BOOSTER_SOFT_START
|
||||
EPD_2IN9BC_SendData(0x17);
|
||||
EPD_2IN9BC_SendData(0x17);
|
||||
EPD_2IN9BC_SendData(0x17);
|
||||
|
||||
EPD_2IN9BC_SendCommand(0x04); // POWER_ON
|
||||
EPD_2IN9BC_ReadBusy();
|
||||
|
||||
EPD_2IN9BC_SendCommand(0x00); // PANEL_SETTING
|
||||
EPD_2IN9BC_SendData(0x8F);
|
||||
|
||||
EPD_2IN9BC_SendCommand(0x50); // VCOM_AND_DATA_INTERVAL_SETTING
|
||||
EPD_2IN9BC_SendData(0x77);
|
||||
|
||||
EPD_2IN9BC_SendCommand(0x61); // TCON_RESOLUTION
|
||||
EPD_2IN9BC_SendData(0x80);
|
||||
EPD_2IN9BC_SendData(0x01);
|
||||
EPD_2IN9BC_SendData(0x28);
|
||||
|
||||
EPD_2IN9BC_SendCommand(0x82); // VCM_DC_SETTING_REGISTER
|
||||
EPD_2IN9BC_SendData(0X0A);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9BC_Clear(void)
|
||||
{
|
||||
UWORD Width = (EPD_2IN9BC_WIDTH % 8 == 0)? (EPD_2IN9BC_WIDTH / 8 ): (EPD_2IN9BC_WIDTH / 8 + 1);
|
||||
UWORD Height = EPD_2IN9BC_HEIGHT;
|
||||
|
||||
//send black data
|
||||
EPD_2IN9BC_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN9BC_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
//send red data
|
||||
EPD_2IN9BC_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN9BC_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN9BC_SendCommand(0x12);
|
||||
EPD_2IN9BC_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9BC_Display(const UBYTE *blackimage, const UBYTE *ryimage)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN9BC_WIDTH % 8 == 0)? (EPD_2IN9BC_WIDTH / 8 ): (EPD_2IN9BC_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN9BC_HEIGHT;
|
||||
|
||||
EPD_2IN9BC_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN9BC_SendData(blackimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2IN9BC_SendCommand(0x92);
|
||||
|
||||
EPD_2IN9BC_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN9BC_SendData(ryimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2IN9BC_SendCommand(0x92);
|
||||
|
||||
EPD_2IN9BC_SendCommand(0x12);
|
||||
EPD_2IN9BC_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9BC_Sleep(void)
|
||||
{
|
||||
EPD_2IN9BC_SendCommand(0x02); // POWER_OFF
|
||||
EPD_2IN9BC_ReadBusy();
|
||||
EPD_2IN9BC_SendCommand(0x07); // DEEP_SLEEP
|
||||
EPD_2IN9BC_SendData(0xA5); // check code
|
||||
}
|
||||
98
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9bc.h
Normal file
98
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9bc.h
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9bc.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper b&c
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_2IN9BC_Reset()
|
||||
* EPD_SendCommand() => EPD_2IN9BC_SendCommand()
|
||||
* EPD_SendData() => EPD_2IN9BC_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2IN9BC_ReadBusy()
|
||||
* EPD_Init() => EPD_2IN9BC_Init()
|
||||
* EPD_Clear() => EPD_2IN9BC_Clear()
|
||||
* EPD_Display() => EPD_2IN9BC_Display()
|
||||
* EPD_Sleep() => EPD_2IN9BC_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING_REGISTER 0x82
|
||||
* #define PARTIAL_WINDOW 0x90
|
||||
* #define PARTIAL_IN 0x91
|
||||
* #define PARTIAL_OUT 0x92
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* #define POWER_SAVING 0xE3
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-06):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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 __EPD_2IN9BC_H_
|
||||
#define __EPD_2IN9BC_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN9BC_WIDTH 128
|
||||
#define EPD_2IN9BC_HEIGHT 296
|
||||
|
||||
void EPD_2IN9BC_Init(void);
|
||||
void EPD_2IN9BC_Clear(void);
|
||||
void EPD_2IN9BC_Display(const UBYTE *blackimage, const UBYTE *ryimage);
|
||||
void EPD_2IN9BC_Sleep(void);
|
||||
|
||||
#endif
|
||||
446
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9d.c
Normal file
446
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9d.c
Normal file
|
|
@ -0,0 +1,446 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9d.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper d
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V2.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* 1.Change:
|
||||
* lut_vcomDC[] => EPD_2IN9D_lut_vcomDC[]
|
||||
* lut_ww[] => EPD_2IN9D_lut_ww[]
|
||||
* lut_bw[] => EPD_2IN9D_lut_bw[]
|
||||
* lut_wb[] => EPD_2IN9D_lut_wb[]
|
||||
* lut_bb[] => EPD_2IN9D_lut_bb[]
|
||||
* lut_vcom1[] => EPD_2IN9D_lut_vcom1[]
|
||||
* lut_ww1[] => EPD_2IN9D_lut_ww1[]
|
||||
* lut_bw1[] => EPD_2IN9D_lut_bw1[]
|
||||
* lut_wb1[] => EPD_2IN9D_lut_wb1[]
|
||||
* lut_bb1[] => EPD_2IN9D_lut_bb1[]
|
||||
* EPD_Reset() => EPD_2IN9D_Reset()
|
||||
* EPD_SendCommand() => EPD_2IN9D_SendCommand()
|
||||
* EPD_SendData() => EPD_2IN9D_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2IN9D_ReadBusy()
|
||||
* EPD_SetFullReg() => EPD_2IN9D_SetFullReg()
|
||||
* EPD_SetPartReg() => EPD_2IN9D_SetPartReg()
|
||||
* EPD_TurnOnDisplay() => EPD_2IN9D_TurnOnDisplay()
|
||||
* EPD_Init() => EPD_2IN9D_Init()
|
||||
* EPD_Clear() => EPD_2IN9D_Clear()
|
||||
* EPD_Display() => EPD_2IN9D_Display()
|
||||
* EPD_Sleep() => EPD_2IN9D_Sleep()
|
||||
*
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_2in9d.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/**
|
||||
* full screen update LUT
|
||||
**/
|
||||
const unsigned char EPD_2IN9D_lut_vcomDC[] = {
|
||||
0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
};
|
||||
const unsigned char EPD_2IN9D_lut_ww[] = {
|
||||
0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
const unsigned char EPD_2IN9D_lut_bw[] = {
|
||||
0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x0F, 0x0F, 0x00, 0x00, 0x03,
|
||||
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01,
|
||||
0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
const unsigned char EPD_2IN9D_lut_wb[] = {
|
||||
0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
const unsigned char EPD_2IN9D_lut_bb[] = {
|
||||
0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* partial screen update LUT
|
||||
**/
|
||||
const unsigned char EPD_2IN9D_lut_vcom1[] = {
|
||||
0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
,0x00, 0x00,
|
||||
};
|
||||
const unsigned char EPD_2IN9D_lut_ww1[] = {
|
||||
0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
const unsigned char EPD_2IN9D_lut_bw1[] = {
|
||||
0x80, 0x19, 0x01, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
const unsigned char EPD_2IN9D_lut_wb1[] = {
|
||||
0x40, 0x19, 0x01, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
const unsigned char EPD_2IN9D_lut_bb1[] = {
|
||||
0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9D_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9D_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9D_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9D_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
UBYTE busy;
|
||||
do {
|
||||
EPD_2IN9D_SendCommand(0x71);
|
||||
busy = DEV_Digital_Read(EPD_BUSY_PIN);
|
||||
busy =!(busy & 0x01);
|
||||
} while(busy);
|
||||
DEV_Delay_ms(200);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : LUT download
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_SetFullReg(void)
|
||||
{
|
||||
EPD_2IN9D_SendCommand(0X50); //VCOM AND DATA INTERVAL SETTING
|
||||
EPD_2IN9D_SendData(0xb7); //WBmode:VBDF 17|D7 VBDW 97 VBDB 57 WBRmode:VBDF F7 VBDW 77 VBDB 37 VBDR B7
|
||||
|
||||
unsigned int count;
|
||||
EPD_2IN9D_SendCommand(0x20);
|
||||
for(count=0; count<44; count++) {
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_lut_vcomDC[count]);
|
||||
}
|
||||
|
||||
EPD_2IN9D_SendCommand(0x21);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_lut_ww[count]);
|
||||
}
|
||||
|
||||
EPD_2IN9D_SendCommand(0x22);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_lut_bw[count]);
|
||||
}
|
||||
|
||||
EPD_2IN9D_SendCommand(0x23);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_lut_wb[count]);
|
||||
}
|
||||
|
||||
EPD_2IN9D_SendCommand(0x24);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_lut_bb[count]);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : LUT download
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9D_SetPartReg(void)
|
||||
{
|
||||
EPD_2IN9D_SendCommand(0x82); //vcom_DC setting
|
||||
EPD_2IN9D_SendData(0x00);
|
||||
EPD_2IN9D_SendCommand(0X50);
|
||||
EPD_2IN9D_SendData(0xb7);
|
||||
|
||||
unsigned int count;
|
||||
EPD_2IN9D_SendCommand(0x20);
|
||||
for(count=0; count<44; count++) {
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_lut_vcom1[count]);
|
||||
}
|
||||
|
||||
EPD_2IN9D_SendCommand(0x21);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_lut_ww1[count]);
|
||||
}
|
||||
|
||||
EPD_2IN9D_SendCommand(0x22);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_lut_bw1[count]);
|
||||
}
|
||||
|
||||
EPD_2IN9D_SendCommand(0x23);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_lut_wb1[count]);
|
||||
}
|
||||
|
||||
EPD_2IN9D_SendCommand(0x24);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_lut_bb1[count]);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9D_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN9D_SendCommand(0x12); //DISPLAY REFRESH
|
||||
DEV_Delay_ms(10); //!!!The delay here is necessary, 200uS at least!!!
|
||||
|
||||
EPD_2IN9D_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9D_Init(void)
|
||||
{
|
||||
EPD_2IN9D_Reset();
|
||||
|
||||
EPD_2IN9D_SendCommand(0x01); //POWER SETTING
|
||||
EPD_2IN9D_SendData(0x03);
|
||||
EPD_2IN9D_SendData(0x00);
|
||||
EPD_2IN9D_SendData(0x2b);
|
||||
EPD_2IN9D_SendData(0x2b);
|
||||
EPD_2IN9D_SendData(0x03);
|
||||
|
||||
EPD_2IN9D_SendCommand(0x06); //boost soft start
|
||||
EPD_2IN9D_SendData(0x17); //A
|
||||
EPD_2IN9D_SendData(0x17); //B
|
||||
EPD_2IN9D_SendData(0x17); //C
|
||||
|
||||
EPD_2IN9D_SendCommand(0x04);
|
||||
EPD_2IN9D_ReadBusy();
|
||||
|
||||
EPD_2IN9D_SendCommand(0x00); //panel setting
|
||||
EPD_2IN9D_SendData(0xbf); //LUT from OTP,128x296
|
||||
EPD_2IN9D_SendData(0x0e); //VCOM to 0V fast
|
||||
|
||||
EPD_2IN9D_SendCommand(0x30); //PLL setting
|
||||
EPD_2IN9D_SendData(0x3a); // 3a 100HZ 29 150Hz 39 200HZ 31 171HZ
|
||||
|
||||
EPD_2IN9D_SendCommand(0x61); //resolution setting
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_WIDTH);
|
||||
EPD_2IN9D_SendData((EPD_2IN9D_HEIGHT >> 8) & 0xff);
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_HEIGHT & 0xff);
|
||||
|
||||
EPD_2IN9D_SendCommand(0x82); //vcom_DC setting
|
||||
EPD_2IN9D_SendData(0x28);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9D_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN9D_WIDTH % 8 == 0)? (EPD_2IN9D_WIDTH / 8 ): (EPD_2IN9D_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN9D_HEIGHT;
|
||||
|
||||
EPD_2IN9D_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN9D_SendData(0x00);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN9D_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN9D_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_SetFullReg();
|
||||
EPD_2IN9D_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9D_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN9D_WIDTH % 8 == 0)? (EPD_2IN9D_WIDTH / 8 ): (EPD_2IN9D_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN9D_HEIGHT;
|
||||
|
||||
EPD_2IN9D_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN9D_SendData(0x00);
|
||||
}
|
||||
}
|
||||
// Dev_Delay_ms(10);
|
||||
|
||||
EPD_2IN9D_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN9D_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
// Dev_Delay_ms(10);
|
||||
|
||||
EPD_SetFullReg();
|
||||
EPD_2IN9D_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9D_DisplayPart(UBYTE *Image)
|
||||
{
|
||||
/* Set partial Windows */
|
||||
EPD_2IN9D_SetPartReg();
|
||||
EPD_2IN9D_SendCommand(0x91); //This command makes the display enter partial mode
|
||||
EPD_2IN9D_SendCommand(0x90); //resolution setting
|
||||
EPD_2IN9D_SendData(0); //x-start
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_WIDTH - 1); //x-end
|
||||
|
||||
EPD_2IN9D_SendData(0);
|
||||
EPD_2IN9D_SendData(0); //y-start
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_HEIGHT / 256);
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_HEIGHT % 256 - 1); //y-end
|
||||
EPD_2IN9D_SendData(0x28);
|
||||
|
||||
UWORD Width;
|
||||
Width = (EPD_2IN9D_WIDTH % 8 == 0)? (EPD_2IN9D_WIDTH / 8 ): (EPD_2IN9D_WIDTH / 8 + 1);
|
||||
|
||||
/* send data */
|
||||
EPD_2IN9D_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < EPD_2IN9D_HEIGHT; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN9D_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set partial refresh */
|
||||
EPD_2IN9D_TurnOnDisplay();
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9D_Sleep(void)
|
||||
{
|
||||
EPD_2IN9D_SendCommand(0X50);
|
||||
EPD_2IN9D_SendData(0xf7);
|
||||
EPD_2IN9D_SendCommand(0X02); //power off
|
||||
EPD_2IN9D_ReadBusy();
|
||||
EPD_2IN9D_SendCommand(0X07); //deep sleep
|
||||
EPD_2IN9D_SendData(0xA5);
|
||||
}
|
||||
69
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9d.h
Normal file
69
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9d.h
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9d.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper d
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V2.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* 1.Change:
|
||||
* lut_vcomDC[] => EPD_2IN9D_lut_vcomDC[]
|
||||
* lut_ww[] => EPD_2IN9D_lut_ww[]
|
||||
* lut_bw[] => EPD_2IN9D_lut_bw[]
|
||||
* lut_wb[] => EPD_2IN9D_lut_wb[]
|
||||
* lut_bb[] => EPD_2IN9D_lut_bb[]
|
||||
* lut_vcom1[] => EPD_2IN9D_lut_vcom1[]
|
||||
* lut_ww1[] => EPD_2IN9D_lut_ww1[]
|
||||
* lut_bw1[] => EPD_2IN9D_lut_bw1[]
|
||||
* lut_wb1[] => EPD_2IN9D_lut_wb1[]
|
||||
* lut_bb1[] => EPD_2IN9D_lut_bb1[]
|
||||
* EPD_Reset() => EPD_2IN9D_Reset()
|
||||
* EPD_SendCommand() => EPD_2IN9D_SendCommand()
|
||||
* EPD_SendData() => EPD_2IN9D_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2IN9D_ReadBusy()
|
||||
* EPD_SetFullReg() => EPD_2IN9D_SetFullReg()
|
||||
* EPD_SetPartReg() => EPD_2IN9D_SetPartReg()
|
||||
* EPD_TurnOnDisplay() => EPD_2IN9D_TurnOnDisplay()
|
||||
* EPD_Init() => EPD_2IN9D_Init()
|
||||
* EPD_Clear() => EPD_2IN9D_Clear()
|
||||
* EPD_Display() => EPD_2IN9D_Display()
|
||||
* EPD_Sleep() => EPD_2IN9D_Sleep()
|
||||
*
|
||||
# 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 __EPD_2IN9D_H_
|
||||
#define __EPD_2IN9D_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN9D_WIDTH 128
|
||||
#define EPD_2IN9D_HEIGHT 296
|
||||
|
||||
void EPD_2IN9D_Init(void);
|
||||
void EPD_2IN9D_Clear(void);
|
||||
void EPD_2IN9D_Display(UBYTE *Image);
|
||||
void EPD_2IN9D_DisplayPart(UBYTE *Image);
|
||||
void EPD_2IN9D_Sleep(void);
|
||||
|
||||
#endif
|
||||
338
STM32/STM32-F103ZET6/User/e-Paper/EPD_4in2.c
Normal file
338
STM32/STM32-F103ZET6/User/e-Paper/EPD_4in2.c
Normal file
|
|
@ -0,0 +1,338 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in2.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.2inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change:
|
||||
* lut_vcomDC[] => EPD_4IN2_lut_vcomDC[]
|
||||
* lut_ww[] => EPD_4IN2_lut_ww[]
|
||||
* lut_bw[] => EPD_4IN2_lut_bw[]
|
||||
* lut_wb[] => EPD_4IN2_lut_wb[]
|
||||
* lut_bb[] => EPD_4IN2_lut_bb[]
|
||||
* EPD_Reset() => EPD_4IN2_Reset()
|
||||
* EPD_SendCommand() => EPD_4IN2_SendCommand()
|
||||
* EPD_SendData() => EPD_4IN2_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_4IN2_ReadBusy()
|
||||
* EPD_SetFullReg() => EPD_4IN2_SetFullReg()
|
||||
* EPD_SetPartReg() => EPD_4IN2_SetPartReg()
|
||||
* EPD_TurnOnDisplay() => EPD_4IN2_TurnOnDisplay()
|
||||
* EPD_Init() => EPD_4IN2_Init()
|
||||
* EPD_Clear() => EPD_4IN2_Clear()
|
||||
* EPD_Display() => EPD_4IN2_Display()
|
||||
* EPD_Sleep() => EPD_4IN2_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define VCOM_LUT 0x20
|
||||
* #define W2W_LUT 0x21
|
||||
* #define B2W_LUT 0x22
|
||||
* #define W2B_LUT 0x23
|
||||
* #define B2B_LUT 0x24
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x40
|
||||
* #define TEMPERATURE_SENSOR_SELECTION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define RESOLUTION_SETTING 0x61
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define READ_VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING 0x82
|
||||
* #define PARTIAL_WINDOW 0x90
|
||||
* #define PARTIAL_IN 0x91
|
||||
* #define PARTIAL_OUT 0x92
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* #define POWER_SAVING 0xE3
|
||||
* V2.0(2018-10-30):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_4in2.h"
|
||||
#include "Debug.h"
|
||||
|
||||
static const unsigned char EPD_4IN2_lut_vcom0[] = {
|
||||
0x00, 0x17, 0x00, 0x00, 0x00, 0x02,
|
||||
0x00, 0x17, 0x17, 0x00, 0x00, 0x02,
|
||||
0x00, 0x0A, 0x01, 0x00, 0x00, 0x01,
|
||||
0x00, 0x0E, 0x0E, 0x00, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
static const unsigned char EPD_4IN2_lut_ww[] = {
|
||||
0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
|
||||
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01,
|
||||
0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
static const unsigned char EPD_4IN2_lut_bw[] = {
|
||||
0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
|
||||
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01,
|
||||
0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
static const unsigned char EPD_4IN2_lut_wb[] = {
|
||||
0x80, 0x17, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
|
||||
0x80, 0x0A, 0x01, 0x00, 0x00, 0x01,
|
||||
0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
static const unsigned char EPD_4IN2_lut_bb[] = {
|
||||
0x80, 0x17, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
|
||||
0x80, 0x0A, 0x01, 0x00, 0x00, 0x01,
|
||||
0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_4IN2_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_4IN2_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_4IN2_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN2_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) { //LOW: idle, HIGH: busy
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_4IN2_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_4IN2_SendCommand(0x12);
|
||||
DEV_Delay_ms(100);
|
||||
EPD_4IN2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : set the look-up tables
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_4IN2_SetLut(void)
|
||||
{
|
||||
UWORD count;
|
||||
EPD_4IN2_SendCommand(0x20); //g vcom
|
||||
for(count=0; count<44; count++) {
|
||||
EPD_4IN2_SendData(EPD_4IN2_lut_vcom0[count]);
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x21);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_4IN2_SendData(EPD_4IN2_lut_ww[count]);
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x22);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_4IN2_SendData(EPD_4IN2_lut_bw[count]);
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x23);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_4IN2_SendData(EPD_4IN2_lut_wb[count]);
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x24);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_4IN2_SendData(EPD_4IN2_lut_bb[count]);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN2_Init(void)
|
||||
{
|
||||
EPD_4IN2_Reset();
|
||||
|
||||
EPD_4IN2_SendCommand(0x01); // POWER SETTING
|
||||
EPD_4IN2_SendData(0x03);
|
||||
EPD_4IN2_SendData(0x00);
|
||||
EPD_4IN2_SendData(0x2b);
|
||||
EPD_4IN2_SendData(0x2b);
|
||||
|
||||
EPD_4IN2_SendCommand(0x06); // boost soft start
|
||||
EPD_4IN2_SendData(0x17); //A
|
||||
EPD_4IN2_SendData(0x17); //B
|
||||
EPD_4IN2_SendData(0x17); //C
|
||||
|
||||
EPD_4IN2_SendCommand(0x04); // POWER_ON
|
||||
EPD_4IN2_ReadBusy();
|
||||
|
||||
EPD_4IN2_SendCommand(0x00); // panel setting
|
||||
EPD_4IN2_SendData(0xbf); // KW-BF KWR-AF BWROTP 0f BWOTP 1f
|
||||
EPD_4IN2_SendData(0x0d);
|
||||
|
||||
EPD_4IN2_SendCommand(0x30); // PLL setting
|
||||
EPD_4IN2_SendData(0x3C); // 3A 100HZ 29 150Hz 39 200HZ 31 171HZ
|
||||
|
||||
EPD_4IN2_SendCommand(0x61); // resolution setting
|
||||
EPD_4IN2_SendData(0x01);
|
||||
EPD_4IN2_SendData(0x90); //128
|
||||
EPD_4IN2_SendData(0x01); //
|
||||
EPD_4IN2_SendData(0x2c);
|
||||
|
||||
EPD_4IN2_SendCommand(0x82); // vcom_DC setting
|
||||
EPD_4IN2_SendData(0x28);
|
||||
|
||||
EPD_4IN2_SendCommand(0X50); // VCOM AND DATA INTERVAL SETTING
|
||||
EPD_4IN2_SendData(0x97); // 97white border 77black border VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7
|
||||
|
||||
EPD_4IN2_SetLut();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN2_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1);
|
||||
Height = EPD_4IN2_HEIGHT;
|
||||
|
||||
EPD_4IN2_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN2_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN2_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_4IN2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN2_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1);
|
||||
Height = EPD_4IN2_HEIGHT;
|
||||
|
||||
EPD_4IN2_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN2_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_4IN2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN2_Sleep(void)
|
||||
{
|
||||
EPD_4IN2_SendCommand(0x02); // POWER_OFF
|
||||
EPD_4IN2_ReadBusy();
|
||||
EPD_4IN2_SendCommand(0x07); // DEEP_SLEEP
|
||||
EPD_4IN2_SendData(0XA5);
|
||||
}
|
||||
105
STM32/STM32-F103ZET6/User/e-Paper/EPD_4in2.h
Normal file
105
STM32/STM32-F103ZET6/User/e-Paper/EPD_4in2.h
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in2.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.2inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change:
|
||||
* lut_vcomDC[] => EPD_4IN2_lut_vcomDC[]
|
||||
* lut_ww[] => EPD_4IN2_lut_ww[]
|
||||
* lut_bw[] => EPD_4IN2_lut_bw[]
|
||||
* lut_wb[] => EPD_4IN2_lut_wb[]
|
||||
* lut_bb[] => EPD_4IN2_lut_bb[]
|
||||
* EPD_Reset() => EPD_4IN2_Reset()
|
||||
* EPD_SendCommand() => EPD_4IN2_SendCommand()
|
||||
* EPD_SendData() => EPD_4IN2_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_4IN2_ReadBusy()
|
||||
* EPD_SetFullReg() => EPD_4IN2_SetFullReg()
|
||||
* EPD_SetPartReg() => EPD_4IN2_SetPartReg()
|
||||
* EPD_TurnOnDisplay() => EPD_4IN2_TurnOnDisplay()
|
||||
* EPD_Init() => EPD_4IN2_Init()
|
||||
* EPD_Clear() => EPD_4IN2_Clear()
|
||||
* EPD_Display() => EPD_4IN2_Display()
|
||||
* EPD_Sleep() => EPD_4IN2_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define VCOM_LUT 0x20
|
||||
* #define W2W_LUT 0x21
|
||||
* #define B2W_LUT 0x22
|
||||
* #define W2B_LUT 0x23
|
||||
* #define B2B_LUT 0x24
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x40
|
||||
* #define TEMPERATURE_SENSOR_SELECTION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define RESOLUTION_SETTING 0x61
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define READ_VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING 0x82
|
||||
* #define PARTIAL_WINDOW 0x90
|
||||
* #define PARTIAL_IN 0x91
|
||||
* #define PARTIAL_OUT 0x92
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* #define POWER_SAVING 0xE3
|
||||
* V2.0(2018-10-30):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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 _EPD_4IN2_H_
|
||||
#define _EPD_4IN2_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_4IN2_WIDTH 400
|
||||
#define EPD_4IN2_HEIGHT 300
|
||||
|
||||
void EPD_4IN2_Init(void);
|
||||
void EPD_4IN2_Clear(void);
|
||||
void EPD_4IN2_Display(UBYTE *Image);
|
||||
void EPD_4IN2_Sleep(void);
|
||||
|
||||
#endif
|
||||
233
STM32/STM32-F103ZET6/User/e-Paper/EPD_4in2bc.c
Normal file
233
STM32/STM32-F103ZET6/User/e-Paper/EPD_4in2bc.c
Normal file
|
|
@ -0,0 +1,233 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in2b.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.2inch e-paper b&c
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_4IN2BC_Reset()
|
||||
* EPD_SendCommand() => EPD_4IN2BC_SendCommand()
|
||||
* EPD_SendData() => EPD_4IN2BC_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_4IN2BC_ReadBusy()
|
||||
* EPD_Init() => EPD_4IN2BC_Init()
|
||||
* EPD_Clear() => EPD_4IN2BC_Clear()
|
||||
* EPD_Display() => EPD_4IN2BC_Display()
|
||||
* EPD_Sleep() => EPD_4IN2BC_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define VCOM_LUT 0x20
|
||||
* #define W2W_LUT 0x21
|
||||
* #define B2W_LUT 0x22
|
||||
* #define W2B_LUT 0x23
|
||||
* #define B2B_LUT 0x24
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x40
|
||||
* #define TEMPERATURE_SENSOR_SELECTION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define RESOLUTION_SETTING 0x61
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define READ_VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING 0x82
|
||||
* #define PARTIAL_WINDOW 0x90
|
||||
* #define PARTIAL_IN 0x91
|
||||
* #define PARTIAL_OUT 0x92
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* #define POWER_SAVING 0xE3
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-09):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_4in2bc.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_4IN2BC_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_4IN2BC_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_4IN2BC_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN2BC_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) { //0: busy, 1: idle
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_4IN2BC_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_4IN2BC_SendCommand(0x12); // DISPLAY_REFRESH
|
||||
DEV_Delay_ms(100);
|
||||
EPD_4IN2BC_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN2BC_Init(void)
|
||||
{
|
||||
EPD_4IN2BC_Reset();
|
||||
|
||||
EPD_4IN2BC_SendCommand(0x06); // BOOSTER_SOFT_START
|
||||
EPD_4IN2BC_SendData(0x17);
|
||||
EPD_4IN2BC_SendData(0x17);
|
||||
EPD_4IN2BC_SendData(0x17); // 07 0f 17 1f 27 2F 37 2f
|
||||
EPD_4IN2BC_SendCommand(0x04); // POWER_ON
|
||||
EPD_4IN2BC_ReadBusy();
|
||||
EPD_4IN2BC_SendCommand(0x00); // PANEL_SETTING
|
||||
EPD_4IN2BC_SendData(0x0F); // LUT from OTP
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN2BC_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_4IN2BC_WIDTH % 8 == 0)? (EPD_4IN2BC_WIDTH / 8 ): (EPD_4IN2BC_WIDTH / 8 + 1);
|
||||
Height = EPD_4IN2BC_HEIGHT;
|
||||
|
||||
EPD_4IN2BC_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN2BC_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_4IN2BC_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN2BC_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_4IN2BC_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN2BC_Display(const UBYTE *blackimage, const UBYTE *ryimage)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_4IN2BC_WIDTH % 8 == 0)? (EPD_4IN2BC_WIDTH / 8 ): (EPD_4IN2BC_WIDTH / 8 + 1);
|
||||
Height = EPD_4IN2BC_HEIGHT;
|
||||
|
||||
EPD_4IN2BC_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN2BC_SendData(blackimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_4IN2BC_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN2BC_SendData(ryimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_4IN2BC_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN2BC_Sleep(void)
|
||||
{
|
||||
EPD_4IN2BC_SendCommand(0x02); // POWER_OFF
|
||||
EPD_4IN2BC_ReadBusy();
|
||||
EPD_4IN2BC_SendCommand(0x07); // DEEP_SLEEP
|
||||
EPD_4IN2BC_SendData(0XA5);
|
||||
}
|
||||
98
STM32/STM32-F103ZET6/User/e-Paper/EPD_4in2bc.h
Normal file
98
STM32/STM32-F103ZET6/User/e-Paper/EPD_4in2bc.h
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in2b.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.2inch e-paper b&c
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_4IN2BC_Reset()
|
||||
* EPD_SendCommand() => EPD_4IN2BC_SendCommand()
|
||||
* EPD_SendData() => EPD_4IN2BC_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_4IN2BC_ReadBusy()
|
||||
* EPD_Init() => EPD_4IN2BC_Init()
|
||||
* EPD_Clear() => EPD_4IN2BC_Clear()
|
||||
* EPD_Display() => EPD_4IN2BC_Display()
|
||||
* EPD_Sleep() => EPD_4IN2BC_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define VCOM_LUT 0x20
|
||||
* #define W2W_LUT 0x21
|
||||
* #define B2W_LUT 0x22
|
||||
* #define W2B_LUT 0x23
|
||||
* #define B2B_LUT 0x24
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x40
|
||||
* #define TEMPERATURE_SENSOR_SELECTION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define RESOLUTION_SETTING 0x61
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define READ_VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING 0x82
|
||||
* #define PARTIAL_WINDOW 0x90
|
||||
* #define PARTIAL_IN 0x91
|
||||
* #define PARTIAL_OUT 0x92
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* #define POWER_SAVING 0xE3
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-09):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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 __EPD_4IN2BC_H_
|
||||
#define __EPD_4IN2BC_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_4IN2BC_WIDTH 400
|
||||
#define EPD_4IN2BC_HEIGHT 300
|
||||
|
||||
void EPD_4IN2BC_Init(void);
|
||||
void EPD_4IN2BC_Clear(void);
|
||||
void EPD_4IN2BC_Display(const UBYTE *blackimage, const UBYTE *ryimage);
|
||||
void EPD_4IN2BC_Sleep(void);
|
||||
|
||||
#endif
|
||||
270
STM32/STM32-F103ZET6/User/e-Paper/EPD_5in83.c
Normal file
270
STM32/STM32-F103ZET6/User/e-Paper/EPD_5in83.c
Normal file
|
|
@ -0,0 +1,270 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in83.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_5IN83_Reset()
|
||||
* EPD_SendCommand() => EPD_5IN83_SendCommand()
|
||||
* EPD_SendData() => EPD_5IN83_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_5IN83_ReadBusy()
|
||||
* EPD_SetFullReg() => EPD_5IN83_SetFullReg()
|
||||
* EPD_SetPartReg() => EPD_5IN83_SetPartReg()
|
||||
* EPD_TurnOnDisplay() => EPD_5IN83_TurnOnDisplay()
|
||||
* EPD_Init() => EPD_5IN83_Init()
|
||||
* EPD_Clear() => EPD_5IN83_Clear()
|
||||
* EPD_Display() => EPD_5IN83_Display()
|
||||
* EPD_Sleep() => EPD_5IN83_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define VCOM_LUT 0x20
|
||||
* #define W2W_LUT 0x21
|
||||
* #define B2W_LUT 0x22
|
||||
* #define W2B_LUT 0x23
|
||||
* #define B2B_LUT 0x24
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x40
|
||||
* #define TEMPERATURE_SENSOR_SELECTION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define RESOLUTION_SETTING 0x61
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define READ_VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING 0x82
|
||||
* #define PARTIAL_WINDOW 0x90
|
||||
* #define PARTIAL_IN 0x91
|
||||
* #define PARTIAL_OUT 0x92
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* #define POWER_SAVING 0xE3
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-09):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_5in83.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_5IN83_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_5IN83_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_5IN83_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_5IN83_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) { //LOW: idle, HIGH: busy
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_5IN83_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_5IN83_SendCommand(0x12); // DISPLAY_REFRESH
|
||||
DEV_Delay_ms(100);
|
||||
EPD_5IN83_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_5IN83_Init(void)
|
||||
{
|
||||
EPD_5IN83_Reset();
|
||||
|
||||
EPD_5IN83_SendCommand(0x01); // POWER_SETTING
|
||||
EPD_5IN83_SendData(0x37);
|
||||
EPD_5IN83_SendData(0x00);
|
||||
|
||||
EPD_5IN83_SendCommand(0x00); // PANEL_SETTING
|
||||
EPD_5IN83_SendData(0xCF);
|
||||
EPD_5IN83_SendData(0x08);
|
||||
|
||||
EPD_5IN83_SendCommand(0x06); // BOOSTER_SOFT_START
|
||||
EPD_5IN83_SendData(0xc7);
|
||||
EPD_5IN83_SendData(0xcc);
|
||||
EPD_5IN83_SendData(0x28);
|
||||
|
||||
EPD_5IN83_SendCommand(0x04); // POWER_ON
|
||||
EPD_5IN83_ReadBusy();
|
||||
|
||||
EPD_5IN83_SendCommand(0x30); // PLL_CONTROL
|
||||
EPD_5IN83_SendData(0x3c);
|
||||
|
||||
EPD_5IN83_SendCommand(0x41); // TEMPERATURE_CALIBRATION
|
||||
EPD_5IN83_SendData(0x00);
|
||||
|
||||
EPD_5IN83_SendCommand(0x50); // VCOM_AND_DATA_INTERVAL_SETTING
|
||||
EPD_5IN83_SendData(0x77);
|
||||
|
||||
EPD_5IN83_SendCommand(0x60); // TCON_SETTING
|
||||
EPD_5IN83_SendData(0x22);
|
||||
|
||||
EPD_5IN83_SendCommand(0x61); // TCON_RESOLUTION
|
||||
EPD_5IN83_SendData(EPD_5IN83_WIDTH >> 8); // source 600
|
||||
EPD_5IN83_SendData(EPD_5IN83_WIDTH & 0xff);
|
||||
EPD_5IN83_SendData(EPD_5IN83_HEIGHT >> 8); // gate 448
|
||||
EPD_5IN83_SendData(EPD_5IN83_HEIGHT & 0xff);
|
||||
|
||||
EPD_5IN83_SendCommand(0x82); // VCM_DC_SETTING
|
||||
EPD_5IN83_SendData(0x1E); // decide by LUT file
|
||||
|
||||
EPD_5IN83_SendCommand(0xe5); // FLASH MODE
|
||||
EPD_5IN83_SendData(0x03);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_5IN83_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_5IN83_WIDTH % 8 == 0)? (EPD_5IN83_WIDTH / 8 ): (EPD_5IN83_WIDTH / 8 + 1);
|
||||
Height = EPD_5IN83_HEIGHT;
|
||||
|
||||
EPD_5IN83_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
for(UBYTE k = 0; k < 4; k++) {
|
||||
EPD_5IN83_SendData(0x33);
|
||||
}
|
||||
}
|
||||
}
|
||||
EPD_5IN83_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_5IN83_Display(UBYTE *Image)
|
||||
{
|
||||
UBYTE Data_Black, Data;
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_5IN83_WIDTH % 8 == 0)? (EPD_5IN83_WIDTH / 8 ): (EPD_5IN83_WIDTH / 8 + 1);
|
||||
Height = EPD_5IN83_HEIGHT;
|
||||
|
||||
EPD_5IN83_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
Data_Black = ~Image[i + j * Width];
|
||||
for(UBYTE k = 0; k < 8; k++) {
|
||||
if(Data_Black & 0x80)
|
||||
Data = 0x00;
|
||||
else
|
||||
Data = 0x03;
|
||||
Data <<= 4;
|
||||
Data_Black <<= 1;
|
||||
k++;
|
||||
if(Data_Black & 0x80)
|
||||
Data |= 0x00;
|
||||
else
|
||||
Data |= 0x03;
|
||||
Data_Black <<= 1;
|
||||
EPD_5IN83_SendData(Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
EPD_5IN83_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_5IN83_Sleep(void)
|
||||
{
|
||||
EPD_5IN83_SendCommand(0x02); // POWER_OFF
|
||||
EPD_5IN83_ReadBusy();
|
||||
EPD_5IN83_SendCommand(0x07); // DEEP_SLEEP
|
||||
EPD_5IN83_SendData(0XA5);
|
||||
}
|
||||
|
||||
101
STM32/STM32-F103ZET6/User/e-Paper/EPD_5in83.h
Normal file
101
STM32/STM32-F103ZET6/User/e-Paper/EPD_5in83.h
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in83.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_5IN83_Reset()
|
||||
* EPD_SendCommand() => EPD_5IN83_SendCommand()
|
||||
* EPD_SendData() => EPD_5IN83_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_5IN83_ReadBusy()
|
||||
* EPD_SetFullReg() => EPD_5IN83_SetFullReg()
|
||||
* EPD_SetPartReg() => EPD_5IN83_SetPartReg()
|
||||
* EPD_TurnOnDisplay() => EPD_5IN83_TurnOnDisplay()
|
||||
* EPD_Init() => EPD_5IN83_Init()
|
||||
* EPD_Clear() => EPD_5IN83_Clear()
|
||||
* EPD_Display() => EPD_5IN83_Display()
|
||||
* EPD_Sleep() => EPD_5IN83_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define VCOM_LUT 0x20
|
||||
* #define W2W_LUT 0x21
|
||||
* #define B2W_LUT 0x22
|
||||
* #define W2B_LUT 0x23
|
||||
* #define B2B_LUT 0x24
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x40
|
||||
* #define TEMPERATURE_SENSOR_SELECTION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define RESOLUTION_SETTING 0x61
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define READ_VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING 0x82
|
||||
* #define PARTIAL_WINDOW 0x90
|
||||
* #define PARTIAL_IN 0x91
|
||||
* #define PARTIAL_OUT 0x92
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* #define POWER_SAVING 0xE3
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-09):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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 __EPD_5IN83_H_
|
||||
#define __EPD_5IN83_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_5IN83_WIDTH 600
|
||||
#define EPD_5IN83_HEIGHT 448
|
||||
|
||||
void EPD_5IN83_Init(void);
|
||||
void EPD_5IN83_Clear(void);
|
||||
void EPD_5IN83_Display(UBYTE *Image);
|
||||
void EPD_5IN83_Sleep(void);
|
||||
|
||||
#endif
|
||||
337
STM32/STM32-F103ZET6/User/e-Paper/EPD_5in83bc.c
Normal file
337
STM32/STM32-F103ZET6/User/e-Paper/EPD_5in83bc.c
Normal file
|
|
@ -0,0 +1,337 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5IN83BC.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch e-paper b&c
|
||||
* | Info :
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_5IN83BC_Reset()
|
||||
* EPD_SendCommand() => EPD_5IN83BC_SendCommand()
|
||||
* EPD_SendData() => EPD_5IN83BC_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_5IN83BC_ReadBusy()
|
||||
* EPD_Init() => EPD_5IN83BC_Init()
|
||||
* EPD_Clear() => EPD_5IN83BC_Clear()
|
||||
* EPD_Display() => EPD_5IN83BC_Display()
|
||||
* EPD_Sleep() => EPD_5IN83BC_Sleep()
|
||||
* 2.Remove:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define IMAGE_PROCESS 0x13
|
||||
* #define LUT_FOR_VCOM 0x20
|
||||
* #define LUT_BLUE 0x21
|
||||
* #define LUT_WHITE 0x22
|
||||
* #define LUT_GRAY_1 0x23
|
||||
* #define LUT_GRAY_2 0x24
|
||||
* #define LUT_RED_0 0x25
|
||||
* #define LUT_RED_1 0x26
|
||||
* #define LUT_RED_2 0x27
|
||||
* #define LUT_RED_3 0x28
|
||||
* #define LUT_XON 0x29
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define SPI_FLASH_CONTROL 0x65
|
||||
* #define REVISION 0x70
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASUREMENT_VCOM 0x80
|
||||
* #define READ_VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING 0x82
|
||||
* 3.add:
|
||||
* EPD_5IN83BC_DisplayHalfScreen()
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-09):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_5in83bc.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_5IN83BC_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_5IN83BC_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_5IN83BC_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_5IN83BC_ReadBusy(void)
|
||||
{
|
||||
UBYTE busy;
|
||||
Debug("e-Paper busy\r\n");
|
||||
do {
|
||||
EPD_5IN83BC_SendCommand(0x71);
|
||||
busy = DEV_Digital_Read(EPD_BUSY_PIN);
|
||||
busy =!(busy & 0x01);
|
||||
} while(busy);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_5IN83BC_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_5IN83BC_SendCommand(0x04); // POWER ON
|
||||
EPD_5IN83BC_ReadBusy();
|
||||
EPD_5IN83BC_SendCommand(0x12); // display refresh
|
||||
DEV_Delay_ms(100);
|
||||
EPD_5IN83BC_ReadBusy();
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_5IN83BC_Init(void)
|
||||
{
|
||||
EPD_5IN83BC_Reset();
|
||||
|
||||
EPD_5IN83BC_SendCommand(0x01); // POWER_SETTING
|
||||
EPD_5IN83BC_SendData(0x37);
|
||||
EPD_5IN83BC_SendData(0x00);
|
||||
|
||||
EPD_5IN83BC_SendCommand(0x00); // PANEL_SETTING
|
||||
EPD_5IN83BC_SendData(0xCF);
|
||||
EPD_5IN83BC_SendData(0x08);
|
||||
|
||||
EPD_5IN83BC_SendCommand(0x30); // PLL_CONTROL
|
||||
EPD_5IN83BC_SendData(0x3A); //PLL: 0-15:0x3C, 15+:0x3A
|
||||
|
||||
EPD_5IN83BC_SendCommand(0x82); // VCM_DC_SETTING
|
||||
EPD_5IN83BC_SendData(0x28); //all temperature range
|
||||
|
||||
EPD_5IN83BC_SendCommand(0x06); // BOOSTER_SOFT_START
|
||||
EPD_5IN83BC_SendData (0xc7);
|
||||
EPD_5IN83BC_SendData (0xcc);
|
||||
EPD_5IN83BC_SendData (0x15);
|
||||
|
||||
EPD_5IN83BC_SendCommand(0x50); // VCOM AND DATA INTERVAL SETTING
|
||||
EPD_5IN83BC_SendData(0x77);
|
||||
|
||||
EPD_5IN83BC_SendCommand(0x60); // TCON_SETTING
|
||||
EPD_5IN83BC_SendData(0x22);
|
||||
|
||||
EPD_5IN83BC_SendCommand(0x65); // FLASH CONTROL
|
||||
EPD_5IN83BC_SendData(0x00);
|
||||
|
||||
EPD_5IN83BC_SendCommand(0x61); // TCON_RESOLUTION
|
||||
EPD_5IN83BC_SendData (0x02); // source 600
|
||||
EPD_5IN83BC_SendData (0x58);
|
||||
EPD_5IN83BC_SendData (0x01); // gate 448
|
||||
EPD_5IN83BC_SendData (0xc0);
|
||||
|
||||
EPD_5IN83BC_SendCommand(0xe5); // FLASH MODE
|
||||
EPD_5IN83BC_SendData(0x03);
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_5IN83BC_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_5IN83BC_WIDTH % 8 == 0)? (EPD_5IN83BC_WIDTH / 8): (EPD_5IN83BC_WIDTH / 8 + 1);
|
||||
Height = EPD_5IN83BC_HEIGHT;
|
||||
|
||||
EPD_5IN83BC_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
for(UBYTE k = 0; k < 4; k++) {
|
||||
EPD_5IN83BC_SendData(0x33);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EPD_5IN83BC_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_5IN83BC_Display(const UBYTE *blackimage, const UBYTE *ryimage)
|
||||
{
|
||||
UBYTE Data_Black, Data_RY, Data;
|
||||
UDOUBLE i, j, Width, Height;
|
||||
Width = (EPD_5IN83BC_WIDTH % 8 == 0)? (EPD_5IN83BC_WIDTH / 8 ): (EPD_5IN83BC_WIDTH / 8 + 1);
|
||||
Height = EPD_5IN83BC_HEIGHT;
|
||||
|
||||
EPD_5IN83BC_SendCommand(0x10);
|
||||
for (j = 0; j < Height; j++) {
|
||||
for (i = 0; i < Width; i++) {
|
||||
Data_Black = blackimage[i + j * Width];
|
||||
Data_RY = ryimage[i + j * Width]; // red or yellow
|
||||
for(UBYTE k = 0; k < 8; k++) {
|
||||
if ((Data_RY & 0x80) == 0x00) {
|
||||
Data = 0x04; //red
|
||||
} else if ((Data_Black & 0x80) == 0x00) {
|
||||
Data = 0x00; //black
|
||||
} else {
|
||||
Data = 0x03; //white
|
||||
}
|
||||
Data = (Data << 4) & 0xFF;
|
||||
Data_Black = (Data_Black << 1) & 0xFF;
|
||||
Data_RY = (Data_RY << 1) & 0xFF;
|
||||
k += 1;
|
||||
|
||||
if((Data_RY & 0x80) == 0x00) {
|
||||
Data |= 0x04; //red
|
||||
} else if ((Data_Black & 0x80) == 0x00) {
|
||||
Data |= 0x00; //black
|
||||
} else {
|
||||
Data |= 0x03; //white
|
||||
}
|
||||
Data_Black = (Data_Black << 1) & 0xFF;
|
||||
Data_RY = (Data_RY << 1) & 0xFF;
|
||||
EPD_5IN83BC_SendData(Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EPD_5IN83BC_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_5IN83BC_DisplayHalfScreen(const UBYTE *blackimage, const UBYTE *ryimage)
|
||||
{
|
||||
UBYTE Data_Black, Data_RY, Data;
|
||||
UDOUBLE i, j, Width, Height;
|
||||
Width = (EPD_5IN83BC_WIDTH % 8 == 0)? (EPD_5IN83BC_WIDTH / 8 ): (EPD_5IN83BC_WIDTH / 8 + 1);
|
||||
Height = EPD_5IN83BC_HEIGHT;
|
||||
|
||||
EPD_5IN83BC_SendCommand(0x10);
|
||||
for (j = 0; j < Height / 2; j++) {
|
||||
for (i = 0; i < Width; i++) {
|
||||
Data_Black = blackimage[i + j * Width];
|
||||
Data_RY = ryimage[i + j * Width]; // red or yellow
|
||||
for(UBYTE k = 0; k < 8; k++) {
|
||||
if ((Data_RY & 0x80) == 0x00) {
|
||||
Data = 0x04; //red
|
||||
} else if ((Data_Black & 0x80) == 0x00) {
|
||||
Data = 0x00; //black
|
||||
} else {
|
||||
Data = 0x03; //white
|
||||
}
|
||||
Data = (Data << 4) & 0xFF;
|
||||
Data_Black = (Data_Black << 1) & 0xFF;
|
||||
Data_RY = (Data_RY << 1) & 0xFF;
|
||||
k += 1;
|
||||
|
||||
if((Data_RY & 0x80) == 0x00) {
|
||||
Data |= 0x04; //red
|
||||
} else if ((Data_Black & 0x80) == 0x00) {
|
||||
Data |= 0x00; //black
|
||||
} else {
|
||||
Data |= 0x03; //white
|
||||
}
|
||||
Data_Black = (Data_Black << 1) & 0xFF;
|
||||
Data_RY = (Data_RY << 1) & 0xFF;
|
||||
EPD_5IN83BC_SendData(Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < Height / 2; j++) {
|
||||
for (i = 0; i < Width; i++) {
|
||||
for(UBYTE k = 0; k < 4; k++) {
|
||||
EPD_5IN83BC_SendData(0x33);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EPD_5IN83BC_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_5IN83BC_Sleep(void)
|
||||
{
|
||||
EPD_5IN83BC_SendCommand(0x02); // POWER_OFF
|
||||
EPD_5IN83BC_ReadBusy();
|
||||
EPD_5IN83BC_SendCommand(0x07); // DEEP_SLEEP
|
||||
EPD_5IN83BC_SendData(0XA5);
|
||||
}
|
||||
100
STM32/STM32-F103ZET6/User/e-Paper/EPD_5in83bc.h
Normal file
100
STM32/STM32-F103ZET6/User/e-Paper/EPD_5in83bc.h
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5IN83BC.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch e-paper b&c
|
||||
* | Info :
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_5IN83BC_Reset()
|
||||
* EPD_SendCommand() => EPD_5IN83BC_SendCommand()
|
||||
* EPD_SendData() => EPD_5IN83BC_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_5IN83BC_ReadBusy()
|
||||
* EPD_Init() => EPD_5IN83BC_Init()
|
||||
* EPD_Clear() => EPD_5IN83BC_Clear()
|
||||
* EPD_Display() => EPD_5IN83BC_Display()
|
||||
* EPD_Sleep() => EPD_5IN83BC_Sleep()
|
||||
* 2.Remove:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define IMAGE_PROCESS 0x13
|
||||
* #define LUT_FOR_VCOM 0x20
|
||||
* #define LUT_BLUE 0x21
|
||||
* #define LUT_WHITE 0x22
|
||||
* #define LUT_GRAY_1 0x23
|
||||
* #define LUT_GRAY_2 0x24
|
||||
* #define LUT_RED_0 0x25
|
||||
* #define LUT_RED_1 0x26
|
||||
* #define LUT_RED_2 0x27
|
||||
* #define LUT_RED_3 0x28
|
||||
* #define LUT_XON 0x29
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define SPI_FLASH_CONTROL 0x65
|
||||
* #define REVISION 0x70
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASUREMENT_VCOM 0x80
|
||||
* #define READ_VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING 0x82
|
||||
* 3.add:
|
||||
* EPD_5IN83BC_DisplayHalfScreen()
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-09):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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 __EPD_5IN83BC_H_
|
||||
#define __EPD_5IN83BC_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_5IN83BC_WIDTH 600
|
||||
#define EPD_5IN83BC_HEIGHT 448
|
||||
|
||||
void EPD_5IN83BC_Init(void);
|
||||
void EPD_5IN83BC_Clear(void);
|
||||
void EPD_5IN83BC_Display(const UBYTE *blackimage, const UBYTE *ryimage);
|
||||
void EPD_5IN83BC_DisplayHalfScreen(const UBYTE *blackimage, const UBYTE *ryimage);
|
||||
void EPD_5IN83BC_Sleep(void);
|
||||
|
||||
#endif
|
||||
271
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5.c
Normal file
271
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5.c
Normal file
|
|
@ -0,0 +1,271 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7IN5.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.5inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_7IN5_Reset()
|
||||
* EPD_SendCommand() => EPD_7IN5_SendCommand()
|
||||
* EPD_SendData() => EPD_7IN5_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_7IN5_ReadBusy()
|
||||
* EPD_SetFullReg() => EPD_7IN5_SetFullReg()
|
||||
* EPD_SetPartReg() => EPD_7IN5_SetPartReg()
|
||||
* EPD_TurnOnDisplay() => EPD_7IN5_TurnOnDisplay()
|
||||
* EPD_Init() => EPD_7IN5_Init()
|
||||
* EPD_Clear() => EPD_7IN5_Clear()
|
||||
* EPD_Display() => EPD_7IN5_Display()
|
||||
* EPD_Sleep() => EPD_7IN5_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define VCOM_LUT 0x20
|
||||
* #define W2W_LUT 0x21
|
||||
* #define B2W_LUT 0x22
|
||||
* #define W2B_LUT 0x23
|
||||
* #define B2B_LUT 0x24
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x40
|
||||
* #define TEMPERATURE_SENSOR_SELECTION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define RESOLUTION_SETTING 0x61
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define READ_VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING 0x82
|
||||
* #define PARTIAL_WINDOW 0x90
|
||||
* #define PARTIAL_IN 0x91
|
||||
* #define PARTIAL_OUT 0x92
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* #define POWER_SAVING 0xE3
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-09):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_7in5.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_7IN5_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_7IN5_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_7IN5_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) { //LOW: idle, HIGH: busy
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_7IN5_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_7IN5_SendCommand(0x12); // DISPLAY_REFRESH
|
||||
DEV_Delay_ms(100);
|
||||
EPD_7IN5_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5_Init(void)
|
||||
{
|
||||
EPD_7IN5_Reset();
|
||||
|
||||
EPD_7IN5_SendCommand(0x01); // POWER_SETTING
|
||||
EPD_7IN5_SendData(0x37);
|
||||
EPD_7IN5_SendData(0x00);
|
||||
|
||||
EPD_7IN5_SendCommand(0x00); // PANEL_SETTING
|
||||
EPD_7IN5_SendData(0xCF);
|
||||
EPD_7IN5_SendData(0x08);
|
||||
|
||||
EPD_7IN5_SendCommand(0x06); // BOOSTER_SOFT_START
|
||||
EPD_7IN5_SendData(0xc7);
|
||||
EPD_7IN5_SendData(0xcc);
|
||||
EPD_7IN5_SendData(0x28);
|
||||
|
||||
EPD_7IN5_SendCommand(0x04); // POWER_ON
|
||||
EPD_7IN5_ReadBusy();
|
||||
|
||||
EPD_7IN5_SendCommand(0x30); // PLL_CONTROL
|
||||
EPD_7IN5_SendData(0x3c);
|
||||
|
||||
EPD_7IN5_SendCommand(0x41); // TEMPERATURE_CALIBRATION
|
||||
EPD_7IN5_SendData(0x00);
|
||||
|
||||
EPD_7IN5_SendCommand(0x50); // VCOM_AND_DATA_INTERVAL_SETTING
|
||||
EPD_7IN5_SendData(0x77);
|
||||
|
||||
EPD_7IN5_SendCommand(0x60); // TCON_SETTING
|
||||
EPD_7IN5_SendData(0x22);
|
||||
|
||||
EPD_7IN5_SendCommand(0x61); // TCON_RESOLUTION
|
||||
EPD_7IN5_SendData(EPD_7IN5_WIDTH >> 8); // source 640
|
||||
EPD_7IN5_SendData(EPD_7IN5_WIDTH & 0xff);
|
||||
EPD_7IN5_SendData(EPD_7IN5_HEIGHT >> 8); // gate 384
|
||||
EPD_7IN5_SendData(EPD_7IN5_HEIGHT & 0xff);
|
||||
|
||||
EPD_7IN5_SendCommand(0x82); // VCM_DC_SETTING
|
||||
EPD_7IN5_SendData(0x1E); // decide by LUT file
|
||||
|
||||
EPD_7IN5_SendCommand(0xe5); // FLASH MODE
|
||||
EPD_7IN5_SendData(0x03);
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_7IN5_WIDTH % 8 == 0)? (EPD_7IN5_WIDTH / 8 ): (EPD_7IN5_WIDTH / 8 + 1);
|
||||
Height = EPD_7IN5_HEIGHT;
|
||||
|
||||
EPD_7IN5_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
for(UBYTE k = 0; k < 4; k++) {
|
||||
EPD_7IN5_SendData(0x33);
|
||||
}
|
||||
}
|
||||
}
|
||||
EPD_7IN5_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5_Display(UBYTE *Image)
|
||||
{
|
||||
UBYTE Data_Black, Data;
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_7IN5_WIDTH % 8 == 0)? (EPD_7IN5_WIDTH / 8 ): (EPD_7IN5_WIDTH / 8 + 1);
|
||||
Height = EPD_7IN5_HEIGHT;
|
||||
|
||||
EPD_7IN5_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
Data_Black = ~Image[i + j * Width];
|
||||
for(UBYTE k = 0; k < 8; k++) {
|
||||
if(Data_Black & 0x80)
|
||||
Data = 0x00;
|
||||
else
|
||||
Data = 0x03;
|
||||
Data <<= 4;
|
||||
Data_Black <<= 1;
|
||||
k++;
|
||||
if(Data_Black & 0x80)
|
||||
Data |= 0x00;
|
||||
else
|
||||
Data |= 0x03;
|
||||
Data_Black <<= 1;
|
||||
EPD_7IN5_SendData(Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
EPD_7IN5_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5_Sleep(void)
|
||||
{
|
||||
EPD_7IN5_SendCommand(0x02); // POWER_OFF
|
||||
EPD_7IN5_ReadBusy();
|
||||
EPD_7IN5_SendCommand(0x07); // DEEP_SLEEP
|
||||
EPD_7IN5_SendData(0XA5);;
|
||||
}
|
||||
101
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5.h
Normal file
101
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5.h
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7IN5.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.5inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_7IN5_Reset()
|
||||
* EPD_SendCommand() => EPD_7IN5_SendCommand()
|
||||
* EPD_SendData() => EPD_7IN5_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_7IN5_ReadBusy()
|
||||
* EPD_SetFullReg() => EPD_7IN5_SetFullReg()
|
||||
* EPD_SetPartReg() => EPD_7IN5_SetPartReg()
|
||||
* EPD_TurnOnDisplay() => EPD_7IN5_TurnOnDisplay()
|
||||
* EPD_Init() => EPD_7IN5_Init()
|
||||
* EPD_Clear() => EPD_7IN5_Clear()
|
||||
* EPD_Display() => EPD_7IN5_Display()
|
||||
* EPD_Sleep() => EPD_7IN5_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define VCOM_LUT 0x20
|
||||
* #define W2W_LUT 0x21
|
||||
* #define B2W_LUT 0x22
|
||||
* #define W2B_LUT 0x23
|
||||
* #define B2B_LUT 0x24
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x40
|
||||
* #define TEMPERATURE_SENSOR_SELECTION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define RESOLUTION_SETTING 0x61
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define READ_VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING 0x82
|
||||
* #define PARTIAL_WINDOW 0x90
|
||||
* #define PARTIAL_IN 0x91
|
||||
* #define PARTIAL_OUT 0x92
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* #define POWER_SAVING 0xE3
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-09):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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 __EPD_7IN5_H_
|
||||
#define __EPD_7IN5_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_7IN5_WIDTH 640
|
||||
#define EPD_7IN5_HEIGHT 384
|
||||
|
||||
void EPD_7IN5_Init(void);
|
||||
void EPD_7IN5_Clear(void);
|
||||
void EPD_7IN5_Display(UBYTE *Image);
|
||||
void EPD_7IN5_Sleep(void);
|
||||
|
||||
#endif
|
||||
331
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5bc.c
Normal file
331
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5bc.c
Normal file
|
|
@ -0,0 +1,331 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7IN5BC.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.5inch e-paper b&c
|
||||
* | Info :
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_7IN5BC_Reset()
|
||||
* EPD_SendCommand() => EPD_7IN5BC_SendCommand()
|
||||
* EPD_SendData() => EPD_7IN5BC_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_7IN5BC_ReadBusy()
|
||||
* EPD_Init() => EPD_7IN5BC_Init()
|
||||
* EPD_Clear() => EPD_7IN5BC_Clear()
|
||||
* EPD_Display() => EPD_7IN5BC_Display()
|
||||
* EPD_Sleep() => EPD_7IN5BC_Sleep()
|
||||
* 2.Remove:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define IMAGE_PROCESS 0x13
|
||||
* #define LUT_FOR_VCOM 0x20
|
||||
* #define LUT_BLUE 0x21
|
||||
* #define LUT_WHITE 0x22
|
||||
* #define LUT_GRAY_1 0x23
|
||||
* #define LUT_GRAY_2 0x24
|
||||
* #define LUT_RED_0 0x25
|
||||
* #define LUT_RED_1 0x26
|
||||
* #define LUT_RED_2 0x27
|
||||
* #define LUT_RED_3 0x28
|
||||
* #define LUT_XON 0x29
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define SPI_FLASH_CONTROL 0x65
|
||||
* #define REVISION 0x70
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASUREMENT_VCOM 0x80
|
||||
* #define READ_VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING 0x82
|
||||
* 3.add:
|
||||
* EPD_7IN5BC_DisplayHalfScreen()
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-09):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_7in5bc.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_7IN5BC_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_7IN5BC_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_7IN5BC_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5BC_ReadBusy(void)
|
||||
{
|
||||
UBYTE busy;
|
||||
Debug("e-Paper busy\r\n");
|
||||
do {
|
||||
EPD_7IN5BC_SendCommand(0x71);
|
||||
busy = DEV_Digital_Read(EPD_BUSY_PIN);
|
||||
busy =!(busy & 0x01);
|
||||
} while(busy);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_7IN5BC_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_7IN5BC_SendCommand(0x04); // POWER ON
|
||||
EPD_7IN5BC_ReadBusy();
|
||||
EPD_7IN5BC_SendCommand(0x12); // display refresh
|
||||
DEV_Delay_ms(100);
|
||||
EPD_7IN5BC_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5BC_Init(void)
|
||||
{
|
||||
EPD_7IN5BC_Reset();
|
||||
|
||||
EPD_7IN5BC_SendCommand(0x01); // POWER_SETTING
|
||||
EPD_7IN5BC_SendData(0x37);
|
||||
EPD_7IN5BC_SendData(0x00);
|
||||
|
||||
EPD_7IN5BC_SendCommand(0x00); // PANEL_SETTING
|
||||
EPD_7IN5BC_SendData(0xCF);
|
||||
EPD_7IN5BC_SendData(0x08);
|
||||
|
||||
EPD_7IN5BC_SendCommand(0x30); // PLL_CONTROL
|
||||
EPD_7IN5BC_SendData(0x3A); // PLL: 0-15:0x3C, 15+:0x3A
|
||||
|
||||
EPD_7IN5BC_SendCommand(0x82); // VCM_DC_SETTING
|
||||
EPD_7IN5BC_SendData(0x28); //all temperature range
|
||||
|
||||
EPD_7IN5BC_SendCommand(0x06); // BOOSTER_SOFT_START
|
||||
EPD_7IN5BC_SendData (0xc7);
|
||||
EPD_7IN5BC_SendData (0xcc);
|
||||
EPD_7IN5BC_SendData (0x15);
|
||||
|
||||
EPD_7IN5BC_SendCommand(0x50); // VCOM AND DATA INTERVAL SETTING
|
||||
EPD_7IN5BC_SendData(0x77);
|
||||
|
||||
EPD_7IN5BC_SendCommand(0x60); // TCON_SETTING
|
||||
EPD_7IN5BC_SendData(0x22);
|
||||
|
||||
EPD_7IN5BC_SendCommand(0x65); // FLASH CONTROL
|
||||
EPD_7IN5BC_SendData(0x00);
|
||||
|
||||
EPD_7IN5BC_SendCommand(0x61); // TCON_RESOLUTION
|
||||
EPD_7IN5BC_SendData(EPD_7IN5BC_WIDTH >> 8); // source 640
|
||||
EPD_7IN5BC_SendData(EPD_7IN5BC_WIDTH & 0xff);
|
||||
EPD_7IN5BC_SendData(EPD_7IN5BC_HEIGHT >> 8); // gate 384
|
||||
EPD_7IN5BC_SendData(EPD_7IN5BC_HEIGHT & 0xff);
|
||||
|
||||
EPD_7IN5BC_SendCommand(0xe5); // FLASH MODE
|
||||
EPD_7IN5BC_SendData(0x03);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5BC_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_7IN5BC_WIDTH % 8 == 0)? (EPD_7IN5BC_WIDTH / 8): (EPD_7IN5BC_WIDTH / 8 + 1);
|
||||
Height = EPD_7IN5BC_HEIGHT;
|
||||
|
||||
EPD_7IN5BC_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
for(UBYTE k = 0; k < 4; k++) {
|
||||
EPD_7IN5BC_SendData(0x33);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EPD_7IN5BC_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5BC_Display(const UBYTE *blackimage, const UBYTE *ryimage)
|
||||
{
|
||||
UBYTE Data_Black, Data_RY, Data;
|
||||
UDOUBLE i, j, Width, Height;
|
||||
Width = (EPD_7IN5BC_WIDTH % 8 == 0)? (EPD_7IN5BC_WIDTH / 8 ): (EPD_7IN5BC_WIDTH / 8 + 1);
|
||||
Height = EPD_7IN5BC_HEIGHT;
|
||||
|
||||
EPD_7IN5BC_SendCommand(0x10);
|
||||
for (j = 0; j < Height; j++) {
|
||||
for (i = 0; i < Width; i++) {
|
||||
Data_Black = blackimage[i + j * Width];
|
||||
Data_RY = ryimage[i + j * Width]; // red or yellow
|
||||
for(UBYTE k = 0; k < 8; k++) {
|
||||
if ((Data_RY & 0x80) == 0x00) {
|
||||
Data = 0x04; //red
|
||||
} else if ((Data_Black & 0x80) == 0x00) {
|
||||
Data = 0x00; //black
|
||||
} else {
|
||||
Data = 0x03; //white
|
||||
}
|
||||
Data = (Data << 4) & 0xFF;
|
||||
Data_Black = (Data_Black << 1) & 0xFF;
|
||||
Data_RY = (Data_RY << 1) & 0xFF;
|
||||
k += 1;
|
||||
|
||||
if((Data_RY & 0x80) == 0x00) {
|
||||
Data |= 0x04; //red
|
||||
} else if ((Data_Black & 0x80) == 0x00) {
|
||||
Data |= 0x00; //black
|
||||
} else {
|
||||
Data |= 0x03; //white
|
||||
}
|
||||
Data_Black = (Data_Black << 1) & 0xFF;
|
||||
Data_RY = (Data_RY << 1) & 0xFF;
|
||||
EPD_7IN5BC_SendData(Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EPD_7IN5BC_TurnOnDisplay();
|
||||
}
|
||||
|
||||
void EPD_7IN5BC_DisplayHalfScreen(const UBYTE *blackimage, const UBYTE *ryimage)
|
||||
{
|
||||
UBYTE Data_Black, Data_RY, Data;
|
||||
UDOUBLE i, j, Width, Height;
|
||||
Width = (EPD_7IN5BC_WIDTH % 8 == 0)? (EPD_7IN5BC_WIDTH / 8 ): (EPD_7IN5BC_WIDTH / 8 + 1);
|
||||
Height = EPD_7IN5BC_HEIGHT;
|
||||
|
||||
EPD_7IN5BC_SendCommand(0x10);
|
||||
for (j = 0; j < Height / 2; j++) {
|
||||
for (i = 0; i < Width; i++) {
|
||||
Data_Black = blackimage[i + j * Width];
|
||||
Data_RY = ryimage[i + j * Width]; // red or yellow
|
||||
for(UBYTE k = 0; k < 8; k++) {
|
||||
if ((Data_RY & 0x80) == 0x00) {
|
||||
Data = 0x04; //red
|
||||
} else if ((Data_Black & 0x80) == 0x00) {
|
||||
Data = 0x00; //black
|
||||
} else {
|
||||
Data = 0x03; //white
|
||||
}
|
||||
Data = (Data << 4) & 0xFF;
|
||||
Data_Black = (Data_Black << 1) & 0xFF;
|
||||
Data_RY = (Data_RY << 1) & 0xFF;
|
||||
k += 1;
|
||||
|
||||
if((Data_RY & 0x80) == 0x00) {
|
||||
Data |= 0x04; //red
|
||||
} else if ((Data_Black & 0x80) == 0x00) {
|
||||
Data |= 0x00; //black
|
||||
} else {
|
||||
Data |= 0x03; //white
|
||||
}
|
||||
Data_Black = (Data_Black << 1) & 0xFF;
|
||||
Data_RY = (Data_RY << 1) & 0xFF;
|
||||
EPD_7IN5BC_SendData(Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < Height / 2; j++) {
|
||||
for (i = 0; i < Width; i++) {
|
||||
for(UBYTE k = 0; k < 4; k++) {
|
||||
EPD_7IN5BC_SendData(Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EPD_7IN5BC_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5BC_Sleep(void)
|
||||
{
|
||||
EPD_7IN5BC_SendCommand(0x02); // POWER_OFF
|
||||
EPD_7IN5BC_ReadBusy();
|
||||
EPD_7IN5BC_SendCommand(0x07); // DEEP_SLEEP
|
||||
EPD_7IN5BC_SendData(0XA5);
|
||||
}
|
||||
100
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5bc.h
Normal file
100
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5bc.h
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7IN5BC.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.5inch e-paper b&c
|
||||
* | Info :
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change:
|
||||
* EPD_Reset() => EPD_7IN5BC_Reset()
|
||||
* EPD_SendCommand() => EPD_7IN5BC_SendCommand()
|
||||
* EPD_SendData() => EPD_7IN5BC_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_7IN5BC_ReadBusy()
|
||||
* EPD_Init() => EPD_7IN5BC_Init()
|
||||
* EPD_Clear() => EPD_7IN5BC_Clear()
|
||||
* EPD_Display() => EPD_7IN5BC_Display()
|
||||
* EPD_Sleep() => EPD_7IN5BC_Sleep()
|
||||
* 2.Remove:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define IMAGE_PROCESS 0x13
|
||||
* #define LUT_FOR_VCOM 0x20
|
||||
* #define LUT_BLUE 0x21
|
||||
* #define LUT_WHITE 0x22
|
||||
* #define LUT_GRAY_1 0x23
|
||||
* #define LUT_GRAY_2 0x24
|
||||
* #define LUT_RED_0 0x25
|
||||
* #define LUT_RED_1 0x26
|
||||
* #define LUT_RED_2 0x27
|
||||
* #define LUT_RED_3 0x28
|
||||
* #define LUT_XON 0x29
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define SPI_FLASH_CONTROL 0x65
|
||||
* #define REVISION 0x70
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASUREMENT_VCOM 0x80
|
||||
* #define READ_VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING 0x82
|
||||
* 3.add:
|
||||
* EPD_7IN5BC_DisplayHalfScreen()
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-09):
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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 __EPD_7IN5BC_H_
|
||||
#define __EPD_7IN5BC_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_7IN5BC_WIDTH 640
|
||||
#define EPD_7IN5BC_HEIGHT 384
|
||||
|
||||
void EPD_7IN5BC_Init(void);
|
||||
void EPD_7IN5BC_Clear(void);
|
||||
void EPD_7IN5BC_Display(const UBYTE *blackimage, const UBYTE *ryimage);
|
||||
void EPD_7IN5BC_DisplayHalfScreen(const UBYTE *blackimage, const UBYTE *ryimage);
|
||||
void EPD_7IN5BC_Sleep(void);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue