mirror of
https://github.com/IcedRooibos/py32f0-template.git
synced 2025-10-28 08:22:06 -07:00
feat: lib and demo of waveshare e-paper
This commit is contained in:
parent
806035f632
commit
f879eebe17
125
Examples/LL/SPI/Waveshare_1.54_EPaper/EPD_Config.h
Normal file
125
Examples/LL/SPI/Waveshare_1.54_EPaper/EPD_Config.h
Normal file
@ -0,0 +1,125 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_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 _EPD_CONFIG_H_
|
||||
#define _EPD_CONFIG_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "main.h"
|
||||
|
||||
/**
|
||||
* Uncomment to enable the part
|
||||
*/
|
||||
// #define EPD_1IN02
|
||||
// #define EPD_1IN54_V2
|
||||
#define EPD_1IN54
|
||||
// #define EPD_1IN54B_V2
|
||||
// #define EPD_1IN54B
|
||||
// #define EPD_1IN54C
|
||||
// #define EPD_1IN64G
|
||||
// #define EPD_2IN7_V2
|
||||
// #define EPD_2IN7
|
||||
// #define EPD_2IN7B_V2
|
||||
// #define EPD_2IN7B
|
||||
// #define EPD_2IN9_V2
|
||||
// #define EPD_2IN9
|
||||
// #define EPD_2IN9B_V3
|
||||
// #define EPD_2IN9BC
|
||||
// #define EPD_2IN9D
|
||||
// #define EPD_2IN13_V2
|
||||
// #define EPD_2IN13_V3
|
||||
// #define EPD_2IN13
|
||||
// #define EPD_2IN13B_V3
|
||||
// #define EPD_2IN13B_V4
|
||||
// #define EPD_2IN13BC
|
||||
// #define EPD_2IN13D
|
||||
// #define EPD_2IN36G
|
||||
// #define EPD_2IN66
|
||||
// #define EPD_2IN66B
|
||||
// #define EPD_3IN0G
|
||||
// #define EPD_3IN7
|
||||
// #define EPD_3IN52
|
||||
// #define EPD_4IN01F
|
||||
// #define EPD_4IN2
|
||||
// #define EPD_4IN2B_V2
|
||||
// #define EPD_4IN2BC
|
||||
// #define EPD_4IN37G
|
||||
// #define EPD_5IN65F
|
||||
// #define EPD_5IN83_V2
|
||||
// #define EPD_5IN83
|
||||
// #define EPD_5IN83B_V2
|
||||
// #define EPD_5IN83BC
|
||||
// #define EPD_7IN3F
|
||||
// #define EPD_7IN3G
|
||||
// #define EPD_7IN5_HD
|
||||
// #define EPD_7IN5_V2
|
||||
// #define EPD_7IN5
|
||||
// #define EPD_7IN5B_HD
|
||||
// #define EPD_7IN5B_V2
|
||||
// #define EPD_7IN5BC
|
||||
|
||||
#define EPD_DEBUG 1
|
||||
|
||||
/**
|
||||
* e-Paper GPIO
|
||||
*/
|
||||
#define EPD_RST_PIN GPIOA, LL_GPIO_PIN_0
|
||||
#define EPD_DC_PIN GPIOA, LL_GPIO_PIN_5
|
||||
#define EPD_CS_PIN GPIOA, LL_GPIO_PIN_6
|
||||
#define EPD_BUSY_PIN GPIOA, LL_GPIO_PIN_4
|
||||
|
||||
/**
|
||||
* GPIO read and write
|
||||
*/
|
||||
#define EPD_Digital_Write(_pin, _value) APP_GPIO_WriteOutputPin(_pin, _value)
|
||||
#define EPD_Digital_Read(_pin) LL_GPIO_IsInputPinSet(_pin)
|
||||
|
||||
#define EPD_SPI_WriteByte(_value) SPI_TxRxByte(_value)
|
||||
#define EPD_Delay_ms(__xms) LL_mDelay(__xms)
|
||||
|
||||
#endif
|
||||
128
Examples/LL/SPI/Waveshare_1.54_EPaper/main.c
Normal file
128
Examples/LL/SPI/Waveshare_1.54_EPaper/main.c
Normal file
@ -0,0 +1,128 @@
|
||||
/***
|
||||
* Demo: Waveshare 1.54' E-Paper
|
||||
*
|
||||
* PY32 E-Paper
|
||||
* PA0 ------> Reset
|
||||
* PA1 ------> CLK/SCK
|
||||
* PA4 ------> Busy
|
||||
* PA5 ------> DC/A0
|
||||
* PA6 ------> CSN
|
||||
* PA7 ------> DIN/MOSI
|
||||
*
|
||||
* PA2 ------> TX
|
||||
* PA3 ------> RX
|
||||
*/
|
||||
#include <string.h>
|
||||
#include "main.h"
|
||||
#include "py32f0xx_bsp_clock.h"
|
||||
#include "py32f0xx_bsp_printf.h"
|
||||
#include "EPD_Test.h"
|
||||
|
||||
static void APP_GPIOConfig(void);
|
||||
static void APP_SPIConfig(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
BSP_RCC_HSI_PLL48MConfig();
|
||||
|
||||
BSP_USART_Config(115200);
|
||||
printf("SPI Demo: Waveshare 1.54' E-Paper\r\nClock: %ld\r\n", SystemCoreClock);
|
||||
|
||||
APP_GPIOConfig();
|
||||
APP_SPIConfig();
|
||||
|
||||
EPD_test();
|
||||
|
||||
while(1);
|
||||
}
|
||||
|
||||
uint8_t SPI_TxRxByte(uint8_t data)
|
||||
{
|
||||
uint8_t SPITimeout = 0xFF;
|
||||
/* Check the status of Transmit buffer Empty flag */
|
||||
while (READ_BIT(SPI1->SR, SPI_SR_TXE) == RESET)
|
||||
{
|
||||
if (SPITimeout-- == 0) return 0;
|
||||
}
|
||||
LL_SPI_TransmitData8(SPI1, data);
|
||||
SPITimeout = 0xFF;
|
||||
while (READ_BIT(SPI1->SR, SPI_SR_RXNE) == RESET)
|
||||
{
|
||||
if (SPITimeout-- == 0) return 0;
|
||||
}
|
||||
// Read from RX buffer
|
||||
return LL_SPI_ReceiveData8(SPI1);
|
||||
}
|
||||
|
||||
static void APP_GPIOConfig(void)
|
||||
{
|
||||
LL_GPIO_InitTypeDef GPIO_InitStruct;
|
||||
|
||||
// PA6 CS
|
||||
LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_6, LL_GPIO_MODE_OUTPUT);
|
||||
// PA5 CE
|
||||
LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_5, LL_GPIO_MODE_OUTPUT);
|
||||
// PA0 RESET
|
||||
LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_0, LL_GPIO_MODE_OUTPUT);
|
||||
/* PA4 Busy (input) */
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_4;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
}
|
||||
|
||||
/**
|
||||
* SPI1 Alternative Function Pins
|
||||
* SPI1_SCK: PA1_AF0, PA2_AF10, PA5_AF0, PA9_AF10, PB3_AF0
|
||||
* SPI1_MISO: PA0_AF10, PA6_AF0, PA7_AF10, PA11_AF0, PA13_AF10, PB4_AF0
|
||||
* SPI1_MOSI: PA1_AF10, PA2_AF0, PA3_AF10, PA7_AF0, PA8_AF10, PA12_AF0, PB5_AF0
|
||||
* SPI1_NSS: PA4_AF0, PA10_AF10, PA15_AF0, PB0_AF0, PF1_AF10, PF3_AF10
|
||||
*/
|
||||
static void APP_SPIConfig(void)
|
||||
{
|
||||
LL_SPI_InitTypeDef SPI_InitStruct;
|
||||
LL_GPIO_InitTypeDef GPIO_InitStruct;
|
||||
|
||||
LL_APB1_GRP2_EnableClock(LL_APB1_GRP2_PERIPH_SPI1);
|
||||
// PA1 SCK
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_1;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
||||
GPIO_InitStruct.Alternate = LL_GPIO_AF_0;
|
||||
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
// PA7 MOSI
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_7;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
GPIO_InitStruct.Alternate = LL_GPIO_AF_0;
|
||||
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
SPI_InitStruct.TransferDirection = LL_SPI_HALF_DUPLEX_TX;
|
||||
SPI_InitStruct.Mode = LL_SPI_MODE_MASTER;
|
||||
SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT;
|
||||
SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW;
|
||||
SPI_InitStruct.ClockPhase = LL_SPI_PHASE_1EDGE;
|
||||
SPI_InitStruct.NSS = LL_SPI_NSS_SOFT;
|
||||
SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV16;
|
||||
SPI_InitStruct.BitOrder = LL_SPI_MSB_FIRST;
|
||||
LL_SPI_Init(SPI1, &SPI_InitStruct);
|
||||
LL_SPI_Enable(SPI1);
|
||||
}
|
||||
|
||||
void APP_GPIO_WriteOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint8_t Val)
|
||||
{
|
||||
(Val == 0U)? WRITE_REG(GPIOx->BRR, PinMask) : WRITE_REG(GPIOx->BSRR, PinMask);
|
||||
}
|
||||
|
||||
void APP_ErrorHandler(void)
|
||||
{
|
||||
while (1);
|
||||
}
|
||||
|
||||
#ifdef USE_FULL_ASSERT
|
||||
void assert_failed(uint8_t *file, uint32_t line)
|
||||
{
|
||||
while (1);
|
||||
}
|
||||
#endif /* USE_FULL_ASSERT */
|
||||
29
Examples/LL/SPI/Waveshare_1.54_EPaper/main.h
Normal file
29
Examples/LL/SPI/Waveshare_1.54_EPaper/main.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef __MAIN_H
|
||||
#define __MAIN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "py32f0xx_ll_bus.h"
|
||||
#include "py32f0xx_ll_cortex.h"
|
||||
#include "py32f0xx_ll_dma.h"
|
||||
#include "py32f0xx_ll_exti.h"
|
||||
#include "py32f0xx_ll_gpio.h"
|
||||
#include "py32f0xx_ll_pwr.h"
|
||||
#include "py32f0xx_ll_rcc.h"
|
||||
#include "py32f0xx_ll_spi.h"
|
||||
#include "py32f0xx_ll_system.h"
|
||||
#include "py32f0xx_ll_tim.h"
|
||||
#include "py32f0xx_ll_utils.h"
|
||||
|
||||
|
||||
void APP_ErrorHandler(void);
|
||||
uint8_t SPI_TxRxByte(uint8_t data);
|
||||
void APP_GPIO_WriteOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint8_t Val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MAIN_H */
|
||||
40
Examples/LL/SPI/Waveshare_1.54_EPaper/py32f0xx_it.c
Normal file
40
Examples/LL/SPI/Waveshare_1.54_EPaper/py32f0xx_it.c
Normal file
@ -0,0 +1,40 @@
|
||||
#include "main.h"
|
||||
#include "py32f0xx_it.h"
|
||||
|
||||
/**
|
||||
* @brief This function handles Non maskable interrupt.
|
||||
*/
|
||||
void NMI_Handler(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Hard fault interrupt.
|
||||
*/
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles System service call via SWI instruction.
|
||||
*/
|
||||
void SVC_Handler(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Pendable request for system service.
|
||||
*/
|
||||
void PendSV_Handler(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles System tick timer.
|
||||
*/
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
}
|
||||
19
Examples/LL/SPI/Waveshare_1.54_EPaper/py32f0xx_it.h
Normal file
19
Examples/LL/SPI/Waveshare_1.54_EPaper/py32f0xx_it.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef __PY32F0XX_IT_H
|
||||
#define __PY32F0XX_IT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void NMI_Handler(void);
|
||||
void HardFault_Handler(void);
|
||||
void SVC_Handler(void);
|
||||
void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PY32F0XX_IT_H */
|
||||
127
Libraries/EPaper/EPD_Config_Template.h
Normal file
127
Libraries/EPaper/EPD_Config_Template.h
Normal file
@ -0,0 +1,127 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_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 _EPD_CONFIG_H_
|
||||
#define _EPD_CONFIG_H_
|
||||
|
||||
#include "main.h"
|
||||
#include "air32f10x.h"
|
||||
#include "debug.h"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/**
|
||||
* Uncomment the part number to enable
|
||||
*/
|
||||
|
||||
// #define EPD_1IN02
|
||||
// #define EPD_1IN54_V2
|
||||
#define EPD_1IN54
|
||||
// #define EPD_1IN54B_V2
|
||||
// #define EPD_1IN54B
|
||||
// #define EPD_1IN54C
|
||||
// #define EPD_1IN64G
|
||||
// #define EPD_2IN7_V2
|
||||
// #define EPD_2IN7
|
||||
// #define EPD_2IN7B_V2
|
||||
// #define EPD_2IN7B
|
||||
// #define EPD_2IN9_V2
|
||||
// #define EPD_2IN9
|
||||
// #define EPD_2IN9B_V3
|
||||
// #define EPD_2IN9BC
|
||||
// #define EPD_2IN9D
|
||||
// #define EPD_2IN13_V2
|
||||
// #define EPD_2IN13_V3
|
||||
// #define EPD_2IN13
|
||||
// #define EPD_2IN13B_V3
|
||||
// #define EPD_2IN13B_V4
|
||||
// #define EPD_2IN13BC
|
||||
// #define EPD_2IN13D
|
||||
// #define EPD_2IN36G
|
||||
// #define EPD_2IN66
|
||||
// #define EPD_2IN66B
|
||||
// #define EPD_3IN0G
|
||||
// #define EPD_3IN7
|
||||
// #define EPD_3IN52
|
||||
// #define EPD_4IN01F
|
||||
// #define EPD_4IN2
|
||||
// #define EPD_4IN2B_V2
|
||||
// #define EPD_4IN2BC
|
||||
// #define EPD_4IN37G
|
||||
// #define EPD_5IN65F
|
||||
// #define EPD_5IN83_V2
|
||||
// #define EPD_5IN83
|
||||
// #define EPD_5IN83B_V2
|
||||
// #define EPD_5IN83BC
|
||||
// #define EPD_7IN3F
|
||||
// #define EPD_7IN3G
|
||||
// #define EPD_7IN5_HD
|
||||
// #define EPD_7IN5_V2
|
||||
// #define EPD_7IN5
|
||||
// #define EPD_7IN5B_HD
|
||||
// #define EPD_7IN5B_V2
|
||||
// #define EPD_7IN5BC
|
||||
|
||||
#define DEBUG 1
|
||||
|
||||
/**
|
||||
* e-Paper GPIO
|
||||
*/
|
||||
#define EPD_RST_PIN GPIOA, GPIO_Pin_6
|
||||
#define EPD_DC_PIN GPIOA, GPIO_Pin_4
|
||||
#define EPD_CS_PIN GPIOA, GPIO_Pin_3
|
||||
#define EPD_BUSY_PIN GPIOA, GPIO_Pin_2
|
||||
|
||||
/**
|
||||
* GPIO read and write
|
||||
*/
|
||||
#define EPD_Digital_Write(_pin, _value) GPIO_WriteBit(_pin, _value == 0? Bit_RESET:Bit_SET)
|
||||
#define EPD_Digital_Read(_pin) GPIO_ReadInputDataBit(_pin)
|
||||
#define EPD_SPI_WriteByte(_value) SPI_TxRx(_value)
|
||||
#define EPD_Delay_ms(__xms) Delay_Ms(__xms)
|
||||
|
||||
#endif
|
||||
176
Libraries/EPaper/Examples/EPD_1in02_test.c
Normal file
176
Libraries/EPaper/Examples/EPD_1in02_test.c
Normal file
@ -0,0 +1,176 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_1IN02_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.02inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-09-29
|
||||
* | 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_1in02d.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef EPD_1IN02
|
||||
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_1IN02_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN02_Init();
|
||||
EPD_1IN02_Clear();
|
||||
EPD_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage,*old_Image;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_1IN02_WIDTH % 8 == 0)? (EPD_1IN02_WIDTH / 8 ): (EPD_1IN02_WIDTH / 8 + 1)) * EPD_1IN02_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((old_Image = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory2...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN02_WIDTH, EPD_1IN02_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(old_Image, EPD_1IN02_WIDTH, EPD_1IN02_HEIGHT, 270, WHITE);
|
||||
Paint_SelectImage(old_Image);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 0 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_1in02d);
|
||||
|
||||
EPD_1IN02_Display(BlackImage);
|
||||
EPD_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, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 15, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 25, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(30, 10, 80, 70, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(80, 10, 30, 70, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(30, 10, 90, 70, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(60, 40, 25, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
|
||||
printf("EPD_1IN02_Display\r\n");
|
||||
EPD_1IN02_Display(BlackImage);
|
||||
EPD_Delay_ms(2000);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
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);
|
||||
|
||||
printf("EPD_1IN02_Display\r\n");
|
||||
EPD_1IN02_Display(BlackImage);
|
||||
EPD_Delay_ms(2000);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawString_CN(0, 10,"你好abc树莓派", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(0, 30,"微雪电子", &Font24CN, WHITE, BLACK);
|
||||
printf("EPD_1IN02_Display\r\n");
|
||||
EPD_1IN02_Display(BlackImage);
|
||||
EPD_Delay_ms(2000);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_1IN02_Display(BlackImage);
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_Clear(WHITE);
|
||||
EPD_1IN02_Display(BlackImage);
|
||||
|
||||
EPD_1IN02_Part_Init();
|
||||
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(20, 20, 20 + Font20.Width * 7, 20 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(20, 20, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_1IN02_DisplayPartial(old_Image, BlackImage);
|
||||
memcpy(old_Image, BlackImage, Imagesize);
|
||||
// EPD_Delay_ms(100);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN02_Init();
|
||||
EPD_1IN02_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN02_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
156
Libraries/EPaper/Examples/EPD_1in54_V2_test.c
Normal file
156
Libraries/EPaper/Examples/EPD_1in54_V2_test.c
Normal file
@ -0,0 +1,156 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_1IN54_V2
|
||||
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_1in54_V2_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN54_V2_Init();
|
||||
EPD_1IN54_V2_Clear();
|
||||
EPD_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);
|
||||
EPD_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(130, 0, "你好abc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "微雪电子", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_1IN54_V2_Display(BlackImage);
|
||||
EPD_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_DisplayPartBaseImage(BlackImage);
|
||||
|
||||
// enter partial mode
|
||||
EPD_1IN54_V2_Init_Partial();
|
||||
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 = 10;
|
||||
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);
|
||||
EPD_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");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
150
Libraries/EPaper/Examples/EPD_1in54_test.c
Normal file
150
Libraries/EPaper/Examples/EPD_1in54_test.c
Normal file
@ -0,0 +1,150 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_1IN54
|
||||
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_1IN54_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN54_Init(EPD_1IN54_FULL);
|
||||
EPD_1IN54_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
113
Libraries/EPaper/Examples/EPD_1in54b_V2_test.c
Normal file
113
Libraries/EPaper/Examples/EPD_1in54b_V2_test.c
Normal file
@ -0,0 +1,113 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_1in54b_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch B e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-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_V2.h"
|
||||
|
||||
#ifdef EPD_1IN54B_V2
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_1IN54b_V2_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
EPD_1IN54B_V2_Init();
|
||||
EPD_1IN54B_V2_Clear();
|
||||
EPD_Delay_ms(200);
|
||||
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
UWORD Imagesize = ((EPD_1IN54B_V2_WIDTH % 8 == 0)? (EPD_1IN54B_V2_WIDTH / 8 ): (EPD_1IN54B_V2_WIDTH / 8 + 1)) * EPD_1IN54B_V2_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_V2_WIDTH, EPD_1IN54B_V2_HEIGHT, 90, WHITE);
|
||||
Paint_NewImage(RedImage, EPD_1IN54B_V2_WIDTH, EPD_1IN54B_V2_HEIGHT, 90, 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, 155, "微雪电子", &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_V2_Display(BlackImage, RedImage);
|
||||
EPD_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_V2_Display(BlackImage, RedImage);
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN54B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN54B_V2_Sleep();
|
||||
free(BlackImage);
|
||||
free(RedImage);
|
||||
BlackImage = NULL;
|
||||
RedImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
116
Libraries/EPaper/Examples/EPD_1in54b_test.c
Normal file
116
Libraries/EPaper/Examples/EPD_1in54b_test.c
Normal file
@ -0,0 +1,116 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_1IN54B
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_1in54b_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN54B_Init();
|
||||
EPD_1IN54B_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
114
Libraries/EPaper/Examples/EPD_1in54c_test.c
Normal file
114
Libraries/EPaper/Examples/EPD_1in54c_test.c
Normal file
@ -0,0 +1,114 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_1IN54C
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_1IN54C_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN54C_Init();
|
||||
EPD_1IN54C_Clear();
|
||||
EPD_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, 135, 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(45, 10, 45, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(20, 35, 70, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawCircle(45, 35, 15, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(110, 35, 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);
|
||||
EPD_Delay_ms(5000);
|
||||
#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);
|
||||
EPD_Delay_ms(5000);
|
||||
#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");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
156
Libraries/EPaper/Examples/EPD_1in64g_test.c
Normal file
156
Libraries/EPaper/Examples/EPD_1in64g_test.c
Normal file
@ -0,0 +1,156 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_1in64g_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.64inch e-paper (G) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-07-22
|
||||
* | 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_1in64g.h"
|
||||
|
||||
#ifdef EPD_1IN64G
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_1IN64G_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN64G_Init();
|
||||
EPD_1IN64G_Clear(EPD_1IN64G_WHITE);
|
||||
EPD_Delay_ms(2000);
|
||||
|
||||
//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_1IN64G_WIDTH % 4 == 0)? (EPD_1IN64G_WIDTH / 4 ): (EPD_1IN64G_WIDTH / 4 + 1)) * EPD_1IN64G_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_1IN64G_WIDTH, EPD_1IN64G_HEIGHT, 0, EPD_1IN64G_WHITE);
|
||||
Paint_SetScale(4);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_1IN64G_WHITE);
|
||||
Paint_DrawBitMap(gImage_1in64g);
|
||||
|
||||
EPD_1IN64G_Display(BlackImage);
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_1IN64G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_1IN64G_RED, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_1IN64G_YELLOW, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_1IN64G_BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_1IN64G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_1IN64G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_1IN64G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_1IN64G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_1IN64G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_1IN64G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_1IN64G_RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_1IN64G_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "Red, yellow, white and black", &Font16, EPD_1IN64G_RED, EPD_1IN64G_YELLOW);
|
||||
Paint_DrawString_EN(10, 35, "Four color e-Paper", &Font12, EPD_1IN64G_YELLOW, EPD_1IN64G_BLACK);
|
||||
Paint_DrawString_CN(10, 125, "微雪电子", &Font24CN, EPD_1IN64G_RED, EPD_1IN64G_WHITE);
|
||||
Paint_DrawNum(10, 50, 123456, &Font12, EPD_1IN64G_RED, EPD_1IN64G_WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_1IN64G_Display(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_1IN64G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawRectangle(1, 1, 168, 55, EPD_1IN64G_RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawRectangle(1, 112, 167, 167, EPD_1IN64G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawRectangle(59, 1, 109, 167, EPD_1IN64G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_1IN64G_Display(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_1IN64G_WHITE);
|
||||
|
||||
int hNumber, hWidth, vNumber, vWidth;
|
||||
hNumber = 8;
|
||||
hWidth = EPD_1IN64G_HEIGHT/hNumber; // 168/16=21
|
||||
vNumber = 8;
|
||||
vWidth = EPD_1IN64G_WIDTH/vNumber; // 168/16=21
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
for(int i=0; i<hNumber; i++) { // horizontal
|
||||
Paint_DrawRectangle(1, 1+i*hWidth, EPD_1IN64G_WIDTH, hWidth*(1+i), EPD_1IN64G_BLACK + (i % 2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
for(int i=0; i<vNumber; i++) { // vertical
|
||||
if(i%2) {
|
||||
Paint_DrawRectangle(1+i*vWidth, 1, vWidth*(i+1), EPD_1IN64G_HEIGHT, EPD_1IN64G_YELLOW + (i/2%2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
}
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_1IN64G_Display(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN64G_Clear(EPD_1IN64G_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN64G_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
EPD_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
158
Libraries/EPaper/Examples/EPD_2in13_V2_test.c
Normal file
158
Libraries/EPaper/Examples/EPD_2in13_V2_test.c
Normal file
@ -0,0 +1,158 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_2IN13_V2
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN13_V2_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
|
||||
EPD_2IN13_V2_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
|
||||
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
|
||||
EPD_2IN13_V2_Clear();
|
||||
EPD_Delay_ms(2000);//Analog clock 1s
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13_V2_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
EPD_Delay_ms(1000);//Analog clock 1s
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
150
Libraries/EPaper/Examples/EPD_2in13_V3_test.c
Normal file
150
Libraries/EPaper/Examples/EPD_2in13_V3_test.c
Normal file
@ -0,0 +1,150 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2in13_V3_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper V3 test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.1
|
||||
* | Date : 2021-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 "EPD_Test.h"
|
||||
#include "EPD_2in13_V3.h"
|
||||
|
||||
#ifdef EPD_2IN13_V3
|
||||
int EPD_test(void)
|
||||
{
|
||||
EPD_Printf("EPD_2in13_V3_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
EPD_Printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2in13_V3_Init();
|
||||
EPD_2in13_V3_Clear();
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1)) * EPD_2in13_V3_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
EPD_Printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
EPD_Printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 //show image for array
|
||||
EPD_Printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in13);
|
||||
|
||||
EPD_2in13_V3_Display(BlackImage);
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
|
||||
EPD_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_V3_Display_Base(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
|
||||
EPD_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 = 10;
|
||||
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_2in13_V3_Display_Partial(BlackImage);
|
||||
EPD_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
#endif
|
||||
|
||||
EPD_Printf("Clear...\r\n");
|
||||
EPD_2in13_V3_Init();
|
||||
EPD_2in13_V3_Clear();
|
||||
|
||||
EPD_Printf("Goto Sleep...\r\n");
|
||||
EPD_2in13_V3_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
EPD_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
EPD_Printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
148
Libraries/EPaper/Examples/EPD_2in13_test.c
Normal file
148
Libraries/EPaper/Examples/EPD_2in13_test.c
Normal file
@ -0,0 +1,148 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_2IN13
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN13_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13_Init(EPD_2IN13_FULL);
|
||||
EPD_2IN13_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
121
Libraries/EPaper/Examples/EPD_2in13b_V3_test.c
Normal file
121
Libraries/EPaper/Examples/EPD_2in13b_V3_test.c
Normal file
@ -0,0 +1,121 @@
|
||||
/*****************************************************************************
|
||||
* | 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_2in13b_V3.h"
|
||||
|
||||
#ifdef EPD_2IN13B_V3
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN13B_V3_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13B_V3_Init();
|
||||
EPD_2IN13B_V3_Clear();
|
||||
EPD_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_2IN13B_V3_WIDTH % 8 == 0)? (EPD_2IN13B_V3_WIDTH / 8 ): (EPD_2IN13B_V3_WIDTH / 8 + 1)) * EPD_2IN13B_V3_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_2IN13B_V3_WIDTH, EPD_2IN13B_V3_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_2IN13B_V3_WIDTH, EPD_2IN13B_V3_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_2IN13B_V3_Display(gImage_2in13b_b, gImage_2in13b_r);
|
||||
|
||||
EPD_2IN13B_V3_Display(gImage_2in13c_b, gImage_2in13c_y);
|
||||
EPD_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, "<EFBFBD><EFBFBD><EFBFBD>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_2IN13B_V3_Display(BlackImage, RYImage);
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN13B_V3_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13B_V3_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
124
Libraries/EPaper/Examples/EPD_2in13b_V4_test.c
Normal file
124
Libraries/EPaper/Examples/EPD_2in13b_V4_test.c
Normal file
@ -0,0 +1,124 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2in13b_V4_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch B V4 e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-04-21
|
||||
* | 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_2in13b_V4.h"
|
||||
|
||||
#ifdef EPD_2IN13B_V4
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN13B_V4_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13B_V4_Init();
|
||||
|
||||
|
||||
EPD_2IN13B_V4_Clear();
|
||||
EPD_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_2IN13B_V4_WIDTH % 8 == 0)? (EPD_2IN13B_V4_WIDTH / 8 ): (EPD_2IN13B_V4_WIDTH / 8 + 1)) * EPD_2IN13B_V4_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_2IN13B_V4_WIDTH, EPD_2IN13B_V4_HEIGHT, 90, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_2IN13B_V4_WIDTH, EPD_2IN13B_V4_HEIGHT, 90, 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_2IN13B_V4_Display(gImage_2in13b_V4b, gImage_2in13b_V4r);
|
||||
EPD_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_2IN13B_V4_Display(BlackImage, RYImage);
|
||||
EPD_Delay_ms(5000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN13B_V4_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13B_V4_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
EPD_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
121
Libraries/EPaper/Examples/EPD_2in13bc_test.c
Normal file
121
Libraries/EPaper/Examples/EPD_2in13bc_test.c
Normal file
@ -0,0 +1,121 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_2IN13BC
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN13BC_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13BC_Init();
|
||||
EPD_2IN13BC_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
148
Libraries/EPaper/Examples/EPD_2in13d_test.c
Normal file
148
Libraries/EPaper/Examples/EPD_2in13d_test.c
Normal file
@ -0,0 +1,148 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_2IN13D
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN13D_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13D_Init();
|
||||
EPD_2IN13D_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
155
Libraries/EPaper/Examples/EPD_2in36g_test.c
Normal file
155
Libraries/EPaper/Examples/EPD_2in36g_test.c
Normal file
@ -0,0 +1,155 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2in36g_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.36inch e-Paper (G) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-08-18
|
||||
* | 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_2in36g.h"
|
||||
#include "time.h"
|
||||
|
||||
#ifdef EPD_2IN36G
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN36G_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN36G_Init();
|
||||
EPD_2IN36G_Clear(EPD_2IN36G_WHITE); // White
|
||||
EPD_Delay_ms(2000);
|
||||
|
||||
//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_2IN36G_WIDTH % 4 == 0)? (EPD_2IN36G_WIDTH / 4 ): (EPD_2IN36G_WIDTH / 4 + 1)) * EPD_2IN36G_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_2IN36G_WIDTH, EPD_2IN36G_HEIGHT, 0, WHITE);
|
||||
Paint_SetScale(4);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_DrawBitMap(gImage_2in36g);
|
||||
EPD_2IN36G_Display(BlackImage);
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_2IN36G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_2IN36G_BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_2IN36G_WHITE, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_2IN36G_RED, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_2IN36G_BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_2IN36G_BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_2IN36G_WHITE, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_2IN36G_WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_2IN36G_RED, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_2IN36G_RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_2IN36G_BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_2IN36G_WHITE, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "Red, yellow, white and black", &Font16, EPD_2IN36G_BLACK, EPD_2IN36G_WHITE);
|
||||
Paint_DrawString_EN(10, 35, "Four color e-Paper", &Font12, EPD_2IN36G_WHITE, EPD_2IN36G_RED);
|
||||
Paint_DrawString_CN(10, 125, "微雪电子", &Font24CN, EPD_2IN36G_BLACK, EPD_2IN36G_YELLOW);
|
||||
Paint_DrawNum(10, 50, 123456, &Font12, EPD_2IN36G_BLACK, EPD_2IN36G_YELLOW);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN36G_Display(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_2IN36G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawRectangle(1, 1, 168, 86, EPD_2IN36G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawRectangle(1, 210, 167, 295, EPD_2IN36G_WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawRectangle(59, 1, 109, 295, EPD_2IN36G_RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN36G_Display(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_2IN36G_WHITE);
|
||||
|
||||
int hNumber, hWidth, vNumber, vWidth;
|
||||
hNumber = 16;
|
||||
hWidth = EPD_2IN36G_HEIGHT/hNumber; // 368/16=23
|
||||
vNumber = 16;
|
||||
vWidth = EPD_2IN36G_WIDTH/vNumber; // 512/16=32
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
for(int i=0; i<hNumber; i++) { // horizontal
|
||||
Paint_DrawRectangle(1, 1+i*hWidth, EPD_2IN36G_WIDTH, hWidth*(1+i), EPD_2IN36G_BLACK + (i % 2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
for(int i=0; i<vNumber; i++) { // vertical
|
||||
if(i%2) {
|
||||
Paint_DrawRectangle(1+i*vWidth, 1, vWidth*(i+1), EPD_2IN36G_HEIGHT, EPD_2IN36G_YELLOW + (i/2%2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
}
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN36G_Display(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN36G_Clear(EPD_2IN36G_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN36G_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
EPD_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
161
Libraries/EPaper/Examples/EPD_2in66_test.c
Normal file
161
Libraries/EPaper/Examples/EPD_2in66_test.c
Normal file
@ -0,0 +1,161 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2IN66_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.66inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-07-29
|
||||
* | 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_2in66.h"
|
||||
|
||||
#ifdef EPD_2IN66
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN66_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN66_Init();
|
||||
EPD_2IN66_Clear();
|
||||
EPD_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_2IN66_WIDTH % 8 == 0)? (EPD_2IN66_WIDTH / 8 ): (EPD_2IN66_WIDTH / 8 + 1)) * EPD_2IN66_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_2IN66_WIDTH, EPD_2IN66_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_2in66);
|
||||
Paint_DrawBitMap_Paste(gImage_100X50, 10, 10, 100, 50, TRUE);
|
||||
EPD_2IN66_Display(BlackImage);
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//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_2IN66_Display(BlackImage);
|
||||
EPD_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
#if 1 //partial refresh, show time
|
||||
printf("EPD_2IN66_DisplayPart\r\n");
|
||||
EPD_2IN66_Init_Partial();
|
||||
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
||||
PAINT_TIME sPaint_time; //time struct
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UWORD num = 10;
|
||||
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(180, 100, 296, 152, WHITE);
|
||||
Paint_DrawTime(180, 110, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
printf("Part refresh...\r\n");
|
||||
EPD_2IN66_Display(BlackImage);
|
||||
|
||||
EPD_Delay_ms(500);
|
||||
}
|
||||
EPD_2IN66_Clear();
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN66_Init();
|
||||
EPD_2IN66_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN66_Sleep();
|
||||
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
129
Libraries/EPaper/Examples/EPD_2in66b_test.c
Normal file
129
Libraries/EPaper/Examples/EPD_2in66b_test.c
Normal file
@ -0,0 +1,129 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2IN66b_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.66inch e-paper b test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-12-02
|
||||
* | 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_2in66b.h"
|
||||
|
||||
#ifdef EPD_2IN66B
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN66B_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN66B_Init();
|
||||
EPD_2IN66B_Clear();
|
||||
EPD_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN66B_WIDTH % 8 == 0)? (EPD_2IN66B_WIDTH / 8 ): (EPD_2IN66B_WIDTH / 8 + 1)) * EPD_2IN66B_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("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN66B_WIDTH, EPD_2IN66B_HEIGHT, 270, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_NewImage(RedImage, EPD_2IN66B_WIDTH, EPD_2IN66B_HEIGHT, 270, WHITE);
|
||||
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_2in66bb);
|
||||
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in66br);
|
||||
|
||||
EPD_2IN66B_Display(BlackImage, RedImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
|
||||
//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);
|
||||
|
||||
EPD_2IN66B_Display(BlackImage, RedImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN66B_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN66B_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
free(RedImage);
|
||||
RedImage = NULL;
|
||||
|
||||
EPD_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
267
Libraries/EPaper/Examples/EPD_2in7_V2_test.c
Normal file
267
Libraries/EPaper/Examples/EPD_2in7_V2_test.c
Normal file
@ -0,0 +1,267 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2in7_V2.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.7inch V2 e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-09-17
|
||||
* | 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_V2.h"
|
||||
#include <time.h>
|
||||
|
||||
#ifdef EPD_2IN7_V2
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN7_V2_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN7_V2_Init();
|
||||
|
||||
EPD_2IN7_V2_Clear();
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_2IN7_V2_WIDTH % 8 == 0)? (EPD_2IN7_V2_WIDTH / 8 ): (EPD_2IN7_V2_WIDTH / 8 + 1)) * EPD_2IN7_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_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
|
||||
#if 1 // Fast Drawing on the image
|
||||
// Fast refresh
|
||||
printf("This is followed by a quick refresh demo\r\n");
|
||||
printf("First, clear the screen\r\n");
|
||||
EPD_2IN7_V2_Init();
|
||||
EPD_2IN7_V2_Clear();
|
||||
|
||||
printf("e-Paper Init Fast\r\n");
|
||||
EPD_2IN7_V2_Init_Fast();
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
||||
// 2.Drawing on the image
|
||||
Paint_Clear(WHITE);
|
||||
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_2IN7_V2_Display_Fast(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
|
||||
#endif
|
||||
|
||||
#if 1 // show bmp
|
||||
|
||||
printf("show window BMP-----------------\r\n");
|
||||
EPD_2IN7_V2_Init();
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in7);
|
||||
EPD_2IN7_V2_Display(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
EPD_2IN7_V2_Init();
|
||||
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,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN7_V2_Display_Base(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
// If you didn't use the EPD_2IN7_V2_Display_Base() function to refresh the image before,
|
||||
// use the EPD_2IN7_V2_Display_Base_color() function to refresh the background color,
|
||||
// otherwise the background color will be garbled
|
||||
EPD_2IN7_V2_Init();
|
||||
// EPD_2IN7_V2_Display_Base_color(WHITE);
|
||||
Paint_NewImage(BlackImage, 50, 120, 90, WHITE);
|
||||
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_SetScale(2);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 15;
|
||||
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_Clear(WHITE);
|
||||
Paint_DrawRectangle(1, 1, 120, 50, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawTime(10, 15, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
printf("Part refresh...\r\n");
|
||||
EPD_2IN7_V2_Display_Partial(BlackImage, 60, 134, 110, 254); // Xstart must be a multiple of 8
|
||||
EPD_Delay_ms(500);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
free(BlackImage);
|
||||
printf("show Gray------------------------\r\n");
|
||||
Imagesize = ((EPD_2IN7_V2_WIDTH % 4 == 0)? (EPD_2IN7_V2_WIDTH / 4 ): (EPD_2IN7_V2_WIDTH / 4 + 1)) * EPD_2IN7_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
EPD_2IN7_V2_Init_4GRAY();
|
||||
printf("4 grayscale display\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(0xff);
|
||||
|
||||
Paint_DrawPoint(10, 80, GRAY4, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, GRAY4, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, GRAY4, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, GRAY2, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, GRAY4, GRAY1);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, GRAY3, GRAY1);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, GRAY4, GRAY2);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(150, 0,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY4, GRAY1);
|
||||
Paint_DrawString_CN(150, 20,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(150, 40,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(150, 60,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(10, 130, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, GRAY1, GRAY4);
|
||||
EPD_2IN7_V2_4GrayDisplay(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in7_4Gray);
|
||||
EPD_2IN7_V2_4GrayDisplay(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN7_V2_Init();
|
||||
EPD_2IN7_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN7_V2_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
EPD_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
152
Libraries/EPaper/Examples/EPD_2in7_test.c
Normal file
152
Libraries/EPaper/Examples/EPD_2in7_test.c
Normal file
@ -0,0 +1,152 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_2IN7
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN7_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN7_Init();
|
||||
EPD_2IN7_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
free(BlackImage);
|
||||
#if 1 // show image for array
|
||||
printf("show Gray------------------------\r\n");
|
||||
Imagesize = ((EPD_2IN7_WIDTH % 4 == 0)? (EPD_2IN7_WIDTH / 4 ): (EPD_2IN7_WIDTH / 4 + 1)) * EPD_2IN7_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("4 grayscale display\r\n");
|
||||
EPD_2IN7_Init_4Gray();
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_WIDTH, EPD_2IN7_HEIGHT, 270, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
Paint_DrawPoint(10, 80, GRAY4, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, GRAY4, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, GRAY4, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, GRAY2, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, GRAY4, GRAY1);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, GRAY3, GRAY1);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, GRAY4, GRAY2);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(150, 0,"你好abc", &Font12CN, GRAY4, GRAY1);
|
||||
Paint_DrawString_CN(150, 20,"你好abc", &Font12CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(150, 40,"你好abc", &Font12CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(150, 60,"你好abc", &Font12CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(10, 130, "微雪电子", &Font24CN, GRAY1, GRAY4);
|
||||
EPD_2IN7_4GrayDisplay(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
|
||||
EPD_2IN7_4GrayDisplay(gImage_2in7_4Gray);
|
||||
EPD_Delay_ms(3000);
|
||||
|
||||
EPD_2IN7_Clear();
|
||||
#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");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
124
Libraries/EPaper/Examples/EPD_2in7b_V2_test.c
Normal file
124
Libraries/EPaper/Examples/EPD_2in7b_V2_test.c
Normal file
@ -0,0 +1,124 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2IN7b_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.7inch e-paper b V2 test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-10-20
|
||||
* | 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_V2.h"
|
||||
|
||||
#ifdef EPD_2IN7B_V2
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN7B_V2_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN7B_V2_Init();
|
||||
|
||||
EPD_2IN7B_V2_Clear();
|
||||
EPD_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
UWORD Imagesize = ((EPD_2IN7B_V2_WIDTH % 8 == 0)? (EPD_2IN7B_V2_WIDTH / 8 ): (EPD_2IN7B_V2_WIDTH / 8 + 1)) * EPD_2IN7B_V2_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_V2_WIDTH, EPD_2IN7B_V2_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RedImage, EPD_2IN7B_V2_WIDTH, EPD_2IN7B_V2_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_V2_Display(BlackImage, RedImage);
|
||||
EPD_Delay_ms(4000);
|
||||
#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_V2_Display(BlackImage, RedImage);
|
||||
EPD_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN7B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN7B_V2_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
EPD_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
122
Libraries/EPaper/Examples/EPD_2in7b_test.c
Normal file
122
Libraries/EPaper/Examples/EPD_2in7b_test.c
Normal file
@ -0,0 +1,122 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_2IN7B
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN7B_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN7B_Init();
|
||||
EPD_2IN7B_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
156
Libraries/EPaper/Examples/EPD_2in9_V2_test.c
Normal file
156
Libraries/EPaper/Examples/EPD_2in9_V2_test.c
Normal file
@ -0,0 +1,156 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2IN9_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper V2 test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-12-09
|
||||
* | 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_V2.h"
|
||||
|
||||
#ifdef EPD_2IN9_V2
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN9_V2_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9_V2_Init();
|
||||
EPD_2IN9_V2_Clear();
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_2IN9_V2_WIDTH % 8 == 0)? (EPD_2IN9_V2_WIDTH / 8 ): (EPD_2IN9_V2_WIDTH / 8 + 1)) * EPD_2IN9_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_2IN9_V2_WIDTH, EPD_2IN9_V2_HEIGHT, 90, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 //show image for array
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_V2_WIDTH, EPD_2IN9_V2_HEIGHT, 90, WHITE);
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in9);
|
||||
|
||||
EPD_2IN9_V2_Display(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_V2_WIDTH, EPD_2IN9_V2_HEIGHT, 90, WHITE);
|
||||
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_V2_Display_Base(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_V2_WIDTH, EPD_2IN9_V2_HEIGHT, 90, WHITE);
|
||||
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 = 10;
|
||||
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_V2_Display_Partial(BlackImage);
|
||||
EPD_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN9_V2_Init();
|
||||
EPD_2IN9_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9_V2_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
EPD_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
153
Libraries/EPaper/Examples/EPD_2in9_test.c
Normal file
153
Libraries/EPaper/Examples/EPD_2in9_test.c
Normal file
@ -0,0 +1,153 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_2IN9
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN9_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9_Init(EPD_2IN9_FULL);
|
||||
EPD_2IN9_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
120
Libraries/EPaper/Examples/EPD_2in9b_V3_test.c
Normal file
120
Libraries/EPaper/Examples/EPD_2in9b_V3_test.c
Normal file
@ -0,0 +1,120 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2in9b_V3_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch B V3 e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.1
|
||||
* | Date : 2020-12-03
|
||||
* | 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_2in9b_V3.h"
|
||||
|
||||
#ifdef EPD_2IN9B_V3
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN9B_V3_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9B_V3_Init();
|
||||
EPD_2IN9B_V3_Clear();
|
||||
EPD_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_2IN9B_V3_WIDTH % 8 == 0)? (EPD_2IN9B_V3_WIDTH / 8 ): (EPD_2IN9B_V3_WIDTH / 8 + 1)) * EPD_2IN9B_V3_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_2IN9B_V3_WIDTH, EPD_2IN9B_V3_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_2IN9B_V3_WIDTH, EPD_2IN9B_V3_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_2IN9B_V3_Display(gImage_2in9bc_b, gImage_2in9bc_ry);
|
||||
EPD_Delay_ms(5000);
|
||||
#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_2IN9B_V3_Display(BlackImage, RYImage);
|
||||
EPD_Delay_ms(5000);
|
||||
#endif
|
||||
// clear EPD
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN9B_V3_Clear();
|
||||
//deep sleep mode, free heap ram
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9B_V3_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
120
Libraries/EPaper/Examples/EPD_2in9bc_test.c
Normal file
120
Libraries/EPaper/Examples/EPD_2in9bc_test.c
Normal file
@ -0,0 +1,120 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_2IN9BC
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN9BC_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9BC_Init();
|
||||
EPD_2IN9BC_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
145
Libraries/EPaper/Examples/EPD_2in9d_test.c
Normal file
145
Libraries/EPaper/Examples/EPD_2in9d_test.c
Normal file
@ -0,0 +1,145 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_2IN9D
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_2IN9D_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9D_Init();
|
||||
EPD_2IN9D_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN9D_Init();
|
||||
EPD_2IN9D_Clear();
|
||||
EPD_Delay_ms(2000);//important, at least 2s
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9D_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
EPD_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
160
Libraries/EPaper/Examples/EPD_3in0g_test.c
Normal file
160
Libraries/EPaper/Examples/EPD_3in0g_test.c
Normal file
@ -0,0 +1,160 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_3in0g_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 3inch e-paper (G) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-07-15
|
||||
* | 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_3in0g.h"
|
||||
#include "time.h"
|
||||
|
||||
#ifdef EPD_3IN0G
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_3IN0G_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_3IN0G_Init();
|
||||
EPD_3IN0G_Clear(EPD_3IN0G_WHITE); // WHITE
|
||||
EPD_Delay_ms(2000);
|
||||
|
||||
//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_3IN0G_WIDTH % 4 == 0)? (EPD_3IN0G_WIDTH / 4 ): (EPD_3IN0G_WIDTH / 4 + 1)) * EPD_3IN0G_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_3IN0G_WIDTH, EPD_3IN0G_HEIGHT, 0, EPD_3IN0G_WHITE);
|
||||
Paint_SetScale(4);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_3IN0G_Init();
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_3IN0G_WHITE);
|
||||
Paint_DrawBitMap(gImage_3in0g);
|
||||
EPD_3IN0G_Display(BlackImage);
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
EPD_3IN0G_Init();
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_3IN0G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_3IN0G_RED, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_3IN0G_YELLOW, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_3IN0G_BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_3IN0G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_3IN0G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_3IN0G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_3IN0G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_3IN0G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_3IN0G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_3IN0G_RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_3IN0G_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "Red, yellow, white and black", &Font16, EPD_3IN0G_RED, EPD_3IN0G_YELLOW);
|
||||
Paint_DrawString_EN(10, 35, "Four color e-Paper", &Font12, EPD_3IN0G_YELLOW, EPD_3IN0G_BLACK);
|
||||
Paint_DrawString_CN(10, 125, "微雪电子", &Font24CN, EPD_3IN0G_RED, EPD_3IN0G_WHITE);
|
||||
Paint_DrawNum(10, 50, 123456, &Font12, EPD_3IN0G_RED, EPD_3IN0G_WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_3IN0G_Display(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
EPD_3IN0G_Init();
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_3IN0G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawRectangle(1, 1, 167, 86, EPD_3IN0G_RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawRectangle(1, 314, 167, 399, EPD_3IN0G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawRectangle(59, 1, 109, 399, EPD_3IN0G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_3IN0G_Display(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
EPD_3IN0G_Init();
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_3IN0G_WHITE);
|
||||
|
||||
int hNumber, hWidth, vNumber, vWidth;
|
||||
hNumber = 20;
|
||||
hWidth = EPD_3IN0G_HEIGHT/hNumber; // 400/20=20
|
||||
vNumber = 8;
|
||||
vWidth = EPD_3IN0G_WIDTH/vNumber; // 168/8=21
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
for(int i=0; i<hNumber; i++) { // horizontal
|
||||
Paint_DrawRectangle(1, 1+i*hWidth, EPD_3IN0G_WIDTH, hWidth*(1+i), EPD_3IN0G_BLACK + (i % 2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
for(int i=0; i<vNumber; i++) { // vertical
|
||||
if(i%2) {
|
||||
Paint_DrawRectangle(1+i*vWidth, 1, vWidth*(i+1), EPD_3IN0G_HEIGHT, EPD_3IN0G_YELLOW + (i/2%2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
}
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_3IN0G_Display(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
EPD_3IN0G_Init();
|
||||
printf("Clear...\r\n");
|
||||
EPD_3IN0G_Clear(EPD_3IN0G_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_3IN0G_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
EPD_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
136
Libraries/EPaper/Examples/EPD_3in52_test.c
Normal file
136
Libraries/EPaper/Examples/EPD_3in52_test.c
Normal file
@ -0,0 +1,136 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_3IN52_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 3.52inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-07-16
|
||||
* | 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_3in52.h"
|
||||
#include <time.h>
|
||||
|
||||
#ifdef EPD_3IN52
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_3IN52_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_3IN52_Init();
|
||||
|
||||
EPD_3IN52_display_NUM(EPD_3IN52_WHITE);
|
||||
EPD_3IN52_lut_GC();
|
||||
EPD_3IN52_refresh();
|
||||
|
||||
EPD_3IN52_SendCommand(0x50);
|
||||
EPD_3IN52_SendData(0x17);
|
||||
|
||||
EPD_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_3IN52_WIDTH % 8 == 0)? (EPD_3IN52_WIDTH / 8 ): (EPD_3IN52_WIDTH / 8 + 1)) * EPD_3IN52_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_3IN52_WIDTH, EPD_3IN52_HEIGHT, 270, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // GC waveform refresh
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_3in52);
|
||||
|
||||
EPD_3IN52_display(BlackImage);
|
||||
EPD_3IN52_lut_GC();
|
||||
EPD_3IN52_refresh();
|
||||
EPD_Delay_ms(2000);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#if 0 //DU waveform refresh
|
||||
printf("Quick refresh is supported, but the refresh effect is not good, but it is not recommended\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_3in52);
|
||||
|
||||
EPD_3IN52_display(BlackImage);
|
||||
EPD_3IN52_lut_DU();
|
||||
EPD_3IN52_refresh();
|
||||
EPD_Delay_ms(2000);
|
||||
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
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);
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_3IN52_display(BlackImage);
|
||||
EPD_3IN52_lut_GC();
|
||||
EPD_3IN52_refresh();
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_3IN52_Clear();
|
||||
|
||||
// Sleep & close 5V
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_3IN52_sleep();
|
||||
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
EPD_Delay_ms(2000);//important, at least 2s
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
162
Libraries/EPaper/Examples/EPD_3in7_test.c
Normal file
162
Libraries/EPaper/Examples/EPD_3in7_test.c
Normal file
@ -0,0 +1,162 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_3IN7_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 3.7inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-07-17
|
||||
* | 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_3in7.h"
|
||||
|
||||
#ifdef EPD_3IN7
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_3IN7_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_3IN7_4Gray_Init();
|
||||
EPD_3IN7_4Gray_Clear();
|
||||
EPD_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_3IN7_WIDTH % 4 == 0)? (EPD_3IN7_WIDTH / 4 ): (EPD_3IN7_WIDTH / 4 + 1)) * EPD_3IN7_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_3IN7_WIDTH, EPD_3IN7_HEIGHT, 270, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_3in7);
|
||||
|
||||
EPD_3IN7_4Gray_Display(BlackImage);
|
||||
EPD_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image, partial display
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_SetScale(4);
|
||||
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_EN(10, 150, "GRAY1 with black background", &Font24, BLACK, GRAY1);
|
||||
Paint_DrawString_EN(10, 175, "GRAY2 with white background", &Font24, WHITE, GRAY2);
|
||||
Paint_DrawString_EN(10, 200, "GRAY3 with white background", &Font24, WHITE, GRAY3);
|
||||
Paint_DrawString_EN(10, 225, "GRAY4 with white background", &Font24, WHITE, GRAY4);
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_3IN7_4Gray_Display(BlackImage);
|
||||
EPD_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
#if 1 // partial update, just 1 Gray mode
|
||||
EPD_3IN7_1Gray_Init(); //init 1 Gray mode
|
||||
EPD_3IN7_1Gray_Clear();
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_SetScale(2);
|
||||
Paint_Clear(WHITE);
|
||||
printf("show time, partial update, just 1 Gary mode\r\n");
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 10;
|
||||
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(300, 0, 479, 80, WHITE);
|
||||
Paint_DrawTime(300, 20, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
printf("Part refresh...\r\n");
|
||||
EPD_3IN7_1Gray_Display(BlackImage);
|
||||
// EPD_3IN7_1Gray_Display_Part(BlackImage, 0, 0, 279, 180);
|
||||
EPD_Delay_ms(500);
|
||||
}
|
||||
|
||||
#endif
|
||||
EPD_3IN7_4Gray_Init();
|
||||
printf("Clear...\r\n");
|
||||
EPD_3IN7_4Gray_Clear();
|
||||
|
||||
// Sleep & close 5V
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_3IN7_Sleep();
|
||||
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
111
Libraries/EPaper/Examples/EPD_4in01f_test.c
Normal file
111
Libraries/EPaper/Examples/EPD_4in01f_test.c
Normal file
@ -0,0 +1,111 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_4IN01F_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.01inch F e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-12-25
|
||||
* | 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_4in01f.h"
|
||||
#include "EPD_Test.h"
|
||||
|
||||
#ifdef EPD_4IN01F
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_4in01f_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN01F_Init();
|
||||
EPD_4IN01F_Clear(EPD_4IN01F_WHITE);
|
||||
EPD_Delay_ms(100);
|
||||
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UDOUBLE Imagesize = ((EPD_4IN01F_WIDTH % 2 == 0)? (EPD_4IN01F_WIDTH / 2 ): (EPD_4IN01F_WIDTH / 2 + 1)) * EPD_4IN01F_HEIGHT;
|
||||
Imagesize = Imagesize/4;
|
||||
printf("Not enough memory, only part of the window is displayed\r\n");
|
||||
printf("Imagesize %ld\r\n",Imagesize);
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
Paint_NewImage(BlackImage, EPD_4IN01F_WIDTH/2, EPD_4IN01F_HEIGHT/2, 0, EPD_4IN01F_WHITE);
|
||||
Paint_SetScale(7);
|
||||
|
||||
#if 1
|
||||
EPD_4IN01F_Display(gImage_4in01);
|
||||
EPD_Delay_ms(5000);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
Paint_Clear(EPD_4IN01F_WHITE);
|
||||
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(10, 120, "你好abc", &Font12CN, EPD_4IN01F_BLACK, WHITE);
|
||||
Paint_DrawString_CN(10, 140, "你好abc", &Font12CN, EPD_4IN01F_GREEN, WHITE);
|
||||
Paint_DrawString_CN(10, 160, "你好abc", &Font12CN, EPD_4IN01F_BLUE, WHITE);
|
||||
Paint_DrawString_CN(10, 180, "你好abc", &Font12CN, EPD_4IN01F_RED, WHITE);
|
||||
Paint_DrawString_CN(10, 200, "你好abc", &Font12CN, EPD_4IN01F_ORANGE, WHITE);
|
||||
|
||||
Paint_DrawString_CN(150, 0, "微雪电子", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawString_CN(150, 40, "微雪电子", &Font24CN, EPD_4IN01F_GREEN, BLACK);
|
||||
Paint_DrawString_CN(150, 80, "微雪电子", &Font24CN, EPD_4IN01F_BLUE, BLACK);
|
||||
Paint_DrawString_CN(150, 120, "微雪电子", &Font24CN, EPD_4IN01F_RED, BLACK);
|
||||
Paint_DrawString_CN(150, 160, "微雪电子", &Font24CN, EPD_4IN01F_YELLOW, BLACK);
|
||||
|
||||
EPD_4IN01F_Display_part(BlackImage, 0, 0, 320, 200);
|
||||
EPD_Delay_ms(5000);
|
||||
#endif
|
||||
printf("e-Paper Clear...\r\n");
|
||||
EPD_4IN01F_Clear(EPD_4IN01F_WHITE);
|
||||
EPD_Delay_ms(1000);
|
||||
EPD_4IN01F_Sleep();
|
||||
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
192
Libraries/EPaper/Examples/EPD_4in2_test.c
Normal file
192
Libraries/EPaper/Examples/EPD_4in2_test.c
Normal file
@ -0,0 +1,192 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef EPD_4IN2
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_4IN2_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN2_Init_Fast();
|
||||
EPD_4IN2_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
printf("Support for partial refresh, but the refresh effect is not good, but it is not recommended\r\n");
|
||||
#if 0
|
||||
EPD_4IN2_Init_Partial();
|
||||
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);
|
||||
EPD_4IN2_PartialDisplay(150, 80, 150 + Font20.Width * 7, 80 + Font20.Height, BlackImage);
|
||||
EPD_Delay_ms(500);//Analog clock 1s
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
EPD_4IN2_Init_4Gray();
|
||||
printf("show Gray------------------------\r\n");
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
Imagesize = ((EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 4 ): (EPD_4IN2_WIDTH / 4 + 1)) * EPD_4IN2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
Paint_NewImage(BlackImage, EPD_4IN2_WIDTH, EPD_4IN2_HEIGHT, 0, WHITE);
|
||||
Paint_SetScale(4);
|
||||
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_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(140, 0, "你好abc", &Font12CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(140, 40, "你好abc", &Font12CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(140, 80, "你好abc", &Font12CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(140, 120, "你好abc", &Font12CN, GRAY4, GRAY1);
|
||||
|
||||
Paint_DrawString_CN(220, 0, "微雪电子", &Font24CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(220, 40, "微雪电子", &Font24CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(220, 80, "微雪电子", &Font24CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(220, 120, "微雪电子", &Font24CN, GRAY4, GRAY1);
|
||||
|
||||
EPD_4IN2_4GrayDisplay(BlackImage);
|
||||
EPD_Delay_ms(500);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
EPD_4IN2_4GrayDisplay(gImage_4in2_4Gray);
|
||||
EPD_Delay_ms(2000);
|
||||
|
||||
|
||||
EPD_4IN2_Clear();
|
||||
|
||||
EPD_4IN2_Init_Fast();
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4IN2_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
124
Libraries/EPaper/Examples/EPD_4in2b_V2_test.c
Normal file
124
Libraries/EPaper/Examples/EPD_4in2b_V2_test.c
Normal file
@ -0,0 +1,124 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_4in2b_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.2inch B V2 e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-11-25
|
||||
* | 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_4in2b_V2.h"
|
||||
|
||||
#ifdef EPD_4IN2B_V2
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_4IN2B_V2_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN2B_V2_Init();
|
||||
EPD_4IN2B_V2_Clear();
|
||||
EPD_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_4IN2B_V2_WIDTH % 8 == 0)? (EPD_4IN2B_V2_WIDTH / 8 ): (EPD_4IN2B_V2_WIDTH / 8 + 1)) * EPD_4IN2B_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
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_4IN2B_V2_WIDTH, EPD_4IN2B_V2_HEIGHT, 180, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_4IN2B_V2_WIDTH, EPD_4IN2B_V2_HEIGHT, 180, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_4IN2B_V2_Display(gImage_4in2bc_b, gImage_4in2bc_ry);
|
||||
EPD_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_4IN2B_V2_Display(BlackImage, RYImage);
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_4IN2B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4IN2B_V2_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
EPD_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
122
Libraries/EPaper/Examples/EPD_4in2bc_test.c
Normal file
122
Libraries/EPaper/Examples/EPD_4in2bc_test.c
Normal file
@ -0,0 +1,122 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_4IN2BC
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_4IN2BC_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN2BC_Init();
|
||||
EPD_4IN2BC_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
136
Libraries/EPaper/Examples/EPD_4in37g_test.c
Normal file
136
Libraries/EPaper/Examples/EPD_4in37g_test.c
Normal file
@ -0,0 +1,136 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_4in37g_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.37inch e-Paper (G) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-08-15
|
||||
* | 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_4in37g.h"
|
||||
|
||||
#ifdef EPD_4IN37G
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_4IN37G_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN37G_Init();
|
||||
EPD_4IN37G_Clear(EPD_4IN37G_WHITE); // WHITE
|
||||
EPD_Delay_ms(2000);
|
||||
|
||||
//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_4IN37G_WIDTH % 4 == 0)? (EPD_4IN37G_WIDTH / 4 ): (EPD_4IN37G_WIDTH / 4 + 1)) * EPD_4IN37G_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_4IN37G_WIDTH, EPD_4IN37G_HEIGHT, 0, EPD_4IN37G_WHITE);
|
||||
Paint_SetScale(4);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_4IN37G_WHITE);
|
||||
Paint_DrawBitMap(gImage_4in37g);
|
||||
EPD_4IN37G_Display(BlackImage);
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_4IN37G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_4IN37G_RED, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_4IN37G_YELLOW, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_4IN37G_BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_4IN37G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_4IN37G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_4IN37G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_4IN37G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_4IN37G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_4IN37G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_4IN37G_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_4IN37G_RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "Red, yellow, white and black", &Font20, EPD_4IN37G_YELLOW, EPD_4IN37G_WHITE);
|
||||
Paint_DrawString_EN(10, 30, "Four color e-Paper", &Font12, EPD_4IN37G_RED, EPD_4IN37G_BLACK);
|
||||
Paint_DrawString_CN(10, 125, "微雪电子", &Font24CN, EPD_4IN37G_WHITE, EPD_4IN37G_RED);
|
||||
Paint_DrawNum(10, 50, 123456, &Font12, EPD_4IN37G_WHITE, EPD_4IN37G_BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_4IN37G_Display(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_4IN37G_WHITE);
|
||||
|
||||
int hNumber, hWidth, vNumber, vWidth;
|
||||
hNumber = 16;
|
||||
hWidth = EPD_4IN37G_HEIGHT/hNumber; // 368/16=23
|
||||
vNumber = 16;
|
||||
vWidth = EPD_4IN37G_WIDTH/vNumber; // 512/16=32
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
for(int i=0; i<hNumber; i++) { // horizontal
|
||||
Paint_DrawRectangle(1, 1+i*hWidth, EPD_4IN37G_WIDTH, hWidth*(1+i), EPD_4IN37G_BLACK + (i % 2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
for(int i=0; i<vNumber; i++) { // vertical
|
||||
if(i%2) {
|
||||
Paint_DrawRectangle(1+i*vWidth, 1, vWidth*(i+1), EPD_4IN37G_HEIGHT, EPD_4IN37G_YELLOW + (i/2%2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
}
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_4IN37G_Display(BlackImage);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
EPD_4IN37G_Clear(EPD_4IN37G_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4IN37G_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
EPD_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
111
Libraries/EPaper/Examples/EPD_5in65f_test.c
Normal file
111
Libraries/EPaper/Examples/EPD_5in65f_test.c
Normal file
@ -0,0 +1,111 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_5in65f_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch F e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-07-07
|
||||
* | 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_5in65f.h"
|
||||
#include "EPD_Test.h"
|
||||
|
||||
#ifdef EPD_5IN65F
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_5in65F_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5IN65F_Init();
|
||||
EPD_5IN65F_Clear(EPD_5IN65F_WHITE);
|
||||
EPD_Delay_ms(100);
|
||||
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UDOUBLE Imagesize = ((EPD_5IN65F_WIDTH % 2 == 0)? (EPD_5IN65F_WIDTH / 2 ): (EPD_5IN65F_WIDTH / 2 + 1)) * EPD_5IN65F_HEIGHT;
|
||||
Imagesize = Imagesize/4;
|
||||
printf("Not enough memory, only part of the window is displayed\r\n");
|
||||
printf("Imagesize %ld\r\n",Imagesize);
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
Paint_NewImage(BlackImage, EPD_5IN65F_WIDTH/2, EPD_5IN65F_HEIGHT/2, 0, EPD_5IN65F_WHITE);
|
||||
Paint_SetScale(7);
|
||||
|
||||
#if 0
|
||||
EPD_5IN65F_Display_part(gImage_5in65f, 204, 153, 192, 143);
|
||||
EPD_Delay_ms(5000);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
Paint_Clear(EPD_5IN65F_GREEN);
|
||||
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(10, 120, "你好abc", &Font12CN, EPD_5IN65F_BLACK, WHITE);
|
||||
Paint_DrawString_CN(10, 140, "你好abc", &Font12CN, EPD_5IN65F_GREEN, WHITE);
|
||||
Paint_DrawString_CN(10, 160, "你好abc", &Font12CN, EPD_5IN65F_BLUE, WHITE);
|
||||
Paint_DrawString_CN(10, 180, "你好abc", &Font12CN, EPD_5IN65F_RED, WHITE);
|
||||
Paint_DrawString_CN(10, 200, "你好abc", &Font12CN, EPD_5IN65F_ORANGE, WHITE);
|
||||
|
||||
Paint_DrawString_CN(150, 0, "微雪电子", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawString_CN(150, 40, "微雪电子", &Font24CN, EPD_5IN65F_GREEN, BLACK);
|
||||
Paint_DrawString_CN(150, 80, "微雪电子", &Font24CN, EPD_5IN65F_BLUE, BLACK);
|
||||
Paint_DrawString_CN(150, 120, "微雪电子", &Font24CN, EPD_5IN65F_RED, BLACK);
|
||||
Paint_DrawString_CN(150, 160, "微雪电子", &Font24CN, EPD_5IN65F_YELLOW, BLACK);
|
||||
|
||||
EPD_5IN65F_Display_part(BlackImage, 0, 0, 300, 224);
|
||||
EPD_Delay_ms(5000);
|
||||
#endif
|
||||
printf("e-Paper Clear...\r\n");
|
||||
EPD_5IN65F_Clear(EPD_5IN65F_WHITE);
|
||||
EPD_Delay_ms(1000);
|
||||
EPD_5IN65F_Sleep();
|
||||
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
112
Libraries/EPaper/Examples/EPD_5in83_V2_test.c
Normal file
112
Libraries/EPaper/Examples/EPD_5in83_V2_test.c
Normal file
@ -0,0 +1,112 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_5in83_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-12-09
|
||||
* | 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_V2.h"
|
||||
#include "time.h"
|
||||
|
||||
#ifdef EPD_5IN83_V2
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_5IN83_V2_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5in83_V2_Init();
|
||||
EPD_5in83_V2_Clear();
|
||||
EPD_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_V2_WIDTH % 8 == 0)? (EPD_5in83_V2_WIDTH / 8 ): (EPD_5in83_V2_WIDTH / 8 + 1)) * EPD_5in83_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_5in83_V2_WIDTH, EPD_5in83_V2_HEIGHT, 180, WHITE);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_5in83_V2);
|
||||
EPD_5in83_V2_Display(BlackImage);
|
||||
EPD_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_V2_Display(BlackImage);
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_5in83_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_5in83_V2_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
EPD_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
110
Libraries/EPaper/Examples/EPD_5in83_test.c
Normal file
110
Libraries/EPaper/Examples/EPD_5in83_test.c
Normal file
@ -0,0 +1,110 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_5IN83
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_5IN83_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5IN83_Init();
|
||||
EPD_5IN83_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
144
Libraries/EPaper/Examples/EPD_5in83b_V2_test.c
Normal file
144
Libraries/EPaper/Examples/EPD_5in83b_V2_test.c
Normal file
@ -0,0 +1,144 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_5in83b_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch B V2 e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-07-04
|
||||
* | 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_5in83b_V2.h"
|
||||
#include "EPD_TestImage.h"
|
||||
|
||||
#ifdef EPD_5IN83B_V2
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_5in83b_V2_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5IN83B_V2_Init();
|
||||
EPD_5IN83B_V2_Clear();
|
||||
EPD_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_5IN83B_V2_WIDTH % 8 == 0)? (EPD_5IN83B_V2_WIDTH / 8 ): (EPD_5IN83B_V2_WIDTH / 8 + 1)) * EPD_5IN83B_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize / 4)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("NewImage:BlackImage and RYImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_5IN83B_V2_WIDTH, EPD_5IN83B_V2_HEIGHT, 0, WHITE);
|
||||
|
||||
#if 1
|
||||
EPD_5IN83B_V2_Display(gImage_5in83b_V2_b, gImage_5in83b_V2_r);
|
||||
EPD_Delay_ms(5000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
printf("Drawing on the image \r\n");
|
||||
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);
|
||||
EPD_5IN83B_V2_DisplayPicture(BlackImage,0);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
EPD_5IN83B_V2_DisplayPicture(BlackImage,1);
|
||||
|
||||
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);
|
||||
EPD_5IN83B_V2_DisplayPicture(BlackImage,2);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
EPD_5IN83B_V2_DisplayPicture(BlackImage,3);
|
||||
|
||||
|
||||
//2.Draw red image
|
||||
Paint_Clear(WHITE);
|
||||
EPD_5IN83B_V2_DisplayPicture(BlackImage,4);
|
||||
|
||||
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);
|
||||
EPD_5IN83B_V2_DisplayPicture(BlackImage,5);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
EPD_5IN83B_V2_DisplayPicture(BlackImage,6);
|
||||
|
||||
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_5IN83B_V2_DisplayPicture(BlackImage,7);
|
||||
EPD_Delay_ms(15000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_5IN83B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_5IN83B_V2_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
120
Libraries/EPaper/Examples/EPD_5in83bc_test.c
Normal file
120
Libraries/EPaper/Examples/EPD_5in83bc_test.c
Normal file
@ -0,0 +1,120 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_5IN83BC
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_5IN83BC_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5IN83BC_Init();
|
||||
EPD_5IN83BC_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
148
Libraries/EPaper/Examples/EPD_7in3f_test.c
Normal file
148
Libraries/EPaper/Examples/EPD_7in3f_test.c
Normal file
@ -0,0 +1,148 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_7in3f_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.3inch e-Paper (F) Demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-10-20
|
||||
* | 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_7in3f.h"
|
||||
|
||||
#ifdef EPD_7IN3F
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_7IN3F_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN3F_Init();
|
||||
|
||||
EPD_7IN3F_Clear(EPD_7IN3F_WHITE); // WHITE
|
||||
EPD_Delay_ms(1000);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UDOUBLE Imagesize = ((EPD_7IN3F_WIDTH % 2 == 0)? (EPD_7IN3F_WIDTH / 2 ): (EPD_7IN3F_WIDTH / 2 + 1)) * EPD_7IN3F_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize/4)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN3F_WIDTH/2, EPD_7IN3F_HEIGHT/2, 0, EPD_7IN3F_WHITE);
|
||||
Paint_SetScale(7);
|
||||
|
||||
#if 1
|
||||
EPD_7IN3F_Display(gImage_7in3f);
|
||||
EPD_Delay_ms(5000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
// 1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_7IN3F_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_7IN3F_RED, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_7IN3F_BLUE, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_7IN3F_GREEN, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_7IN3F_ORANGE, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_7IN3F_ORANGE, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_7IN3F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_7IN3F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_7IN3F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_7IN3F_WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_7IN3F_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_7IN3F_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_CN(10, 160, "你好Abc", &Font12CN, EPD_7IN3F_BLACK, EPD_7IN3F_WHITE);
|
||||
Paint_DrawString_CN(10, 180, "微雪电子", &Font24CN, EPD_7IN3F_WHITE, EPD_7IN3F_BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, EPD_7IN3F_BLACK, EPD_7IN3F_WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, EPD_7IN3F_WHITE, EPD_7IN3F_BLACK);
|
||||
Paint_DrawString_EN(300, 0, "Waveshare", &Font16, EPD_7IN3F_BLACK, EPD_7IN3F_WHITE);
|
||||
Paint_DrawString_EN(300, 20, "Waveshare", &Font16, EPD_7IN3F_GREEN, EPD_7IN3F_WHITE);
|
||||
Paint_DrawString_EN(300, 40, "Waveshare", &Font16, EPD_7IN3F_BLUE, EPD_7IN3F_WHITE);
|
||||
Paint_DrawString_EN(300, 60, "Waveshare", &Font16, EPD_7IN3F_RED, EPD_7IN3F_WHITE);
|
||||
Paint_DrawString_EN(300, 80, "Waveshare", &Font16, EPD_7IN3F_YELLOW, EPD_7IN3F_WHITE);
|
||||
Paint_DrawString_EN(300, 100, "Waveshare", &Font16, EPD_7IN3F_ORANGE, EPD_7IN3F_WHITE);
|
||||
Paint_DrawString_EN(160, 0, "hello world", &Font12, EPD_7IN3F_WHITE, EPD_7IN3F_BLACK);
|
||||
Paint_DrawString_EN(160, 30, "hello world", &Font12, EPD_7IN3F_GREEN, EPD_7IN3F_BLACK);
|
||||
Paint_DrawString_EN(160, 60, "hello world", &Font12, EPD_7IN3F_BLUE, EPD_7IN3F_BLACK);
|
||||
Paint_DrawString_EN(160, 90, "hello world", &Font12, EPD_7IN3F_RED, EPD_7IN3F_BLACK);
|
||||
Paint_DrawString_EN(160, 120, "hello world", &Font12, EPD_7IN3F_YELLOW, EPD_7IN3F_BLACK);
|
||||
Paint_DrawString_EN(160, 150, "hello world", &Font12, EPD_7IN3F_ORANGE, EPD_7IN3F_BLACK);
|
||||
Paint_DrawString_EN(160, 180, "hello world", &Font12, EPD_7IN3F_BLACK, EPD_7IN3F_YELLOW);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN3F_DisplayPart(BlackImage, 200, 120, 400, 240);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_7IN3F_WHITE);
|
||||
|
||||
int hNumber, hWidth, vNumber, vWidth;
|
||||
hNumber = 10;
|
||||
hWidth = EPD_7IN3F_HEIGHT/2/hNumber; // 480/2/10=24
|
||||
vNumber = 20;
|
||||
vWidth = EPD_7IN3F_WIDTH/2/vNumber; // 800/2/20=20
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
for(int i=0; i<hNumber; i++) { // horizontal
|
||||
Paint_DrawRectangle(1, 1+i*hWidth, EPD_7IN3F_WIDTH/2, hWidth*(1+i), EPD_7IN3F_BLACK + (i % 2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
for(int i=0; i<vNumber; i++) { // vertical
|
||||
if(i%2) {
|
||||
Paint_DrawRectangle(1+i*vWidth, 1, vWidth*(i+1), EPD_7IN3F_HEIGHT/2, EPD_7IN3F_GREEN + (i%5), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
}
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN3F_DisplayPart(BlackImage, 200, 120, 400, 240);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN3F_Clear(EPD_7IN3F_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN3F_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
EPD_Delay_ms(2000); // important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
110
Libraries/EPaper/Examples/EPD_7in3g_test.c
Normal file
110
Libraries/EPaper/Examples/EPD_7in3g_test.c
Normal file
@ -0,0 +1,110 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_7in3g_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.3inch e-paper (G) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-07-22
|
||||
* | 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_7in3g.h"
|
||||
#include "time.h"
|
||||
|
||||
#ifdef EPD_7IN3G
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_7IN3G_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN3G_Init();
|
||||
EPD_7IN3G_Clear(EPD_7IN3G_WHITE);
|
||||
EPD_Delay_ms(2000);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UDOUBLE Imagesize = ((EPD_7IN3G_WIDTH % 4 == 0)? (EPD_7IN3G_WIDTH / 4 ): (EPD_7IN3G_WIDTH / 4 + 1)) * EPD_7IN3G_HEIGHT;
|
||||
Imagesize = Imagesize/4;
|
||||
printf("Not enough memory, only part of the window is displayed\r\n");
|
||||
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_7IN3G_WIDTH/2, EPD_7IN3G_HEIGHT/2 , 0, EPD_7IN3G_WHITE);
|
||||
Paint_SetScale(4);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_7IN3G_Display(gImage_7in3g);
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_7IN3G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_7IN3G_WHITE, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_7IN3G_YELLOW, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_7IN3G_BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_7IN3G_WHITE, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_7IN3G_WHITE, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_7IN3G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_7IN3G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_7IN3G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_7IN3G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_7IN3G_WHITE, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_7IN3G_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "Red, yellow, white and black", &Font16, EPD_7IN3G_WHITE, EPD_7IN3G_YELLOW);
|
||||
Paint_DrawString_EN(10, 35, "Four color e-Paper", &Font12, EPD_7IN3G_YELLOW, EPD_7IN3G_BLACK);
|
||||
Paint_DrawString_CN(10, 125, "微雪电子", &Font24CN, EPD_7IN3G_RED, EPD_7IN3G_WHITE);
|
||||
Paint_DrawNum(10, 50, 123456, &Font12, EPD_7IN3G_RED, EPD_7IN3G_WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN3G_Display_part(BlackImage, 200, 120, 400, 240);
|
||||
EPD_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN3G_Clear(EPD_7IN3G_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN3G_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
EPD_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
118
Libraries/EPaper/Examples/EPD_7in5_HD_test.c
Normal file
118
Libraries/EPaper/Examples/EPD_7in5_HD_test.c
Normal file
@ -0,0 +1,118 @@
|
||||
/*****************************************************************************
|
||||
* | 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_HD.h"
|
||||
|
||||
#ifdef EPD_7IN5_HD
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_7IN5_HD_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5_HD_Init();
|
||||
EPD_7IN5_HD_Clear();
|
||||
EPD_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_HD_WIDTH % 8 == 0)? (EPD_7IN5_HD_WIDTH / 8 ): (EPD_7IN5_HD_WIDTH / 8 + 1)) * EPD_7IN5_HD_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize/2)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN5_HD_WIDTH, EPD_7IN5_HD_HEIGHT/2, 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_V2);
|
||||
//EPD_7IN5_HD_WritePicture(BlackImage, 0);
|
||||
//The entire image size is EPD_7IN5_HD_WIDTH*EPD_7IN5_HD_HEIGHT/8
|
||||
//Since the memory problem is transmitted halfway, now the other half is transmitted, so the offset address is required.
|
||||
//Paint_DrawBitMap(gImage_7in5_V2 + EPD_7IN5_HD_WIDTH*EPD_7IN5_HD_HEIGHT/8/2);
|
||||
//EPD_7IN5_HD_WritePicture(BlackImage, 1);
|
||||
|
||||
EPD_7IN5_HD_DisplayImage(gImage_7in5_V2,0,0,800,480);
|
||||
EPD_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);
|
||||
EPD_7IN5_HD_WritePicture(BlackImage, 0);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_7IN5_HD_WritePicture(BlackImage, 1);
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5_HD_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5_HD_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
116
Libraries/EPaper/Examples/EPD_7in5_V2_test.c
Normal file
116
Libraries/EPaper/Examples/EPD_7in5_V2_test.c
Normal file
@ -0,0 +1,116 @@
|
||||
/*****************************************************************************
|
||||
* | 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_V2.h"
|
||||
|
||||
#ifdef EPD_7IN5_V2
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_7IN5_V2_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5_V2_Init();
|
||||
EPD_7IN5_V2_Clear();
|
||||
EPD_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_V2_WIDTH % 8 == 0)? (EPD_7IN5_V2_WIDTH / 8 ): (EPD_7IN5_V2_WIDTH / 8 + 1)) * EPD_7IN5_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize/2)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN5_V2_WIDTH, EPD_7IN5_V2_HEIGHT/2, 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_V2);
|
||||
EPD_7IN5_V2_WritePicture(BlackImage, 0);
|
||||
//The entire image size is EPD_7IN5_V2_WIDTH*EPD_7IN5_V2_HEIGHT/8
|
||||
//Since the memory problem is transmitted halfway, now the other half is transmitted, so the offset address is required.
|
||||
Paint_DrawBitMap(gImage_7in5_V2 + EPD_7IN5_V2_WIDTH*EPD_7IN5_V2_HEIGHT/8/2);
|
||||
EPD_7IN5_V2_WritePicture(BlackImage, 1);
|
||||
EPD_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);
|
||||
EPD_7IN5_V2_WritePicture(BlackImage, 0);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_7IN5_V2_WritePicture(BlackImage, 1);
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5_V2_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
110
Libraries/EPaper/Examples/EPD_7in5_test.c
Normal file
110
Libraries/EPaper/Examples/EPD_7in5_test.c
Normal file
@ -0,0 +1,110 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_7IN5
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_7IN5_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5_Init();
|
||||
EPD_7IN5_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
119
Libraries/EPaper/Examples/EPD_7in5b_HD_test.c
Normal file
119
Libraries/EPaper/Examples/EPD_7in5b_HD_test.c
Normal file
@ -0,0 +1,119 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_7in5bc_HD_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_7in5b_HD.h"
|
||||
#include "EPD_TestImage.h"
|
||||
|
||||
#ifdef EPD_7IN5B_HD
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_7IN5B_HD_test Demo\r\n");
|
||||
if(EPD_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5B_HD_Init();
|
||||
EPD_7IN5B_HD_Clear();
|
||||
EPD_Delay_ms(500);
|
||||
// EPD_7IN5B_HD_ClearRed();
|
||||
// EPD_Delay_ms(3000);
|
||||
// EPD_7IN5B_HD_ClearBlack();
|
||||
// EPD_Delay_ms(3000);
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage;
|
||||
UWORD Imagesize = ((EPD_7IN5B_HD_WIDTH % 8 == 0)? (EPD_7IN5B_HD_WIDTH / 8 ): (EPD_7IN5B_HD_WIDTH / 8 + 1)) * EPD_7IN5B_HD_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize/2)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage \r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN5B_HD_WIDTH, EPD_7IN5B_HD_HEIGHT/2 , 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
// Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
#if 1
|
||||
EPD_7IN5B_HD_DisplayImage(gImage_7in5_V2_b,gImage_7in5_V2_ry,16,10,800,480);
|
||||
EPD_Delay_ms(5000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
printf("Drawing on the image \r\n");
|
||||
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);
|
||||
EPD_7IN5B_HD_DisplayPicture(BlackImage,0);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_7IN5B_HD_DisplayPicture(BlackImage,1);
|
||||
//2.Draw red image
|
||||
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);
|
||||
EPD_7IN5B_HD_DisplayPicture(BlackImage,2);
|
||||
Paint_Clear(WHITE);
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN5B_HD_DisplayPicture(BlackImage,3);
|
||||
EPD_Delay_ms(5000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5B_HD_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5B_HD_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
117
Libraries/EPaper/Examples/EPD_7in5b_V2_test.c
Normal file
117
Libraries/EPaper/Examples/EPD_7in5b_V2_test.c
Normal file
@ -0,0 +1,117 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_7in5b_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.5inch B V2 e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.1
|
||||
* | Date : 2020-11-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 "EPD_Test.h"
|
||||
#include "EPD_7in5b_V2.h"
|
||||
|
||||
#ifdef EPD_7IN5B_V2
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_7IN5B_V2_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5B_V2_Init();
|
||||
EPD_7IN5B_V2_Clear();
|
||||
EPD_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *Image;
|
||||
UWORD Imagesize = ((EPD_7IN5B_V2_WIDTH % 8 == 0)? (EPD_7IN5B_V2_WIDTH / 8 ): (EPD_7IN5B_V2_WIDTH / 8 + 1)) * EPD_7IN5B_V2_HEIGHT;
|
||||
if((Image = (UBYTE *)malloc(Imagesize / 2)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:Image\r\n");
|
||||
Paint_NewImage(Image, EPD_7IN5B_V2_WIDTH, EPD_7IN5B_V2_HEIGHT / 2, 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(Image);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
//The entire image size is Imagesize
|
||||
//Since the memory problem is transmitted halfway, now the other half is transmitted, so the offset address is required.
|
||||
EPD_7IN5B_V2_WritePicture(gImage_7in5_V2_b, 0);
|
||||
EPD_7IN5B_V2_WritePicture(gImage_7in5_V2_b + Imagesize/2, 1);
|
||||
EPD_7IN5B_V2_WritePicture(gImage_7in5_V2_ry, 2);
|
||||
EPD_7IN5B_V2_WritePicture(gImage_7in5_V2_ry + Imagesize/2, 3);
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(Image);
|
||||
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);
|
||||
EPD_7IN5B_V2_WritePicture(Image, 0);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_7IN5B_V2_WritePicture(Image, 1);
|
||||
//2.Draw red image
|
||||
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);
|
||||
EPD_7IN5B_V2_WritePicture(Image, 2);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_7IN5B_V2_WritePicture(Image, 3);
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5B_V2_Sleep();
|
||||
free(Image);
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
120
Libraries/EPaper/Examples/EPD_7in5bc_test.c
Normal file
120
Libraries/EPaper/Examples/EPD_7in5bc_test.c
Normal file
@ -0,0 +1,120 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_7IN5BC
|
||||
int EPD_test(void)
|
||||
{
|
||||
printf("EPD_7IN5BC_test Demo\r\n");
|
||||
EPD_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5BC_Init();
|
||||
EPD_7IN5BC_Clear();
|
||||
EPD_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);
|
||||
EPD_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);
|
||||
EPD_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");
|
||||
EPD_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
41
Libraries/EPaper/Examples/EPD_Test.h
Normal file
41
Libraries/EPaper/Examples/EPD_Test.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*****************************************************************************
|
||||
* | 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 "EPD_Common.h"
|
||||
#include "GUI_Paint.h"
|
||||
#include "EPD_TestImage.h"
|
||||
|
||||
#include <stdlib.h> // malloc() free()
|
||||
|
||||
int EPD_test(void);
|
||||
|
||||
#endif
|
||||
51993
Libraries/EPaper/Examples/EPD_TestImage.c
Normal file
51993
Libraries/EPaper/Examples/EPD_TestImage.c
Normal file
File diff suppressed because it is too large
Load Diff
108
Libraries/EPaper/Examples/EPD_TestImage.h
Normal file
108
Libraries/EPaper/Examples/EPD_TestImage.h
Normal file
@ -0,0 +1,108 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_TestImage.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 _EPD_TESTIMAGE_H_
|
||||
#define _EPD_TESTIMAGE_H_
|
||||
|
||||
// ImageData2.c
|
||||
/* --------------------------------------- */
|
||||
extern const unsigned char gImage_2in13b_V4b[];
|
||||
extern const unsigned char gImage_2in13b_V4r[];
|
||||
|
||||
extern const unsigned char gImage_1in64g[];
|
||||
extern const unsigned char gImage_2in36g[];
|
||||
extern const unsigned char gImage_3in0g[];
|
||||
extern const unsigned char gImage_4in37g[];
|
||||
extern const unsigned char gImage_7in3f[];
|
||||
extern const unsigned char gImage_7in3g[];
|
||||
/* --------------------------------------- */
|
||||
|
||||
// ImageData.c
|
||||
extern const unsigned char gImage_100X50[];
|
||||
|
||||
extern const unsigned char gImage_1in02d[];
|
||||
|
||||
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_2in7b_Black_V2[5808];
|
||||
extern const unsigned char gImage_2in7b_Red_V2[5808];
|
||||
extern const unsigned char gImage_2in7_4Gray[];
|
||||
|
||||
|
||||
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_2in66[];
|
||||
extern const unsigned char gImage_2in66bb[];
|
||||
extern const unsigned char gImage_2in66br[];
|
||||
|
||||
extern const unsigned char gImage_3in52[];
|
||||
extern const unsigned char gImage_3in7[]; //4 Gray
|
||||
|
||||
extern const unsigned char gImage_4in01[];
|
||||
|
||||
extern const unsigned char gImage_4in2[];
|
||||
extern const unsigned char gImage_4in2_4Gray[];
|
||||
extern const unsigned char gImage_4in2bc_b[];
|
||||
extern const unsigned char gImage_4in2bc_ry[];
|
||||
|
||||
extern const unsigned char gImage_5in65f[];//192*143
|
||||
|
||||
extern const unsigned char gImage_5in83[];
|
||||
extern const unsigned char gImage_5in83_V2[];
|
||||
extern const unsigned char gImage_5in83bc_b[];
|
||||
extern const unsigned char gImage_5in83bc_ry[];
|
||||
extern const unsigned char gImage_5in83b_V2_b[];
|
||||
extern const unsigned char gImage_5in83b_V2_r[];
|
||||
|
||||
extern const unsigned char gImage_7in5[];
|
||||
extern const unsigned char gImage_7in5_V2[];
|
||||
extern const unsigned char gImage_7in5bc_b[];
|
||||
extern const unsigned char gImage_7in5bc_ry[];
|
||||
extern const unsigned char gImage_7in5_V2_b[];
|
||||
extern const unsigned char gImage_7in5_V2_ry[];
|
||||
#endif
|
||||
/* FILE END */
|
||||
23773
Libraries/EPaper/Examples/EPD_TestImage2.c
Normal file
23773
Libraries/EPaper/Examples/EPD_TestImage2.c
Normal file
File diff suppressed because it is too large
Load Diff
1384
Libraries/EPaper/Fonts/font12.c
Normal file
1384
Libraries/EPaper/Fonts/font12.c
Normal file
File diff suppressed because it is too large
Load Diff
119
Libraries/EPaper/Fonts/font12cn.c
Normal file
119
Libraries/EPaper/Fonts/font12cn.c
Normal file
@ -0,0 +1,119 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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 --*/
|
||||
{
|
||||
index:"你",
|
||||
matrix: {
|
||||
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 --*/
|
||||
{
|
||||
index:"好",
|
||||
matrix: {
|
||||
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}
|
||||
},
|
||||
|
||||
/*-- 文字: a --*/
|
||||
/*-- 微软雅黑12; 此字体下对应的点阵为:宽x高=16x21 --*/
|
||||
{
|
||||
index: "a",
|
||||
matrix: {
|
||||
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 --*/
|
||||
{
|
||||
index: "b",
|
||||
matrix: {
|
||||
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 --*/
|
||||
{
|
||||
index: "c",
|
||||
matrix: {
|
||||
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 --*/
|
||||
{
|
||||
index: "A",
|
||||
matrix: {
|
||||
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
Libraries/EPaper/Fonts/font16.c
Normal file
1764
Libraries/EPaper/Fonts/font16.c
Normal file
File diff suppressed because it is too large
Load Diff
2142
Libraries/EPaper/Fonts/font20.c
Normal file
2142
Libraries/EPaper/Fonts/font20.c
Normal file
File diff suppressed because it is too large
Load Diff
2520
Libraries/EPaper/Fonts/font24.c
Normal file
2520
Libraries/EPaper/Fonts/font24.c
Normal file
File diff suppressed because it is too large
Load Diff
478
Libraries/EPaper/Fonts/font24cn.c
Normal file
478
Libraries/EPaper/Fonts/font24cn.c
Normal file
@ -0,0 +1,478 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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 --*/
|
||||
{
|
||||
index: "你",
|
||||
matrix: {
|
||||
0x00,0x00,0x00,0x00,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 --*/
|
||||
{
|
||||
index:"好",
|
||||
matrix: {
|
||||
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 --*/
|
||||
{
|
||||
index: "微",
|
||||
matrix: {
|
||||
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 --*/
|
||||
{
|
||||
index:"雪",
|
||||
matrix: {
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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 --*/
|
||||
{
|
||||
index:"电",
|
||||
matrix: {
|
||||
0x00,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 --*/
|
||||
{
|
||||
index: "子",
|
||||
matrix: {
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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
Libraries/EPaper/Fonts/font8.c
Normal file
1004
Libraries/EPaper/Fonts/font8.c
Normal file
File diff suppressed because it is too large
Load Diff
66
Libraries/EPaper/Fonts/fonts.h
Normal file
66
Libraries/EPaper/Fonts/fonts.h
Normal file
@ -0,0 +1,66 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file fonts.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 18-February-2014
|
||||
* @brief Header for fonts.c file
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __FONTS_H
|
||||
#define __FONTS_H
|
||||
|
||||
#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;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char index[3];
|
||||
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 */
|
||||
890
Libraries/EPaper/GUI/GUI_Paint.c
Normal file
890
Libraries/EPaper/GUI/GUI_Paint.c
Normal file
@ -0,0 +1,890 @@
|
||||
/******************************************************************************
|
||||
* | 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.1
|
||||
* | Date : 2020-07-08
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.1(2020-07-08):
|
||||
* 1.Change: Paint_SetScale(UBYTE scale)
|
||||
* Add scale 7 for 5.65f e-Parper
|
||||
* 2.Change: Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
|
||||
* Add the branch for scale 7
|
||||
* 3.Change: Paint_Clear(UWORD Color)
|
||||
* Add the branch for scale 7
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
* 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 "EPD_Common.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.Scale = 2;
|
||||
|
||||
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) {
|
||||
EPD_Printf("Set image Rotate %d\r\n", Rotate);
|
||||
Paint.Rotate = Rotate;
|
||||
} else {
|
||||
EPD_Printf("rotate = 0, 90, 180, 270\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
void Paint_SetScale(UBYTE scale)
|
||||
{
|
||||
if(scale == 2){
|
||||
Paint.Scale = scale;
|
||||
Paint.WidthByte = (Paint.WidthMemory % 8 == 0)? (Paint.WidthMemory / 8 ): (Paint.WidthMemory / 8 + 1);
|
||||
}else if(scale == 4){
|
||||
Paint.Scale = scale;
|
||||
Paint.WidthByte = (Paint.WidthMemory % 4 == 0)? (Paint.WidthMemory / 4 ): (Paint.WidthMemory / 4 + 1);
|
||||
}else if(scale == 7){//Only applicable with 5in65 e-Paper
|
||||
Paint.Scale = scale;
|
||||
Paint.WidthByte = (Paint.WidthMemory % 2 == 0)? (Paint.WidthMemory / 2 ): (Paint.WidthMemory / 2 + 1);;
|
||||
}else{
|
||||
EPD_Printf("Set Scale Input parameter error\r\n");
|
||||
EPD_Printf("Scale Only support: 2 4 7\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) {
|
||||
EPD_Printf("mirror image x:%s, y:%s\r\n",(mirror & 0x01)? "mirror":"none", ((mirror >> 1) & 0x01)? "mirror":"none");
|
||||
Paint.Mirror = mirror;
|
||||
} else {
|
||||
EPD_Printf("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){
|
||||
EPD_Printf("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){
|
||||
EPD_Printf("Exceeding display boundaries\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(Paint.Scale == 2){
|
||||
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));
|
||||
}else if(Paint.Scale == 4){
|
||||
UDOUBLE Addr = X / 4 + Y * Paint.WidthByte;
|
||||
Color = Color % 4;//Guaranteed color scale is 4 --- 0~3
|
||||
UBYTE Rdata = Paint.Image[Addr];
|
||||
|
||||
Rdata = Rdata & (~(0xC0 >> ((X % 4)*2)));
|
||||
Paint.Image[Addr] = Rdata | ((Color << 6) >> ((X % 4)*2));
|
||||
}else if(Paint.Scale == 7){
|
||||
UDOUBLE Addr = X / 2 + Y * Paint.WidthByte;
|
||||
UBYTE Rdata = Paint.Image[Addr];
|
||||
Rdata = Rdata & (~(0xF0 >> ((X % 2)*4)));//Clear first, then set value
|
||||
Paint.Image[Addr] = Rdata | ((Color << 4) >> ((X % 2)*4));
|
||||
//printf("Add = %d ,data = %d\r\n",Addr,Rdata);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Clear the color of the picture
|
||||
parameter:
|
||||
Color : Painted colors
|
||||
******************************************************************************/
|
||||
void Paint_Clear(UWORD Color)
|
||||
{
|
||||
if(Paint.Scale == 2) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}else if(Paint.Scale == 4) {
|
||||
for (UWORD Y = 0; Y < Paint.HeightByte; Y++) {
|
||||
for (UWORD X = 0; X < Paint.WidthByte; X++ ) {
|
||||
UDOUBLE Addr = X + Y*Paint.WidthByte;
|
||||
Paint.Image[Addr] = (Color<<6)|(Color<<4)|(Color<<2)|Color;
|
||||
}
|
||||
}
|
||||
}else if(Paint.Scale == 7) {
|
||||
for (UWORD Y = 0; Y < Paint.HeightByte; Y++) {
|
||||
for (UWORD X = 0; X < Paint.WidthByte; X++ ) {
|
||||
UDOUBLE Addr = X + Y*Paint.WidthByte;
|
||||
Paint.Image[Addr] = (Color<<4)|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) {
|
||||
EPD_Printf("Paint_DrawPoint Input exceeds the normal display range\r\n");
|
||||
printf("Xpoint = %d , Paint.Width = %d \r\n ",Xpoint,Paint.Width);
|
||||
printf("Ypoint = %d , Paint.Height = %d \r\n ",Ypoint,Paint.Height);
|
||||
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) {
|
||||
EPD_Printf("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) {
|
||||
//EPD_Printf("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) {
|
||||
EPD_Printf("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) {
|
||||
EPD_Printf("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) {
|
||||
EPD_Printf("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) {
|
||||
EPD_Printf("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 += 3;
|
||||
/* 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) {
|
||||
EPD_Printf("Paint_DisNum Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//Converts a number to a string
|
||||
do {
|
||||
Num_Array[Num_Bit] = Nummber % 10 + '0';
|
||||
Num_Bit++;
|
||||
Nummber /= 10;
|
||||
} while(Nummber);
|
||||
|
||||
|
||||
//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 nummber (Able to display decimals)
|
||||
parameter:
|
||||
Xstart :X coordinate
|
||||
Ystart : Y coordinate
|
||||
Nummber : The number displayed
|
||||
Font :A structure pointer that displays a character size
|
||||
Digit : Fractional width
|
||||
Color_Foreground : Select the foreground color
|
||||
Color_Background : Select the background color
|
||||
******************************************************************************/
|
||||
void Paint_DrawNumDecimals(UWORD Xpoint, UWORD Ypoint, double Nummber,
|
||||
sFONT* Font, UWORD Digit, 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;
|
||||
int temp = Nummber;
|
||||
float decimals;
|
||||
uint8_t i;
|
||||
if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
|
||||
EPD_Printf("Paint_DisNum Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(Digit > 0) {
|
||||
decimals = Nummber - temp;
|
||||
for(i=Digit; i > 0; i--) {
|
||||
decimals*=10;
|
||||
}
|
||||
temp = decimals;
|
||||
//Converts a number to a string
|
||||
for(i=Digit; i>0; i--) {
|
||||
Num_Array[Num_Bit] = temp % 10 + '0';
|
||||
Num_Bit++;
|
||||
temp /= 10;
|
||||
}
|
||||
Num_Array[Num_Bit] = '.';
|
||||
Num_Bit++;
|
||||
}
|
||||
|
||||
temp = Nummber;
|
||||
//Converts a number to a string
|
||||
do {
|
||||
Num_Array[Num_Bit] = temp % 10 + '0';
|
||||
Num_Bit++;
|
||||
temp /= 10;
|
||||
} while(temp);
|
||||
|
||||
//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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: paste monochrome bitmap to a frame buff
|
||||
parameter:
|
||||
image_buffer :A picture data converted to a bitmap
|
||||
xStart: The starting x coordinate
|
||||
yStart: The starting y coordinate
|
||||
imageWidth: Original image width
|
||||
imageHeight: Original image height
|
||||
flipColor: Whether the color is reversed
|
||||
info:
|
||||
Use this function to paste image data into a buffer
|
||||
******************************************************************************/
|
||||
void Paint_DrawBitMap_Paste(const unsigned char* image_buffer, UWORD xStart, UWORD yStart, UWORD imageWidth, UWORD imageHeight, UBYTE flipColor)
|
||||
{
|
||||
UBYTE color, srcImage;
|
||||
UWORD x, y;
|
||||
UWORD width = (imageWidth%8==0 ? imageWidth/8 : imageWidth/8+1);
|
||||
|
||||
for (y = 0; y < imageHeight; y++) {
|
||||
for (x = 0; x < imageWidth; x++) {
|
||||
srcImage = image_buffer[y*width + x/8];
|
||||
if(flipColor)
|
||||
color = (((srcImage<<(x%8) & 0x80) == 0) ? 1 : 0);
|
||||
else
|
||||
color = (((srcImage<<(x%8) & 0x80) == 0) ? 0 : 1);
|
||||
Paint_SetPixel(x+xStart, y+yStart, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Paint_DrawBitMap_Block(const unsigned char* image_buffer, UBYTE Region)
|
||||
{
|
||||
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+ (Paint.HeightByte)*Paint.WidthByte*(Region - 1)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
218
Libraries/EPaper/GUI/GUI_Paint.h
Normal file
218
Libraries/EPaper/GUI/GUI_Paint.h
Normal file
@ -0,0 +1,218 @@
|
||||
/******************************************************************************
|
||||
* | 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 "EPD_Common.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;
|
||||
UWORD Scale;
|
||||
} 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
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
//4 Gray level
|
||||
#define GRAY1 0x03 //Blackest
|
||||
#define GRAY2 0x02
|
||||
#define GRAY3 0x01 //gray
|
||||
#define GRAY4 0x00 //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_SetScale(UBYTE scale);
|
||||
|
||||
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_DrawNumDecimals(UWORD Xpoint, UWORD Ypoint, double Nummber, sFONT* Font, UWORD Digit, UWORD Color_Foreground, UWORD Color_Background); // Able to display decimals
|
||||
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);
|
||||
void Paint_DrawBitMap_Paste(const unsigned char* image_buffer, UWORD Xstart, UWORD Ystart, UWORD imageWidth, UWORD imageHeight, UBYTE flipColor);
|
||||
//void Paint_DrawBitMap_Half(const unsigned char* image_buffer, UBYTE Region);
|
||||
//void Paint_DrawBitMap_OneQuarter(const unsigned char* image_buffer, UBYTE Region);
|
||||
//void Paint_DrawBitMap_OneEighth(const unsigned char* image_buffer, UBYTE Region);
|
||||
void Paint_DrawBitMap_Block(const unsigned char* image_buffer, UBYTE Region);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
394
Libraries/EPaper/Lib/EPD_1in02d.c
Normal file
394
Libraries/EPaper/Lib/EPD_1in02d.c
Normal file
@ -0,0 +1,394 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_1IN02_1in02.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : Electronic paper driver
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-09-27
|
||||
* | 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_1in02d.h"
|
||||
|
||||
#ifdef EPD_1IN02
|
||||
|
||||
/**
|
||||
* full screen update LUT
|
||||
**/
|
||||
const unsigned char lut_w1[] =
|
||||
{
|
||||
0x60 ,0x5A ,0x5A ,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 lut_b1[] =
|
||||
{
|
||||
0x90 ,0x5A ,0x5A ,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 ,
|
||||
|
||||
|
||||
};
|
||||
/**
|
||||
* partial screen update LUT
|
||||
**/
|
||||
const unsigned char lut_w[] =
|
||||
{
|
||||
0x60 ,0x01 ,0x01 ,0x00 ,0x00 ,0x01 ,
|
||||
0x80 ,0x1f ,0x00 ,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 ,
|
||||
|
||||
};
|
||||
const unsigned char lut_b[] =
|
||||
{
|
||||
0x90 ,0x01 ,0x01 ,0x00 ,0x00 ,0x01 ,
|
||||
0x40 ,0x1f ,0x00 ,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 ,
|
||||
|
||||
};
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN02_Reset(void)
|
||||
{
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(20);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);// Module reset
|
||||
EPD_Delay_ms(2);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(20);
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
command : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_1IN02_SendCommand(UBYTE command)
|
||||
{
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);// command write
|
||||
|
||||
EPD_SPI_WriteByte(command);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_1IN02_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1); // command write
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : LUT download
|
||||
******************************************************************************/
|
||||
void EPD_1IN02_SetFulltReg(void)
|
||||
{
|
||||
unsigned int count;
|
||||
EPD_1IN02_SendCommand(0x23);
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_1IN02_SendData(lut_w1[count]);}
|
||||
|
||||
EPD_1IN02_SendCommand(0x24);
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_1IN02_SendData(lut_b1[count]);}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : LUT download
|
||||
******************************************************************************/
|
||||
void EPD_1IN02_SetPartReg(void)
|
||||
{
|
||||
unsigned int count;
|
||||
EPD_1IN02_SendCommand(0x23);
|
||||
for(count=0;count<42;count++){
|
||||
EPD_1IN02_SendData(lut_w[count]);
|
||||
}
|
||||
|
||||
EPD_1IN02_SendCommand(0x24);
|
||||
for(count=0;count<42;count++){
|
||||
EPD_1IN02_SendData(lut_b[count]);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
******************************************************************************/
|
||||
void EPD_1IN02_WaitUntilIdle(void)
|
||||
{
|
||||
unsigned char busy;
|
||||
do
|
||||
{
|
||||
EPD_1IN02_SendCommand(0x71);
|
||||
busy = EPD_Digital_Read(EPD_BUSY_PIN);
|
||||
busy =!(busy & 0x01);
|
||||
}
|
||||
while(busy);
|
||||
EPD_Delay_ms(800);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
******************************************************************************/
|
||||
void EPD_1IN02_TurnOnDisplay(void)
|
||||
{
|
||||
// EPD_1IN02_SendCommand(0x04); //power on
|
||||
// EPD_1IN02_WaitUntilIdle();
|
||||
EPD_1IN02_SendCommand(0x12); //Start refreshing the screen
|
||||
EPD_Delay_ms(10);
|
||||
EPD_1IN02_WaitUntilIdle();
|
||||
// EPD_1IN02_SendCommand(0x02);
|
||||
// EPD_1IN02_WaitUntilIdle(); //power off
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function :Initialize the e-Paper register
|
||||
******************************************************************************/
|
||||
UBYTE EPD_1IN02_Init(void)
|
||||
{
|
||||
EPD_1IN02_Reset();
|
||||
|
||||
EPD_1IN02_SendCommand(0xD2);
|
||||
EPD_1IN02_SendData(0x3F);
|
||||
|
||||
EPD_1IN02_SendCommand(0x00);
|
||||
EPD_1IN02_SendData (0x6F); //from outside
|
||||
|
||||
EPD_1IN02_SendCommand(0x01); //power setting
|
||||
EPD_1IN02_SendData (0x03);
|
||||
EPD_1IN02_SendData (0x00);
|
||||
EPD_1IN02_SendData (0x2b);
|
||||
EPD_1IN02_SendData (0x2b);
|
||||
|
||||
EPD_1IN02_SendCommand(0x06); //Configuring the charge pump
|
||||
EPD_1IN02_SendData(0x3f);
|
||||
|
||||
EPD_1IN02_SendCommand(0x2A); //Setting XON and the options of LUT
|
||||
EPD_1IN02_SendData(0x00);
|
||||
EPD_1IN02_SendData(0x00);
|
||||
|
||||
EPD_1IN02_SendCommand(0x30); //Set the clock frequency
|
||||
EPD_1IN02_SendData(0x17); //50Hz
|
||||
|
||||
EPD_1IN02_SendCommand(0x50); //Set VCOM and data output interval
|
||||
EPD_1IN02_SendData(0x57);
|
||||
|
||||
EPD_1IN02_SendCommand(0x60); //Set The non-overlapping period of Gate and Source.
|
||||
EPD_1IN02_SendData(0x22);
|
||||
|
||||
EPD_1IN02_SendCommand(0x61); //resolution setting
|
||||
EPD_1IN02_SendData (0x50); //source 128
|
||||
EPD_1IN02_SendData (0x80);
|
||||
|
||||
EPD_1IN02_SendCommand(0x82); //sets VCOM_DC value
|
||||
EPD_1IN02_SendData(0x12); //-1v
|
||||
|
||||
EPD_1IN02_SendCommand(0xe3);//Set POWER SAVING
|
||||
EPD_1IN02_SendData(0x33);
|
||||
EPD_1IN02_SetFulltReg();
|
||||
EPD_1IN02_SendCommand(0x04); //power on
|
||||
EPD_1IN02_WaitUntilIdle();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function :Partial refresh initialization e-paper
|
||||
******************************************************************************/
|
||||
void EPD_1IN02_Part_Init(void)
|
||||
{
|
||||
EPD_1IN02_Reset();
|
||||
EPD_1IN02_SendCommand(0xD2);
|
||||
EPD_1IN02_SendData(0x3F);
|
||||
|
||||
EPD_1IN02_SendCommand(0x00);
|
||||
EPD_1IN02_SendData (0x6F); //from outside
|
||||
|
||||
EPD_1IN02_SendCommand(0x01); //power setting
|
||||
EPD_1IN02_SendData (0x03);
|
||||
EPD_1IN02_SendData (0x00);
|
||||
EPD_1IN02_SendData (0x2b);
|
||||
EPD_1IN02_SendData (0x2b);
|
||||
|
||||
EPD_1IN02_SendCommand(0x06); //Configuring the charge pump
|
||||
EPD_1IN02_SendData(0x3f);
|
||||
|
||||
EPD_1IN02_SendCommand(0x2A); //Setting XON and the options of LUT
|
||||
EPD_1IN02_SendData(0x00);
|
||||
EPD_1IN02_SendData(0x00);
|
||||
|
||||
EPD_1IN02_SendCommand(0x30); //Set the clock frequency
|
||||
EPD_1IN02_SendData(0x17);
|
||||
|
||||
EPD_1IN02_SendCommand(0x50); //Set VCOM and data output interval
|
||||
EPD_1IN02_SendData(0xf2);
|
||||
|
||||
EPD_1IN02_SendCommand(0x60); //Set The non-overlapping period of Gate and Source.
|
||||
EPD_1IN02_SendData(0x22);
|
||||
|
||||
EPD_1IN02_SendCommand(0x82); //Set VCOM_DC value
|
||||
EPD_1IN02_SendData(0x12);//-1v
|
||||
|
||||
EPD_1IN02_SendCommand(0xe3);//Set POWER SAVING
|
||||
EPD_1IN02_SendData(0x33);
|
||||
|
||||
EPD_1IN02_SetPartReg();
|
||||
|
||||
EPD_1IN02_SendCommand(0x04);//Set POWER SAVING
|
||||
|
||||
EPD_1IN02_WaitUntilIdle();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
******************************************************************************/
|
||||
void EPD_1IN02_Clear(void)
|
||||
{
|
||||
unsigned int i;
|
||||
EPD_1IN02_SendCommand(0x10);
|
||||
for(i=0;i<1280;i++){
|
||||
EPD_1IN02_SendData(0X00);
|
||||
}
|
||||
EPD_1IN02_SendCommand(0x13); //Transfer new data
|
||||
for(i=0;i<1280;i++){
|
||||
EPD_1IN02_SendData(0xff);
|
||||
}
|
||||
EPD_1IN02_TurnOnDisplay();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
Image :Displayed data
|
||||
******************************************************************************/
|
||||
void EPD_1IN02_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width;
|
||||
Width = (EPD_1IN02_WIDTH % 8 == 0)? (EPD_1IN02_WIDTH / 8 ): (EPD_1IN02_WIDTH / 8 + 1);
|
||||
//EPD_1IN02_Init();
|
||||
EPD_1IN02_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < EPD_1IN02_HEIGHT; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_1IN02_SendData(0xff);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_1IN02_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < EPD_1IN02_HEIGHT; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_1IN02_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_1IN02_TurnOnDisplay();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
old_Image: Last displayed data
|
||||
Image2 : New data
|
||||
******************************************************************************/
|
||||
void EPD_1IN02_DisplayPartial(UBYTE *old_Image, UBYTE *Image)
|
||||
{
|
||||
/* Set partial Windows */
|
||||
EPD_1IN02_SendCommand(0x91); //This command makes the display enter partial mode
|
||||
EPD_1IN02_SendCommand(0x90); //resolution setting
|
||||
EPD_1IN02_SendData(0); //x-start
|
||||
EPD_1IN02_SendData(79); //x-end
|
||||
|
||||
EPD_1IN02_SendData(0);
|
||||
EPD_1IN02_SendData(127); //y-end
|
||||
EPD_1IN02_SendData(0x00);
|
||||
|
||||
UWORD Width;
|
||||
Width = (EPD_1IN02_WIDTH % 8 == 0)? (EPD_1IN02_WIDTH / 8 ): (EPD_1IN02_WIDTH / 8 + 1);
|
||||
|
||||
/* send data */
|
||||
EPD_1IN02_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < EPD_1IN02_HEIGHT; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_1IN02_SendData(old_Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_1IN02_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < EPD_1IN02_HEIGHT; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_1IN02_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set partial refresh */
|
||||
EPD_1IN02_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
******************************************************************************/
|
||||
void EPD_1IN02_Sleep(void)
|
||||
{
|
||||
EPD_1IN02_SendCommand(0X50);
|
||||
EPD_1IN02_SendData(0xf7);
|
||||
EPD_1IN02_SendCommand(0X02); //power off
|
||||
EPD_1IN02_WaitUntilIdle();
|
||||
EPD_1IN02_SendCommand(0X07); //deep sleep
|
||||
EPD_1IN02_SendData(0xA5);
|
||||
|
||||
EPD_Delay_ms(200);
|
||||
printf("Turn off the power!!! \r\n");
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);// Module reset
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
47
Libraries/EPaper/Lib/EPD_1in02d.h
Normal file
47
Libraries/EPaper/Lib/EPD_1in02d.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_1IN02_1in02.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : Electronic paper driver
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-09-27
|
||||
* | 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_1IN02_H_
|
||||
#define _EPD_1IN02_H_
|
||||
|
||||
#include "EPD_Common.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_1IN02_WIDTH 80
|
||||
#define EPD_1IN02_HEIGHT 128
|
||||
|
||||
UBYTE EPD_1IN02_Init(void);
|
||||
void EPD_1IN02_Clear(void);
|
||||
void EPD_1IN02_Display(UBYTE *Image);
|
||||
void EPD_1IN02_DisplayPartial(UBYTE *Image1, UBYTE *Image2);
|
||||
void EPD_1IN02_Sleep(void);
|
||||
void EPD_1IN02_Part_Init(void);
|
||||
#endif
|
||||
|
||||
|
||||
303
Libraries/EPaper/Lib/EPD_1in54.c
Normal file
303
Libraries/EPaper/Lib/EPD_1in54.c
Normal file
@ -0,0 +1,303 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_1IN54
|
||||
|
||||
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)
|
||||
{
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(200);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(2);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_SendCommand(UBYTE Reg)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Reg);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_ReadBusy(void)
|
||||
{
|
||||
EPD_Printf("e-Paper busy\r\n");
|
||||
while(EPD_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
|
||||
EPD_Delay_ms(100);
|
||||
}
|
||||
EPD_Printf("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{
|
||||
EPD_Printf("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);
|
||||
}
|
||||
|
||||
#endif
|
||||
104
Libraries/EPaper/Lib/EPD_1in54.h
Normal file
104
Libraries/EPaper/Lib/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 "EPD_Common.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
|
||||
384
Libraries/EPaper/Lib/EPD_1in54_V2.c
Normal file
384
Libraries/EPaper/Lib/EPD_1in54_V2.c
Normal file
@ -0,0 +1,384 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_1IN54_V2
|
||||
|
||||
// waveform full refresh
|
||||
unsigned char WF_Full_1IN54[159] =
|
||||
{
|
||||
0x80, 0x48, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x40, 0x48, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x80, 0x48, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x40, 0x48, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0xA, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x8, 0x1, 0x0, 0x8, 0x1, 0x0, 0x2,
|
||||
0xA, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, 0x0,
|
||||
0x22, 0x17, 0x41, 0x0, 0x32, 0x20
|
||||
};
|
||||
|
||||
// waveform partial refresh(fast)
|
||||
unsigned char WF_PARTIAL_1IN54_0[159] =
|
||||
{
|
||||
0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x40,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0xF,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x1,0x1,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
|
||||
0x02,0x17,0x41,0xB0,0x32,0x28,
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_V2_Reset(void)
|
||||
{
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(200);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(2);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_V2_SendCommand(UBYTE Reg)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Reg);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_V2_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_V2_ReadBusy(void)
|
||||
{
|
||||
EPD_Printf("e-Paper busy\r\n");
|
||||
while(EPD_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
|
||||
EPD_Delay_ms(10);
|
||||
}
|
||||
EPD_Printf("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(0xc7);
|
||||
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(0xcF);
|
||||
EPD_1IN54_V2_SendCommand(0x20);
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
}
|
||||
|
||||
static void EPD_1IN54_V2_Lut(UBYTE *lut)
|
||||
{
|
||||
EPD_1IN54_V2_SendCommand(0x32);
|
||||
for(UBYTE i=0; i<153; i++)
|
||||
EPD_1IN54_V2_SendData(lut[i]);
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
}
|
||||
|
||||
static void EPD_1IN54_V2_SetLut(UBYTE *lut)
|
||||
{
|
||||
EPD_1IN54_V2_Lut(lut);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x3f);
|
||||
EPD_1IN54_V2_SendData(lut[153]);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x03);
|
||||
EPD_1IN54_V2_SendData(lut[154]);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x04);
|
||||
EPD_1IN54_V2_SendData(lut[155]);
|
||||
EPD_1IN54_V2_SendData(lut[156]);
|
||||
EPD_1IN54_V2_SendData(lut[157]);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x2c);
|
||||
EPD_1IN54_V2_SendData(lut[158]);
|
||||
}
|
||||
|
||||
static void EPD_1IN54_V2_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
EPD_1IN54_V2_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
EPD_1IN54_V2_SendData((Xstart>>3) & 0xFF);
|
||||
EPD_1IN54_V2_SendData((Xend>>3) & 0xFF);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
EPD_1IN54_V2_SendData(Ystart & 0xFF);
|
||||
EPD_1IN54_V2_SendData((Ystart >> 8) & 0xFF);
|
||||
EPD_1IN54_V2_SendData(Yend & 0xFF);
|
||||
EPD_1IN54_V2_SendData((Yend >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
static void EPD_1IN54_V2_SetCursor(UWORD Xstart, UWORD Ystart)
|
||||
{
|
||||
EPD_1IN54_V2_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
EPD_1IN54_V2_SendData(Xstart & 0xFF);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
|
||||
EPD_1IN54_V2_SendData(Ystart & 0xFF);
|
||||
EPD_1IN54_V2_SendData((Ystart >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
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_SetWindows(0, EPD_1IN54_V2_HEIGHT-1, EPD_1IN54_V2_WIDTH-1, 0);
|
||||
|
||||
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_SetCursor(0, EPD_1IN54_V2_HEIGHT-1);
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
|
||||
EPD_1IN54_V2_SetLut(WF_Full_1IN54);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register (Partial display)
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_V2_Init_Partial(void)
|
||||
{
|
||||
EPD_1IN54_V2_Reset();
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
|
||||
EPD_1IN54_V2_SetLut(WF_PARTIAL_1IN54_0);
|
||||
EPD_1IN54_V2_SendCommand(0x37);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x40);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
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(0x80);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x22);
|
||||
EPD_1IN54_V2_SendData(0xc0);
|
||||
EPD_1IN54_V2_SendCommand(0x20);
|
||||
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_SendCommand(0x26);
|
||||
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);
|
||||
EPD_Delay_ms(100);
|
||||
}
|
||||
|
||||
#endif
|
||||
47
Libraries/EPaper/Lib/EPD_1in54_V2.h
Normal file
47
Libraries/EPaper/Lib/EPD_1in54_V2.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*****************************************************************************
|
||||
* | 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 "EPD_Common.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_Init_Partial(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
|
||||
351
Libraries/EPaper/Lib/EPD_1in54b.c
Normal file
351
Libraries/EPaper/Lib/EPD_1in54b.c
Normal file
@ -0,0 +1,351 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_1IN54B
|
||||
|
||||
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)
|
||||
{
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(100);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(2);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(100);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54B_SendCommand(UBYTE Reg)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Reg);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54B_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54B_ReadBusy(void)
|
||||
{
|
||||
EPD_Printf("e-Paper busy\r\n");
|
||||
while(1) {
|
||||
if(EPD_Digital_Read(EPD_BUSY_PIN) == 1)
|
||||
break;
|
||||
}
|
||||
EPD_Delay_ms(200);
|
||||
EPD_Printf("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
|
||||
EPD_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);
|
||||
}
|
||||
}
|
||||
EPD_Delay_ms(2);
|
||||
|
||||
//send red data
|
||||
EPD_1IN54B_SendCommand(0x13);// DATA_START_TRANSMISSION_2
|
||||
EPD_Delay_ms(2);
|
||||
for(UWORD i = 0; i < Height; i++) {
|
||||
for(UWORD i = 0; i < Width; i++) {
|
||||
EPD_1IN54B_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
EPD_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);
|
||||
}
|
||||
}
|
||||
EPD_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]);
|
||||
}
|
||||
}
|
||||
EPD_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();
|
||||
EPD_Delay_ms(1000);
|
||||
|
||||
EPD_1IN54B_SendCommand(0x02);// POWER_OFF
|
||||
}
|
||||
|
||||
#endif
|
||||
108
Libraries/EPaper/Lib/EPD_1in54b.h
Normal file
108
Libraries/EPaper/Lib/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 "EPD_Common.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
|
||||
197
Libraries/EPaper/Lib/EPD_1in54b_V2.c
Normal file
197
Libraries/EPaper/Lib/EPD_1in54b_V2.c
Normal file
@ -0,0 +1,197 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_1in54b_V2.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper b V2
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-02
|
||||
* | 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_1in54b_V2.h"
|
||||
|
||||
#ifdef EPD_1IN54B_V2
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54B_V2_Reset(void)
|
||||
{
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(100);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(2);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(100);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54B_V2_SendCommand(UBYTE Reg)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Reg);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54B_V2_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54B_V2_ReadBusy(void)
|
||||
{
|
||||
EPD_Printf("e-Paper busy\r\n");
|
||||
while(1) {
|
||||
if(EPD_Digital_Read(EPD_BUSY_PIN) == 0)
|
||||
break;
|
||||
}
|
||||
EPD_Delay_ms(200);
|
||||
EPD_Printf("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54B_V2_Init(void)
|
||||
{
|
||||
EPD_1IN54B_V2_Reset();
|
||||
|
||||
EPD_1IN54B_V2_ReadBusy();
|
||||
EPD_1IN54B_V2_SendCommand(0x12); //SWRESET
|
||||
EPD_1IN54B_V2_ReadBusy();
|
||||
|
||||
EPD_1IN54B_V2_SendCommand(0x01); //Driver output control
|
||||
EPD_1IN54B_V2_SendData(0xC7);
|
||||
EPD_1IN54B_V2_SendData(0x00);
|
||||
EPD_1IN54B_V2_SendData(0x01);
|
||||
|
||||
EPD_1IN54B_V2_SendCommand(0x11); //data entry mode
|
||||
EPD_1IN54B_V2_SendData(0x01);
|
||||
|
||||
EPD_1IN54B_V2_SendCommand(0x44); //set Ram-X address start/end position
|
||||
EPD_1IN54B_V2_SendData(0x00);
|
||||
EPD_1IN54B_V2_SendData(0x18); //0x18-->(24+1)*8=200
|
||||
|
||||
EPD_1IN54B_V2_SendCommand(0x45); //set Ram-Y address start/end position
|
||||
EPD_1IN54B_V2_SendData(0xC7); //0xC7-->(199+1)=200
|
||||
EPD_1IN54B_V2_SendData(0x00);
|
||||
EPD_1IN54B_V2_SendData(0x00);
|
||||
EPD_1IN54B_V2_SendData(0x00);
|
||||
|
||||
EPD_1IN54B_V2_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_1IN54B_V2_SendData(0x05);
|
||||
|
||||
EPD_1IN54B_V2_SendCommand(0x18); //Read built-in temperature sensor
|
||||
EPD_1IN54B_V2_SendData(0x80);
|
||||
|
||||
EPD_1IN54B_V2_SendCommand(0x4E); // set RAM x address count to 0;
|
||||
EPD_1IN54B_V2_SendData(0x00);
|
||||
EPD_1IN54B_V2_SendCommand(0x4F); // set RAM y address count to 0X199;
|
||||
EPD_1IN54B_V2_SendData(0xC7);
|
||||
EPD_1IN54B_V2_SendData(0x00);
|
||||
EPD_1IN54B_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54B_V2_Clear(void)
|
||||
{
|
||||
|
||||
unsigned int i;
|
||||
EPD_1IN54B_V2_SendCommand(0x24); //write RAM for black(0)/white (1)
|
||||
for(i=0;i<5000;i++)
|
||||
{
|
||||
EPD_1IN54B_V2_SendData(0xff);
|
||||
}
|
||||
EPD_1IN54B_V2_SendCommand(0x26); //write RAM for black(0)/white (1)
|
||||
for(i=0;i<5000;i++)
|
||||
{
|
||||
EPD_1IN54B_V2_SendData(0x00);
|
||||
}
|
||||
EPD_1IN54B_V2_SendCommand(0x22); //Display Update Control
|
||||
EPD_1IN54B_V2_SendData(0xF7);
|
||||
EPD_1IN54B_V2_SendCommand(0x20); //Activate Display Update Sequence
|
||||
EPD_1IN54B_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54B_V2_Display(const UBYTE *blackimage, const UBYTE *redimage)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_1IN54B_V2_WIDTH % 8 == 0)? (EPD_1IN54B_V2_WIDTH / 8 ): (EPD_1IN54B_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_1IN54B_V2_HEIGHT;
|
||||
|
||||
unsigned int i;
|
||||
EPD_1IN54B_V2_SendCommand(0x24); //write RAM for black(0)/white (1)
|
||||
for(i=0;i<Width * Height;i++)
|
||||
{
|
||||
EPD_1IN54B_V2_SendData(blackimage[i]);
|
||||
}
|
||||
EPD_1IN54B_V2_SendCommand(0x26); //write RAM for black(0)/white (1)
|
||||
for(i=0;i<Width * Height;i++)
|
||||
{
|
||||
EPD_1IN54B_V2_SendData(~redimage[i]);
|
||||
}
|
||||
EPD_1IN54B_V2_SendCommand(0x22); //Display Update Control
|
||||
EPD_1IN54B_V2_SendData(0xF7);
|
||||
EPD_1IN54B_V2_SendCommand(0x20); //Activate Display Update Sequence
|
||||
EPD_1IN54B_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54B_V2_Sleep(void)
|
||||
{
|
||||
EPD_1IN54B_V2_SendCommand(0x10); //enter deep sleep
|
||||
EPD_1IN54B_V2_SendData(0x01);
|
||||
EPD_Delay_ms(100);
|
||||
}
|
||||
|
||||
#endif
|
||||
45
Libraries/EPaper/Lib/EPD_1in54b_V2.h
Normal file
45
Libraries/EPaper/Lib/EPD_1in54b_V2.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_1in54b_V2.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper b V2
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-02
|
||||
* | 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_1IN54B_V2_H_
|
||||
#define __EPD_1IN54B_V2_H_
|
||||
|
||||
#include "EPD_Common.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_1IN54B_V2_WIDTH 200
|
||||
#define EPD_1IN54B_V2_HEIGHT 200
|
||||
|
||||
void EPD_1IN54B_V2_Init(void);
|
||||
void EPD_1IN54B_V2_Clear(void);
|
||||
void EPD_1IN54B_V2_Display(const UBYTE *blackimage, const UBYTE *redimage);
|
||||
void EPD_1IN54B_V2_Sleep(void);
|
||||
|
||||
#endif
|
||||
243
Libraries/EPaper/Lib/EPD_1in54c.c
Normal file
243
Libraries/EPaper/Lib/EPD_1in54c.c
Normal file
@ -0,0 +1,243 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_1IN54C
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54C_Reset(void)
|
||||
{
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(100);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(2);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(100);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54C_SendCommand(UBYTE Reg)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Reg);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54C_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_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 = EPD_Digital_Read(EPD_BUSY_PIN);
|
||||
busy =!(busy & 0x01);
|
||||
} while(busy);
|
||||
EPD_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<54><50>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);
|
||||
}
|
||||
|
||||
#endif
|
||||
95
Libraries/EPaper/Lib/EPD_1in54c.h
Normal file
95
Libraries/EPaper/Lib/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 "EPD_Common.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
|
||||
235
Libraries/EPaper/Lib/EPD_1in64g.c
Normal file
235
Libraries/EPaper/Lib/EPD_1in64g.c
Normal file
@ -0,0 +1,235 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_1in64_g.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.64inchg e-paper (G)
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-07-22
|
||||
* | 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_1in64g.h"
|
||||
|
||||
#ifdef EPD_1IN64G
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN64G_Reset(void)
|
||||
{
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(20);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(1);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(20);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_1IN64G_SendCommand(UBYTE Reg)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Reg);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_1IN64G_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN64G_ReadBusyH(void)
|
||||
{
|
||||
EPD_Printf("e-Paper busy H\r\n");
|
||||
while(!EPD_Digital_Read(EPD_BUSY_PIN)) { //LOW: idle, HIGH: busy
|
||||
EPD_Delay_ms(5);
|
||||
}
|
||||
EPD_Printf("e-Paper busy H release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN64G_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_1IN64G_SendCommand(0x12); // DISPLAY_REFRESH
|
||||
EPD_1IN64G_SendData(0x01);
|
||||
EPD_1IN64G_ReadBusyH();
|
||||
|
||||
EPD_1IN64G_SendCommand(0x02); // POWER_OFF
|
||||
EPD_1IN64G_SendData(0X00);
|
||||
EPD_1IN64G_ReadBusyH();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN64G_Init(void)
|
||||
{
|
||||
EPD_1IN64G_Reset();
|
||||
|
||||
EPD_1IN64G_SendCommand(0x66);
|
||||
EPD_1IN64G_SendData(0x49);
|
||||
EPD_1IN64G_SendData(0x55);
|
||||
EPD_1IN64G_SendData(0x13);
|
||||
EPD_1IN64G_SendData(0x5D);
|
||||
|
||||
EPD_1IN64G_SendCommand(0x66);
|
||||
EPD_1IN64G_SendData(0x49);
|
||||
EPD_1IN64G_SendData(0x55);
|
||||
|
||||
EPD_1IN64G_SendCommand(0xB0);
|
||||
EPD_1IN64G_SendData(0x03);//1 boost 20211113
|
||||
|
||||
|
||||
EPD_1IN64G_SendCommand(0x00);
|
||||
EPD_1IN64G_SendData(0x4F);
|
||||
EPD_1IN64G_SendData(0x6B);
|
||||
|
||||
EPD_1IN64G_SendCommand(0x03);
|
||||
EPD_1IN64G_SendData(0x00);
|
||||
|
||||
EPD_1IN64G_SendCommand(0xF0);
|
||||
EPD_1IN64G_SendData(0xF6);
|
||||
EPD_1IN64G_SendData(0x0D);
|
||||
EPD_1IN64G_SendData(0x00);
|
||||
EPD_1IN64G_SendData(0x00);
|
||||
EPD_1IN64G_SendData(0x00);
|
||||
|
||||
//20220303
|
||||
EPD_1IN64G_SendCommand(0x06);
|
||||
EPD_1IN64G_SendData(0xCF);
|
||||
EPD_1IN64G_SendData(0xDF);
|
||||
EPD_1IN64G_SendData(0x0F);
|
||||
|
||||
EPD_1IN64G_SendCommand(0x41);
|
||||
EPD_1IN64G_SendData(0x00);
|
||||
|
||||
EPD_1IN64G_SendCommand(0x50);
|
||||
EPD_1IN64G_SendData(0x30);
|
||||
|
||||
EPD_1IN64G_SendCommand(0x60);
|
||||
EPD_1IN64G_SendData(0x0C);
|
||||
EPD_1IN64G_SendData(0x05);
|
||||
|
||||
EPD_1IN64G_SendCommand(0x61);
|
||||
EPD_1IN64G_SendData(0xA8);
|
||||
EPD_1IN64G_SendData(0x00);
|
||||
EPD_1IN64G_SendData(0xA8);
|
||||
|
||||
EPD_1IN64G_SendCommand(0x84);
|
||||
EPD_1IN64G_SendData(0x01);
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN64G_Clear(UBYTE color)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_1IN64G_WIDTH % 4 == 0)? (EPD_1IN64G_WIDTH / 4 ): (EPD_1IN64G_WIDTH / 4 + 1);
|
||||
Height = EPD_1IN64G_HEIGHT;
|
||||
|
||||
EPD_1IN64G_SendCommand(0x68);
|
||||
EPD_1IN64G_SendData(0x01);
|
||||
|
||||
EPD_1IN64G_SendCommand(0x04);
|
||||
EPD_1IN64G_ReadBusyH();
|
||||
|
||||
EPD_1IN64G_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_1IN64G_SendData((color << 6) | (color << 4) | (color << 2) | color);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_1IN64G_SendCommand(0x68);
|
||||
EPD_1IN64G_SendData(0x00);
|
||||
|
||||
EPD_1IN64G_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN64G_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_1IN64G_WIDTH % 4 == 0)? (EPD_1IN64G_WIDTH / 4 ): (EPD_1IN64G_WIDTH / 4 + 1);
|
||||
Height = EPD_1IN64G_HEIGHT;
|
||||
|
||||
EPD_1IN64G_SendCommand(0x68);
|
||||
EPD_1IN64G_SendData(0x01);
|
||||
|
||||
EPD_1IN64G_SendCommand(0x04);
|
||||
EPD_1IN64G_ReadBusyH();
|
||||
|
||||
EPD_1IN64G_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_1IN64G_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_1IN64G_SendCommand(0x68);
|
||||
EPD_1IN64G_SendData(0x00);
|
||||
|
||||
EPD_1IN64G_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN64G_Sleep(void)
|
||||
{
|
||||
EPD_1IN64G_SendCommand(0x02); // POWER_OFF
|
||||
EPD_1IN64G_SendData(0X00);
|
||||
EPD_1IN64G_SendCommand(0x07); // DEEP_SLEEP
|
||||
EPD_1IN64G_SendData(0XA5);
|
||||
}
|
||||
|
||||
#endif
|
||||
32
Libraries/EPaper/Lib/EPD_1in64g.h
Normal file
32
Libraries/EPaper/Lib/EPD_1in64g.h
Normal file
@ -0,0 +1,32 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_1in64g.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.64inch e-paper (G)
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-07-14
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
******************************************************************************/
|
||||
#ifndef __EPD_1IN64G_H_
|
||||
#define __EPD_1IN64G_H_
|
||||
|
||||
#include "EPD_Common.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_1IN64G_WIDTH 168
|
||||
#define EPD_1IN64G_HEIGHT 168
|
||||
|
||||
// Color
|
||||
#define EPD_1IN64G_BLACK 0x0
|
||||
#define EPD_1IN64G_WHITE 0x1
|
||||
#define EPD_1IN64G_YELLOW 0x2
|
||||
#define EPD_1IN64G_RED 0x3
|
||||
|
||||
void EPD_1IN64G_Init(void);
|
||||
void EPD_1IN64G_Clear(UBYTE color);
|
||||
void EPD_1IN64G_Display(UBYTE *Image);
|
||||
void EPD_1IN64G_Sleep(void);
|
||||
|
||||
#endif
|
||||
258
Libraries/EPaper/Lib/EPD_2in13.c
Normal file
258
Libraries/EPaper/Lib/EPD_2in13.c
Normal file
@ -0,0 +1,258 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_2IN13
|
||||
|
||||
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)
|
||||
{
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(200);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(2);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_SendCommand(UBYTE Reg)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Reg);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_ReadBusy(void)
|
||||
{
|
||||
EPD_Printf("e-Paper busy\r\n");
|
||||
while(EPD_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
|
||||
EPD_Delay_ms(100);
|
||||
}
|
||||
EPD_Printf("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 {
|
||||
EPD_Printf("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);
|
||||
}
|
||||
|
||||
#endif
|
||||
68
Libraries/EPaper/Lib/EPD_2in13.h
Normal file
68
Libraries/EPaper/Lib/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 "EPD_Common.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
|
||||
367
Libraries/EPaper/Lib/EPD_2in13_V2.c
Normal file
367
Libraries/EPaper/Lib/EPD_2in13_V2.c
Normal file
@ -0,0 +1,367 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_2IN13_V2
|
||||
|
||||
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)
|
||||
{
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(200);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(2);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_V2_SendCommand(UBYTE Reg)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Reg);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_V2_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_V2_ReadBusy(void)
|
||||
{
|
||||
EPD_Printf("e-Paper busy\r\n");
|
||||
while(EPD_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
|
||||
EPD_Delay_ms(100);
|
||||
}
|
||||
EPD_Printf("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 {
|
||||
EPD_Printf("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);
|
||||
EPD_Delay_ms(100);
|
||||
}
|
||||
|
||||
#endif
|
||||
72
Libraries/EPaper/Lib/EPD_2in13_V2.h
Normal file
72
Libraries/EPaper/Lib/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 "EPD_Common.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
|
||||
399
Libraries/EPaper/Lib/EPD_2in13_V3.c
Normal file
399
Libraries/EPaper/Lib/EPD_2in13_V3.c
Normal file
@ -0,0 +1,399 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2in13_V3.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper V3
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.1
|
||||
* | Date : 2021-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 "EPD_2in13_V3.h"
|
||||
|
||||
#ifdef EPD_2IN13_V3
|
||||
|
||||
UBYTE WF_PARTIAL_2IN13_V3[159] =
|
||||
{
|
||||
0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x40,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x14,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
|
||||
0x22,0x17,0x41,0x00,0x32,0x36,
|
||||
};
|
||||
|
||||
UBYTE WS_20_30_2IN13_V3[159] =
|
||||
{
|
||||
0x80, 0x4A, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x40, 0x4A, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x80, 0x4A, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x40, 0x4A, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0xF, 0x0, 0x0, 0xF, 0x0, 0x0, 0x2,
|
||||
0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, 0x0,
|
||||
0x22, 0x17, 0x41, 0x0, 0x32, 0x36
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2in13_V3_Reset(void)
|
||||
{
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(20);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(2);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(20);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2in13_V3_SendCommand(UBYTE Reg)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Reg);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2in13_V3_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2in13_V3_ReadBusy(void)
|
||||
{
|
||||
EPD_Printf("e-Paper busy\r\n");
|
||||
while(1)
|
||||
{ //=1 BUSY
|
||||
if(EPD_Digital_Read(EPD_BUSY_PIN)==0)
|
||||
break;
|
||||
EPD_Delay_ms(10);
|
||||
}
|
||||
EPD_Delay_ms(10);
|
||||
EPD_Printf("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2in13_V3_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2in13_V3_SendCommand(0x22); // Display Update Control
|
||||
EPD_2in13_V3_SendData(0xc7);
|
||||
EPD_2in13_V3_SendCommand(0x20); // Activate Display Update Sequence
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2in13_V3_TurnOnDisplay_Partial(void)
|
||||
{
|
||||
EPD_2in13_V3_SendCommand(0x22); // Display Update Control
|
||||
EPD_2in13_V3_SendData(0x0f); // fast:0x0c, quality:0x0f, 0xcf
|
||||
EPD_2in13_V3_SendCommand(0x20); // Activate Display Update Sequence
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Set lut
|
||||
parameter:
|
||||
lut : lut data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_V3_LUT(UBYTE *lut)
|
||||
{
|
||||
UBYTE count;
|
||||
EPD_2in13_V3_SendCommand(0x32);
|
||||
for(count=0; count<153; count++)
|
||||
EPD_2in13_V3_SendData(lut[count]);
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Send lut data and configuration
|
||||
parameter:
|
||||
lut : lut data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_V2_LUT_by_host(UBYTE *lut)
|
||||
{
|
||||
EPD_2IN13_V3_LUT((UBYTE *)lut); //lut
|
||||
EPD_2in13_V3_SendCommand(0x3f);
|
||||
EPD_2in13_V3_SendData(*(lut+153));
|
||||
EPD_2in13_V3_SendCommand(0x03); // gate voltage
|
||||
EPD_2in13_V3_SendData(*(lut+154));
|
||||
EPD_2in13_V3_SendCommand(0x04); // source voltage
|
||||
EPD_2in13_V3_SendData(*(lut+155)); // VSH
|
||||
EPD_2in13_V3_SendData(*(lut+156)); // VSH2
|
||||
EPD_2in13_V3_SendData(*(lut+157)); // VSL
|
||||
EPD_2in13_V3_SendCommand(0x2c); // VCOM
|
||||
EPD_2in13_V3_SendData(*(lut+158));
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Setting the display window
|
||||
parameter:
|
||||
Xstart : X-axis starting position
|
||||
Ystart : Y-axis starting position
|
||||
Xend : End position of X-axis
|
||||
Yend : End position of Y-axis
|
||||
******************************************************************************/
|
||||
static void EPD_2in13_V3_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
EPD_2in13_V3_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
EPD_2in13_V3_SendData((Xstart>>3) & 0xFF);
|
||||
EPD_2in13_V3_SendData((Xend>>3) & 0xFF);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
EPD_2in13_V3_SendData(Ystart & 0xFF);
|
||||
EPD_2in13_V3_SendData((Ystart >> 8) & 0xFF);
|
||||
EPD_2in13_V3_SendData(Yend & 0xFF);
|
||||
EPD_2in13_V3_SendData((Yend >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Set Cursor
|
||||
parameter:
|
||||
Xstart : X-axis starting position
|
||||
Ystart : Y-axis starting position
|
||||
******************************************************************************/
|
||||
static void EPD_2in13_V3_SetCursor(UWORD Xstart, UWORD Ystart)
|
||||
{
|
||||
EPD_2in13_V3_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
EPD_2in13_V3_SendData(Xstart & 0xFF);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
|
||||
EPD_2in13_V3_SendData(Ystart & 0xFF);
|
||||
EPD_2in13_V3_SendData((Ystart >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2in13_V3_Init(void)
|
||||
{
|
||||
EPD_2in13_V3_Reset();
|
||||
EPD_Delay_ms(100);
|
||||
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
EPD_2in13_V3_SendCommand(0x12); //SWRESET
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x01); //Driver output control
|
||||
EPD_2in13_V3_SendData(0xf9);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x11); //data entry mode
|
||||
EPD_2in13_V3_SendData(0x03);
|
||||
|
||||
EPD_2in13_V3_SetWindows(0, 0, EPD_2in13_V3_WIDTH-1, EPD_2in13_V3_HEIGHT-1);
|
||||
EPD_2in13_V3_SetCursor(0, 0);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_2in13_V3_SendData(0x05);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x21); // Display update control
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x80);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x18); //Read built-in temperature sensor
|
||||
EPD_2in13_V3_SendData(0x80);
|
||||
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
EPD_2IN13_V2_LUT_by_host(WS_20_30_2IN13_V3);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2in13_V3_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1);
|
||||
Height = EPD_2in13_V3_HEIGHT;
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2in13_V3_SendData(0XFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2in13_V3_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
image : Image data
|
||||
******************************************************************************/
|
||||
void EPD_2in13_V3_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1);
|
||||
Height = EPD_2in13_V3_HEIGHT;
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2in13_V3_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2in13_V3_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Refresh a base image
|
||||
parameter:
|
||||
image : Image data
|
||||
******************************************************************************/
|
||||
void EPD_2in13_V3_Display_Base(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1);
|
||||
Height = EPD_2in13_V3_HEIGHT;
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x24); //Write Black and White image to RAM
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2in13_V3_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2in13_V3_SendCommand(0x26); //Write Black and White image to RAM
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2in13_V3_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2in13_V3_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and partial refresh
|
||||
parameter:
|
||||
image : Image data
|
||||
******************************************************************************/
|
||||
void EPD_2in13_V3_Display_Partial(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1);
|
||||
Height = EPD_2in13_V3_HEIGHT;
|
||||
|
||||
//Reset
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(1);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
|
||||
EPD_2IN13_V2_LUT_by_host(WF_PARTIAL_2IN13_V3);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x37);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x40); ///RAM Ping-Pong enable
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_2in13_V3_SendData(0x80);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x22); //Display Update Sequence Option
|
||||
EPD_2in13_V3_SendData(0xC0); // Enable clock and Enable analog
|
||||
EPD_2in13_V3_SendCommand(0x20); //Activate Display Update Sequence
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
|
||||
EPD_2in13_V3_SetWindows(0, 0, EPD_2in13_V3_WIDTH-1, EPD_2in13_V3_HEIGHT-1);
|
||||
EPD_2in13_V3_SetCursor(0, 0);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x24); //Write Black and White image to RAM
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2in13_V3_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2in13_V3_TurnOnDisplay_Partial();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2in13_V3_Sleep(void)
|
||||
{
|
||||
EPD_2in13_V3_SendCommand(0x10); //enter deep sleep
|
||||
EPD_2in13_V3_SendData(0x01);
|
||||
EPD_Delay_ms(100);
|
||||
}
|
||||
|
||||
#endif
|
||||
47
Libraries/EPaper/Lib/EPD_2in13_V3.h
Normal file
47
Libraries/EPaper/Lib/EPD_2in13_V3.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2Iin13_V3.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper V3
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.1
|
||||
* | Date : 2021-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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#ifndef __EPD_2in13_V3_H_
|
||||
#define __EPD_2in13_V3_H_
|
||||
|
||||
#include "EPD_Common.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2in13_V3_WIDTH 122
|
||||
#define EPD_2in13_V3_HEIGHT 250
|
||||
|
||||
void EPD_2in13_V3_Init(void);
|
||||
void EPD_2in13_V3_Clear(void);
|
||||
void EPD_2in13_V3_Display(UBYTE *Image);
|
||||
void EPD_2in13_V3_Display_Base(UBYTE *Image);
|
||||
void EPD_2in13_V3_Display_Partial(UBYTE *Image);
|
||||
void EPD_2in13_V3_Sleep(void);
|
||||
|
||||
#endif
|
||||
200
Libraries/EPaper/Lib/EPD_2in13b_V3.c
Normal file
200
Libraries/EPaper/Lib/EPD_2in13b_V3.c
Normal file
@ -0,0 +1,200 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2in13b_V3.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper b V3
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-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_2in13b_V3.h"
|
||||
|
||||
#ifdef EPD_2IN13B_V3
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13B_V3_Reset(void)
|
||||
{
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(100);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(2);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(10);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13B_V3_SendCommand(UBYTE Reg)
|
||||
{
|
||||
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Reg);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13B_V3_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13B_V3_ReadBusy(void)
|
||||
{
|
||||
UBYTE busy;
|
||||
EPD_Printf("e-Paper busy\r\n");
|
||||
do{
|
||||
EPD_2IN13B_V3_SendCommand(0x71);
|
||||
busy = EPD_Digital_Read(EPD_BUSY_PIN);
|
||||
busy =!(busy & 0x01);
|
||||
}while(busy);
|
||||
EPD_Printf("e-Paper busy release\r\n");
|
||||
EPD_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13B_V3_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN13B_V3_SendCommand(0x12); //DISPLAY REFRESH
|
||||
EPD_Delay_ms(100);
|
||||
EPD_2IN13B_V3_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13B_V3_Init(void)
|
||||
{
|
||||
EPD_2IN13B_V3_Reset();
|
||||
EPD_Delay_ms(10);
|
||||
|
||||
EPD_2IN13B_V3_SendCommand(0x04);
|
||||
EPD_2IN13B_V3_ReadBusy();//waiting for the electronic paper IC to release the idle signal
|
||||
|
||||
EPD_2IN13B_V3_SendCommand(0x00);//panel setting
|
||||
EPD_2IN13B_V3_SendData(0x0f);//LUT from OTP,128x296
|
||||
EPD_2IN13B_V3_SendData(0x89);//Temperature sensor, boost and other related timing settings
|
||||
|
||||
EPD_2IN13B_V3_SendCommand(0x61);//resolution setting
|
||||
EPD_2IN13B_V3_SendData (0x68);
|
||||
EPD_2IN13B_V3_SendData (0x00);
|
||||
EPD_2IN13B_V3_SendData (0xD4);
|
||||
|
||||
EPD_2IN13B_V3_SendCommand(0X50);//VCOM AND DATA INTERVAL SETTING
|
||||
EPD_2IN13B_V3_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_2IN13B_V3_Clear(void)
|
||||
{
|
||||
UWORD Width = (EPD_2IN13B_V3_WIDTH % 8 == 0)? (EPD_2IN13B_V3_WIDTH / 8 ): (EPD_2IN13B_V3_WIDTH / 8 + 1);
|
||||
UWORD Height = EPD_2IN13B_V3_HEIGHT;
|
||||
|
||||
//send black data
|
||||
EPD_2IN13B_V3_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13B_V3_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
//send red data
|
||||
EPD_2IN13B_V3_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13B_V3_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
EPD_2IN13B_V3_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13B_V3_Display(const UBYTE *blackimage, const UBYTE *ryimage)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN13B_V3_WIDTH % 8 == 0)? (EPD_2IN13B_V3_WIDTH / 8 ): (EPD_2IN13B_V3_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN13B_V3_HEIGHT;
|
||||
|
||||
EPD_2IN13B_V3_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13B_V3_SendData(blackimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN13B_V3_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13B_V3_SendData(ryimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2IN13B_V3_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13B_V3_Sleep(void)
|
||||
{
|
||||
EPD_2IN13B_V3_SendCommand(0X50);
|
||||
EPD_2IN13B_V3_SendData(0xf7);
|
||||
|
||||
EPD_2IN13B_V3_SendCommand(0X02); //power off
|
||||
EPD_2IN13B_V3_ReadBusy(); //waiting for the electronic paper IC to release the idle signal
|
||||
EPD_2IN13B_V3_SendCommand(0X07); //deep sleep
|
||||
EPD_2IN13B_V3_SendData(0xA5);
|
||||
}
|
||||
|
||||
#endif
|
||||
45
Libraries/EPaper/Lib/EPD_2in13b_V3.h
Normal file
45
Libraries/EPaper/Lib/EPD_2in13b_V3.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2in13b_V3.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper b V3
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#ifndef __EPD_2IN13B_V3_H_
|
||||
#define __EPD_2IN13B_V3_H_
|
||||
|
||||
#include "EPD_Common.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN13B_V3_WIDTH 104
|
||||
#define EPD_2IN13B_V3_HEIGHT 212
|
||||
|
||||
void EPD_2IN13B_V3_Init(void);
|
||||
void EPD_2IN13B_V3_Clear(void);
|
||||
void EPD_2IN13B_V3_Display(const UBYTE *blackimage, const UBYTE *ryimage);
|
||||
void EPD_2IN13B_V3_Sleep(void);
|
||||
|
||||
#endif
|
||||
231
Libraries/EPaper/Lib/EPD_2in13b_V4.c
Normal file
231
Libraries/EPaper/Lib/EPD_2in13b_V4.c
Normal file
@ -0,0 +1,231 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2IN13b_V4.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper B V4
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-04-25
|
||||
* | 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_2in13b_V4.h"
|
||||
|
||||
#ifdef EPD_2IN13B_V4
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13B_V4_Reset(void)
|
||||
{
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(20);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(2);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(20);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13B_V4_SendCommand(UBYTE Reg)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Reg);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13B_V4_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13B_V4_ReadBusy(void)
|
||||
{
|
||||
EPD_Printf("e-Paper busy\r\n");
|
||||
while(1)
|
||||
{ //=1 BUSY
|
||||
if(EPD_Digital_Read(EPD_BUSY_PIN)==0)
|
||||
break;
|
||||
EPD_Delay_ms(20);
|
||||
}
|
||||
EPD_Delay_ms(20);
|
||||
EPD_Printf("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13B_V4_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN13B_V4_SendCommand(0x20); // Activate Display Update Sequence
|
||||
EPD_2IN13B_V4_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Setting the display window
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13B_V4_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
EPD_2IN13B_V4_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
EPD_2IN13B_V4_SendData((Xstart>>3) & 0xFF);
|
||||
EPD_2IN13B_V4_SendData((Xend>>3) & 0xFF);
|
||||
|
||||
EPD_2IN13B_V4_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
EPD_2IN13B_V4_SendData(Ystart & 0xFF);
|
||||
EPD_2IN13B_V4_SendData((Ystart >> 8) & 0xFF);
|
||||
EPD_2IN13B_V4_SendData(Yend & 0xFF);
|
||||
EPD_2IN13B_V4_SendData((Yend >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Set Cursor
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13B_V4_SetCursor(UWORD Xstart, UWORD Ystart)
|
||||
{
|
||||
EPD_2IN13B_V4_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
EPD_2IN13B_V4_SendData(Xstart & 0xFF);
|
||||
|
||||
EPD_2IN13B_V4_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
|
||||
EPD_2IN13B_V4_SendData(Ystart & 0xFF);
|
||||
EPD_2IN13B_V4_SendData((Ystart >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13B_V4_Init(void)
|
||||
{
|
||||
EPD_2IN13B_V4_Reset();
|
||||
|
||||
EPD_2IN13B_V4_ReadBusy();
|
||||
EPD_2IN13B_V4_SendCommand(0x12); //SWRESET
|
||||
EPD_2IN13B_V4_ReadBusy();
|
||||
|
||||
EPD_2IN13B_V4_SendCommand(0x01); //Driver output control
|
||||
EPD_2IN13B_V4_SendData(0xf9);
|
||||
EPD_2IN13B_V4_SendData(0x00);
|
||||
EPD_2IN13B_V4_SendData(0x00);
|
||||
|
||||
EPD_2IN13B_V4_SendCommand(0x11); //data entry mode
|
||||
EPD_2IN13B_V4_SendData(0x03);
|
||||
|
||||
EPD_2IN13B_V4_SetWindows(0, 0, EPD_2IN13B_V4_WIDTH-1, EPD_2IN13B_V4_HEIGHT-1);
|
||||
EPD_2IN13B_V4_SetCursor(0, 0);
|
||||
|
||||
EPD_2IN13B_V4_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_2IN13B_V4_SendData(0x05);
|
||||
|
||||
EPD_2IN13B_V4_SendCommand(0x18); //Read built-in temperature sensor
|
||||
EPD_2IN13B_V4_SendData(0x80);
|
||||
|
||||
EPD_2IN13B_V4_SendCommand(0x21); // Display update control
|
||||
EPD_2IN13B_V4_SendData(0x80);
|
||||
EPD_2IN13B_V4_SendData(0x80);
|
||||
|
||||
EPD_2IN13B_V4_ReadBusy();
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13B_V4_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN13B_V4_WIDTH % 8 == 0)? (EPD_2IN13B_V4_WIDTH / 8 ): (EPD_2IN13B_V4_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN13B_V4_HEIGHT;
|
||||
|
||||
EPD_2IN13B_V4_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13B_V4_SendData(0XFF);
|
||||
}
|
||||
}
|
||||
EPD_2IN13B_V4_SendCommand(0x26);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13B_V4_SendData(0XFF);
|
||||
}
|
||||
}
|
||||
EPD_2IN13B_V4_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13B_V4_Display(const UBYTE *blackImage, const UBYTE *redImage)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN13B_V4_WIDTH % 8 == 0)? (EPD_2IN13B_V4_WIDTH / 8 ): (EPD_2IN13B_V4_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN13B_V4_HEIGHT;
|
||||
|
||||
EPD_2IN13B_V4_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13B_V4_SendData(blackImage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2IN13B_V4_SendCommand(0x26);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13B_V4_SendData(redImage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2IN13B_V4_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13B_V4_Sleep(void)
|
||||
{
|
||||
EPD_2IN13B_V4_SendCommand(0x10); //enter deep sleep
|
||||
EPD_2IN13B_V4_SendData(0x01);
|
||||
EPD_Delay_ms(100);
|
||||
}
|
||||
|
||||
#endif
|
||||
45
Libraries/EPaper/Lib/EPD_2in13b_V4.h
Normal file
45
Libraries/EPaper/Lib/EPD_2in13b_V4.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2in13b_V4.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper B V4
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-04-25
|
||||
* | 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_2IN13B_V4_H_
|
||||
#define __EPD_2IN13B_V4_H_
|
||||
|
||||
#include "EPD_Common.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN13B_V4_WIDTH 122
|
||||
#define EPD_2IN13B_V4_HEIGHT 250
|
||||
|
||||
void EPD_2IN13B_V4_Init(void);
|
||||
void EPD_2IN13B_V4_Clear(void);
|
||||
void EPD_2IN13B_V4_Display(const UBYTE *blackImage, const UBYTE *redImage);
|
||||
void EPD_2IN13B_V4_Sleep(void);
|
||||
|
||||
#endif
|
||||
250
Libraries/EPaper/Lib/EPD_2in13bc.c
Normal file
250
Libraries/EPaper/Lib/EPD_2in13bc.c
Normal file
@ -0,0 +1,250 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_2IN13BC
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13BC_Reset(void)
|
||||
{
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(200);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(2);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13BC_SendCommand(UBYTE Reg)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Reg);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13BC_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13BC_ReadBusy(void)
|
||||
{
|
||||
EPD_Printf("e-Paper busy\r\n");
|
||||
while(EPD_Digital_Read(EPD_BUSY_PIN) == 0) {
|
||||
EPD_Delay_ms(100);
|
||||
}
|
||||
EPD_Printf("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13BC_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN13BC_SendCommand(0x12); //DISPLAY REFRESH
|
||||
EPD_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
|
||||
}
|
||||
|
||||
#endif
|
||||
97
Libraries/EPaper/Lib/EPD_2in13bc.h
Normal file
97
Libraries/EPaper/Lib/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 "EPD_Common.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
|
||||
464
Libraries/EPaper/Lib/EPD_2in13d.c
Normal file
464
Libraries/EPaper/Lib/EPD_2in13d.c
Normal file
@ -0,0 +1,464 @@
|
||||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
#ifdef EPD_2IN13D
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(200);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(2);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13D_SendCommand(UBYTE Reg)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Reg);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13D_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13D_ReadBusy(void)
|
||||
{
|
||||
EPD_Printf("e-Paper busy\r\n");
|
||||
UBYTE busy;
|
||||
do {
|
||||
EPD_2IN13D_SendCommand(0x71);
|
||||
busy = EPD_Digital_Read(EPD_BUSY_PIN);
|
||||
busy =!(busy & 0x01);
|
||||
} while(busy);
|
||||
EPD_Delay_ms(200);
|
||||
EPD_Printf("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
|
||||
EPD_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);
|
||||
}
|
||||
|
||||
#endif
|
||||
78
Libraries/EPaper/Lib/EPD_2in13d.h
Normal file
78
Libraries/EPaper/Lib/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 "EPD_Common.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
|
||||
232
Libraries/EPaper/Lib/EPD_2in36g.c
Normal file
232
Libraries/EPaper/Lib/EPD_2in36g.c
Normal file
@ -0,0 +1,232 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2in36g.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.36inch e-Paper (G)
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-08-17
|
||||
* | 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_2in36g.h"
|
||||
|
||||
#ifdef EPD_2IN36G
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN36G_Reset(void)
|
||||
{
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(20);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(2);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(20);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN36G_SendCommand(UBYTE Reg)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Reg);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN36G_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN36G_ReadBusyH(void)
|
||||
{
|
||||
EPD_Printf("e-Paper busy H\r\n");
|
||||
while(!EPD_Digital_Read(EPD_BUSY_PIN)) { //LOW: idle, HIGH: busy
|
||||
EPD_Delay_ms(5);
|
||||
}
|
||||
EPD_Printf("e-Paper busy H release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN36G_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN36G_SendCommand(0x12); // DISPLAY_REFRESH
|
||||
EPD_2IN36G_SendData(0x01);
|
||||
EPD_2IN36G_ReadBusyH();
|
||||
|
||||
EPD_2IN36G_SendCommand(0x02); // POWER_OFF
|
||||
EPD_2IN36G_SendData(0X00);
|
||||
EPD_2IN36G_ReadBusyH();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN36G_Init(void)
|
||||
{
|
||||
EPD_2IN36G_Reset();
|
||||
|
||||
EPD_2IN36G_SendCommand(0x66);
|
||||
EPD_2IN36G_SendData(0x49);
|
||||
EPD_2IN36G_SendData(0x55);
|
||||
EPD_2IN36G_SendData(0x13);
|
||||
EPD_2IN36G_SendData(0x5D);
|
||||
|
||||
EPD_2IN36G_SendCommand(0x66);
|
||||
EPD_2IN36G_SendData(0x49);
|
||||
EPD_2IN36G_SendData(0x55);
|
||||
|
||||
EPD_2IN36G_SendCommand(0xB0);
|
||||
EPD_2IN36G_SendData(0x03);//1 boost 20211113
|
||||
|
||||
EPD_2IN36G_SendCommand(0x00);
|
||||
EPD_2IN36G_SendData(0x4F);
|
||||
EPD_2IN36G_SendData(0x69);
|
||||
|
||||
EPD_2IN36G_SendCommand(0x03);
|
||||
EPD_2IN36G_SendData(0x00);
|
||||
|
||||
EPD_2IN36G_SendCommand(0xF0);
|
||||
EPD_2IN36G_SendData(0xF6);
|
||||
EPD_2IN36G_SendData(0x0D);
|
||||
EPD_2IN36G_SendData(0x00);
|
||||
EPD_2IN36G_SendData(0x00);
|
||||
EPD_2IN36G_SendData(0x00);
|
||||
|
||||
EPD_2IN36G_SendCommand(0x06); //20211113
|
||||
EPD_2IN36G_SendData(0xCF);
|
||||
EPD_2IN36G_SendData(0xDE);
|
||||
EPD_2IN36G_SendData(0x0F);
|
||||
|
||||
EPD_2IN36G_SendCommand(0x41);
|
||||
EPD_2IN36G_SendData(0x00);
|
||||
|
||||
EPD_2IN36G_SendCommand(0x50);
|
||||
EPD_2IN36G_SendData(0x30);
|
||||
|
||||
EPD_2IN36G_SendCommand(0x60);
|
||||
EPD_2IN36G_SendData(0x0C);
|
||||
EPD_2IN36G_SendData(0x05);
|
||||
|
||||
EPD_2IN36G_SendCommand(0x61);
|
||||
EPD_2IN36G_SendData(0xA8);
|
||||
EPD_2IN36G_SendData(0x01);
|
||||
EPD_2IN36G_SendData(0x28);
|
||||
|
||||
EPD_2IN36G_SendCommand(0x84);
|
||||
EPD_2IN36G_SendData(0x01);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN36G_Clear(UBYTE color)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN36G_WIDTH % 4 == 0)? (EPD_2IN36G_WIDTH / 4 ): (EPD_2IN36G_WIDTH / 4 + 1);
|
||||
Height = EPD_2IN36G_HEIGHT;
|
||||
|
||||
EPD_2IN36G_SendCommand(0x68);
|
||||
EPD_2IN36G_SendData(0x01);
|
||||
|
||||
EPD_2IN36G_SendCommand(0x04);
|
||||
EPD_2IN36G_ReadBusyH();
|
||||
|
||||
EPD_2IN36G_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN36G_SendData((color << 6) | (color << 4) | (color << 2) | color);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN36G_SendCommand(0x68);
|
||||
EPD_2IN36G_SendData(0x00);
|
||||
|
||||
EPD_2IN36G_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN36G_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN36G_WIDTH % 4 == 0)? (EPD_2IN36G_WIDTH / 4 ): (EPD_2IN36G_WIDTH / 4 + 1);
|
||||
Height = EPD_2IN36G_HEIGHT;
|
||||
|
||||
EPD_2IN36G_SendCommand(0x68);
|
||||
EPD_2IN36G_SendData(0x01);
|
||||
|
||||
EPD_2IN36G_SendCommand(0x04);
|
||||
EPD_2IN36G_ReadBusyH();
|
||||
|
||||
EPD_2IN36G_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN36G_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN36G_SendCommand(0x68);
|
||||
EPD_2IN36G_SendData(0x00);
|
||||
|
||||
EPD_2IN36G_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN36G_Sleep(void)
|
||||
{
|
||||
EPD_2IN36G_SendCommand(0x02); // POWER_OFF
|
||||
EPD_2IN36G_SendData(0X00);
|
||||
EPD_2IN36G_SendCommand(0x07); // DEEP_SLEEP
|
||||
EPD_2IN36G_SendData(0XA5);
|
||||
}
|
||||
|
||||
#endif
|
||||
51
Libraries/EPaper/Lib/EPD_2in36g.h
Normal file
51
Libraries/EPaper/Lib/EPD_2in36g.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2in36g.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.36inch e-Paper (G)
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-08-17
|
||||
* | 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_2IN36G_H_
|
||||
#define __EPD_2IN36G_H_
|
||||
|
||||
#include "EPD_Common.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN36G_WIDTH 168
|
||||
#define EPD_2IN36G_HEIGHT 296
|
||||
|
||||
// Color
|
||||
#define EPD_2IN36G_BLACK 0x0
|
||||
#define EPD_2IN36G_WHITE 0x1
|
||||
#define EPD_2IN36G_YELLOW 0x2
|
||||
#define EPD_2IN36G_RED 0x3
|
||||
|
||||
void EPD_2IN36G_Init(void);
|
||||
void EPD_2IN36G_Clear(UBYTE color);
|
||||
void EPD_2IN36G_Display(UBYTE *Image);
|
||||
void EPD_2IN36G_Sleep(void);
|
||||
|
||||
#endif
|
||||
262
Libraries/EPaper/Lib/EPD_2in66.c
Normal file
262
Libraries/EPaper/Lib/EPD_2in66.c
Normal file
@ -0,0 +1,262 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2in66.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.66inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-07-29
|
||||
* | 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_2in66.h"
|
||||
|
||||
#ifdef EPD_2IN66
|
||||
|
||||
const unsigned char WF_PARTIAL[159] ={
|
||||
0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x0A,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x00,0x00,
|
||||
0x00,0x00,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x22,0x22,0x22,0x22,0x22,0x22,
|
||||
0x00,0x00,0x00,0x22,0x17,0x41,0xB0,0x32,0x36,
|
||||
};
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN66_Reset(void)
|
||||
{
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(200);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(2);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN66_SendCommand(UBYTE Reg)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Reg);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN66_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN66_ReadBusy(void)
|
||||
{
|
||||
EPD_Printf("e-Paper busy\r\n");
|
||||
EPD_Delay_ms(100);
|
||||
while(EPD_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
|
||||
EPD_Delay_ms(100);
|
||||
}
|
||||
EPD_Delay_ms(100);
|
||||
EPD_Printf("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN66_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN66_SendCommand(0x20);
|
||||
EPD_2IN66_ReadBusy();
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Send LUT
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN66_SetLUA(void)
|
||||
{
|
||||
UWORD count;
|
||||
EPD_2IN66_SendCommand(0x32);
|
||||
for(count=0;count<153;count++){
|
||||
EPD_2IN66_SendData(WF_PARTIAL[count]);
|
||||
}
|
||||
EPD_2IN66_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN66_Init(void)
|
||||
{
|
||||
EPD_2IN66_Reset();
|
||||
EPD_2IN66_ReadBusy();
|
||||
EPD_2IN66_SendCommand(0x12);//soft reset
|
||||
EPD_2IN66_ReadBusy();
|
||||
/* Y increment, X increment */
|
||||
EPD_2IN66_SendCommand(0x11);
|
||||
EPD_2IN66_SendData(0x03);
|
||||
/* Set RamX-address Start/End position */
|
||||
EPD_2IN66_SendCommand(0x44);
|
||||
EPD_2IN66_SendData(0x01);
|
||||
EPD_2IN66_SendData((EPD_2IN66_WIDTH % 8 == 0)? (EPD_2IN66_WIDTH / 8 ): (EPD_2IN66_WIDTH / 8 + 1) );
|
||||
/* Set RamY-address Start/End position */
|
||||
EPD_2IN66_SendCommand(0x45);
|
||||
EPD_2IN66_SendData(0);
|
||||
EPD_2IN66_SendData(0);
|
||||
EPD_2IN66_SendData((EPD_2IN66_HEIGHT&0xff));
|
||||
EPD_2IN66_SendData((EPD_2IN66_HEIGHT&0x100)>>8);
|
||||
|
||||
|
||||
EPD_2IN66_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register(Partial display)
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN66_Init_Partial(void)
|
||||
{
|
||||
EPD_2IN66_Reset();
|
||||
EPD_2IN66_ReadBusy();
|
||||
EPD_2IN66_SendCommand(0x12);//soft reset
|
||||
EPD_2IN66_ReadBusy();
|
||||
|
||||
EPD_2IN66_SetLUA();
|
||||
EPD_2IN66_SendCommand(0x37);
|
||||
EPD_2IN66_SendData(0x00);
|
||||
EPD_2IN66_SendData(0x00);
|
||||
EPD_2IN66_SendData(0x00);
|
||||
EPD_2IN66_SendData(0x00);
|
||||
EPD_2IN66_SendData(0x00);
|
||||
EPD_2IN66_SendData(0x40);
|
||||
EPD_2IN66_SendData(0x00);
|
||||
EPD_2IN66_SendData(0x00);
|
||||
EPD_2IN66_SendData(0x00);
|
||||
EPD_2IN66_SendData(0x00);
|
||||
|
||||
/* Y increment, X increment */
|
||||
EPD_2IN66_SendCommand(0x11);
|
||||
EPD_2IN66_SendData(0x03);
|
||||
/* Set RamX-address Start/End position */
|
||||
EPD_2IN66_SendCommand(0x44);
|
||||
EPD_2IN66_SendData(0x01);
|
||||
EPD_2IN66_SendData((EPD_2IN66_WIDTH % 8 == 0)? (EPD_2IN66_WIDTH / 8 ): (EPD_2IN66_WIDTH / 8 + 1) );
|
||||
/* Set RamY-address Start/End position */
|
||||
EPD_2IN66_SendCommand(0x45);
|
||||
EPD_2IN66_SendData(0);
|
||||
EPD_2IN66_SendData(0);
|
||||
EPD_2IN66_SendData((EPD_2IN66_HEIGHT&0xff));
|
||||
EPD_2IN66_SendData((EPD_2IN66_HEIGHT&0x100)>>8);
|
||||
|
||||
EPD_2IN66_SendCommand(0x3C);
|
||||
EPD_2IN66_SendData(0x80);
|
||||
|
||||
EPD_2IN66_SendCommand(0x22);
|
||||
EPD_2IN66_SendData(0xcf);
|
||||
EPD_2IN66_SendCommand(0x20);
|
||||
EPD_2IN66_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN66_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN66_WIDTH % 8 == 0)? (EPD_2IN66_WIDTH / 8 ): (EPD_2IN66_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN66_HEIGHT;
|
||||
EPD_2IN66_SendCommand(0x24);
|
||||
for (UWORD j = 0; j <=Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN66_SendData(0xff);
|
||||
}
|
||||
}
|
||||
EPD_2IN66_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN66_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN66_WIDTH % 8 == 0)? (EPD_2IN66_WIDTH / 8 ): (EPD_2IN66_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN66_HEIGHT;
|
||||
|
||||
UDOUBLE Addr = 0;
|
||||
|
||||
// UDOUBLE Offset = ImageName;
|
||||
EPD_2IN66_SendCommand(0x24);
|
||||
for (UWORD j = 0; j <Height; j++) {
|
||||
for (UWORD i = 0; i <Width; i++) {
|
||||
Addr = i + j * Width;
|
||||
EPD_2IN66_SendData(Image[Addr]);
|
||||
}
|
||||
}
|
||||
EPD_2IN66_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN66_Sleep(void)
|
||||
{
|
||||
EPD_2IN66_SendCommand(0x10);
|
||||
EPD_2IN66_SendData(0x01);
|
||||
//EPD_2IN66_ReadBusy();
|
||||
}
|
||||
|
||||
#endif
|
||||
46
Libraries/EPaper/Lib/EPD_2in66.h
Normal file
46
Libraries/EPaper/Lib/EPD_2in66.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2in66.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.66inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-07-29
|
||||
* | 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_2IN66_H_
|
||||
#define __EPD_2IN66_H_
|
||||
|
||||
#include "EPD_Common.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN66_WIDTH 152
|
||||
#define EPD_2IN66_HEIGHT 296
|
||||
|
||||
|
||||
void EPD_2IN66_Init(void);
|
||||
void EPD_2IN66_Init_Partial(void);
|
||||
void EPD_2IN66_Clear(void);
|
||||
void EPD_2IN66_Display(UBYTE *Image);
|
||||
void EPD_2IN66_Sleep(void);
|
||||
|
||||
#endif
|
||||
216
Libraries/EPaper/Lib/EPD_2in66b.c
Normal file
216
Libraries/EPaper/Lib/EPD_2in66b.c
Normal file
@ -0,0 +1,216 @@
|
||||
/*****************************************************************************
|
||||
* | File : EPD_2in66b.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.66inch e-paper b
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-12-02
|
||||
* | 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_2in66b.h"
|
||||
|
||||
#ifdef EPD_2IN66B
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN66B_Reset(void)
|
||||
{
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(200);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 0);
|
||||
EPD_Delay_ms(2);
|
||||
EPD_Digital_Write(EPD_RST_PIN, 1);
|
||||
EPD_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN66B_SendCommand(UBYTE Reg)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 0);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Reg);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN66B_SendData(UBYTE Data)
|
||||
{
|
||||
EPD_Digital_Write(EPD_DC_PIN, 1);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 0);
|
||||
EPD_SPI_WriteByte(Data);
|
||||
EPD_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN66B_ReadBusy(void)
|
||||
{
|
||||
EPD_Printf("e-Paper busy\r\n");
|
||||
EPD_Delay_ms(50);
|
||||
while(EPD_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
|
||||
EPD_Delay_ms(10);
|
||||
}
|
||||
EPD_Delay_ms(50);
|
||||
EPD_Printf("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN66B_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN66B_SendCommand(0x20);
|
||||
EPD_2IN66B_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Setting the display window
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN66B_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
EPD_2IN66B_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
EPD_2IN66B_SendData((Xstart>>3) & 0x1F);
|
||||
EPD_2IN66B_SendData((Xend>>3) & 0x1F);
|
||||
|
||||
EPD_2IN66B_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
EPD_2IN66B_SendData(Ystart & 0xFF);
|
||||
EPD_2IN66B_SendData((Ystart >> 8) & 0x01);
|
||||
EPD_2IN66B_SendData(Yend & 0xFF);
|
||||
EPD_2IN66B_SendData((Yend >> 8) & 0x01);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Set Cursor
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN66B_SetCursor(UWORD Xstart, UWORD Ystart)
|
||||
{
|
||||
EPD_2IN66B_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
EPD_2IN66B_SendData(Xstart & 0x1F);
|
||||
|
||||
EPD_2IN66B_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
|
||||
EPD_2IN66B_SendData(Ystart & 0xFF);
|
||||
EPD_2IN66B_SendData((Ystart >> 8) & 0x01);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN66B_Init(void)
|
||||
{
|
||||
EPD_2IN66B_Reset();
|
||||
EPD_2IN66B_ReadBusy();
|
||||
EPD_2IN66B_SendCommand(0x12);//soft reset
|
||||
EPD_2IN66B_ReadBusy();
|
||||
|
||||
EPD_2IN66B_SendCommand(0x11); //data entry mode
|
||||
EPD_2IN66B_SendData(0x03);
|
||||
|
||||
EPD_2IN66B_SetWindows(0, 0, EPD_2IN66B_WIDTH-1, EPD_2IN66B_HEIGHT-1);
|
||||
|
||||
EPD_2IN66B_SendCommand(0x21); // Display update control
|
||||
EPD_2IN66B_SendData(0x00);
|
||||
EPD_2IN66B_SendData(0x80);
|
||||
|
||||
EPD_2IN66B_SetCursor(0, 0);
|
||||
EPD_2IN66B_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN66B_Display(UBYTE *ImageBlack, UBYTE*ImageRed)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN66B_WIDTH % 8 == 0)? (EPD_2IN66B_WIDTH / 8 ): (EPD_2IN66B_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN66B_HEIGHT;
|
||||
|
||||
EPD_2IN66B_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN66B_SendData(ImageBlack[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN66B_SendCommand(0x26);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN66B_SendData(~ImageRed[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN66B_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN66B_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN66B_WIDTH % 8 == 0)? (EPD_2IN66B_WIDTH / 8 ): (EPD_2IN66B_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN66B_HEIGHT;
|
||||
|
||||
EPD_2IN66B_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN66B_SendData(0xff);
|
||||
}
|
||||
}
|
||||
EPD_2IN66B_SendCommand(0x26);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN66B_SendData(0x00);
|
||||
}
|
||||
}
|
||||
EPD_2IN66B_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN66B_Sleep(void)
|
||||
{
|
||||
EPD_2IN66B_SendCommand(0x10);
|
||||
EPD_2IN66B_SendData(0x01);
|
||||
}
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user