From ab55151a9d5d8b5a142f3a3051ba933ec331fd4a Mon Sep 17 00:00:00 2001 From: UnknownObject Date: Sat, 27 May 2023 18:01:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/arduino.json | 6 + .vscode/c_cpp_properties.json | 551 ++++++++++++++++++++++++++++ 2021_Arduino_Demo.ino | 90 +++++ 2021_Arduino_Demo.sln | 25 ++ 2021_Arduino_Demo.vcxproj | 134 +++++++ 2021_Arduino_Demo.vcxproj.filters | 60 +++ AccurateMotor.cpp | 93 +++++ AccurateMotor.h | 42 +++ DebugOpt.cpp | 133 +++++++ DebugOpt.h | 50 +++ GlobalDatas.cpp | 41 +++ GlobalDatas.h | 48 +++ Handler.cpp | 201 ++++++++++ Handler.h | 30 ++ OpenMVOpt.cpp | 167 +++++++++ OpenMVOpt.h | 32 ++ __vm/.2021_Arduino_Demo.vsarduino.h | 93 +++++ __vm/.Arduino.vsarduino.h | 92 +++++ __vm/Compile.vmps.xml | 12 + __vm/Configuration.Release.vmps.xml | 9 + __vm/Upload.vmps.xml | 12 + 21 files changed, 1921 insertions(+) create mode 100644 .vscode/arduino.json create mode 100644 .vscode/c_cpp_properties.json create mode 100644 2021_Arduino_Demo.ino create mode 100644 2021_Arduino_Demo.sln create mode 100644 2021_Arduino_Demo.vcxproj create mode 100644 2021_Arduino_Demo.vcxproj.filters create mode 100644 AccurateMotor.cpp create mode 100644 AccurateMotor.h create mode 100644 DebugOpt.cpp create mode 100644 DebugOpt.h create mode 100644 GlobalDatas.cpp create mode 100644 GlobalDatas.h create mode 100644 Handler.cpp create mode 100644 Handler.h create mode 100644 OpenMVOpt.cpp create mode 100644 OpenMVOpt.h create mode 100644 __vm/.2021_Arduino_Demo.vsarduino.h create mode 100644 __vm/.Arduino.vsarduino.h create mode 100644 __vm/Compile.vmps.xml create mode 100644 __vm/Configuration.Release.vmps.xml create mode 100644 __vm/Upload.vmps.xml diff --git a/.vscode/arduino.json b/.vscode/arduino.json new file mode 100644 index 0000000..87a3abb --- /dev/null +++ b/.vscode/arduino.json @@ -0,0 +1,6 @@ +{ + "port": "COM12", + "configuration": "cpu=atmega2560", + "board": "arduino:avr:mega", + "sketch": "2021_Arduino_Demo.ino" +} \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..b87c7bc --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,551 @@ +{ + "version": 4, + "configurations": [ + { + "name": "Arduino", + "compilerPath": "C:\\Users\\BKRC-WQ\\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\\BKRC-WQ\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.4\\cores\\arduino", + "C:\\Users\\BKRC-WQ\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.4\\variants\\mega", + "C:\\Users\\BKRC-WQ\\Desktop\\libraries\\DCMotor", + "C:\\Users\\BKRC-WQ\\Desktop\\libraries\\CoreLED", + "C:\\Users\\BKRC-WQ\\Desktop\\libraries\\CoreKEY", + "C:\\Users\\BKRC-WQ\\Desktop\\libraries\\CoreBeep", + "C:\\Users\\BKRC-WQ\\Desktop\\libraries\\ExtSRAMInterface", + "C:\\Users\\BKRC-WQ\\Desktop\\libraries\\LED", + "C:\\Users\\BKRC-WQ\\Desktop\\libraries\\BH1750", + "C:\\Users\\BKRC-WQ\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.4\\libraries\\Wire\\src", + "C:\\Users\\BKRC-WQ\\Desktop\\libraries\\Command", + "C:\\Users\\BKRC-WQ\\Desktop\\libraries\\BEEP", + "C:\\Users\\BKRC-WQ\\Desktop\\libraries\\Infrares", + "C:\\Users\\BKRC-WQ\\Desktop\\libraries\\Ultrasonic", + "C:\\Users\\BKRC-WQ\\Desktop\\libraries\\BKRC_Voice", + "C:\\Users\\BKRC-WQ\\Desktop\\libraries\\Metro", + "c:\\users\\bkrc-wq\\appdata\\local\\arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7\\lib\\gcc\\avr\\7.3.0\\include", + "c:\\users\\bkrc-wq\\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\\bkrc-wq\\appdata\\local\\arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7\\avr\\include" + ], + "forcedInclude": [ + "C:\\Users\\BKRC-WQ\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.4\\cores\\arduino\\Arduino.h" + ], + "cStandard": "c11", + "cppStandard": "c++11", + "defines": [ + "F_CPU=16000000L", + "ARDUINO=10813", + "ARDUINO_AVR_MEGA2560", + "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" + ] + } + ] +} \ No newline at end of file diff --git a/2021_Arduino_Demo.ino b/2021_Arduino_Demo.ino new file mode 100644 index 0000000..c8b26c8 --- /dev/null +++ b/2021_Arduino_Demo.ino @@ -0,0 +1,90 @@ +#include +#include "AccurateMotor.h" +#include +#include +#include "GlobalDatas.h" +#include +#include +#include +#include +#include +#include "Handler.h" +#include +#include + +void setup() +{ + Serial.begin(115200); + CoreLED.Initialization(); + CoreKEY.Initialization(); + CoreBeep.Initialization(); + ExtSRAMInterface.Initialization(); + LED.Initialization(); + BH1750.Initialization(); + BEEP.Initialization(); + Infrare.Initialization(); + Ultrasonic.Initialization(); + DCMotor.Initialization(30000); + BKRC_Voice.Initialization(); + + while (!Serial); + sendflag = 0; + frisrtime = 0; + Tcount = 0; +} + +void loop() +{ + uint8_t si = 0; + frisrtime = millis(); + + CoreKEY.Kwhile(Handler::KEY_Handler); //按键检测 + + if (ExtSRAMInterface.ExMem_Read(0x6100) != 0x00) //从车接收ZigBee数据 + { + ExtSRAMInterface.ExMem_Read_Bytes(ZigBee_command, 8); + ZigBee_judge = ZigBee_command[6]; //获取校验和 + Command.Judgment(ZigBee_command); //计算校验和 + if ((ZigBee_judge == ZigBee_command[6]) && (ZigBee_command[0] == 0x55) && (ZigBee_command[7] == 0xBB)) + Handler::ZigBeeRx_Handler(ZigBee_command); //ZigBee接收数据处理 + } + + if (ExtSRAMInterface.ExMem_Read(0x6038) != 0x00) //检测OpenMV识别结果 + { + Data_Type = ExtSRAMInterface.ExMem_Read(0x603A); + Data_Flag = ExtSRAMInterface.ExMem_Read(0x603B); + Data_Length = ExtSRAMInterface.ExMem_Read(0x603C); + Data_Length = Data_Length + 6; + ExtSRAMInterface.ExMem_Read_Bytes(0x6038, Data_OTABuf, Data_Length); + if ((Data_OTABuf[0] == 0x55) && (Data_OTABuf[1] == 0x02)) + { + ExtSRAMInterface.ExMem_Write_Bytes(0x6180, Data_OTABuf, Data_Length); //使用自定义数据区上传OpenMV识别结果 + Handler::OpenMVRx_Handler(Data_OTABuf); //接收OpenMV,数据处理函数 + } + } + + if (((millis() - frisrtime >= TSendCycle) || (Tcount >= TSendCycle)) && (sendflag == 1)) //获取、上传任务版数据 + { + uint16_t tp = (uint16_t)(Ultrasonic.Ranging(CM) * 10.0); + ZigBee_back[5] = (tp >> 8) & 0xff; + ZigBee_back[4] = tp & 0xff; + + tp = BH1750.ReadLightLevel(); + ZigBee_back[7] = (tp >> 8) & 0xff; + ZigBee_back[6] = tp & 0xff; + + ZigBee_back[9] = (uint8_t)ExtSRAMInterface.ExMem_Read(0x6003); + if (ZigBee_back[9] >= 0x80) ZigBee_back[9] = 0xff - ZigBee_back[9]; + ZigBee_back[8] = (uint8_t)ExtSRAMInterface.ExMem_Read(0x6002); + + ExtSRAMInterface.ExMem_Write_Bytes(0x6080, ZigBee_back, 16); + Tcount = 0x00; + } + else if (sendflag == 1) + { + Tcount += (millis() - frisrtime); + } + + //空闲时进行流水灯 + DebugOpt::DoLEDFlow(); +} \ No newline at end of file diff --git a/2021_Arduino_Demo.sln b/2021_Arduino_Demo.sln new file mode 100644 index 0000000..93677ab --- /dev/null +++ b/2021_Arduino_Demo.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33122.133 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "2021_Arduino_Demo", "2021_Arduino_Demo.vcxproj", "{C5F80730-F44F-4478-BDAE-6634EFC2CA88}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C5F80730-F44F-4478-BDAE-6634EFC2CA88}.Debug|x86.ActiveCfg = Debug|Win32 + {C5F80730-F44F-4478-BDAE-6634EFC2CA88}.Debug|x86.Build.0 = Debug|Win32 + {C5F80730-F44F-4478-BDAE-6634EFC2CA88}.Release|x86.ActiveCfg = Release|Win32 + {C5F80730-F44F-4478-BDAE-6634EFC2CA88}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B8FFB700-F86B-4323-8C57-B79DE3B46041} + EndGlobalSection +EndGlobal diff --git a/2021_Arduino_Demo.vcxproj b/2021_Arduino_Demo.vcxproj new file mode 100644 index 0000000..a1639d7 --- /dev/null +++ b/2021_Arduino_Demo.vcxproj @@ -0,0 +1,134 @@ + + + + + Release + Win32 + + + Debug + Win32 + + + + {C5F80730-F44F-4478-BDAE-6634EFC2CA88} + + + 2021_Arduino_Demo + + + + Application + true + MultiByte + + + + + Application + false + true + MultiByte + v143 + + + Application + true + MultiByte + + + + + Application + false + true + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + Level3 + MaxSpeed + true + true + true + $(ProjectDir)__vm\.Arduino.vsarduino.h;%(ForcedIncludeFiles) + __AVR_atmega2560__;__AVR_ATmega2560__;F_CPU=16000000L;ARDUINO=108010;ARDUINO_AVR_MEGA2560;ARDUINO_ARCH_AVR;__cplusplus=201103L;_VMICRO_INTELLISENSE;%(PreprocessorDefinitions) + stdcpp17 + stdc11 + $(ProjectDir)..\Arduino;G:\Users\15819\Documents\Arduino\libraries\ExtSRAMInterface;G:\Users\15819\Documents\Arduino\libraries\DCMotor;G:\Users\15819\Documents\Arduino\libraries\MsTimer2;G:\Users\15819\Documents\Arduino\libraries\Ultrasonic;G:\Users\15819\Documents\Arduino\libraries\BKRC_Voice;C:\Users\15819\AppData\Local\arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src;G:\Users\15819\Documents\Arduino\libraries\CoreBeep;G:\Users\15819\Documents\Arduino\libraries\CoreKEY;G:\Users\15819\Documents\Arduino\libraries\CoreLED;G:\Users\15819\Documents\Arduino\libraries\Command;G:\Users\15819\Documents\Arduino\libraries\Infrares;G:\Users\15819\Documents\Arduino\libraries\BEEP;G:\Users\15819\Documents\Arduino\libraries\LED;G:\Users\15819\Documents\Arduino\libraries\BH1750;G:\Users\15819\Documents\Arduino\libraries\Metro;C:\Users\15819\AppData\Local\arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src\utility;C:\Users\15819\AppData\Local\arduino15\packages\arduino\hardware\avr\1.8.6\variants\mega;C:\Users\15819\AppData\Local\arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino;$(ProjectDir)..\..\..\RACECA~1\SUBCAR~1\Arduino;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\\lib\gcc\avr\7.3.0\include;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\\lib\gcc\avr\7.3.0\include;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include-fixed;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\lib\gcc\avr\4.9.2\include;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\lib\gcc\avr\4.9.2\include;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\lib\gcc\avr\4.9.3\include;%(AdditionalIncludeDirectories) + + + true + true + true + + + + + Level3 + Disabled + true + %(AdditionalIncludeDirectories) + %(ForcedIncludeFiles) + true + %(PreprocessorDefinitions) + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + VisualMicroDebugger + + + + + + + + + + \ No newline at end of file diff --git a/2021_Arduino_Demo.vcxproj.filters b/2021_Arduino_Demo.vcxproj.filters new file mode 100644 index 0000000..e7ff4b8 --- /dev/null +++ b/2021_Arduino_Demo.vcxproj.filters @@ -0,0 +1,60 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/AccurateMotor.cpp b/AccurateMotor.cpp new file mode 100644 index 0000000..c920ef3 --- /dev/null +++ b/AccurateMotor.cpp @@ -0,0 +1,93 @@ +#include "AccurateMotor.h" + +void AccurateMotorClass::Init() +{ + car_running = false; +} + +void AccurateMotorClass::SetCarRunning() +{ + AccurateMotor.car_running = true; +} + +void AccurateMotorClass::SetCarNotRunning() +{ + AccurateMotor.car_running = false; +} + +void AccurateMotorClass::TurnLeft(uint8_t degree) +{ + if (car_running) + return; + DCMotor.TurnLeft(car_speed, car_speed); + SetCarRunning(); + MsTimer2::set(degree * 50, []() + { + { + DCMotor.Stop(); + SetCarNotRunning(); + } + }); + MsTimer2::start(); +} + +void AccurateMotorClass::TurnRight(uint8_t degree) +{ + if (car_running) + return; + DCMotor.TurnRight(car_speed, car_speed); + SetCarRunning(); + MsTimer2::set(degree * 50, []() + { + { + DCMotor.Stop(); + SetCarNotRunning(); + } + }); + MsTimer2::start(); +} + +void AccurateMotorClass::RunForward(uint8_t distence) +{ + if (car_running) + return; + DCMotor.Go(car_speed); + SetCarRunning(); + MsTimer2::set(distence * 100, []() + { + { + DCMotor.Stop(); + SetCarNotRunning(); + } + }); + MsTimer2::start(); +} + +bool AccurateMotorClass::IsCarRunning() +{ + return car_running; +} + +void AccurateMotorClass::DelayUntilCarStop() +{ + while (car_running) + delay(10); +} + +void AccurateMotorClass::RunBackward(uint8_t distence) +{ + if (car_running) + return; + DCMotor.Back(car_speed); + SetCarRunning(); + MsTimer2::set(distence * 100, []() + { + { + DCMotor.Stop(); + SetCarNotRunning(); + } + }); + MsTimer2::start(); +} + +AccurateMotorClass AccurateMotor; \ No newline at end of file diff --git a/AccurateMotor.h b/AccurateMotor.h new file mode 100644 index 0000000..fbf2a14 --- /dev/null +++ b/AccurateMotor.h @@ -0,0 +1,42 @@ +// AccurateMotor.h +/* +* ȷĵ࣬ͨʱжϵʽ̲ɿ +*/ + +#ifndef _ACCURATEMOTOR_h +#define _ACCURATEMOTOR_h + +#if defined(ARDUINO) && ARDUINO >= 100 + #include "arduino.h" +#else + #include "WProgram.h" +#endif + +#include +#include + +class AccurateMotorClass +{ +private: + bool car_running; + const uint8_t car_speed = 100; + +private: + static void SetCarRunning(); + static void SetCarNotRunning(); + + public: + void Init(); + bool IsCarRunning(); + void DelayUntilCarStop(); + +public: + void TurnLeft(uint8_t degree); + void TurnRight(uint8_t degree); + void RunForward(uint8_t distence); + void RunBackward(uint8_t distence); +}; + +extern AccurateMotorClass AccurateMotor; + +#endif \ No newline at end of file diff --git a/DebugOpt.cpp b/DebugOpt.cpp new file mode 100644 index 0000000..01185a8 --- /dev/null +++ b/DebugOpt.cpp @@ -0,0 +1,133 @@ +#include "DebugOpt.h" + +uint8_t DebugOpt::led_flow_cnt = 0; +uint8_t DebugOpt::open_road_buf[8] = { 0x55,0x03,0x01,0x01,0x00,0x00,0x00,0xBB }; +uint8_t DebugOpt::voive_test_buf[9] = { 0xFD,0x00,0x06,0x01,0x01,0xC4,0xFA,0xBA,0xC3 }; +uint8_t DebugOpt::voice_trm_buf[8] = { 0xAF,0x06,0x00,0x02,0x00,0x00,0x01,0xBB }; +uint8_t DebugOpt::ir_repo_buf[6] = { 0x03,0x05,0x14,0x45,0xDE,0x92 }; + +void DebugOpt::DoLEDFlow() +{ + switch (led_flow_cnt) + { + case 0: + CoreLED.TurnOn(LED1); + CoreLED.TurnOff(LED2); + CoreLED.TurnOff(LED3); + CoreLED.TurnOff(LED4); + + LED.LeftTurnOn(); + LED.RightTurnOff(); + + digitalWrite(LED_BUILTIN, HIGH); + break; + case 1: + CoreLED.TurnOff(LED1); + CoreLED.TurnOn(LED2); + CoreLED.TurnOff(LED3); + CoreLED.TurnOff(LED4); + + LED.LeftTurnOff(); + LED.RightTurnOn(); + + digitalWrite(LED_BUILTIN, LOW); + break; + case 2: + CoreLED.TurnOff(LED1); + CoreLED.TurnOff(LED2); + CoreLED.TurnOn(LED3); + CoreLED.TurnOff(LED4); + + LED.LeftTurnOn(); + LED.RightTurnOff(); + + digitalWrite(LED_BUILTIN, LOW); + break; + case 3: + CoreLED.TurnOff(LED1); + CoreLED.TurnOff(LED2); + CoreLED.TurnOff(LED3); + CoreLED.TurnOn(LED4); + + LED.LeftTurnOff(); + LED.RightTurnOn(); + + digitalWrite(LED_BUILTIN, LOW); + break; + } + led_flow_cnt++; + if (led_flow_cnt >= 4) + led_flow_cnt = 0; + delay(200); +} + +void DebugOpt::DebugRun() +{ + Serial.println("Hello Accurate DCMotor."); + LED.LeftTurnOn(); + LED.RightTurnOn(); + BEEP.TurnOn(); + delay(100); + BEEP.TurnOff(); + /*DCMotor.Go(100, 100); + DCMotor.Stop(); + DCMotor.Back(100, 100); + DCMotor.Stop(); + DCMotor.TurnLeft_Code(200, 100); + DCMotor.Stop(); + DCMotor.TurnRight_Code(200, 100); + DCMotor.Stop();*/ + AccurateMotor.RunForward(10); + AccurateMotor.DelayUntilCarStop(); + AccurateMotor.RunBackward(10); + AccurateMotor.DelayUntilCarStop(); + AccurateMotor.TurnLeft(20); + AccurateMotor.DelayUntilCarStop(); + AccurateMotor.TurnRight(20); + AccurateMotor.DelayUntilCarStop(); + BEEP.TurnOn(); + delay(100); + BEEP.TurnOff(); + LED.LeftTurnOff(); + LED.RightTurnOff(); +} + +void DebugOpt::DebugServo() +{ + Serial.println("Hello Servo."); + for (int i = -80; i <= 20; i++) + { + OpenMVOpt::Servo_Control(i); + delay(50); + } + OpenMVOpt::Servo_Control(0); +} + +void DebugOpt::Road_Gate_Test() +{ + Command.Judgment(open_road_buf); //У + ExtSRAMInterface.ExMem_Write_Bytes(0x6008, open_road_buf, 8); +} + +void DebugOpt::Speech_Sounds_Ctr() +{ + ExtSRAMInterface.ExMem_Write_Bytes(0x6180, voive_test_buf, 13); +} + +void DebugOpt::Speech_Disc() +{ + uint8_t sph_id = 0; + /*0Ϊ־ʶ + 2-6Ϊָʶ𣬾Ϣɲ鿴ͨЭ*/ + sph_id = BKRC_Voice.BKRC_Voice_Extern(0); + delay(200); + Serial.print("ʶ𵽵ĴIDΪ"); + Serial.println(sph_id, HEX); + voice_trm_buf[2] = sph_id; + ExtSRAMInterface.ExMem_Write_Bytes(0x6008, voice_trm_buf, 8);//ϴʶն +} + +void DebugOpt::Infrared_Test() +{ + Infrare.Transmition(ir_repo_buf, 6); +} diff --git a/DebugOpt.h b/DebugOpt.h new file mode 100644 index 0000000..a7fc883 --- /dev/null +++ b/DebugOpt.h @@ -0,0 +1,50 @@ +#ifndef __DEBUG_OPT__ +#define __DEBUG_OPT_ + +#include +#include "AccurateMotor.h" +#include "GlobalDatas.h" +#include +#include "OpenMVOpt.h" +#include +#include +#include +#include +#include + +namespace DebugOpt +{ + //LEDˮƼ + extern uint8_t led_flow_cnt; + //բָ + extern uint8_t open_road_buf[8]; + //ָ + extern uint8_t voive_test_buf[9]; + //ʶָ + extern uint8_t voice_trm_buf[8]; + //ָ + extern uint8_t ir_repo_buf[6]; + + //LEDˮ + void DoLEDFlow(); + + //в + void DebugRun(); + + //в + void DebugServo(); + + //բ + void Road_Gate_Test(); + + // + void Speech_Sounds_Ctr(); + + //ʶ + void Speech_Disc(); + + //ⷢͲ + void Infrared_Test(); +}; + +#endif \ No newline at end of file diff --git a/GlobalDatas.cpp b/GlobalDatas.cpp new file mode 100644 index 0000000..2324a33 --- /dev/null +++ b/GlobalDatas.cpp @@ -0,0 +1,41 @@ +#include "GlobalDatas.h" + +uint8_t GarageB_To1[8] = { 0x55,0x05,0x01,0x01,0x00,0x00,0x02,0xBB }; // 峵B һ +uint8_t GarageB_To2[8] = { 0x55,0x05,0x01,0x02,0x00,0x00,0x03,0xBB }; // 峵B ڶ +uint8_t GarageB_To3[8] = { 0x55,0x05,0x01,0x03,0x00,0x00,0x04,0xBB }; // 峵B +uint8_t GarageB_To4[8] = { 0x55,0x05,0x01,0x04,0x00,0x00,0x05,0xBB }; // 峵B IJ + +uint8_t TrafficA_Open[8] = { 0x55,0x0E,0x01,0x00,0x00,0x00,0x01,0xBB }; // ܽͨA ʶģʽ ʶģʽ +uint8_t TrafficA_Red[8] = { 0x55,0x0E,0x02,0x01,0x00,0x00,0x03,0xBB }; // ܽͨA ʶΪɫȷ +uint8_t TrafficA_Green[8] = { 0x55,0x0E,0x02,0x02,0x00,0x00,0x04,0xBB }; // ܽͨA ʶΪɫȷ +uint8_t TrafficA_Yellow[8] = { 0x55,0x0E,0x02,0x03,0x00,0x00,0x05,0xBB }; // ܽͨA ʶΪɫȷ + +uint8_t Gate_Open[8] = { 0x55,0x03,0x01,0x01,0x00,0x00,0x02,0xBB }; // բ + +uint8_t Light_plus1[4] = { 0x00,0xFF,0x0C,~(0x0C) }; // · Դλ1 +uint8_t Light_plus2[4] = { 0x00,0xFF,0x18,~(0x18) }; // · Դλ2 +uint8_t Light_plus3[4] = { 0x00,0xFF,0x5E,~(0x5E) }; // · Դλ3 + +uint8_t SEG_TimOpen[8] = { 0x55,0x04,0x03,0x01,0x00,0x00,0x04,0xBB }; // LEDʾ ʱ +uint8_t SMG_TimClose[8] = { 0x55,0x04,0x03,0x00,0x00,0x00,0x03,0xBB }; // LEDʾ ʱر + +uint8_t ZigBee_back[16] = { 0x55, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +uint8_t qrdi_buf[8] = { 0x55,0x02,0x92,0x00,0x00,0x00,0x00,0xBB }; // OpenMVʶά + +uint8_t trackdi_buf[8] = { 0x55,0x02,0x91,0x00,0x00,0x00,0x00,0xBB }; //OpenMVѭָ + +uint8_t servo_buf[8] = { 0x55,0x02,0x91,0x03,0x00,0x00,0x00,0xBB }; // OpenMVͶǶ + +//ȫֱ +uint8_t ATM_Data[ATM_Data_Length]; +uint8_t ZigBee_command[8]; +uint8_t ZigBee_judge; +uint8_t infrare_com[6]; +uint8_t sendflag; +unsigned long frisrtime; +unsigned long Tcount; +uint8_t Data_Type; +uint8_t Data_Flag; +uint8_t Data_Length; +uint8_t Data_OTABuf[40]; \ No newline at end of file diff --git a/GlobalDatas.h b/GlobalDatas.h new file mode 100644 index 0000000..25126b0 --- /dev/null +++ b/GlobalDatas.h @@ -0,0 +1,48 @@ +#ifndef __GLOBAL_DATAS__ +#define __GLOBAL_DATAS__ +#include + +#define TSendCycle 200 +#define ATM_Data_Length 48 + +extern uint8_t GarageB_To1[8]; // 峵B һ +extern uint8_t GarageB_To2[8]; // 峵B ڶ +extern uint8_t GarageB_To3[8]; // 峵B +extern uint8_t GarageB_To4[8]; // 峵B IJ + +extern uint8_t TrafficA_Open[8]; // ܽͨA ʶģʽ ʶģʽ +extern uint8_t TrafficA_Red[8]; // ܽͨA ʶΪɫȷ +extern uint8_t TrafficA_Green[8]; // ܽͨA ʶΪɫȷ +extern uint8_t TrafficA_Yellow[8]; // ܽͨA ʶΪɫȷ + +extern uint8_t Gate_Open[8]; // բ + +extern uint8_t Light_plus1[4]; // · Դλ1 +extern uint8_t Light_plus2[4]; // · Դλ2 +extern uint8_t Light_plus3[4]; // · Դλ3 + +extern uint8_t SEG_TimOpen[8]; // LEDʾ ʱ +extern uint8_t SMG_TimClose[8]; // LEDʾ ʱر + +extern uint8_t ZigBee_back[16]; + +extern uint8_t qrdi_buf[8]; // OpenMVʶά + +extern uint8_t trackdi_buf[8]; //OpenMVѭָ + +extern uint8_t servo_buf[8]; // OpenMVͶǶ + +//ȫֱ +extern uint8_t ATM_Data[ATM_Data_Length]; +extern uint8_t ZigBee_command[8]; +extern uint8_t ZigBee_judge; +extern uint8_t infrare_com[6]; +extern uint8_t sendflag; +extern unsigned long frisrtime; +extern unsigned long Tcount; +extern uint8_t Data_Type; +extern uint8_t Data_Flag; +extern uint8_t Data_Length; +extern uint8_t Data_OTABuf[40]; + +#endif \ No newline at end of file diff --git a/Handler.cpp b/Handler.cpp new file mode 100644 index 0000000..bcb0e45 --- /dev/null +++ b/Handler.cpp @@ -0,0 +1,201 @@ +#include "Handler.h" + +void Handler::ZigBeeRx_Handler(uint8_t* mar) +{ + switch (mar[1]) + { + case 0x02: // + MainCarRx_Handler(mar); //Ӧ + break; + case 0x03: //բ־ + break; + case 0x04: //LEDʾ־޷أ + break; + case 0x05: //峵־B + break; + case 0x06: //־ + break; + case 0x07: //ⱨ־ + break; + case 0x08: //TFTʾ־B + break; + case 0x09: //־ + break; + case 0x0A: //߳־ + break; + case 0x0B: //TFTʾ־A + break; + case 0x0C: //ETCϵͳ־ + break; + case 0x0D: //峵־A + break; + case 0x0E: //ͨƱעA + break; + case 0x0F: //ͨƱ־B + break; + default: + break; + } +} + +void Handler::OpenMVRx_Handler(uint8_t* mac) +{ + switch (mac[2]) + { + case 0x91: // + + break; + case 0x92: //άʶ + + break; + default: + break; + } +} + +void Handler::MainCarRx_Handler(uint8_t* com) +{ + switch (com[2]) + { + case 0x01: //ֹͣ + DCMotor.Stop(); + break; + case 0x02: //ǰ + DCMotor.Go(com[3], (com[4] + (com[5] << 8))); + ZigBee_back[2] = 0x03; + break; + case 0x03: // + DCMotor.Back(com[3], (com[4] + (com[5] << 8))); + ZigBee_back[2] = 0x03; + break; + case 0x04: //ת + DCMotor.TurnLeft(com[3]); + ZigBee_back[2] = 0x02; + break; + case 0x05: //ת + DCMotor.TurnRight(com[3]); + ZigBee_back[2] = 0x02; + break; + case 0x06: //ѭ + DCMotor.CarTrack(com[3]); + ZigBee_back[2] = 0x00; + break; + case 0x07: // + Command.Judgment(Command.command01); //У + ExtSRAMInterface.ExMem_Write_Bytes(Command.command01, 8); // + break; + case 0x10: // + infrare_com[0] = com[3]; + infrare_com[1] = com[4]; + infrare_com[2] = com[5]; + break; + case 0x11: // + infrare_com[3] = com[3]; + infrare_com[4] = com[4]; + infrare_com[5] = com[5]; + break; + case 0x12: //ͺ + Infrare.Transmition(infrare_com, 6); + break; + case 0x20: //ת + if (com[3] == 0x01) + LED.LeftTurnOn(); + else + LED.LeftTurnOff(); + if (com[4] == 0x01) + LED.RightTurnOn(); + else + LED.RightTurnOff(); + break; + case 0x30: // + if (com[3] == 0x01) + BEEP.TurnOn(); + else + BEEP.TurnOff(); + break; + case 0x40: // + break; + case 0x50: //LCDͼƬϷҳ + Command.Judgment(Command.command13); + ExtSRAMInterface.ExMem_Write_Bytes(Command.command13, 8); + break; + case 0x51: //LCDͼƬ·ҳ + Command.Judgment(Command.command14); + ExtSRAMInterface.ExMem_Write_Bytes(Command.command14, 8); + break; + case 0x61: //Դһ + Infrare.Transmition(Command.HW_Dimming1, 4); + break; + case 0x62: //ԴӶ + Infrare.Transmition(Command.HW_Dimming2, 4); + break; + case 0x63: //Դ + Infrare.Transmition(Command.HW_Dimming3, 4); + break; + case 0x80: //ӳл + if (com[3] == 0x01) + { + sendflag = 0x01; //ϴӳ + } + else + { + sendflag = 0x00; //رϴӳ + } + case 0x91: + if (com[3] == 0x03) // + { + //Servoangle_control(com[4]); + } + break; + default: + break; + } +} + +void Handler::Key_0() +{ + BEEP.TurnOn(); + delay(50); + BEEP.TurnOff(); + OpenMVOpt::Servo_Control(-60); + OpenMVOpt::OpenMV_Track(50); + DCMotor.TurnLeft_Code(80, 760); +} + +void Handler::Key_1() +{ + BEEP.TurnOn(); + delay(50); + BEEP.TurnOff(); + delay(50); + OpenMVOpt::Servo_Control(0); +} + +void Handler::Key_2() +{ + DebugOpt::DebugRun(); +} + +void Handler::Key_3() +{ + DebugOpt::DebugServo(); +} + +void Handler::KEY_Handler(uint8_t k_value) +{ + switch (k_value) + { + case 1: + Key_0(); + break; + case 2: + Key_1(); + break; + case 3: + Key_2(); + break; + case 4: + Key_3(); + break; + } +} diff --git a/Handler.h b/Handler.h new file mode 100644 index 0000000..b1daaab --- /dev/null +++ b/Handler.h @@ -0,0 +1,30 @@ +#ifndef __HANDLER__ +#define __HANDLER__ + +#include "GlobalDatas.h" +#include "DebugOpt.h" + +namespace Handler +{ + //ZigBeeϢմ + void ZigBeeRx_Handler(uint8_t* mar); + + //OpenMVϢմ + void OpenMVRx_Handler(uint8_t* mac); + + //ָմ + void MainCarRx_Handler(uint8_t* com); + + //¼ - 0 + void Key_0(); + //¼ - 1 + void Key_1(); + //¼ - 2 + void Key_2(); + //¼ - 3 + void Key_3(); + //մ + void KEY_Handler(uint8_t k_value); +}; + +#endif \ No newline at end of file diff --git a/OpenMVOpt.cpp b/OpenMVOpt.cpp new file mode 100644 index 0000000..1abb4d8 --- /dev/null +++ b/OpenMVOpt.cpp @@ -0,0 +1,167 @@ +#include "OpenMVOpt.h" + +uint8_t OpenMVOpt::Data_OpenMVBuf[8] = { 0 }; + +void OpenMVOpt::AdjustCarPosition(uint8_t Car_Speed) +{ + if (Data_OpenMVBuf[6] <= 5) // У׼ + { + if (Data_OpenMVBuf[5] == 43) // + + { + DCMotor.SpeedCtr(Car_Speed, Car_Speed); + } + else if (Data_OpenMVBuf[5] == 45) // - ҵ + { + DCMotor.SpeedCtr(Car_Speed, Car_Speed); + } + } + else if (Data_OpenMVBuf[6] <= 15) // ΢ƫ + { + if (Data_OpenMVBuf[5] == 43) // + + { + DCMotor.SpeedCtr(20, 50); + } + else if (Data_OpenMVBuf[5] == 45) // - ҵ + { + DCMotor.SpeedCtr(50, 20); + } + } + else if (Data_OpenMVBuf[6] <= 25) + { + + if (Data_OpenMVBuf[5] == 43) // + + { + DCMotor.SpeedCtr(10, 50); + } + else if (Data_OpenMVBuf[5] == 45) // - ҵ + { + DCMotor.SpeedCtr(50, 10); + } + } + else if (Data_OpenMVBuf[6] <= 35) + { + + if (Data_OpenMVBuf[5] == 43) // + + { + DCMotor.SpeedCtr(5, 50); + } + else if (Data_OpenMVBuf[5] == 45) // - ҵ + { + DCMotor.SpeedCtr(50, 5); + } + } + else if (Data_OpenMVBuf[6] <= 50) + { + + if (Data_OpenMVBuf[5] == 43) // + + { + DCMotor.SpeedCtr(0, 40); + } + else if (Data_OpenMVBuf[5] == 45) // - ҵ + { + DCMotor.SpeedCtr(40, 0); + } + } + else if (Data_OpenMVBuf[6] <= 70) + { + + if (Data_OpenMVBuf[5] == 43) // + + { + DCMotor.SpeedCtr(-5, 30); + } + else if (Data_OpenMVBuf[5] == 45) // - ҵ + { + DCMotor.SpeedCtr(30, -5); + } + } + else if (Data_OpenMVBuf[6] > 70) + { + + if (Data_OpenMVBuf[5] == 43) // + + { + DCMotor.SpeedCtr(-10, 20); + } + else if (Data_OpenMVBuf[5] == 45) // - ҵ + { + DCMotor.SpeedCtr(20, -10); + } + } +} + +void OpenMVOpt::OpenMVTrack_Disc_StartUp() +{ + trackdi_buf[3] = 0x01; //ʼʶ + Command.Judgment(trackdi_buf); //У + ExtSRAMInterface.ExMem_Write_Bytes(0x6008, trackdi_buf, 8); +} + +void OpenMVOpt::OpenMVTrack_Disc_CloseUp() +{ + trackdi_buf[3] = 0x02; //رʶ + Command.Judgment(trackdi_buf); //У + ExtSRAMInterface.ExMem_Write_Bytes(0x6008, trackdi_buf, 8); +} + +void OpenMVOpt::OpenMV_Track(uint8_t Car_Speed) +{ + uint32_t num = 0; + Car_Speed = 50; + // մڻ + while (ExtSRAMInterface.ExMem_Read(0x6038) != 0x00) + ExtSRAMInterface.ExMem_Read_Bytes(0x6038, Data_OpenMVBuf, 1); + OpenMVTrack_Disc_StartUp(); + delay(500); + DCMotor.SpeedCtr(Car_Speed, Car_Speed); + Serial.println("Video Track Start."); + while (1) + { + delay(10); //ӳٷֹ + if (ExtSRAMInterface.ExMem_Read(0x6038) != 0x00) //OpenMVʶ + { + ExtSRAMInterface.ExMem_Read_Bytes(0x6038, Data_OpenMVBuf, 8); + if ((Data_OpenMVBuf[0] == 0x55) && (Data_OpenMVBuf[1] == 0x02) && (Data_OpenMVBuf[2] == 0x91)) + { + num++; + Serial.println(num); + if (Data_OpenMVBuf[4] == 1) // · + { + DCMotor.Stop(); + OpenMVTrack_Disc_CloseUp(); + break; + } + else // + AdjustCarPosition(Car_Speed); + } + } + } +} + +void OpenMVOpt::OpenMVQr_Disc_StartUp() +{ + qrdi_buf[3] = 0x01; //ʼʶ + Command.Judgment(qrdi_buf); //У + ExtSRAMInterface.ExMem_Write_Bytes(0x6008, qrdi_buf, 8); +} + +void OpenMVOpt::OpenMVQr_Disc_CloseUp() +{ + qrdi_buf[3] = 0x02; //رʶ + Command.Judgment(qrdi_buf); //У + ExtSRAMInterface.ExMem_Write_Bytes(0x6008, qrdi_buf, 8); +} + +void OpenMVOpt::Servo_Control(int8_t angle) +{ + if (angle >= 0) + { + servo_buf[4] = 0x2B; + } + else + { + servo_buf[4] = 0x2D; + } + servo_buf[5] = abs(angle); //ʼʶ + Command.Judgment(servo_buf); //У + ExtSRAMInterface.ExMem_Write_Bytes(0x6008, servo_buf, 8); + delay(1000); +} diff --git a/OpenMVOpt.h b/OpenMVOpt.h new file mode 100644 index 0000000..046b701 --- /dev/null +++ b/OpenMVOpt.h @@ -0,0 +1,32 @@ +#ifndef __OPENMV_OPT__ +#define __OPENMV_OPT__ + +#include +#include "GlobalDatas.h" +#include +#include + +namespace OpenMVOpt +{ + extern uint8_t Data_OpenMVBuf[8]; + + //̬ + void AdjustCarPosition(uint8_t Car_Speed); + + //Ƶѭ + void OpenMVTrack_Disc_StartUp(); + //ֹͣƵѭ + void OpenMVTrack_Disc_CloseUp(); + //ѭһ·ڣ + void OpenMV_Track(uint8_t Car_Speed); + + //άʶ + void OpenMVQr_Disc_StartUp(); + //ֹͣάʶ + void OpenMVQr_Disc_CloseUp(); + + //Ƕȿ + void Servo_Control(int8_t angle); +}; + +#endif \ No newline at end of file diff --git a/__vm/.2021_Arduino_Demo.vsarduino.h b/__vm/.2021_Arduino_Demo.vsarduino.h new file mode 100644 index 0000000..884e5bd --- /dev/null +++ b/__vm/.2021_Arduino_Demo.vsarduino.h @@ -0,0 +1,93 @@ +/* + Editor: https://www.visualmicro.com/ + This file is for intellisense purpose only. + Visual micro (and the arduino ide) ignore this code during compilation. This code is automatically maintained by visualmicro, manual changes to this file will be overwritten + The contents of the _vm sub folder can be deleted prior to publishing a project + All non-arduino files created by visual micro and all visual studio project or solution files can be freely deleted and are not required to compile a sketch (do not delete your own code!). + Note: debugger breakpoints are stored in '.sln' or '.asln' files, knowledge of last uploaded breakpoints is stored in the upload.vmps.xml file. Both files are required to continue a previous debug session without needing to compile and upload again + + Hardware: ATmega2560 (Mega 2560) (Arduino Mega) (mega_atmega2560), Platform=avr, Package=arduino +*/ + +#if defined(_VMICRO_INTELLISENSE) + +#ifndef _VSARDUINO_H_ +#define _VSARDUINO_H_ +#define __AVR_atmega2560__ 1 +#define __AVR_ATmega2560__ 1 +#define F_CPU 16000000L +#define ARDUINO 108010 +#define ARDUINO_AVR_MEGA2560 1 +#define ARDUINO_ARCH_AVR 1 +#define __cplusplus 201103L +#define _Pragma(x) +#define __AVR__ +#define __inline__ +#define __asm__(...) +#define __extension__ +#define __inline__ +#define __volatile__ +// Redefine __cplusplus to correct version: https://www.visualmicro.com/forums/YaBB.pl?num=1592217268 +#undef __cplusplus +#define __cplusplus 201103L + +//#define GCC_VERSION 40902 +//https://www.visualmicro.com/forums/YaBB.pl?num=1569762585/5#5 +#define __GNUC__ 5 +#define __GNUC_MINOR__ 4 +#define __GNUC_PATCHLEVEL__ 0 +#define GCC_VERSION ((__GNUC__*10000)+(__GNUC_MINOR__*100)+__GNUC_PATCHLEVEL__)) + + +#define volatile(va_arg) +#define _CONST +#define __builtin_va_start +#define __builtin_va_end +#define __attribute__(...) +#define NOINLINE __attribute__((noinline)) +#define prog_void +#define PGM_VOID_P int + + +#ifndef __builtin_constant_p + #define __builtin_constant_p __attribute__((__const__)) +#endif +#ifndef __builtin_strlen + #define __builtin_strlen __attribute__((__const__)) +#endif + + +#define NEW_H +typedef void *__builtin_va_list; +//extern "C" void __cxa_pure_virtual() {;} + +typedef int div_t; +typedef int ldiv_t; + + +typedef void *__builtin_va_list; +//extern "C" void __cxa_pure_virtual() {;} + + + +#include +#include +//#undef F +//#define F(string_literal) ((const PROGMEM char *)(string_literal)) +#undef PSTR +#define PSTR(string_literal) ((const PROGMEM char *)(string_literal)) + +//typedef unsigned char uint8_t; +//typedef unsigned int uint8_t; + +#define pgm_read_byte_near(address_short) uint8_t() +#define pgm_read_byte(address_short) uint8_t() +#define pgm_read_word(address_short) uint16_t() +#define pgm_read_dword(address_short) uint32_t() +#define pgm_read_float(address_short) float() +#define pgm_read_ptr(address_short) short() + +#include "2021_Arduino_Demo.ino" +#include "OpenMV_Track.ino" +#endif +#endif diff --git a/__vm/.Arduino.vsarduino.h b/__vm/.Arduino.vsarduino.h new file mode 100644 index 0000000..fcaa208 --- /dev/null +++ b/__vm/.Arduino.vsarduino.h @@ -0,0 +1,92 @@ +/* + Editor: https://www.visualmicro.com/ + This file is for intellisense purpose only. + Visual micro (and the arduino ide) ignore this code during compilation. This code is automatically maintained by visualmicro, manual changes to this file will be overwritten + The contents of the _vm sub folder can be deleted prior to publishing a project + All non-arduino files created by visual micro and all visual studio project or solution files can be freely deleted and are not required to compile a sketch (do not delete your own code!). + Note: debugger breakpoints are stored in '.sln' or '.asln' files, knowledge of last uploaded breakpoints is stored in the upload.vmps.xml file. Both files are required to continue a previous debug session without needing to compile and upload again + + Hardware: ATmega2560 (Mega 2560) (Arduino Mega) (mega_atmega2560), Platform=avr, Package=arduino +*/ + +#if defined(_VMICRO_INTELLISENSE) + +#ifndef _VSARDUINO_H_ +#define _VSARDUINO_H_ +#define __AVR_atmega2560__ 1 +#define __AVR_ATmega2560__ 1 +#define F_CPU 16000000L +#define ARDUINO 108010 +#define ARDUINO_AVR_MEGA2560 1 +#define ARDUINO_ARCH_AVR 1 +#define __cplusplus 201103L +#define _Pragma(x) +#define __AVR__ +#define __inline__ +#define __asm__(...) +#define __extension__ +#define __inline__ +#define __volatile__ +// Redefine __cplusplus to correct version: https://www.visualmicro.com/forums/YaBB.pl?num=1592217268 +#undef __cplusplus +#define __cplusplus 201103L + +//#define GCC_VERSION 40902 +//https://www.visualmicro.com/forums/YaBB.pl?num=1569762585/5#5 +#define __GNUC__ 5 +#define __GNUC_MINOR__ 4 +#define __GNUC_PATCHLEVEL__ 0 +#define GCC_VERSION ((__GNUC__*10000)+(__GNUC_MINOR__*100)+__GNUC_PATCHLEVEL__)) + + +#define volatile(va_arg) +#define _CONST +#define __builtin_va_start +#define __builtin_va_end +#define __attribute__(...) +#define NOINLINE __attribute__((noinline)) +#define prog_void +#define PGM_VOID_P int + + +#ifndef __builtin_constant_p + #define __builtin_constant_p __attribute__((__const__)) +#endif +#ifndef __builtin_strlen + #define __builtin_strlen __attribute__((__const__)) +#endif + + +#define NEW_H +typedef void *__builtin_va_list; +//extern "C" void __cxa_pure_virtual() {;} + +typedef int div_t; +typedef int ldiv_t; + + +typedef void *__builtin_va_list; +//extern "C" void __cxa_pure_virtual() {;} + + + +#include +#include +//#undef F +//#define F(string_literal) ((const PROGMEM char *)(string_literal)) +#undef PSTR +#define PSTR(string_literal) ((const PROGMEM char *)(string_literal)) + +//typedef unsigned char uint8_t; +//typedef unsigned int uint8_t; + +#define pgm_read_byte_near(address_short) uint8_t() +#define pgm_read_byte(address_short) uint8_t() +#define pgm_read_word(address_short) uint16_t() +#define pgm_read_dword(address_short) uint32_t() +#define pgm_read_float(address_short) float() +#define pgm_read_ptr(address_short) short() + +#include "2021_Arduino_Demo.ino" +#endif +#endif diff --git a/__vm/Compile.vmps.xml b/__vm/Compile.vmps.xml new file mode 100644 index 0000000..0ad473a --- /dev/null +++ b/__vm/Compile.vmps.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/__vm/Configuration.Release.vmps.xml b/__vm/Configuration.Release.vmps.xml new file mode 100644 index 0000000..af566e1 --- /dev/null +++ b/__vm/Configuration.Release.vmps.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/__vm/Upload.vmps.xml b/__vm/Upload.vmps.xml new file mode 100644 index 0000000..0ad473a --- /dev/null +++ b/__vm/Upload.vmps.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file