first commit
This commit is contained in:
commit
9005e49d82
3071 changed files with 1941927 additions and 0 deletions
4
e-Paper/Arduino/epd3in7/.vscode/arduino.json
vendored
Normal file
4
e-Paper/Arduino/epd3in7/.vscode/arduino.json
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"board": "arduino:avr:uno",
|
||||
"sketch": "epd3in7.ino"
|
||||
}
|
||||
538
e-Paper/Arduino/epd3in7/.vscode/c_cpp_properties.json
vendored
Normal file
538
e-Paper/Arduino/epd3in7/.vscode/c_cpp_properties.json
vendored
Normal file
|
|
@ -0,0 +1,538 @@
|
|||
{
|
||||
"version": 4,
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Arduino",
|
||||
"compilerPath": "C:\\Users\\liuyujian\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7\\bin\\avr-g++",
|
||||
"compilerArgs": [
|
||||
"-w",
|
||||
"-std=gnu++11",
|
||||
"-fpermissive",
|
||||
"-fno-exceptions",
|
||||
"-ffunction-sections",
|
||||
"-fdata-sections",
|
||||
"-fno-threadsafe-statics",
|
||||
"-Wno-error=narrowing"
|
||||
],
|
||||
"intelliSenseMode": "gcc-x64",
|
||||
"includePath": [
|
||||
"C:\\Users\\liuyujian\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino",
|
||||
"C:\\Users\\liuyujian\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\standard",
|
||||
"C:\\Users\\liuyujian\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\SPI\\src",
|
||||
"c:\\users\\liuyujian\\appdata\\local\\arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7\\lib\\gcc\\avr\\7.3.0\\include",
|
||||
"c:\\users\\liuyujian\\appdata\\local\\arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7\\lib\\gcc\\avr\\7.3.0\\include-fixed",
|
||||
"c:\\users\\liuyujian\\appdata\\local\\arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7\\avr\\include"
|
||||
],
|
||||
"forcedInclude": [
|
||||
"C:\\Users\\liuyujian\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino\\Arduino.h"
|
||||
],
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++11",
|
||||
"defines": [
|
||||
"F_CPU=16000000L",
|
||||
"ARDUINO=10607",
|
||||
"ARDUINO_AVR_UNO",
|
||||
"ARDUINO_ARCH_AVR",
|
||||
"__DBL_MIN_EXP__=(-125)",
|
||||
"__HQ_FBIT__=15",
|
||||
"__cpp_attributes=200809",
|
||||
"__UINT_LEAST16_MAX__=0xffffU",
|
||||
"__ATOMIC_ACQUIRE=2",
|
||||
"__SFRACT_IBIT__=0",
|
||||
"__FLT_MIN__=1.17549435e-38F",
|
||||
"__GCC_IEC_559_COMPLEX=0",
|
||||
"__BUILTIN_AVR_SLEEP=1",
|
||||
"__BUILTIN_AVR_COUNTLSULLK=1",
|
||||
"__cpp_aggregate_nsdmi=201304",
|
||||
"__BUILTIN_AVR_COUNTLSULLR=1",
|
||||
"__UFRACT_MAX__=0XFFFFP-16UR",
|
||||
"__UINT_LEAST8_TYPE__=unsigned char",
|
||||
"__DQ_FBIT__=63",
|
||||
"__INTMAX_C(c)=c ## LL",
|
||||
"__ULFRACT_FBIT__=32",
|
||||
"__SACCUM_EPSILON__=0x1P-7HK",
|
||||
"__CHAR_BIT__=8",
|
||||
"__USQ_IBIT__=0",
|
||||
"__UINT8_MAX__=0xff",
|
||||
"__ACCUM_FBIT__=15",
|
||||
"__WINT_MAX__=0x7fff",
|
||||
"__FLT32_MIN_EXP__=(-125)",
|
||||
"__cpp_static_assert=200410",
|
||||
"__USFRACT_FBIT__=8",
|
||||
"__ORDER_LITTLE_ENDIAN__=1234",
|
||||
"__SIZE_MAX__=0xffffU",
|
||||
"__WCHAR_MAX__=0x7fff",
|
||||
"__LACCUM_IBIT__=32",
|
||||
"__DBL_DENORM_MIN__=double(1.40129846e-45L)",
|
||||
"__GCC_ATOMIC_CHAR_LOCK_FREE=1",
|
||||
"__GCC_IEC_559=0",
|
||||
"__FLT_EVAL_METHOD__=0",
|
||||
"__BUILTIN_AVR_LLKBITS=1",
|
||||
"__cpp_binary_literals=201304",
|
||||
"__LLACCUM_MAX__=0X7FFFFFFFFFFFFFFFP-47LLK",
|
||||
"__GCC_ATOMIC_CHAR32_T_LOCK_FREE=1",
|
||||
"__BUILTIN_AVR_HKBITS=1",
|
||||
"__BUILTIN_AVR_BITSLLK=1",
|
||||
"__FRACT_FBIT__=15",
|
||||
"__BUILTIN_AVR_BITSLLR=1",
|
||||
"__cpp_variadic_templates=200704",
|
||||
"__UINT_FAST64_MAX__=0xffffffffffffffffULL",
|
||||
"__SIG_ATOMIC_TYPE__=char",
|
||||
"__BUILTIN_AVR_UHKBITS=1",
|
||||
"__UACCUM_FBIT__=16",
|
||||
"__DBL_MIN_10_EXP__=(-37)",
|
||||
"__FINITE_MATH_ONLY__=0",
|
||||
"__cpp_variable_templates=201304",
|
||||
"__LFRACT_IBIT__=0",
|
||||
"__GNUC_PATCHLEVEL__=0",
|
||||
"__FLT32_HAS_DENORM__=1",
|
||||
"__LFRACT_MAX__=0X7FFFFFFFP-31LR",
|
||||
"__UINT_FAST8_MAX__=0xff",
|
||||
"__has_include(STR)=__has_include__(STR)",
|
||||
"__DEC64_MAX_EXP__=385",
|
||||
"__INT8_C(c)=c",
|
||||
"__INT_LEAST8_WIDTH__=8",
|
||||
"__UINT_LEAST64_MAX__=0xffffffffffffffffULL",
|
||||
"__SA_FBIT__=15",
|
||||
"__SHRT_MAX__=0x7fff",
|
||||
"__LDBL_MAX__=3.40282347e+38L",
|
||||
"__FRACT_MAX__=0X7FFFP-15R",
|
||||
"__UFRACT_FBIT__=16",
|
||||
"__UFRACT_MIN__=0.0UR",
|
||||
"__UINT_LEAST8_MAX__=0xff",
|
||||
"__GCC_ATOMIC_BOOL_LOCK_FREE=1",
|
||||
"__UINTMAX_TYPE__=long long unsigned int",
|
||||
"__LLFRACT_EPSILON__=0x1P-63LLR",
|
||||
"__BUILTIN_AVR_DELAY_CYCLES=1",
|
||||
"__DEC32_EPSILON__=1E-6DF",
|
||||
"__FLT_EVAL_METHOD_TS_18661_3__=0",
|
||||
"__UINT32_MAX__=0xffffffffUL",
|
||||
"__GXX_EXPERIMENTAL_CXX0X__=1",
|
||||
"__ULFRACT_MAX__=0XFFFFFFFFP-32ULR",
|
||||
"__TA_IBIT__=16",
|
||||
"__LDBL_MAX_EXP__=128",
|
||||
"__WINT_MIN__=(-__WINT_MAX__ - 1)",
|
||||
"__INT_LEAST16_WIDTH__=16",
|
||||
"__ULLFRACT_MIN__=0.0ULLR",
|
||||
"__SCHAR_MAX__=0x7f",
|
||||
"__WCHAR_MIN__=(-__WCHAR_MAX__ - 1)",
|
||||
"__INT64_C(c)=c ## LL",
|
||||
"__DBL_DIG__=6",
|
||||
"__GCC_ATOMIC_POINTER_LOCK_FREE=1",
|
||||
"__AVR_HAVE_SPH__=1",
|
||||
"__LLACCUM_MIN__=(-0X1P15LLK-0X1P15LLK)",
|
||||
"__BUILTIN_AVR_KBITS=1",
|
||||
"__BUILTIN_AVR_ABSK=1",
|
||||
"__BUILTIN_AVR_ABSR=1",
|
||||
"__SIZEOF_INT__=2",
|
||||
"__SIZEOF_POINTER__=2",
|
||||
"__GCC_ATOMIC_CHAR16_T_LOCK_FREE=1",
|
||||
"__USACCUM_IBIT__=8",
|
||||
"__USER_LABEL_PREFIX__",
|
||||
"__STDC_HOSTED__=1",
|
||||
"__LDBL_HAS_INFINITY__=1",
|
||||
"__LFRACT_MIN__=(-0.5LR-0.5LR)",
|
||||
"__HA_IBIT__=8",
|
||||
"__FLT32_DIG__=6",
|
||||
"__TQ_IBIT__=0",
|
||||
"__FLT_EPSILON__=1.19209290e-7F",
|
||||
"__GXX_WEAK__=1",
|
||||
"__SHRT_WIDTH__=16",
|
||||
"__USFRACT_IBIT__=0",
|
||||
"__LDBL_MIN__=1.17549435e-38L",
|
||||
"__FRACT_MIN__=(-0.5R-0.5R)",
|
||||
"__AVR_SFR_OFFSET__=0x20",
|
||||
"__DEC32_MAX__=9.999999E96DF",
|
||||
"__cpp_threadsafe_static_init=200806",
|
||||
"__DA_IBIT__=32",
|
||||
"__INT32_MAX__=0x7fffffffL",
|
||||
"__UQQ_FBIT__=8",
|
||||
"__INT_WIDTH__=16",
|
||||
"__SIZEOF_LONG__=4",
|
||||
"__UACCUM_MAX__=0XFFFFFFFFP-16UK",
|
||||
"__UINT16_C(c)=c ## U",
|
||||
"__PTRDIFF_WIDTH__=16",
|
||||
"__DECIMAL_DIG__=9",
|
||||
"__LFRACT_EPSILON__=0x1P-31LR",
|
||||
"__AVR_2_BYTE_PC__=1",
|
||||
"__ULFRACT_MIN__=0.0ULR",
|
||||
"__INTMAX_WIDTH__=64",
|
||||
"__has_include_next(STR)=__has_include_next__(STR)",
|
||||
"__BUILTIN_AVR_ULLRBITS=1",
|
||||
"__LDBL_HAS_QUIET_NAN__=1",
|
||||
"__ULACCUM_IBIT__=32",
|
||||
"__UACCUM_EPSILON__=0x1P-16UK",
|
||||
"__BUILTIN_AVR_SEI=1",
|
||||
"__GNUC__=7",
|
||||
"__ULLACCUM_MAX__=0XFFFFFFFFFFFFFFFFP-48ULLK",
|
||||
"__cpp_delegating_constructors=200604",
|
||||
"__HQ_IBIT__=0",
|
||||
"__BUILTIN_AVR_SWAP=1",
|
||||
"__FLT_HAS_DENORM__=1",
|
||||
"__SIZEOF_LONG_DOUBLE__=4",
|
||||
"__BIGGEST_ALIGNMENT__=1",
|
||||
"__STDC_UTF_16__=1",
|
||||
"__UINT24_MAX__=16777215UL",
|
||||
"__BUILTIN_AVR_NOP=1",
|
||||
"__GNUC_STDC_INLINE__=1",
|
||||
"__DQ_IBIT__=0",
|
||||
"__FLT32_HAS_INFINITY__=1",
|
||||
"__DBL_MAX__=double(3.40282347e+38L)",
|
||||
"__ULFRACT_IBIT__=0",
|
||||
"__cpp_raw_strings=200710",
|
||||
"__INT_FAST32_MAX__=0x7fffffffL",
|
||||
"__DBL_HAS_INFINITY__=1",
|
||||
"__INT64_MAX__=0x7fffffffffffffffLL",
|
||||
"__ACCUM_IBIT__=16",
|
||||
"__DEC32_MIN_EXP__=(-94)",
|
||||
"__BUILTIN_AVR_UKBITS=1",
|
||||
"__INTPTR_WIDTH__=16",
|
||||
"__BUILTIN_AVR_FMULSU=1",
|
||||
"__LACCUM_MAX__=0X7FFFFFFFFFFFFFFFP-31LK",
|
||||
"__INT_FAST16_TYPE__=int",
|
||||
"__LDBL_HAS_DENORM__=1",
|
||||
"__BUILTIN_AVR_BITSK=1",
|
||||
"__BUILTIN_AVR_BITSR=1",
|
||||
"__cplusplus=201402L",
|
||||
"__cpp_ref_qualifiers=200710",
|
||||
"__DEC128_MAX__=9.999999999999999999999999999999999E6144DL",
|
||||
"__INT_LEAST32_MAX__=0x7fffffffL",
|
||||
"__USING_SJLJ_EXCEPTIONS__=1",
|
||||
"__DEC32_MIN__=1E-95DF",
|
||||
"__ACCUM_MAX__=0X7FFFFFFFP-15K",
|
||||
"__DEPRECATED=1",
|
||||
"__cpp_rvalue_references=200610",
|
||||
"__DBL_MAX_EXP__=128",
|
||||
"__USACCUM_EPSILON__=0x1P-8UHK",
|
||||
"__WCHAR_WIDTH__=16",
|
||||
"__FLT32_MAX__=3.40282347e+38F32",
|
||||
"__DEC128_EPSILON__=1E-33DL",
|
||||
"__SFRACT_MAX__=0X7FP-7HR",
|
||||
"__FRACT_IBIT__=0",
|
||||
"__PTRDIFF_MAX__=0x7fff",
|
||||
"__UACCUM_MIN__=0.0UK",
|
||||
"__UACCUM_IBIT__=16",
|
||||
"__BUILTIN_AVR_NOPS=1",
|
||||
"__BUILTIN_AVR_WDR=1",
|
||||
"__FLT32_HAS_QUIET_NAN__=1",
|
||||
"__GNUG__=7",
|
||||
"__LONG_LONG_MAX__=0x7fffffffffffffffLL",
|
||||
"__SIZEOF_SIZE_T__=2",
|
||||
"__ULACCUM_MAX__=0XFFFFFFFFFFFFFFFFP-32ULK",
|
||||
"__cpp_rvalue_reference=200610",
|
||||
"__cpp_nsdmi=200809",
|
||||
"__SIZEOF_WINT_T__=2",
|
||||
"__LONG_LONG_WIDTH__=64",
|
||||
"__cpp_initializer_lists=200806",
|
||||
"__FLT32_MAX_EXP__=128",
|
||||
"__SA_IBIT__=16",
|
||||
"__ULLACCUM_MIN__=0.0ULLK",
|
||||
"__BUILTIN_AVR_ROUNDUHK=1",
|
||||
"__BUILTIN_AVR_ROUNDUHR=1",
|
||||
"__cpp_hex_float=201603",
|
||||
"__GXX_ABI_VERSION=1011",
|
||||
"__INT24_MAX__=8388607L",
|
||||
"__UTA_FBIT__=48",
|
||||
"__FLT_MIN_EXP__=(-125)",
|
||||
"__USFRACT_MAX__=0XFFP-8UHR",
|
||||
"__UFRACT_IBIT__=0",
|
||||
"__BUILTIN_AVR_ROUNDFX=1",
|
||||
"__BUILTIN_AVR_ROUNDULK=1",
|
||||
"__BUILTIN_AVR_ROUNDULR=1",
|
||||
"__cpp_lambdas=200907",
|
||||
"__BUILTIN_AVR_COUNTLSLLK=1",
|
||||
"__BUILTIN_AVR_COUNTLSLLR=1",
|
||||
"__BUILTIN_AVR_ROUNDHK=1",
|
||||
"__INT_FAST64_TYPE__=long long int",
|
||||
"__BUILTIN_AVR_ROUNDHR=1",
|
||||
"__DBL_MIN__=double(1.17549435e-38L)",
|
||||
"__BUILTIN_AVR_COUNTLSK=1",
|
||||
"__BUILTIN_AVR_ROUNDLK=1",
|
||||
"__BUILTIN_AVR_COUNTLSR=1",
|
||||
"__BUILTIN_AVR_ROUNDLR=1",
|
||||
"__LACCUM_MIN__=(-0X1P31LK-0X1P31LK)",
|
||||
"__ULLACCUM_FBIT__=48",
|
||||
"__BUILTIN_AVR_LKBITS=1",
|
||||
"__ULLFRACT_EPSILON__=0x1P-64ULLR",
|
||||
"__DEC128_MIN__=1E-6143DL",
|
||||
"__REGISTER_PREFIX__",
|
||||
"__UINT16_MAX__=0xffffU",
|
||||
"__DBL_HAS_DENORM__=1",
|
||||
"__BUILTIN_AVR_ULKBITS=1",
|
||||
"__ACCUM_MIN__=(-0X1P15K-0X1P15K)",
|
||||
"__AVR_ARCH__=2",
|
||||
"__SQ_IBIT__=0",
|
||||
"__FLT32_MIN__=1.17549435e-38F32",
|
||||
"__UINT8_TYPE__=unsigned char",
|
||||
"__BUILTIN_AVR_ROUNDUK=1",
|
||||
"__BUILTIN_AVR_ROUNDUR=1",
|
||||
"__UHA_FBIT__=8",
|
||||
"__NO_INLINE__=1",
|
||||
"__SFRACT_MIN__=(-0.5HR-0.5HR)",
|
||||
"__UTQ_FBIT__=128",
|
||||
"__FLT_MANT_DIG__=24",
|
||||
"__LDBL_DECIMAL_DIG__=9",
|
||||
"__VERSION__=\"7.3.0\"",
|
||||
"__UINT64_C(c)=c ## ULL",
|
||||
"__ULLFRACT_FBIT__=64",
|
||||
"__cpp_unicode_characters=200704",
|
||||
"__FRACT_EPSILON__=0x1P-15R",
|
||||
"__ULACCUM_MIN__=0.0ULK",
|
||||
"__UDA_FBIT__=32",
|
||||
"__cpp_decltype_auto=201304",
|
||||
"__LLACCUM_EPSILON__=0x1P-47LLK",
|
||||
"__GCC_ATOMIC_INT_LOCK_FREE=1",
|
||||
"__FLT32_MANT_DIG__=24",
|
||||
"__BUILTIN_AVR_BITSUHK=1",
|
||||
"__BUILTIN_AVR_BITSUHR=1",
|
||||
"__FLOAT_WORD_ORDER__=__ORDER_LITTLE_ENDIAN__",
|
||||
"__USFRACT_MIN__=0.0UHR",
|
||||
"__BUILTIN_AVR_BITSULK=1",
|
||||
"__ULLACCUM_IBIT__=16",
|
||||
"__BUILTIN_AVR_BITSULR=1",
|
||||
"__UQQ_IBIT__=0",
|
||||
"__BUILTIN_AVR_LLRBITS=1",
|
||||
"__SCHAR_WIDTH__=8",
|
||||
"__BUILTIN_AVR_BITSULLK=1",
|
||||
"__BUILTIN_AVR_BITSULLR=1",
|
||||
"__INT32_C(c)=c ## L",
|
||||
"__DEC64_EPSILON__=1E-15DD",
|
||||
"__ORDER_PDP_ENDIAN__=3412",
|
||||
"__DEC128_MIN_EXP__=(-6142)",
|
||||
"__UHQ_FBIT__=16",
|
||||
"__LLACCUM_FBIT__=47",
|
||||
"__FLT32_MAX_10_EXP__=38",
|
||||
"__BUILTIN_AVR_ROUNDULLK=1",
|
||||
"__BUILTIN_AVR_ROUNDULLR=1",
|
||||
"__INT_FAST32_TYPE__=long int",
|
||||
"__BUILTIN_AVR_HRBITS=1",
|
||||
"__UINT_LEAST16_TYPE__=unsigned int",
|
||||
"__BUILTIN_AVR_UHRBITS=1",
|
||||
"__INT16_MAX__=0x7fff",
|
||||
"__SIZE_TYPE__=unsigned int",
|
||||
"__UINT64_MAX__=0xffffffffffffffffULL",
|
||||
"__UDQ_FBIT__=64",
|
||||
"__INT8_TYPE__=signed char",
|
||||
"__cpp_digit_separators=201309",
|
||||
"__ELF__=1",
|
||||
"__ULFRACT_EPSILON__=0x1P-32ULR",
|
||||
"__LLFRACT_FBIT__=63",
|
||||
"__FLT_RADIX__=2",
|
||||
"__INT_LEAST16_TYPE__=int",
|
||||
"__BUILTIN_AVR_ABSFX=1",
|
||||
"__LDBL_EPSILON__=1.19209290e-7L",
|
||||
"__UINTMAX_C(c)=c ## ULL",
|
||||
"__INT24_MIN__=(-__INT24_MAX__-1)",
|
||||
"__SACCUM_MAX__=0X7FFFP-7HK",
|
||||
"__BUILTIN_AVR_ABSHR=1",
|
||||
"__SIG_ATOMIC_MAX__=0x7f",
|
||||
"__GCC_ATOMIC_WCHAR_T_LOCK_FREE=1",
|
||||
"__cpp_sized_deallocation=201309",
|
||||
"__SIZEOF_PTRDIFF_T__=2",
|
||||
"__AVR=1",
|
||||
"__BUILTIN_AVR_ABSLK=1",
|
||||
"__BUILTIN_AVR_ABSLR=1",
|
||||
"__LACCUM_EPSILON__=0x1P-31LK",
|
||||
"__DEC32_SUBNORMAL_MIN__=0.000001E-95DF",
|
||||
"__INT_FAST16_MAX__=0x7fff",
|
||||
"__UINT_FAST32_MAX__=0xffffffffUL",
|
||||
"__UINT_LEAST64_TYPE__=long long unsigned int",
|
||||
"__USACCUM_MAX__=0XFFFFP-8UHK",
|
||||
"__SFRACT_EPSILON__=0x1P-7HR",
|
||||
"__FLT_HAS_QUIET_NAN__=1",
|
||||
"__FLT_MAX_10_EXP__=38",
|
||||
"__LONG_MAX__=0x7fffffffL",
|
||||
"__DEC128_SUBNORMAL_MIN__=0.000000000000000000000000000000001E-6143DL",
|
||||
"__FLT_HAS_INFINITY__=1",
|
||||
"__cpp_unicode_literals=200710",
|
||||
"__USA_FBIT__=16",
|
||||
"__UINT_FAST16_TYPE__=unsigned int",
|
||||
"__DEC64_MAX__=9.999999999999999E384DD",
|
||||
"__INT_FAST32_WIDTH__=32",
|
||||
"__BUILTIN_AVR_RBITS=1",
|
||||
"__CHAR16_TYPE__=unsigned int",
|
||||
"__PRAGMA_REDEFINE_EXTNAME=1",
|
||||
"__SIZE_WIDTH__=16",
|
||||
"__INT_LEAST16_MAX__=0x7fff",
|
||||
"__DEC64_MANT_DIG__=16",
|
||||
"__UINT_LEAST32_MAX__=0xffffffffUL",
|
||||
"__SACCUM_FBIT__=7",
|
||||
"__FLT32_DENORM_MIN__=1.40129846e-45F32",
|
||||
"__GCC_ATOMIC_LONG_LOCK_FREE=1",
|
||||
"__SIG_ATOMIC_WIDTH__=8",
|
||||
"__INT_LEAST64_TYPE__=long long int",
|
||||
"__INT16_TYPE__=int",
|
||||
"__INT_LEAST8_TYPE__=signed char",
|
||||
"__SQ_FBIT__=31",
|
||||
"__DEC32_MAX_EXP__=97",
|
||||
"__INT_FAST8_MAX__=0x7f",
|
||||
"__INTPTR_MAX__=0x7fff",
|
||||
"__QQ_FBIT__=7",
|
||||
"__cpp_range_based_for=200907",
|
||||
"__UTA_IBIT__=16",
|
||||
"__AVR_ERRATA_SKIP__=1",
|
||||
"__FLT32_MIN_10_EXP__=(-37)",
|
||||
"__LDBL_MANT_DIG__=24",
|
||||
"__SFRACT_FBIT__=7",
|
||||
"__SACCUM_MIN__=(-0X1P7HK-0X1P7HK)",
|
||||
"__DBL_HAS_QUIET_NAN__=1",
|
||||
"__SIG_ATOMIC_MIN__=(-__SIG_ATOMIC_MAX__ - 1)",
|
||||
"AVR=1",
|
||||
"__BUILTIN_AVR_FMULS=1",
|
||||
"__cpp_return_type_deduction=201304",
|
||||
"__INTPTR_TYPE__=int",
|
||||
"__UINT16_TYPE__=unsigned int",
|
||||
"__WCHAR_TYPE__=int",
|
||||
"__SIZEOF_FLOAT__=4",
|
||||
"__AVR__=1",
|
||||
"__BUILTIN_AVR_INSERT_BITS=1",
|
||||
"__USQ_FBIT__=32",
|
||||
"__UINTPTR_MAX__=0xffffU",
|
||||
"__INT_FAST64_WIDTH__=64",
|
||||
"__DEC64_MIN_EXP__=(-382)",
|
||||
"__cpp_decltype=200707",
|
||||
"__FLT32_DECIMAL_DIG__=9",
|
||||
"__INT_FAST64_MAX__=0x7fffffffffffffffLL",
|
||||
"__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1",
|
||||
"__FLT_DIG__=6",
|
||||
"__UINT_FAST64_TYPE__=long long unsigned int",
|
||||
"__BUILTIN_AVR_BITSHK=1",
|
||||
"__BUILTIN_AVR_BITSHR=1",
|
||||
"__INT_MAX__=0x7fff",
|
||||
"__LACCUM_FBIT__=31",
|
||||
"__USACCUM_MIN__=0.0UHK",
|
||||
"__UHA_IBIT__=8",
|
||||
"__INT64_TYPE__=long long int",
|
||||
"__BUILTIN_AVR_BITSLK=1",
|
||||
"__BUILTIN_AVR_BITSLR=1",
|
||||
"__FLT_MAX_EXP__=128",
|
||||
"__UTQ_IBIT__=0",
|
||||
"__DBL_MANT_DIG__=24",
|
||||
"__cpp_inheriting_constructors=201511",
|
||||
"__BUILTIN_AVR_ULLKBITS=1",
|
||||
"__INT_LEAST64_MAX__=0x7fffffffffffffffLL",
|
||||
"__DEC64_MIN__=1E-383DD",
|
||||
"__WINT_TYPE__=int",
|
||||
"__UINT_LEAST32_TYPE__=long unsigned int",
|
||||
"__SIZEOF_SHORT__=2",
|
||||
"__ULLFRACT_IBIT__=0",
|
||||
"__LDBL_MIN_EXP__=(-125)",
|
||||
"__UDA_IBIT__=32",
|
||||
"__WINT_WIDTH__=16",
|
||||
"__INT_LEAST8_MAX__=0x7f",
|
||||
"__LFRACT_FBIT__=31",
|
||||
"__LDBL_MAX_10_EXP__=38",
|
||||
"__ATOMIC_RELAXED=0",
|
||||
"__DBL_EPSILON__=double(1.19209290e-7L)",
|
||||
"__BUILTIN_AVR_BITSUK=1",
|
||||
"__BUILTIN_AVR_BITSUR=1",
|
||||
"__UINT8_C(c)=c",
|
||||
"__INT_LEAST32_TYPE__=long int",
|
||||
"__BUILTIN_AVR_URBITS=1",
|
||||
"__SIZEOF_WCHAR_T__=2",
|
||||
"__LLFRACT_MAX__=0X7FFFFFFFFFFFFFFFP-63LLR",
|
||||
"__TQ_FBIT__=127",
|
||||
"__INT_FAST8_TYPE__=signed char",
|
||||
"__ULLACCUM_EPSILON__=0x1P-48ULLK",
|
||||
"__BUILTIN_AVR_ROUNDK=1",
|
||||
"__BUILTIN_AVR_ROUNDR=1",
|
||||
"__UHQ_IBIT__=0",
|
||||
"__LLACCUM_IBIT__=16",
|
||||
"__FLT32_EPSILON__=1.19209290e-7F32",
|
||||
"__DBL_DECIMAL_DIG__=9",
|
||||
"__STDC_UTF_32__=1",
|
||||
"__INT_FAST8_WIDTH__=8",
|
||||
"__DEC_EVAL_METHOD__=2",
|
||||
"__TA_FBIT__=47",
|
||||
"__UDQ_IBIT__=0",
|
||||
"__ORDER_BIG_ENDIAN__=4321",
|
||||
"__cpp_runtime_arrays=198712",
|
||||
"__WITH_AVRLIBC__=1",
|
||||
"__UINT64_TYPE__=long long unsigned int",
|
||||
"__ACCUM_EPSILON__=0x1P-15K",
|
||||
"__UINT32_C(c)=c ## UL",
|
||||
"__BUILTIN_AVR_COUNTLSUHK=1",
|
||||
"__INTMAX_MAX__=0x7fffffffffffffffLL",
|
||||
"__cpp_alias_templates=200704",
|
||||
"__BUILTIN_AVR_COUNTLSUHR=1",
|
||||
"__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__",
|
||||
"__FLT_DENORM_MIN__=1.40129846e-45F",
|
||||
"__LLFRACT_IBIT__=0",
|
||||
"__INT8_MAX__=0x7f",
|
||||
"__LONG_WIDTH__=32",
|
||||
"__UINT_FAST32_TYPE__=long unsigned int",
|
||||
"__CHAR32_TYPE__=long unsigned int",
|
||||
"__BUILTIN_AVR_COUNTLSULK=1",
|
||||
"__BUILTIN_AVR_COUNTLSULR=1",
|
||||
"__FLT_MAX__=3.40282347e+38F",
|
||||
"__cpp_constexpr=201304",
|
||||
"__USACCUM_FBIT__=8",
|
||||
"__BUILTIN_AVR_COUNTLSFX=1",
|
||||
"__INT32_TYPE__=long int",
|
||||
"__SIZEOF_DOUBLE__=4",
|
||||
"__FLT_MIN_10_EXP__=(-37)",
|
||||
"__UFRACT_EPSILON__=0x1P-16UR",
|
||||
"__INT_LEAST32_WIDTH__=32",
|
||||
"__BUILTIN_AVR_COUNTLSHK=1",
|
||||
"__BUILTIN_AVR_COUNTLSHR=1",
|
||||
"__INTMAX_TYPE__=long long int",
|
||||
"__BUILTIN_AVR_ABSLLK=1",
|
||||
"__BUILTIN_AVR_ABSLLR=1",
|
||||
"__DEC128_MAX_EXP__=6145",
|
||||
"__AVR_HAVE_16BIT_SP__=1",
|
||||
"__ATOMIC_CONSUME=1",
|
||||
"__GNUC_MINOR__=3",
|
||||
"__INT_FAST16_WIDTH__=16",
|
||||
"__UINTMAX_MAX__=0xffffffffffffffffULL",
|
||||
"__DEC32_MANT_DIG__=7",
|
||||
"__HA_FBIT__=7",
|
||||
"__BUILTIN_AVR_COUNTLSLK=1",
|
||||
"__BUILTIN_AVR_COUNTLSLR=1",
|
||||
"__BUILTIN_AVR_CLI=1",
|
||||
"__DBL_MAX_10_EXP__=38",
|
||||
"__LDBL_DENORM_MIN__=1.40129846e-45L",
|
||||
"__INT16_C(c)=c",
|
||||
"__cpp_generic_lambdas=201304",
|
||||
"__STDC__=1",
|
||||
"__PTRDIFF_TYPE__=int",
|
||||
"__LLFRACT_MIN__=(-0.5LLR-0.5LLR)",
|
||||
"__BUILTIN_AVR_LRBITS=1",
|
||||
"__ATOMIC_SEQ_CST=5",
|
||||
"__DA_FBIT__=31",
|
||||
"__UINT32_TYPE__=long unsigned int",
|
||||
"__BUILTIN_AVR_ROUNDLLK=1",
|
||||
"__UINTPTR_TYPE__=unsigned int",
|
||||
"__BUILTIN_AVR_ROUNDLLR=1",
|
||||
"__USA_IBIT__=16",
|
||||
"__BUILTIN_AVR_ULRBITS=1",
|
||||
"__DEC64_SUBNORMAL_MIN__=0.000000000000001E-383DD",
|
||||
"__DEC128_MANT_DIG__=34",
|
||||
"__LDBL_MIN_10_EXP__=(-37)",
|
||||
"__BUILTIN_AVR_COUNTLSUK=1",
|
||||
"__BUILTIN_AVR_COUNTLSUR=1",
|
||||
"__SIZEOF_LONG_LONG__=8",
|
||||
"__ULACCUM_EPSILON__=0x1P-32ULK",
|
||||
"__cpp_user_defined_literals=200809",
|
||||
"__SACCUM_IBIT__=8",
|
||||
"__GCC_ATOMIC_LLONG_LOCK_FREE=1",
|
||||
"__LDBL_DIG__=6",
|
||||
"__FLT_DECIMAL_DIG__=9",
|
||||
"__UINT_FAST16_MAX__=0xffffU",
|
||||
"__GCC_ATOMIC_SHORT_LOCK_FREE=1",
|
||||
"__BUILTIN_AVR_ABSHK=1",
|
||||
"__BUILTIN_AVR_FLASH_SEGMENT=1",
|
||||
"__INT_LEAST64_WIDTH__=64",
|
||||
"__ULLFRACT_MAX__=0XFFFFFFFFFFFFFFFFP-64ULLR",
|
||||
"__UINT_FAST8_TYPE__=unsigned char",
|
||||
"__USFRACT_EPSILON__=0x1P-8UHR",
|
||||
"__ULACCUM_FBIT__=32",
|
||||
"__QQ_IBIT__=0",
|
||||
"__cpp_init_captures=201304",
|
||||
"__ATOMIC_ACQ_REL=4",
|
||||
"__ATOMIC_RELEASE=3",
|
||||
"__BUILTIN_AVR_FMUL=1",
|
||||
"USBCON"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
388
e-Paper/Arduino/epd3in7/epd3in7.cpp
Normal file
388
e-Paper/Arduino/epd3in7/epd3in7.cpp
Normal file
|
|
@ -0,0 +1,388 @@
|
|||
/**
|
||||
* @filename : epd3in7.cpp
|
||||
* @brief : Implements for e-paper library
|
||||
* @author : Waveshare
|
||||
*
|
||||
* Copyright (C) Waveshare July 17 2020
|
||||
*
|
||||
* 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 <stdlib.h>
|
||||
#include "epd3in7.h"
|
||||
#include "imagedata.h"
|
||||
|
||||
static const UBYTE lut_4Gray_GC[] =
|
||||
{
|
||||
0x2A,0x06,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1
|
||||
0x28,0x06,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//2
|
||||
0x20,0x06,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3
|
||||
0x14,0x06,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//4
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5
|
||||
0x00,0x02,0x02,0x0A,0x00,0x00,0x00,0x08,0x08,0x02,//6
|
||||
0x00,0x02,0x02,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,//7
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//8
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//10
|
||||
0x22,0x22,0x22,0x22,0x22
|
||||
};
|
||||
|
||||
static const UBYTE lut_1Gray_GC[] =
|
||||
{
|
||||
0x2A,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1
|
||||
0x05,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//2
|
||||
0x2A,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3
|
||||
0x05,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//4
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5
|
||||
0x00,0x02,0x03,0x0A,0x00,0x02,0x06,0x0A,0x05,0x00,//6
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//7
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//8
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//10
|
||||
0x22,0x22,0x22,0x22,0x22
|
||||
};
|
||||
|
||||
static const UBYTE lut_1Gray_DU[] =
|
||||
{
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1
|
||||
0x01,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x0A,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5
|
||||
0x00,0x00,0x05,0x05,0x00,0x05,0x03,0x05,0x05,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//7
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x22,0x22,0x22,0x22,0x22
|
||||
};
|
||||
|
||||
static const UBYTE lut_1Gray_A2[] =
|
||||
{
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //1
|
||||
0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //2
|
||||
0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //3
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //4
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //5
|
||||
0x00,0x00,0x03,0x05,0x00,0x00,0x00,0x00,0x00,0x00, //6
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //7
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //8
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //9
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //10
|
||||
0x22,0x22,0x22,0x22,0x22
|
||||
};
|
||||
|
||||
Epd::~Epd() {
|
||||
};
|
||||
|
||||
Epd::Epd() {
|
||||
reset_pin = RST_PIN;
|
||||
dc_pin = DC_PIN;
|
||||
cs_pin = CS_PIN;
|
||||
busy_pin = BUSY_PIN;
|
||||
width = EPD_WIDTH;
|
||||
height = EPD_HEIGHT;
|
||||
};
|
||||
|
||||
int Epd::Init(void) {
|
||||
if (IfInit() != 0) {
|
||||
return -1;
|
||||
}
|
||||
Reset();
|
||||
|
||||
SendCommand(0x12);
|
||||
DelayMs(300);
|
||||
|
||||
SendCommand(0x46);
|
||||
SendData(0xF7);
|
||||
WaitUntilIdle();
|
||||
SendCommand(0x47);
|
||||
SendData(0xF7);
|
||||
WaitUntilIdle();
|
||||
|
||||
SendCommand(0x01); // setting gaet number
|
||||
SendData(0xDF);
|
||||
SendData(0x01);
|
||||
SendData(0x00);
|
||||
|
||||
SendCommand(0x03); // set gate voltage
|
||||
SendData(0x00);
|
||||
|
||||
SendCommand(0x04); // set source voltage
|
||||
SendData(0x41);
|
||||
SendData(0xA8);
|
||||
SendData(0x32);
|
||||
|
||||
SendCommand(0x11); // set data entry sequence
|
||||
SendData(0x03);
|
||||
|
||||
SendCommand(0x3C); // set border
|
||||
SendData(0x00);
|
||||
|
||||
SendCommand(0x0C); // set booster strength
|
||||
SendData(0xAE);
|
||||
SendData(0xC7);
|
||||
SendData(0xC3);
|
||||
SendData(0xC0);
|
||||
SendData(0xC0);
|
||||
|
||||
SendCommand(0x18); // set internal sensor on
|
||||
SendData(0x80);
|
||||
|
||||
SendCommand(0x2C); // set vcom value
|
||||
SendData(0x44);
|
||||
|
||||
SendCommand(0x37); // set display option, these setting turn on previous function
|
||||
SendData(0x00);
|
||||
SendData(0xff);
|
||||
SendData(0xff);
|
||||
SendData(0xff);
|
||||
SendData(0xff);
|
||||
SendData(0x4f);
|
||||
SendData(0xff);
|
||||
SendData(0xff);
|
||||
SendData(0xff);
|
||||
SendData(0xff);
|
||||
|
||||
SendCommand(0x44); // setting X direction start/end position of RAM
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendData(0x17);
|
||||
SendData(0x01);
|
||||
|
||||
SendCommand(0x45); // setting Y direction start/end position of RAM
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendData(0xDF);
|
||||
SendData(0x01);
|
||||
|
||||
SendCommand(0x22); // Display Update Control 2
|
||||
SendData(0xCF);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: basic function for sending commands
|
||||
*/
|
||||
void Epd::SendCommand(unsigned char command) {
|
||||
DigitalWrite(dc_pin, LOW);
|
||||
SpiTransfer(command);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: basic function for sending data
|
||||
*/
|
||||
void Epd::SendData(unsigned char data) {
|
||||
DigitalWrite(dc_pin, HIGH);
|
||||
SpiTransfer(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: Wait until the busy_pin goes HIGH
|
||||
*/
|
||||
void Epd::WaitUntilIdle(void) {
|
||||
Serial.print("e-Paper busy \r\n ");
|
||||
UBYTE busy;
|
||||
do {
|
||||
busy = DigitalRead(busy_pin);
|
||||
} while(busy);
|
||||
DelayMs(200);
|
||||
Serial.print("e-Paper busy release \r\n ");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: module reset.
|
||||
* often used to awaken the module in deep sleep,
|
||||
* see Epd::Sleep();
|
||||
*/
|
||||
void Epd::Reset(void) {
|
||||
DigitalWrite(reset_pin, HIGH);
|
||||
DelayMs(20);
|
||||
DigitalWrite(reset_pin, LOW); //module reset
|
||||
DelayMs(2);
|
||||
DigitalWrite(reset_pin, HIGH);
|
||||
DelayMs(20);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Display
|
||||
******************************************************************************/
|
||||
void Epd::DisplayFrame(const UBYTE *Image, bool isBase) {
|
||||
UWORD i;
|
||||
UWORD IMAGE_COUNTER = width * height / 8;
|
||||
|
||||
SendCommand(0x4E);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendCommand(0x4F);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
|
||||
SendCommand(0x24);
|
||||
for (i = 0; i < IMAGE_COUNTER; i++) {
|
||||
SendData(pgm_read_byte(&Image[i]));
|
||||
}
|
||||
if(isBase) {
|
||||
SendCommand(0x26);
|
||||
for (i = 0; i < IMAGE_COUNTER; i++) {
|
||||
SendData(pgm_read_byte(&Image[i]));
|
||||
}
|
||||
}
|
||||
|
||||
Load_LUT(1);
|
||||
SendCommand(0x20);
|
||||
WaitUntilIdle();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Partial Display
|
||||
note:
|
||||
1. iwidth must be a multiple of 8
|
||||
2. The update will clear other parts of the image data
|
||||
******************************************************************************/
|
||||
void Epd::DisplayFrame_Partial(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD iwidth, UWORD iheight) {
|
||||
UWORD i, j;
|
||||
SendCommand(0x4E);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendCommand(0x4F);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
|
||||
SendCommand(0x24);
|
||||
for(i=0; i<EPD_WIDTH; i++) {
|
||||
for(j=0; j<EPD_HEIGHT/8; j++) {
|
||||
if(i>=Ystart && i<Ystart+iheight && j>=Xstart/8 && j<(Xstart+iwidth)/8)
|
||||
SendData(Image[(j-Xstart/8) + (i-Ystart)*iwidth/8]);
|
||||
else
|
||||
SendData(0xff);
|
||||
}
|
||||
}
|
||||
|
||||
Load_LUT(0);
|
||||
SendCommand(0x20);
|
||||
WaitUntilIdle();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends part the image buffer in RAM to e-Paper and displays
|
||||
notes:
|
||||
1. Xstart must be a multiple of 8
|
||||
1. isGC: use GC mode to clear base-image
|
||||
******************************************************************************/
|
||||
void Epd::DisplayFrame_Part(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, bool isGC)
|
||||
{
|
||||
UWORD i, Width;
|
||||
Width = (Xend-Xstart)%8 == 0 ? (Xend-Xstart)/8 : (Xend-Xstart)/8+1;
|
||||
UWORD IMAGE_COUNTER = Width * (Yend-Ystart);
|
||||
|
||||
Xend -= 1;
|
||||
Yend -= 1;
|
||||
|
||||
SendCommand(0x44);
|
||||
SendData(Xstart & 0xff);
|
||||
SendData((Xstart>>8) & 0x03);
|
||||
SendData(Xend & 0xff);
|
||||
SendData((Xend>>8) & 0x03);
|
||||
SendCommand(0x45);
|
||||
SendData(Ystart & 0xff);
|
||||
SendData((Ystart>>8) & 0x03);
|
||||
SendData(Yend & 0xff);
|
||||
SendData((Yend>>8) & 0x03);
|
||||
|
||||
SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
SendData(Xstart & 0xFF);
|
||||
|
||||
SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
|
||||
SendData(Ystart & 0xFF);
|
||||
SendData((Ystart >> 8) & 0xFF);
|
||||
|
||||
SendCommand(0x24);
|
||||
for (i = 0; i < IMAGE_COUNTER; i++)
|
||||
{
|
||||
SendData(Image[i]);
|
||||
}
|
||||
if(isGC)
|
||||
Load_LUT(1);
|
||||
else
|
||||
Load_LUT(0);
|
||||
}
|
||||
|
||||
void Epd::TurnOnDisplay(void) {
|
||||
SendCommand(0x20);
|
||||
WaitUntilIdle();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : set the look-up tables
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void Epd::Load_LUT(UBYTE mode) {
|
||||
UWORD i;
|
||||
SendCommand(0x32);
|
||||
for (i = 0; i < 105; i++) {
|
||||
if(mode == 1)
|
||||
SendData(lut_1Gray_GC[i]);
|
||||
else if(mode == 0)
|
||||
SendData(lut_1Gray_A2[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear Screen
|
||||
parameter:
|
||||
mode: 0:just partial mode
|
||||
1:clear all
|
||||
******************************************************************************/
|
||||
void Epd::Clear(UBYTE mode) {
|
||||
UWORD i;
|
||||
UWORD IMAGE_COUNTER = width * height / 8;
|
||||
|
||||
SendCommand(0x4E);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendCommand(0x4F);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
|
||||
SendCommand(0x24);
|
||||
for (i = 0; i < IMAGE_COUNTER; i++)
|
||||
{
|
||||
SendData(0xff);
|
||||
}
|
||||
if(mode)
|
||||
Load_LUT(1);
|
||||
else
|
||||
Load_LUT(0);
|
||||
SendCommand(0x20);
|
||||
WaitUntilIdle();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: After this command is transmitted, the chip would enter the
|
||||
* deep-sleep mode to save power.
|
||||
* The deep sleep mode would return to standby by hardware reset.
|
||||
* The only one parameter is a check code, the command would be
|
||||
* You can use EPD_Reset() to awaken
|
||||
*/
|
||||
void Epd::Sleep(void) {
|
||||
SendCommand(0X10); //deep sleep
|
||||
SendData(0x03);
|
||||
}
|
||||
/* END OF FILE */
|
||||
68
e-Paper/Arduino/epd3in7/epd3in7.h
Normal file
68
e-Paper/Arduino/epd3in7/epd3in7.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/**
|
||||
* @filename : epd3in7.h
|
||||
* @brief : Header file for e-paper library epd3in7.cpp
|
||||
* @author : Waveshare
|
||||
*
|
||||
* Copyright (C) Waveshare July 17 2020
|
||||
*
|
||||
* 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 EPD3IN7_H
|
||||
#define EPD3IN7_H
|
||||
|
||||
#include "epdif.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_WIDTH 480
|
||||
#define EPD_HEIGHT 280
|
||||
|
||||
#define UWORD unsigned int
|
||||
#define UBYTE unsigned char
|
||||
#define UDOUBLE unsigned long
|
||||
|
||||
class Epd : EpdIf {
|
||||
public:
|
||||
Epd();
|
||||
~Epd();
|
||||
int Init(void);
|
||||
void WaitUntilIdle(void);
|
||||
void Reset(void);
|
||||
void DisplayFrame(const UBYTE *Image, bool isBase);
|
||||
void SendCommand(unsigned char command);
|
||||
void DisplayFrame_Partial(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD iwidth, UWORD iheight);
|
||||
void DisplayFrame_Part(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, bool isGC);
|
||||
void TurnOnDisplay(void);
|
||||
void SendData(unsigned char data);
|
||||
void Sleep(void);
|
||||
void Clear(UBYTE mode);
|
||||
void Load_LUT(UBYTE mode);
|
||||
|
||||
private:
|
||||
unsigned int reset_pin;
|
||||
unsigned int dc_pin;
|
||||
unsigned int cs_pin;
|
||||
unsigned int busy_pin;
|
||||
unsigned long width;
|
||||
unsigned long height;
|
||||
};
|
||||
|
||||
#endif /* EPD3IN7_H */
|
||||
|
||||
/* END OF FILE */
|
||||
92
e-Paper/Arduino/epd3in7/epd3in7.ino
Normal file
92
e-Paper/Arduino/epd3in7/epd3in7.ino
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/**
|
||||
@filename : epd3in7-demo.ino
|
||||
@brief : 3.7inch e-paper display demo
|
||||
@author : Waveshare
|
||||
|
||||
Copyright (C) Waveshare July 17 2020
|
||||
|
||||
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 <SPI.h>
|
||||
#include "epd3in7.h"
|
||||
#include "imagedata.h"
|
||||
#include "epdpaint.h"
|
||||
|
||||
#define COLORED 0
|
||||
#define UNCOLORED 1
|
||||
|
||||
UBYTE image[700];
|
||||
Paint paint(image, 0, 0); // width should be the multiple of 8
|
||||
UDOUBLE time_start_ms;
|
||||
UDOUBLE time_now_s;
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(115200);
|
||||
Epd epd;
|
||||
if (epd.Init() != 0) {
|
||||
Serial.print("e-Paper init failed");
|
||||
return;
|
||||
}
|
||||
Serial.print("3.7inch e-paper demo\r\n ");
|
||||
Serial.print("e-Paper Clear\r\n ");
|
||||
epd.Clear(1);
|
||||
Serial.print("draw image\r\n ");
|
||||
epd.DisplayFrame(IMAGE_DATA, true); // Set base image
|
||||
delay(3000);
|
||||
|
||||
paint.SetWidth(40);
|
||||
paint.SetHeight(120);
|
||||
paint.SetRotate(ROTATE_270);
|
||||
paint.Clear(UNCOLORED);
|
||||
|
||||
UBYTE i;
|
||||
time_start_ms = millis();
|
||||
for(i=0; i<5; i++) {
|
||||
time_now_s = (millis() - time_start_ms) / 1000;
|
||||
char time_string[] = {'0', '0', ':', '0', '0', '\0'};
|
||||
time_string[0] = time_now_s / 60 / 10 + '0';
|
||||
time_string[1] = time_now_s / 60 % 10 + '0';
|
||||
time_string[3] = time_now_s % 60 / 10 + '0';
|
||||
time_string[4] = time_now_s % 60 % 10 + '0';
|
||||
|
||||
paint.Clear(UNCOLORED);
|
||||
paint.DrawStringAt(20, 10, time_string, &Font16, COLORED);
|
||||
Serial.print("refresh------\r\n ");
|
||||
// epd.DisplayFrame_Partial(paint.GetImage(), 20, 100, 40, 120); // Width must be a multiple of 8
|
||||
/* Writes new data to RAM */
|
||||
epd.DisplayFrame_Part(paint.GetImage(), 40+i*40, 30, 80+i*40, 140, false); // Xstart must be a multiple of 8
|
||||
/* Displays and toggles the RAM currently in use */
|
||||
epd.TurnOnDisplay();
|
||||
/* Writes the last data to another RAM */
|
||||
epd.DisplayFrame_Part(paint.GetImage(), 40+i*40, 30, 80+i*40, 140, false); // Xstart must be a multiple of 8
|
||||
delay(500);
|
||||
}
|
||||
|
||||
Serial.print("clear and sleep......\r\n ");
|
||||
epd.Init();
|
||||
epd.Clear(1);
|
||||
epd.Sleep();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
|
||||
}
|
||||
68
e-Paper/Arduino/epd3in7/epdif.cpp
Normal file
68
e-Paper/Arduino/epd3in7/epdif.cpp
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/**
|
||||
* @filename : epdif.cpp
|
||||
* @brief : Implements EPD interface functions
|
||||
* Users have to implement all the functions in epdif.cpp
|
||||
* @author : Yehui from Waveshare
|
||||
*
|
||||
* Copyright (C) Waveshare August 10 2017
|
||||
*
|
||||
* 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 "epdif.h"
|
||||
#include <SPI.h>
|
||||
|
||||
EpdIf::EpdIf() {
|
||||
};
|
||||
|
||||
EpdIf::~EpdIf() {
|
||||
};
|
||||
|
||||
void EpdIf::DigitalWrite(int pin, int value) {
|
||||
digitalWrite(pin, value);
|
||||
}
|
||||
|
||||
int EpdIf::DigitalRead(int pin) {
|
||||
return digitalRead(pin);
|
||||
}
|
||||
|
||||
void EpdIf::DelayMs(unsigned int delaytime) {
|
||||
delay(delaytime);
|
||||
}
|
||||
|
||||
void EpdIf::SpiTransfer(unsigned char data) {
|
||||
digitalWrite(CS_PIN, LOW);
|
||||
SPI.transfer(data);
|
||||
digitalWrite(CS_PIN, HIGH);
|
||||
}
|
||||
|
||||
int EpdIf::IfInit(void) {
|
||||
pinMode(CS_PIN, OUTPUT);
|
||||
pinMode(RST_PIN, OUTPUT);
|
||||
pinMode(DC_PIN, OUTPUT);
|
||||
pinMode(BUSY_PIN, INPUT);
|
||||
|
||||
pinMode(PWR_PIN, OUTPUT);
|
||||
DigitalWrite(PWR_PIN, 1);
|
||||
|
||||
SPI.begin();
|
||||
SPI.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0));
|
||||
return 0;
|
||||
}
|
||||
|
||||
52
e-Paper/Arduino/epd3in7/epdif.h
Normal file
52
e-Paper/Arduino/epd3in7/epdif.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* @filename : epdif.h
|
||||
* @brief : Header file of epdif.cpp providing EPD interface functions
|
||||
* Users have to implement all the functions in epdif.cpp
|
||||
* @author : Yehui from Waveshare
|
||||
*
|
||||
* Copyright (C) Waveshare August 10 2017
|
||||
*
|
||||
* 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 EPDIF_H
|
||||
#define EPDIF_H
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
// Pin definition
|
||||
#define RST_PIN 8
|
||||
#define DC_PIN 9
|
||||
#define CS_PIN 10
|
||||
#define BUSY_PIN 7
|
||||
#define PWR_PIN 6
|
||||
|
||||
class EpdIf {
|
||||
public:
|
||||
EpdIf(void);
|
||||
~EpdIf(void);
|
||||
|
||||
static int IfInit(void);
|
||||
static void DigitalWrite(int pin, int value);
|
||||
static int DigitalRead(int pin);
|
||||
static void DelayMs(unsigned int delaytime);
|
||||
static void SpiTransfer(unsigned char data);
|
||||
};
|
||||
|
||||
#endif
|
||||
342
e-Paper/Arduino/epd3in7/epdpaint.cpp
Normal file
342
e-Paper/Arduino/epd3in7/epdpaint.cpp
Normal file
|
|
@ -0,0 +1,342 @@
|
|||
/**
|
||||
* @filename : epdpaint.cpp
|
||||
* @brief : Paint tools
|
||||
* @author : Yehui from Waveshare
|
||||
*
|
||||
* Copyright (C) Waveshare September 9 2017
|
||||
*
|
||||
* 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 <avr/pgmspace.h>
|
||||
#include "epdpaint.h"
|
||||
|
||||
Paint::Paint(unsigned char* image, int width, int height) {
|
||||
this->rotate = ROTATE_0;
|
||||
this->image = image;
|
||||
/* 1 byte = 8 pixels, so the width should be the multiple of 8 */
|
||||
this->width = width % 8 ? width + 8 - (width % 8) : width;
|
||||
this->height = height;
|
||||
}
|
||||
|
||||
Paint::~Paint() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: clear the image
|
||||
*/
|
||||
void Paint::Clear(int colored) {
|
||||
for (int x = 0; x < this->width; x++) {
|
||||
for (int y = 0; y < this->height; y++) {
|
||||
DrawAbsolutePixel(x, y, colored);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: this draws a pixel by absolute coordinates.
|
||||
* this function won't be affected by the rotate parameter.
|
||||
*/
|
||||
void Paint::DrawAbsolutePixel(int x, int y, int colored) {
|
||||
if (x < 0 || x >= this->width || y < 0 || y >= this->height) {
|
||||
return;
|
||||
}
|
||||
if (IF_INVERT_COLOR) {
|
||||
if (colored) {
|
||||
image[(x + y * this->width) / 8] |= 0x80 >> (x % 8);
|
||||
} else {
|
||||
image[(x + y * this->width) / 8] &= ~(0x80 >> (x % 8));
|
||||
}
|
||||
} else {
|
||||
if (colored) {
|
||||
image[(x + y * this->width) / 8] &= ~(0x80 >> (x % 8));
|
||||
} else {
|
||||
image[(x + y * this->width) / 8] |= 0x80 >> (x % 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: Getters and Setters
|
||||
*/
|
||||
unsigned char* Paint::GetImage(void) {
|
||||
return this->image;
|
||||
}
|
||||
|
||||
int Paint::GetWidth(void) {
|
||||
return this->width;
|
||||
}
|
||||
|
||||
void Paint::SetWidth(int width) {
|
||||
this->width = width % 8 ? width + 8 - (width % 8) : width;
|
||||
}
|
||||
|
||||
int Paint::GetHeight(void) {
|
||||
return this->height;
|
||||
}
|
||||
|
||||
void Paint::SetHeight(int height) {
|
||||
this->height = height;
|
||||
}
|
||||
|
||||
int Paint::GetRotate(void) {
|
||||
return this->rotate;
|
||||
}
|
||||
|
||||
void Paint::SetRotate(int rotate){
|
||||
this->rotate = rotate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: this draws a pixel by the coordinates
|
||||
*/
|
||||
void Paint::DrawPixel(int x, int y, int colored) {
|
||||
int point_temp;
|
||||
if (this->rotate == ROTATE_0) {
|
||||
if(x < 0 || x >= this->width || y < 0 || y >= this->height) {
|
||||
return;
|
||||
}
|
||||
DrawAbsolutePixel(x, y, colored);
|
||||
} else if (this->rotate == ROTATE_90) {
|
||||
if(x < 0 || x >= this->height || y < 0 || y >= this->width) {
|
||||
return;
|
||||
}
|
||||
point_temp = x;
|
||||
x = this->width - y;
|
||||
y = point_temp;
|
||||
DrawAbsolutePixel(x, y, colored);
|
||||
} else if (this->rotate == ROTATE_180) {
|
||||
if(x < 0 || x >= this->width || y < 0 || y >= this->height) {
|
||||
return;
|
||||
}
|
||||
x = this->width - x;
|
||||
y = this->height - y;
|
||||
DrawAbsolutePixel(x, y, colored);
|
||||
} else if (this->rotate == ROTATE_270) {
|
||||
if(x < 0 || x >= this->height || y < 0 || y >= this->width) {
|
||||
return;
|
||||
}
|
||||
point_temp = x;
|
||||
x = y;
|
||||
y = this->height - point_temp;
|
||||
DrawAbsolutePixel(x, y, colored);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: this draws a charactor on the frame buffer but not refresh
|
||||
*/
|
||||
void Paint::DrawCharAt(int x, int y, char ascii_char, sFONT* font, int colored) {
|
||||
int i, j;
|
||||
unsigned int char_offset = (ascii_char - ' ') * font->Height * (font->Width / 8 + (font->Width % 8 ? 1 : 0));
|
||||
const unsigned char* ptr = &font->table[char_offset];
|
||||
|
||||
for (j = 0; j < font->Height; j++) {
|
||||
for (i = 0; i < font->Width; i++) {
|
||||
if (pgm_read_byte(ptr) & (0x80 >> (i % 8))) {
|
||||
DrawPixel(x + i, y + j, colored);
|
||||
}
|
||||
if (i % 8 == 7) {
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
if (font->Width % 8 != 0) {
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: this displays a string on the frame buffer but not refresh
|
||||
*/
|
||||
void Paint::DrawStringAt(int x, int y, const char* text, sFONT* font, int colored) {
|
||||
const char* p_text = text;
|
||||
unsigned int counter = 0;
|
||||
int refcolumn = x;
|
||||
|
||||
/* Send the string character by character on EPD */
|
||||
while (*p_text != 0) {
|
||||
/* Display one character on EPD */
|
||||
DrawCharAt(refcolumn, y, *p_text, font, colored);
|
||||
/* Decrement the column position by 16 */
|
||||
refcolumn += font->Width;
|
||||
/* Point on the next character */
|
||||
p_text++;
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: this draws a line on the frame buffer
|
||||
*/
|
||||
void Paint::DrawLine(int x0, int y0, int x1, int y1, int colored) {
|
||||
/* Bresenham algorithm */
|
||||
int dx = x1 - x0 >= 0 ? x1 - x0 : x0 - x1;
|
||||
int sx = x0 < x1 ? 1 : -1;
|
||||
int dy = y1 - y0 <= 0 ? y1 - y0 : y0 - y1;
|
||||
int sy = y0 < y1 ? 1 : -1;
|
||||
int err = dx + dy;
|
||||
|
||||
while((x0 != x1) && (y0 != y1)) {
|
||||
DrawPixel(x0, y0 , colored);
|
||||
if (2 * err >= dy) {
|
||||
err += dy;
|
||||
x0 += sx;
|
||||
}
|
||||
if (2 * err <= dx) {
|
||||
err += dx;
|
||||
y0 += sy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: this draws a horizontal line on the frame buffer
|
||||
*/
|
||||
void Paint::DrawHorizontalLine(int x, int y, int line_width, int colored) {
|
||||
int i;
|
||||
for (i = x; i < x + line_width; i++) {
|
||||
DrawPixel(i, y, colored);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: this draws a vertical line on the frame buffer
|
||||
*/
|
||||
void Paint::DrawVerticalLine(int x, int y, int line_height, int colored) {
|
||||
int i;
|
||||
for (i = y; i < y + line_height; i++) {
|
||||
DrawPixel(x, i, colored);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: this draws a rectangle
|
||||
*/
|
||||
void Paint::DrawRectangle(int x0, int y0, int x1, int y1, int colored) {
|
||||
int min_x, min_y, max_x, max_y;
|
||||
min_x = x1 > x0 ? x0 : x1;
|
||||
max_x = x1 > x0 ? x1 : x0;
|
||||
min_y = y1 > y0 ? y0 : y1;
|
||||
max_y = y1 > y0 ? y1 : y0;
|
||||
|
||||
DrawHorizontalLine(min_x, min_y, max_x - min_x + 1, colored);
|
||||
DrawHorizontalLine(min_x, max_y, max_x - min_x + 1, colored);
|
||||
DrawVerticalLine(min_x, min_y, max_y - min_y + 1, colored);
|
||||
DrawVerticalLine(max_x, min_y, max_y - min_y + 1, colored);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: this draws a filled rectangle
|
||||
*/
|
||||
void Paint::DrawFilledRectangle(int x0, int y0, int x1, int y1, int colored) {
|
||||
int min_x, min_y, max_x, max_y;
|
||||
int i;
|
||||
min_x = x1 > x0 ? x0 : x1;
|
||||
max_x = x1 > x0 ? x1 : x0;
|
||||
min_y = y1 > y0 ? y0 : y1;
|
||||
max_y = y1 > y0 ? y1 : y0;
|
||||
|
||||
for (i = min_x; i <= max_x; i++) {
|
||||
DrawVerticalLine(i, min_y, max_y - min_y + 1, colored);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: this draws a circle
|
||||
*/
|
||||
void Paint::DrawCircle(int x, int y, int radius, int colored) {
|
||||
/* Bresenham algorithm */
|
||||
int x_pos = -radius;
|
||||
int y_pos = 0;
|
||||
int err = 2 - 2 * radius;
|
||||
int e2;
|
||||
|
||||
do {
|
||||
DrawPixel(x - x_pos, y + y_pos, colored);
|
||||
DrawPixel(x + x_pos, y + y_pos, colored);
|
||||
DrawPixel(x + x_pos, y - y_pos, colored);
|
||||
DrawPixel(x - x_pos, y - y_pos, colored);
|
||||
e2 = err;
|
||||
if (e2 <= y_pos) {
|
||||
err += ++y_pos * 2 + 1;
|
||||
if(-x_pos == y_pos && e2 <= x_pos) {
|
||||
e2 = 0;
|
||||
}
|
||||
}
|
||||
if (e2 > x_pos) {
|
||||
err += ++x_pos * 2 + 1;
|
||||
}
|
||||
} while (x_pos <= 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: this draws a filled circle
|
||||
*/
|
||||
void Paint::DrawFilledCircle(int x, int y, int radius, int colored) {
|
||||
/* Bresenham algorithm */
|
||||
int x_pos = -radius;
|
||||
int y_pos = 0;
|
||||
int err = 2 - 2 * radius;
|
||||
int e2;
|
||||
|
||||
do {
|
||||
DrawPixel(x - x_pos, y + y_pos, colored);
|
||||
DrawPixel(x + x_pos, y + y_pos, colored);
|
||||
DrawPixel(x + x_pos, y - y_pos, colored);
|
||||
DrawPixel(x - x_pos, y - y_pos, colored);
|
||||
DrawHorizontalLine(x + x_pos, y + y_pos, 2 * (-x_pos) + 1, colored);
|
||||
DrawHorizontalLine(x + x_pos, y - y_pos, 2 * (-x_pos) + 1, colored);
|
||||
e2 = err;
|
||||
if (e2 <= y_pos) {
|
||||
err += ++y_pos * 2 + 1;
|
||||
if(-x_pos == y_pos && e2 <= x_pos) {
|
||||
e2 = 0;
|
||||
}
|
||||
}
|
||||
if(e2 > x_pos) {
|
||||
err += ++x_pos * 2 + 1;
|
||||
}
|
||||
} while(x_pos <= 0);
|
||||
}
|
||||
|
||||
/* END OF FILE */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
75
e-Paper/Arduino/epd3in7/epdpaint.h
Normal file
75
e-Paper/Arduino/epd3in7/epdpaint.h
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/**
|
||||
* @filename : epdpaint.h
|
||||
* @brief : Header file for epdpaint.cpp
|
||||
* @author : Yehui from Waveshare
|
||||
*
|
||||
* Copyright (C) Waveshare July 28 2017
|
||||
*
|
||||
* 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 EPDPAINT_H
|
||||
#define EPDPAINT_H
|
||||
|
||||
// Display orientation
|
||||
#define ROTATE_0 0
|
||||
#define ROTATE_90 1
|
||||
#define ROTATE_180 2
|
||||
#define ROTATE_270 3
|
||||
|
||||
// Color inverse. 1 or 0 = set or reset a bit if set a colored pixel
|
||||
#define IF_INVERT_COLOR 1
|
||||
|
||||
#include "fonts.h"
|
||||
|
||||
class Paint {
|
||||
public:
|
||||
Paint(unsigned char* image, int width, int height);
|
||||
~Paint();
|
||||
void Clear(int colored);
|
||||
int GetWidth(void);
|
||||
void SetWidth(int width);
|
||||
int GetHeight(void);
|
||||
void SetHeight(int height);
|
||||
int GetRotate(void);
|
||||
void SetRotate(int rotate);
|
||||
unsigned char* GetImage(void);
|
||||
void DrawAbsolutePixel(int x, int y, int colored);
|
||||
void DrawPixel(int x, int y, int colored);
|
||||
void DrawCharAt(int x, int y, char ascii_char, sFONT* font, int colored);
|
||||
void DrawStringAt(int x, int y, const char* text, sFONT* font, int colored);
|
||||
void DrawLine(int x0, int y0, int x1, int y1, int colored);
|
||||
void DrawHorizontalLine(int x, int y, int width, int colored);
|
||||
void DrawVerticalLine(int x, int y, int height, int colored);
|
||||
void DrawRectangle(int x0, int y0, int x1, int y1, int colored);
|
||||
void DrawFilledRectangle(int x0, int y0, int x1, int y1, int colored);
|
||||
void DrawCircle(int x, int y, int radius, int colored);
|
||||
void DrawFilledCircle(int x, int y, int radius, int colored);
|
||||
|
||||
private:
|
||||
unsigned char* image;
|
||||
int width;
|
||||
int height;
|
||||
int rotate;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* END OF FILE */
|
||||
|
||||
1385
e-Paper/Arduino/epd3in7/font12.cpp
Normal file
1385
e-Paper/Arduino/epd3in7/font12.cpp
Normal file
File diff suppressed because it is too large
Load diff
1765
e-Paper/Arduino/epd3in7/font16.cpp
Normal file
1765
e-Paper/Arduino/epd3in7/font16.cpp
Normal file
File diff suppressed because it is too large
Load diff
2143
e-Paper/Arduino/epd3in7/font20.cpp
Normal file
2143
e-Paper/Arduino/epd3in7/font20.cpp
Normal file
File diff suppressed because it is too large
Load diff
2521
e-Paper/Arduino/epd3in7/font24.cpp
Normal file
2521
e-Paper/Arduino/epd3in7/font24.cpp
Normal file
File diff suppressed because it is too large
Load diff
1005
e-Paper/Arduino/epd3in7/font8.cpp
Normal file
1005
e-Paper/Arduino/epd3in7/font8.cpp
Normal file
File diff suppressed because it is too large
Load diff
65
e-Paper/Arduino/epd3in7/fonts.h
Normal file
65
e-Paper/Arduino/epd3in7/fonts.h
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file fonts.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 18-February-2014
|
||||
* @brief Header for fonts.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __FONTS_H
|
||||
#define __FONTS_H
|
||||
|
||||
/* Max size of bitmap will based on a font24 (17x24) */
|
||||
#define MAX_HEIGHT_FONT 24
|
||||
#define MAX_WIDTH_FONT 17
|
||||
#define OFFSET_BITMAP 54
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
|
||||
struct sFONT {
|
||||
const uint8_t *table;
|
||||
uint16_t Width;
|
||||
uint16_t Height;
|
||||
};
|
||||
|
||||
extern sFONT Font24;
|
||||
extern sFONT Font20;
|
||||
extern sFONT Font16;
|
||||
extern sFONT Font12;
|
||||
extern sFONT Font8;
|
||||
|
||||
#endif /* __FONTS_H */
|
||||
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
1082
e-Paper/Arduino/epd3in7/imagedata.cpp
Normal file
1082
e-Paper/Arduino/epd3in7/imagedata.cpp
Normal file
File diff suppressed because it is too large
Load diff
28
e-Paper/Arduino/epd3in7/imagedata.h
Normal file
28
e-Paper/Arduino/epd3in7/imagedata.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* @filename : imagedata.h
|
||||
* @brief : head file for imagedata.cpp
|
||||
*
|
||||
* Copyright (C) Waveshare July 17 2020
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
extern const unsigned char IMAGE_DATA[]; //1-Gray 480*280
|
||||
|
||||
/* FILE END */
|
||||
Loading…
Add table
Add a link
Reference in a new issue