Commit 021f4169 authored by 时昊's avatar 时昊

🎉 init:上传修改串口通信的代码

parent ed779cfc
...@@ -7,4 +7,4 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake) ...@@ -7,4 +7,4 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake)
add_compile_options(-fdiagnostics-color=always -w) add_compile_options(-fdiagnostics-color=always -w)
project(YEDEA_C011_L) project(YEDEA_C011_M)
set(CMAKE_ASM_COMPILER "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc")
set(CMAKE_ASM_COMPILER_ARG1 "")
set(CMAKE_AR "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-ar")
set(CMAKE_ASM_COMPILER_AR "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc-ar")
set(CMAKE_RANLIB "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-ranlib")
set(CMAKE_ASM_COMPILER_RANLIB "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc-ranlib")
set(CMAKE_LINKER "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-ld")
set(CMAKE_MT "")
set(CMAKE_ASM_COMPILER_LOADED 1)
set(CMAKE_ASM_COMPILER_ID "GNU")
set(CMAKE_ASM_COMPILER_VERSION "")
set(CMAKE_ASM_COMPILER_ENV_VAR "ASM")
set(CMAKE_ASM_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
set(CMAKE_ASM_LINKER_PREFERENCE 0)
set(CMAKE_C_COMPILER "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc")
set(CMAKE_C_COMPILER_ARG1 "")
set(CMAKE_C_COMPILER_ID "GNU")
set(CMAKE_C_COMPILER_VERSION "13.2.0")
set(CMAKE_C_COMPILER_VERSION_INTERNAL "")
set(CMAKE_C_COMPILER_WRAPPER "")
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17")
set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON")
set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23")
set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes")
set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros")
set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert")
set(CMAKE_C17_COMPILE_FEATURES "c_std_17")
set(CMAKE_C23_COMPILE_FEATURES "c_std_23")
set(CMAKE_C_PLATFORM_ID "")
set(CMAKE_C_SIMULATE_ID "")
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "")
set(CMAKE_C_SIMULATE_VERSION "")
set(CMAKE_AR "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-ar")
set(CMAKE_C_COMPILER_AR "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc-ar")
set(CMAKE_RANLIB "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-ranlib")
set(CMAKE_C_COMPILER_RANLIB "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc-ranlib")
set(CMAKE_LINKER "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-ld")
set(CMAKE_MT "")
set(CMAKE_COMPILER_IS_GNUCC 1)
set(CMAKE_C_COMPILER_LOADED 1)
set(CMAKE_C_COMPILER_WORKS TRUE)
set(CMAKE_C_ABI_COMPILED TRUE)
set(CMAKE_C_COMPILER_ENV_VAR "CC")
set(CMAKE_C_COMPILER_ID_RUN 1)
set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
set(CMAKE_C_LINKER_PREFERENCE 10)
# Save compiler ABI information.
set(CMAKE_C_SIZEOF_DATA_PTR "4")
set(CMAKE_C_COMPILER_ABI "ELF")
set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN")
set(CMAKE_C_LIBRARY_ARCHITECTURE "")
if(CMAKE_C_SIZEOF_DATA_PTR)
set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
endif()
if(CMAKE_C_COMPILER_ABI)
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
endif()
if(CMAKE_C_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "")
endif()
set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "")
if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
endif()
set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/lib/gcc/xtensa-esp-elf/13.2.0/include;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/lib/gcc/xtensa-esp-elf/13.2.0/include-fixed;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/sys-include;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/include")
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;c;nosys;c;gcc")
set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/lib/gcc/xtensa-esp-elf/13.2.0/esp32;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/lib/esp32;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/lib/gcc/xtensa-esp-elf/13.2.0;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/lib/gcc;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/lib")
set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
set(CMAKE_CXX_COMPILER "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-g++")
set(CMAKE_CXX_COMPILER_ARG1 "")
set(CMAKE_CXX_COMPILER_ID "GNU")
set(CMAKE_CXX_COMPILER_VERSION "13.2.0")
set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "")
set(CMAKE_CXX_COMPILER_WRAPPER "")
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "17")
set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON")
set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23")
set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters")
set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates")
set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates")
set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17")
set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20")
set(CMAKE_CXX23_COMPILE_FEATURES "cxx_std_23")
set(CMAKE_CXX_PLATFORM_ID "")
set(CMAKE_CXX_SIMULATE_ID "")
set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "")
set(CMAKE_CXX_SIMULATE_VERSION "")
set(CMAKE_AR "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-ar")
set(CMAKE_CXX_COMPILER_AR "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc-ar")
set(CMAKE_RANLIB "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-ranlib")
set(CMAKE_CXX_COMPILER_RANLIB "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc-ranlib")
set(CMAKE_LINKER "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-ld")
set(CMAKE_MT "")
set(CMAKE_COMPILER_IS_GNUCXX 1)
set(CMAKE_CXX_COMPILER_LOADED 1)
set(CMAKE_CXX_COMPILER_WORKS TRUE)
set(CMAKE_CXX_ABI_COMPILED TRUE)
set(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
set(CMAKE_CXX_COMPILER_ID_RUN 1)
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm)
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
foreach (lang C OBJC OBJCXX)
if (CMAKE_${lang}_COMPILER_ID_RUN)
foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS)
list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension})
endforeach()
endif()
endforeach()
set(CMAKE_CXX_LINKER_PREFERENCE 30)
set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
# Save compiler ABI information.
set(CMAKE_CXX_SIZEOF_DATA_PTR "4")
set(CMAKE_CXX_COMPILER_ABI "ELF")
set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN")
set(CMAKE_CXX_LIBRARY_ARCHITECTURE "")
if(CMAKE_CXX_SIZEOF_DATA_PTR)
set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}")
endif()
if(CMAKE_CXX_COMPILER_ABI)
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
endif()
if(CMAKE_CXX_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "")
endif()
set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "")
if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX)
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}")
endif()
set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/xtensa-esp-elf/esp32;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/backward;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/lib/gcc/xtensa-esp-elf/13.2.0/include;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/lib/gcc/xtensa-esp-elf/13.2.0/include-fixed;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/sys-include;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/include")
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc;c;nosys;c;gcc")
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/lib/gcc/xtensa-esp-elf/13.2.0/esp32;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/lib/esp32;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/lib/gcc/xtensa-esp-elf/13.2.0;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/lib/gcc;/home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/lib")
set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
set(CMAKE_HOST_SYSTEM "Linux-6.5.0-41-generic")
set(CMAKE_HOST_SYSTEM_NAME "Linux")
set(CMAKE_HOST_SYSTEM_VERSION "6.5.0-41-generic")
set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
include("/home/king/esp/esp-idf/tools/cmake/toolchain-esp32.cmake")
set(CMAKE_SYSTEM "Generic")
set(CMAKE_SYSTEM_NAME "Generic")
set(CMAKE_SYSTEM_VERSION "")
set(CMAKE_SYSTEM_PROCESSOR "")
set(CMAKE_CROSSCOMPILING "TRUE")
set(CMAKE_SYSTEM_LOADED 1)
#ifdef __cplusplus
# error "A C++ compiler has been selected for C."
#endif
#if defined(__18CXX)
# define ID_VOID_MAIN
#endif
#if defined(__CLASSIC_C__)
/* cv-qualifiers did not exist in K&R C */
# define const
# define volatile
#endif
#if !defined(__has_include)
/* If the compiler does not have __has_include, pretend the answer is
always no. */
# define __has_include(x) 0
#endif
/* Version number components: V=Version, R=Revision, P=Patch
Version date components: YYYY=Year, MM=Month, DD=Day */
#if defined(__INTEL_COMPILER) || defined(__ICC)
# define COMPILER_ID "Intel"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# if defined(__GNUC__)
# define SIMULATE_ID "GNU"
# endif
/* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later,
except that a few beta releases use the old format with V=2021. */
# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
# if defined(__INTEL_COMPILER_UPDATE)
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
# else
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
# endif
# else
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER)
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE)
/* The third version component from --version is an update index,
but no macro is provided for it. */
# define COMPILER_VERSION_PATCH DEC(0)
# endif
# if defined(__INTEL_COMPILER_BUILD_DATE)
/* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
# endif
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
# if defined(__GNUC__)
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
# elif defined(__GNUG__)
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
# endif
# if defined(__GNUC_MINOR__)
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
# endif
# if defined(__GNUC_PATCHLEVEL__)
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
# endif
#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER)
# define COMPILER_ID "IntelLLVM"
#if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
#endif
#if defined(__GNUC__)
# define SIMULATE_ID "GNU"
#endif
/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and
* later. Look for 6 digit vs. 8 digit version number to decide encoding.
* VVVV is no smaller than the current year when a version is released.
*/
#if __INTEL_LLVM_COMPILER < 1000000L
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100)
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10)
#else
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000)
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100)
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100)
#endif
#if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
#endif
#if defined(__GNUC__)
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
#elif defined(__GNUG__)
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
#endif
#if defined(__GNUC_MINOR__)
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
#endif
#if defined(__GNUC_PATCHLEVEL__)
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
#endif
#elif defined(__PATHCC__)
# define COMPILER_ID "PathScale"
# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
# if defined(__PATHCC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
# endif
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
# define COMPILER_ID "Embarcadero"
# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
#elif defined(__BORLANDC__)
# define COMPILER_ID "Borland"
/* __BORLANDC__ = 0xVRR */
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
# define COMPILER_ID "Watcom"
/* __WATCOMC__ = VVRR */
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# if (__WATCOMC__ % 10) > 0
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
# endif
#elif defined(__WATCOMC__)
# define COMPILER_ID "OpenWatcom"
/* __WATCOMC__ = VVRP + 1100 */
# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# if (__WATCOMC__ % 10) > 0
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
# endif
#elif defined(__SUNPRO_C)
# define COMPILER_ID "SunPro"
# if __SUNPRO_C >= 0x5100
/* __SUNPRO_C = 0xVRRP */
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
# else
/* __SUNPRO_CC = 0xVRP */
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
# endif
#elif defined(__HP_cc)
# define COMPILER_ID "HP"
/* __HP_cc = VVRRPP */
# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100)
#elif defined(__DECC)
# define COMPILER_ID "Compaq"
/* __DECC_VER = VVRRTPPPP */
# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100)
# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)
#elif defined(__IBMC__) && defined(__COMPILER_VER__)
# define COMPILER_ID "zOS"
/* __IBMC__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
#elif defined(__ibmxl__) && defined(__clang__)
# define COMPILER_ID "XLClang"
# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800
# define COMPILER_ID "XL"
/* __IBMC__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800
# define COMPILER_ID "VisualAge"
/* __IBMC__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
#elif defined(__NVCOMPILER)
# define COMPILER_ID "NVHPC"
# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__)
# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__)
# if defined(__NVCOMPILER_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__)
# endif
#elif defined(__PGI)
# define COMPILER_ID "PGI"
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
# if defined(__PGIC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
# endif
#elif defined(_CRAYC)
# define COMPILER_ID "Cray"
# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
#elif defined(__TI_COMPILER_VERSION__)
# define COMPILER_ID "TI"
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
#elif defined(__CLANG_FUJITSU)
# define COMPILER_ID "FujitsuClang"
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
# define COMPILER_VERSION_INTERNAL_STR __clang_version__
#elif defined(__FUJITSU)
# define COMPILER_ID "Fujitsu"
# if defined(__FCC_version__)
# define COMPILER_VERSION __FCC_version__
# elif defined(__FCC_major__)
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
# endif
# if defined(__fcc_version)
# define COMPILER_VERSION_INTERNAL DEC(__fcc_version)
# elif defined(__FCC_VERSION)
# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION)
# endif
#elif defined(__ghs__)
# define COMPILER_ID "GHS"
/* __GHS_VERSION_NUMBER = VVVVRP */
# ifdef __GHS_VERSION_NUMBER
# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
# endif
#elif defined(__TINYC__)
# define COMPILER_ID "TinyCC"
#elif defined(__BCC__)
# define COMPILER_ID "Bruce"
#elif defined(__SCO_VERSION__)
# define COMPILER_ID "SCO"
#elif defined(__ARMCC_VERSION) && !defined(__clang__)
# define COMPILER_ID "ARMCC"
#if __ARMCC_VERSION >= 1000000
/* __ARMCC_VERSION = VRRPPPP */
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
#else
/* __ARMCC_VERSION = VRPPPP */
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
#endif
#elif defined(__clang__) && defined(__apple_build_version__)
# define COMPILER_ID "AppleClang"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
# define COMPILER_ID "ARMClang"
# define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
# define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
# define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000)
# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
#elif defined(__clang__)
# define COMPILER_ID "Clang"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
#elif defined(__GNUC__)
# define COMPILER_ID "GNU"
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
# if defined(__GNUC_MINOR__)
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
# endif
# if defined(__GNUC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
# endif
#elif defined(_MSC_VER)
# define COMPILER_ID "MSVC"
/* _MSC_VER = VVRR */
# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
# if defined(_MSC_FULL_VER)
# if _MSC_VER >= 1400
/* _MSC_FULL_VER = VVRRPPPPP */
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
# else
/* _MSC_FULL_VER = VVRRPPPP */
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
# endif
# endif
# if defined(_MSC_BUILD)
# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
# endif
#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
# define COMPILER_ID "ADSP"
#if defined(__VISUALDSPVERSION__)
/* __VISUALDSPVERSION__ = 0xVVRRPP00 */
# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
#endif
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
# define COMPILER_ID "IAR"
# if defined(__VER__) && defined(__ICCARM__)
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__))
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
# endif
#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC)
# define COMPILER_ID "SDCC"
# if defined(__SDCC_VERSION_MAJOR)
# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR)
# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR)
# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH)
# else
/* SDCC = VRP */
# define COMPILER_VERSION_MAJOR DEC(SDCC/100)
# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
# define COMPILER_VERSION_PATCH DEC(SDCC % 10)
# endif
/* These compilers are either not known or too old to define an
identification macro. Try to identify the platform and guess that
it is the native compiler. */
#elif defined(__hpux) || defined(__hpua)
# define COMPILER_ID "HP"
#else /* unknown compiler */
# define COMPILER_ID ""
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
#ifdef SIMULATE_ID
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
#endif
#ifdef __QNXNTO__
char const* qnxnto = "INFO" ":" "qnxnto[]";
#endif
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
#endif
#define STRINGIFY_HELPER(X) #X
#define STRINGIFY(X) STRINGIFY_HELPER(X)
/* Identify known platforms by name. */
#if defined(__linux) || defined(__linux__) || defined(linux)
# define PLATFORM_ID "Linux"
#elif defined(__MSYS__)
# define PLATFORM_ID "MSYS"
#elif defined(__CYGWIN__)
# define PLATFORM_ID "Cygwin"
#elif defined(__MINGW32__)
# define PLATFORM_ID "MinGW"
#elif defined(__APPLE__)
# define PLATFORM_ID "Darwin"
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
# define PLATFORM_ID "Windows"
#elif defined(__FreeBSD__) || defined(__FreeBSD)
# define PLATFORM_ID "FreeBSD"
#elif defined(__NetBSD__) || defined(__NetBSD)
# define PLATFORM_ID "NetBSD"
#elif defined(__OpenBSD__) || defined(__OPENBSD)
# define PLATFORM_ID "OpenBSD"
#elif defined(__sun) || defined(sun)
# define PLATFORM_ID "SunOS"
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
# define PLATFORM_ID "AIX"
#elif defined(__hpux) || defined(__hpux__)
# define PLATFORM_ID "HP-UX"
#elif defined(__HAIKU__)
# define PLATFORM_ID "Haiku"
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
# define PLATFORM_ID "BeOS"
#elif defined(__QNX__) || defined(__QNXNTO__)
# define PLATFORM_ID "QNX"
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
# define PLATFORM_ID "Tru64"
#elif defined(__riscos) || defined(__riscos__)
# define PLATFORM_ID "RISCos"
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
# define PLATFORM_ID "SINIX"
#elif defined(__UNIX_SV__)
# define PLATFORM_ID "UNIX_SV"
#elif defined(__bsdos__)
# define PLATFORM_ID "BSDOS"
#elif defined(_MPRAS) || defined(MPRAS)
# define PLATFORM_ID "MP-RAS"
#elif defined(__osf) || defined(__osf__)
# define PLATFORM_ID "OSF1"
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
# define PLATFORM_ID "SCO_SV"
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
# define PLATFORM_ID "ULTRIX"
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
# define PLATFORM_ID "Xenix"
#elif defined(__WATCOMC__)
# if defined(__LINUX__)
# define PLATFORM_ID "Linux"
# elif defined(__DOS__)
# define PLATFORM_ID "DOS"
# elif defined(__OS2__)
# define PLATFORM_ID "OS2"
# elif defined(__WINDOWS__)
# define PLATFORM_ID "Windows3x"
# elif defined(__VXWORKS__)
# define PLATFORM_ID "VxWorks"
# else /* unknown platform */
# define PLATFORM_ID
# endif
#elif defined(__INTEGRITY)
# if defined(INT_178B)
# define PLATFORM_ID "Integrity178"
# else /* regular Integrity */
# define PLATFORM_ID "Integrity"
# endif
#else /* unknown platform */
# define PLATFORM_ID
#endif
/* For windows compilers MSVC and Intel we can determine
the architecture of the compiler being used. This is because
the compilers do not have flags that can change the architecture,
but rather depend on which compiler is being used
*/
#if defined(_WIN32) && defined(_MSC_VER)
# if defined(_M_IA64)
# define ARCHITECTURE_ID "IA64"
# elif defined(_M_ARM64EC)
# define ARCHITECTURE_ID "ARM64EC"
# elif defined(_M_X64) || defined(_M_AMD64)
# define ARCHITECTURE_ID "x64"
# elif defined(_M_IX86)
# define ARCHITECTURE_ID "X86"
# elif defined(_M_ARM64)
# define ARCHITECTURE_ID "ARM64"
# elif defined(_M_ARM)
# if _M_ARM == 4
# define ARCHITECTURE_ID "ARMV4I"
# elif _M_ARM == 5
# define ARCHITECTURE_ID "ARMV5I"
# else
# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
# endif
# elif defined(_M_MIPS)
# define ARCHITECTURE_ID "MIPS"
# elif defined(_M_SH)
# define ARCHITECTURE_ID "SHx"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__WATCOMC__)
# if defined(_M_I86)
# define ARCHITECTURE_ID "I86"
# elif defined(_M_IX86)
# define ARCHITECTURE_ID "X86"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
# if defined(__ICCARM__)
# define ARCHITECTURE_ID "ARM"
# elif defined(__ICCRX__)
# define ARCHITECTURE_ID "RX"
# elif defined(__ICCRH850__)
# define ARCHITECTURE_ID "RH850"
# elif defined(__ICCRL78__)
# define ARCHITECTURE_ID "RL78"
# elif defined(__ICCRISCV__)
# define ARCHITECTURE_ID "RISCV"
# elif defined(__ICCAVR__)
# define ARCHITECTURE_ID "AVR"
# elif defined(__ICC430__)
# define ARCHITECTURE_ID "MSP430"
# elif defined(__ICCV850__)
# define ARCHITECTURE_ID "V850"
# elif defined(__ICC8051__)
# define ARCHITECTURE_ID "8051"
# elif defined(__ICCSTM8__)
# define ARCHITECTURE_ID "STM8"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__ghs__)
# if defined(__PPC64__)
# define ARCHITECTURE_ID "PPC64"
# elif defined(__ppc__)
# define ARCHITECTURE_ID "PPC"
# elif defined(__ARM__)
# define ARCHITECTURE_ID "ARM"
# elif defined(__x86_64__)
# define ARCHITECTURE_ID "x64"
# elif defined(__i386__)
# define ARCHITECTURE_ID "X86"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__TI_COMPILER_VERSION__)
# if defined(__TI_ARM__)
# define ARCHITECTURE_ID "ARM"
# elif defined(__MSP430__)
# define ARCHITECTURE_ID "MSP430"
# elif defined(__TMS320C28XX__)
# define ARCHITECTURE_ID "TMS320C28x"
# elif defined(__TMS320C6X__) || defined(_TMS320C6X)
# define ARCHITECTURE_ID "TMS320C6x"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#else
# define ARCHITECTURE_ID
#endif
/* Convert integer to decimal digit literals. */
#define DEC(n) \
('0' + (((n) / 10000000)%10)), \
('0' + (((n) / 1000000)%10)), \
('0' + (((n) / 100000)%10)), \
('0' + (((n) / 10000)%10)), \
('0' + (((n) / 1000)%10)), \
('0' + (((n) / 100)%10)), \
('0' + (((n) / 10)%10)), \
('0' + ((n) % 10))
/* Convert integer to hex digit literals. */
#define HEX(n) \
('0' + ((n)>>28 & 0xF)), \
('0' + ((n)>>24 & 0xF)), \
('0' + ((n)>>20 & 0xF)), \
('0' + ((n)>>16 & 0xF)), \
('0' + ((n)>>12 & 0xF)), \
('0' + ((n)>>8 & 0xF)), \
('0' + ((n)>>4 & 0xF)), \
('0' + ((n) & 0xF))
/* Construct a string literal encoding the version number. */
#ifdef COMPILER_VERSION
char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]";
/* Construct a string literal encoding the version number components. */
#elif defined(COMPILER_VERSION_MAJOR)
char const info_version[] = {
'I', 'N', 'F', 'O', ':',
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
COMPILER_VERSION_MAJOR,
# ifdef COMPILER_VERSION_MINOR
'.', COMPILER_VERSION_MINOR,
# ifdef COMPILER_VERSION_PATCH
'.', COMPILER_VERSION_PATCH,
# ifdef COMPILER_VERSION_TWEAK
'.', COMPILER_VERSION_TWEAK,
# endif
# endif
# endif
']','\0'};
#endif
/* Construct a string literal encoding the internal version number. */
#ifdef COMPILER_VERSION_INTERNAL
char const info_version_internal[] = {
'I', 'N', 'F', 'O', ':',
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
'i','n','t','e','r','n','a','l','[',
COMPILER_VERSION_INTERNAL,']','\0'};
#elif defined(COMPILER_VERSION_INTERNAL_STR)
char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]";
#endif
/* Construct a string literal encoding the version number components. */
#ifdef SIMULATE_VERSION_MAJOR
char const info_simulate_version[] = {
'I', 'N', 'F', 'O', ':',
's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
SIMULATE_VERSION_MAJOR,
# ifdef SIMULATE_VERSION_MINOR
'.', SIMULATE_VERSION_MINOR,
# ifdef SIMULATE_VERSION_PATCH
'.', SIMULATE_VERSION_PATCH,
# ifdef SIMULATE_VERSION_TWEAK
'.', SIMULATE_VERSION_TWEAK,
# endif
# endif
# endif
']','\0'};
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
#if !defined(__STDC__) && !defined(__clang__)
# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__)
# define C_VERSION "90"
# else
# define C_VERSION
# endif
#elif __STDC_VERSION__ > 201710L
# define C_VERSION "23"
#elif __STDC_VERSION__ >= 201710L
# define C_VERSION "17"
#elif __STDC_VERSION__ >= 201000L
# define C_VERSION "11"
#elif __STDC_VERSION__ >= 199901L
# define C_VERSION "99"
#else
# define C_VERSION "90"
#endif
const char* info_language_standard_default =
"INFO" ":" "standard_default[" C_VERSION "]";
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */
#if (defined(__clang__) || defined(__GNUC__) || \
defined(__TI_COMPILER_VERSION__)) && \
!defined(__STRICT_ANSI__) && !defined(_MSC_VER)
"ON"
#else
"OFF"
#endif
"]";
/*--------------------------------------------------------------------------*/
#ifdef ID_VOID_MAIN
void main() {}
#else
# if defined(__CLASSIC_C__)
int main(argc, argv) int argc; char *argv[];
# else
int main(int argc, char* argv[])
# endif
{
int require = 0;
require += info_compiler[argc];
require += info_platform[argc];
require += info_arch[argc];
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
#ifdef COMPILER_VERSION_INTERNAL
require += info_version_internal[argc];
#endif
#ifdef SIMULATE_ID
require += info_simulate[argc];
#endif
#ifdef SIMULATE_VERSION_MAJOR
require += info_simulate_version[argc];
#endif
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
require += info_cray[argc];
#endif
require += info_language_standard_default[argc];
require += info_language_extensions_default[argc];
(void)argv;
return require;
}
#endif
/* This source file must have a .cpp extension so that all C++ compilers
recognize the extension without flags. Borland does not know .cxx for
example. */
#ifndef __cplusplus
# error "A C compiler has been selected for C++."
#endif
#if !defined(__has_include)
/* If the compiler does not have __has_include, pretend the answer is
always no. */
# define __has_include(x) 0
#endif
/* Version number components: V=Version, R=Revision, P=Patch
Version date components: YYYY=Year, MM=Month, DD=Day */
#if defined(__COMO__)
# define COMPILER_ID "Comeau"
/* __COMO_VERSION__ = VRR */
# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)
#elif defined(__INTEL_COMPILER) || defined(__ICC)
# define COMPILER_ID "Intel"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# if defined(__GNUC__)
# define SIMULATE_ID "GNU"
# endif
/* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later,
except that a few beta releases use the old format with V=2021. */
# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
# if defined(__INTEL_COMPILER_UPDATE)
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
# else
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
# endif
# else
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER)
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE)
/* The third version component from --version is an update index,
but no macro is provided for it. */
# define COMPILER_VERSION_PATCH DEC(0)
# endif
# if defined(__INTEL_COMPILER_BUILD_DATE)
/* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
# endif
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
# if defined(__GNUC__)
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
# elif defined(__GNUG__)
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
# endif
# if defined(__GNUC_MINOR__)
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
# endif
# if defined(__GNUC_PATCHLEVEL__)
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
# endif
#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER)
# define COMPILER_ID "IntelLLVM"
#if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
#endif
#if defined(__GNUC__)
# define SIMULATE_ID "GNU"
#endif
/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and
* later. Look for 6 digit vs. 8 digit version number to decide encoding.
* VVVV is no smaller than the current year when a version is released.
*/
#if __INTEL_LLVM_COMPILER < 1000000L
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100)
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10)
#else
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000)
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100)
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100)
#endif
#if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
#endif
#if defined(__GNUC__)
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
#elif defined(__GNUG__)
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
#endif
#if defined(__GNUC_MINOR__)
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
#endif
#if defined(__GNUC_PATCHLEVEL__)
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
#endif
#elif defined(__PATHCC__)
# define COMPILER_ID "PathScale"
# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
# if defined(__PATHCC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
# endif
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
# define COMPILER_ID "Embarcadero"
# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
#elif defined(__BORLANDC__)
# define COMPILER_ID "Borland"
/* __BORLANDC__ = 0xVRR */
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
# define COMPILER_ID "Watcom"
/* __WATCOMC__ = VVRR */
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# if (__WATCOMC__ % 10) > 0
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
# endif
#elif defined(__WATCOMC__)
# define COMPILER_ID "OpenWatcom"
/* __WATCOMC__ = VVRP + 1100 */
# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# if (__WATCOMC__ % 10) > 0
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
# endif
#elif defined(__SUNPRO_CC)
# define COMPILER_ID "SunPro"
# if __SUNPRO_CC >= 0x5100
/* __SUNPRO_CC = 0xVRRP */
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
# else
/* __SUNPRO_CC = 0xVRP */
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
# endif
#elif defined(__HP_aCC)
# define COMPILER_ID "HP"
/* __HP_aCC = VVRRPP */
# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100)
#elif defined(__DECCXX)
# define COMPILER_ID "Compaq"
/* __DECCXX_VER = VVRRTPPPP */
# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100)
# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000)
#elif defined(__IBMCPP__) && defined(__COMPILER_VER__)
# define COMPILER_ID "zOS"
/* __IBMCPP__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
#elif defined(__ibmxl__) && defined(__clang__)
# define COMPILER_ID "XLClang"
# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800
# define COMPILER_ID "XL"
/* __IBMCPP__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800
# define COMPILER_ID "VisualAge"
/* __IBMCPP__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
#elif defined(__NVCOMPILER)
# define COMPILER_ID "NVHPC"
# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__)
# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__)
# if defined(__NVCOMPILER_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__)
# endif
#elif defined(__PGI)
# define COMPILER_ID "PGI"
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
# if defined(__PGIC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
# endif
#elif defined(_CRAYC)
# define COMPILER_ID "Cray"
# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
#elif defined(__TI_COMPILER_VERSION__)
# define COMPILER_ID "TI"
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
#elif defined(__CLANG_FUJITSU)
# define COMPILER_ID "FujitsuClang"
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
# define COMPILER_VERSION_INTERNAL_STR __clang_version__
#elif defined(__FUJITSU)
# define COMPILER_ID "Fujitsu"
# if defined(__FCC_version__)
# define COMPILER_VERSION __FCC_version__
# elif defined(__FCC_major__)
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
# endif
# if defined(__fcc_version)
# define COMPILER_VERSION_INTERNAL DEC(__fcc_version)
# elif defined(__FCC_VERSION)
# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION)
# endif
#elif defined(__ghs__)
# define COMPILER_ID "GHS"
/* __GHS_VERSION_NUMBER = VVVVRP */
# ifdef __GHS_VERSION_NUMBER
# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
# endif
#elif defined(__SCO_VERSION__)
# define COMPILER_ID "SCO"
#elif defined(__ARMCC_VERSION) && !defined(__clang__)
# define COMPILER_ID "ARMCC"
#if __ARMCC_VERSION >= 1000000
/* __ARMCC_VERSION = VRRPPPP */
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
#else
/* __ARMCC_VERSION = VRPPPP */
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
#endif
#elif defined(__clang__) && defined(__apple_build_version__)
# define COMPILER_ID "AppleClang"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
# define COMPILER_ID "ARMClang"
# define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
# define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
# define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000)
# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
#elif defined(__clang__)
# define COMPILER_ID "Clang"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
#elif defined(__GNUC__) || defined(__GNUG__)
# define COMPILER_ID "GNU"
# if defined(__GNUC__)
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
# else
# define COMPILER_VERSION_MAJOR DEC(__GNUG__)
# endif
# if defined(__GNUC_MINOR__)
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
# endif
# if defined(__GNUC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
# endif
#elif defined(_MSC_VER)
# define COMPILER_ID "MSVC"
/* _MSC_VER = VVRR */
# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
# if defined(_MSC_FULL_VER)
# if _MSC_VER >= 1400
/* _MSC_FULL_VER = VVRRPPPPP */
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
# else
/* _MSC_FULL_VER = VVRRPPPP */
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
# endif
# endif
# if defined(_MSC_BUILD)
# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
# endif
#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
# define COMPILER_ID "ADSP"
#if defined(__VISUALDSPVERSION__)
/* __VISUALDSPVERSION__ = 0xVVRRPP00 */
# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
#endif
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
# define COMPILER_ID "IAR"
# if defined(__VER__) && defined(__ICCARM__)
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__))
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
# endif
/* These compilers are either not known or too old to define an
identification macro. Try to identify the platform and guess that
it is the native compiler. */
#elif defined(__hpux) || defined(__hpua)
# define COMPILER_ID "HP"
#else /* unknown compiler */
# define COMPILER_ID ""
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
#ifdef SIMULATE_ID
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
#endif
#ifdef __QNXNTO__
char const* qnxnto = "INFO" ":" "qnxnto[]";
#endif
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
#endif
#define STRINGIFY_HELPER(X) #X
#define STRINGIFY(X) STRINGIFY_HELPER(X)
/* Identify known platforms by name. */
#if defined(__linux) || defined(__linux__) || defined(linux)
# define PLATFORM_ID "Linux"
#elif defined(__MSYS__)
# define PLATFORM_ID "MSYS"
#elif defined(__CYGWIN__)
# define PLATFORM_ID "Cygwin"
#elif defined(__MINGW32__)
# define PLATFORM_ID "MinGW"
#elif defined(__APPLE__)
# define PLATFORM_ID "Darwin"
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
# define PLATFORM_ID "Windows"
#elif defined(__FreeBSD__) || defined(__FreeBSD)
# define PLATFORM_ID "FreeBSD"
#elif defined(__NetBSD__) || defined(__NetBSD)
# define PLATFORM_ID "NetBSD"
#elif defined(__OpenBSD__) || defined(__OPENBSD)
# define PLATFORM_ID "OpenBSD"
#elif defined(__sun) || defined(sun)
# define PLATFORM_ID "SunOS"
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
# define PLATFORM_ID "AIX"
#elif defined(__hpux) || defined(__hpux__)
# define PLATFORM_ID "HP-UX"
#elif defined(__HAIKU__)
# define PLATFORM_ID "Haiku"
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
# define PLATFORM_ID "BeOS"
#elif defined(__QNX__) || defined(__QNXNTO__)
# define PLATFORM_ID "QNX"
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
# define PLATFORM_ID "Tru64"
#elif defined(__riscos) || defined(__riscos__)
# define PLATFORM_ID "RISCos"
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
# define PLATFORM_ID "SINIX"
#elif defined(__UNIX_SV__)
# define PLATFORM_ID "UNIX_SV"
#elif defined(__bsdos__)
# define PLATFORM_ID "BSDOS"
#elif defined(_MPRAS) || defined(MPRAS)
# define PLATFORM_ID "MP-RAS"
#elif defined(__osf) || defined(__osf__)
# define PLATFORM_ID "OSF1"
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
# define PLATFORM_ID "SCO_SV"
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
# define PLATFORM_ID "ULTRIX"
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
# define PLATFORM_ID "Xenix"
#elif defined(__WATCOMC__)
# if defined(__LINUX__)
# define PLATFORM_ID "Linux"
# elif defined(__DOS__)
# define PLATFORM_ID "DOS"
# elif defined(__OS2__)
# define PLATFORM_ID "OS2"
# elif defined(__WINDOWS__)
# define PLATFORM_ID "Windows3x"
# elif defined(__VXWORKS__)
# define PLATFORM_ID "VxWorks"
# else /* unknown platform */
# define PLATFORM_ID
# endif
#elif defined(__INTEGRITY)
# if defined(INT_178B)
# define PLATFORM_ID "Integrity178"
# else /* regular Integrity */
# define PLATFORM_ID "Integrity"
# endif
#else /* unknown platform */
# define PLATFORM_ID
#endif
/* For windows compilers MSVC and Intel we can determine
the architecture of the compiler being used. This is because
the compilers do not have flags that can change the architecture,
but rather depend on which compiler is being used
*/
#if defined(_WIN32) && defined(_MSC_VER)
# if defined(_M_IA64)
# define ARCHITECTURE_ID "IA64"
# elif defined(_M_ARM64EC)
# define ARCHITECTURE_ID "ARM64EC"
# elif defined(_M_X64) || defined(_M_AMD64)
# define ARCHITECTURE_ID "x64"
# elif defined(_M_IX86)
# define ARCHITECTURE_ID "X86"
# elif defined(_M_ARM64)
# define ARCHITECTURE_ID "ARM64"
# elif defined(_M_ARM)
# if _M_ARM == 4
# define ARCHITECTURE_ID "ARMV4I"
# elif _M_ARM == 5
# define ARCHITECTURE_ID "ARMV5I"
# else
# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
# endif
# elif defined(_M_MIPS)
# define ARCHITECTURE_ID "MIPS"
# elif defined(_M_SH)
# define ARCHITECTURE_ID "SHx"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__WATCOMC__)
# if defined(_M_I86)
# define ARCHITECTURE_ID "I86"
# elif defined(_M_IX86)
# define ARCHITECTURE_ID "X86"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
# if defined(__ICCARM__)
# define ARCHITECTURE_ID "ARM"
# elif defined(__ICCRX__)
# define ARCHITECTURE_ID "RX"
# elif defined(__ICCRH850__)
# define ARCHITECTURE_ID "RH850"
# elif defined(__ICCRL78__)
# define ARCHITECTURE_ID "RL78"
# elif defined(__ICCRISCV__)
# define ARCHITECTURE_ID "RISCV"
# elif defined(__ICCAVR__)
# define ARCHITECTURE_ID "AVR"
# elif defined(__ICC430__)
# define ARCHITECTURE_ID "MSP430"
# elif defined(__ICCV850__)
# define ARCHITECTURE_ID "V850"
# elif defined(__ICC8051__)
# define ARCHITECTURE_ID "8051"
# elif defined(__ICCSTM8__)
# define ARCHITECTURE_ID "STM8"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__ghs__)
# if defined(__PPC64__)
# define ARCHITECTURE_ID "PPC64"
# elif defined(__ppc__)
# define ARCHITECTURE_ID "PPC"
# elif defined(__ARM__)
# define ARCHITECTURE_ID "ARM"
# elif defined(__x86_64__)
# define ARCHITECTURE_ID "x64"
# elif defined(__i386__)
# define ARCHITECTURE_ID "X86"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__TI_COMPILER_VERSION__)
# if defined(__TI_ARM__)
# define ARCHITECTURE_ID "ARM"
# elif defined(__MSP430__)
# define ARCHITECTURE_ID "MSP430"
# elif defined(__TMS320C28XX__)
# define ARCHITECTURE_ID "TMS320C28x"
# elif defined(__TMS320C6X__) || defined(_TMS320C6X)
# define ARCHITECTURE_ID "TMS320C6x"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#else
# define ARCHITECTURE_ID
#endif
/* Convert integer to decimal digit literals. */
#define DEC(n) \
('0' + (((n) / 10000000)%10)), \
('0' + (((n) / 1000000)%10)), \
('0' + (((n) / 100000)%10)), \
('0' + (((n) / 10000)%10)), \
('0' + (((n) / 1000)%10)), \
('0' + (((n) / 100)%10)), \
('0' + (((n) / 10)%10)), \
('0' + ((n) % 10))
/* Convert integer to hex digit literals. */
#define HEX(n) \
('0' + ((n)>>28 & 0xF)), \
('0' + ((n)>>24 & 0xF)), \
('0' + ((n)>>20 & 0xF)), \
('0' + ((n)>>16 & 0xF)), \
('0' + ((n)>>12 & 0xF)), \
('0' + ((n)>>8 & 0xF)), \
('0' + ((n)>>4 & 0xF)), \
('0' + ((n) & 0xF))
/* Construct a string literal encoding the version number. */
#ifdef COMPILER_VERSION
char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]";
/* Construct a string literal encoding the version number components. */
#elif defined(COMPILER_VERSION_MAJOR)
char const info_version[] = {
'I', 'N', 'F', 'O', ':',
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
COMPILER_VERSION_MAJOR,
# ifdef COMPILER_VERSION_MINOR
'.', COMPILER_VERSION_MINOR,
# ifdef COMPILER_VERSION_PATCH
'.', COMPILER_VERSION_PATCH,
# ifdef COMPILER_VERSION_TWEAK
'.', COMPILER_VERSION_TWEAK,
# endif
# endif
# endif
']','\0'};
#endif
/* Construct a string literal encoding the internal version number. */
#ifdef COMPILER_VERSION_INTERNAL
char const info_version_internal[] = {
'I', 'N', 'F', 'O', ':',
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
'i','n','t','e','r','n','a','l','[',
COMPILER_VERSION_INTERNAL,']','\0'};
#elif defined(COMPILER_VERSION_INTERNAL_STR)
char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]";
#endif
/* Construct a string literal encoding the version number components. */
#ifdef SIMULATE_VERSION_MAJOR
char const info_simulate_version[] = {
'I', 'N', 'F', 'O', ':',
's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
SIMULATE_VERSION_MAJOR,
# ifdef SIMULATE_VERSION_MINOR
'.', SIMULATE_VERSION_MINOR,
# ifdef SIMULATE_VERSION_PATCH
'.', SIMULATE_VERSION_PATCH,
# ifdef SIMULATE_VERSION_TWEAK
'.', SIMULATE_VERSION_TWEAK,
# endif
# endif
# endif
']','\0'};
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L
# if defined(__INTEL_CXX11_MODE__)
# if defined(__cpp_aggregate_nsdmi)
# define CXX_STD 201402L
# else
# define CXX_STD 201103L
# endif
# else
# define CXX_STD 199711L
# endif
#elif defined(_MSC_VER) && defined(_MSVC_LANG)
# define CXX_STD _MSVC_LANG
#else
# define CXX_STD __cplusplus
#endif
const char* info_language_standard_default = "INFO" ":" "standard_default["
#if CXX_STD > 202002L
"23"
#elif CXX_STD > 201703L
"20"
#elif CXX_STD >= 201703L
"17"
#elif CXX_STD >= 201402L
"14"
#elif CXX_STD >= 201103L
"11"
#else
"98"
#endif
"]";
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */
#if (defined(__clang__) || defined(__GNUC__) || \
defined(__TI_COMPILER_VERSION__)) && \
!defined(__STRICT_ANSI__) && !defined(_MSC_VER)
"ON"
#else
"OFF"
#endif
"]";
/*--------------------------------------------------------------------------*/
int main(int argc, char* argv[])
{
int require = 0;
require += info_compiler[argc];
require += info_platform[argc];
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
#ifdef COMPILER_VERSION_INTERNAL
require += info_version_internal[argc];
#endif
#ifdef SIMULATE_ID
require += info_simulate[argc];
#endif
#ifdef SIMULATE_VERSION_MAJOR
require += info_simulate_version[argc];
#endif
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
require += info_cray[argc];
#endif
require += info_language_standard_default[argc];
require += info_language_extensions_default[argc];
(void)argv;
return require;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(HEAD_HASH)
file(READ "/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/build/CMakeFiles/git-data/HEAD" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
set(GIT_DIR "/home/king/esp/esp-idf/.git")
# handle git-worktree
if(EXISTS "${GIT_DIR}/commondir")
file(READ "${GIT_DIR}/commondir" GIT_DIR_NEW LIMIT 1024)
string(STRIP "${GIT_DIR_NEW}" GIT_DIR_NEW)
if(NOT IS_ABSOLUTE "${GIT_DIR_NEW}")
get_filename_component(GIT_DIR_NEW ${GIT_DIR}/${GIT_DIR_NEW} ABSOLUTE)
endif()
if(EXISTS "${GIT_DIR_NEW}")
set(GIT_DIR "${GIT_DIR_NEW}")
endif()
endif()
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "${GIT_DIR}/${HEAD_REF}")
configure_file("${GIT_DIR}/${HEAD_REF}" "/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/build/CMakeFiles/git-data/head-ref" COPYONLY)
elseif(EXISTS "${GIT_DIR}/logs/${HEAD_REF}")
configure_file("${GIT_DIR}/logs/${HEAD_REF}" "/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/build/CMakeFiles/git-data/head-ref" COPYONLY)
set(HEAD_HASH "${HEAD_REF}")
endif()
else()
# detached HEAD
configure_file("${GIT_DIR}/HEAD" "/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/build/CMakeFiles/git-data/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/build/CMakeFiles/git-data/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()
69359f4dfb75e4b9c3bf93a03f4f05f750a14a72
components:
- name: "app_trace"
path: "/home/king/esp/esp-idf/components/app_trace"
- name: "app_update"
path: "/home/king/esp/esp-idf/components/app_update"
- name: "bootloader"
path: "/home/king/esp/esp-idf/components/bootloader"
- name: "bootloader_support"
path: "/home/king/esp/esp-idf/components/bootloader_support"
- name: "bt"
path: "/home/king/esp/esp-idf/components/bt"
- name: "cmock"
path: "/home/king/esp/esp-idf/components/cmock"
- name: "console"
path: "/home/king/esp/esp-idf/components/console"
- name: "cxx"
path: "/home/king/esp/esp-idf/components/cxx"
- name: "driver"
path: "/home/king/esp/esp-idf/components/driver"
- name: "efuse"
path: "/home/king/esp/esp-idf/components/efuse"
- name: "esp-tls"
path: "/home/king/esp/esp-idf/components/esp-tls"
- name: "esp_adc"
path: "/home/king/esp/esp-idf/components/esp_adc"
- name: "esp_app_format"
path: "/home/king/esp/esp-idf/components/esp_app_format"
- name: "esp_bootloader_format"
path: "/home/king/esp/esp-idf/components/esp_bootloader_format"
- name: "esp_coex"
path: "/home/king/esp/esp-idf/components/esp_coex"
- name: "esp_common"
path: "/home/king/esp/esp-idf/components/esp_common"
- name: "esp_eth"
path: "/home/king/esp/esp-idf/components/esp_eth"
- name: "esp_event"
path: "/home/king/esp/esp-idf/components/esp_event"
- name: "esp_gdbstub"
path: "/home/king/esp/esp-idf/components/esp_gdbstub"
- name: "esp_hid"
path: "/home/king/esp/esp-idf/components/esp_hid"
- name: "esp_http_client"
path: "/home/king/esp/esp-idf/components/esp_http_client"
- name: "esp_http_server"
path: "/home/king/esp/esp-idf/components/esp_http_server"
- name: "esp_https_ota"
path: "/home/king/esp/esp-idf/components/esp_https_ota"
- name: "esp_https_server"
path: "/home/king/esp/esp-idf/components/esp_https_server"
- name: "esp_hw_support"
path: "/home/king/esp/esp-idf/components/esp_hw_support"
- name: "esp_lcd"
path: "/home/king/esp/esp-idf/components/esp_lcd"
- name: "esp_local_ctrl"
path: "/home/king/esp/esp-idf/components/esp_local_ctrl"
- name: "esp_mm"
path: "/home/king/esp/esp-idf/components/esp_mm"
- name: "esp_netif"
path: "/home/king/esp/esp-idf/components/esp_netif"
- name: "esp_netif_stack"
path: "/home/king/esp/esp-idf/components/esp_netif_stack"
- name: "esp_partition"
path: "/home/king/esp/esp-idf/components/esp_partition"
- name: "esp_phy"
path: "/home/king/esp/esp-idf/components/esp_phy"
- name: "esp_pm"
path: "/home/king/esp/esp-idf/components/esp_pm"
- name: "esp_psram"
path: "/home/king/esp/esp-idf/components/esp_psram"
- name: "esp_ringbuf"
path: "/home/king/esp/esp-idf/components/esp_ringbuf"
- name: "esp_rom"
path: "/home/king/esp/esp-idf/components/esp_rom"
- name: "esp_system"
path: "/home/king/esp/esp-idf/components/esp_system"
- name: "esp_timer"
path: "/home/king/esp/esp-idf/components/esp_timer"
- name: "esp_wifi"
path: "/home/king/esp/esp-idf/components/esp_wifi"
- name: "espcoredump"
path: "/home/king/esp/esp-idf/components/espcoredump"
- name: "esptool_py"
path: "/home/king/esp/esp-idf/components/esptool_py"
- name: "fatfs"
path: "/home/king/esp/esp-idf/components/fatfs"
- name: "freertos"
path: "/home/king/esp/esp-idf/components/freertos"
- name: "hal"
path: "/home/king/esp/esp-idf/components/hal"
- name: "heap"
path: "/home/king/esp/esp-idf/components/heap"
- name: "http_parser"
path: "/home/king/esp/esp-idf/components/http_parser"
- name: "idf_test"
path: "/home/king/esp/esp-idf/components/idf_test"
- name: "ieee802154"
path: "/home/king/esp/esp-idf/components/ieee802154"
- name: "json"
path: "/home/king/esp/esp-idf/components/json"
- name: "linux"
path: "/home/king/esp/esp-idf/components/linux"
- name: "log"
path: "/home/king/esp/esp-idf/components/log"
- name: "lwip"
path: "/home/king/esp/esp-idf/components/lwip"
- name: "mbedtls"
path: "/home/king/esp/esp-idf/components/mbedtls"
- name: "mqtt"
path: "/home/king/esp/esp-idf/components/mqtt"
- name: "newlib"
path: "/home/king/esp/esp-idf/components/newlib"
- name: "nvs_flash"
path: "/home/king/esp/esp-idf/components/nvs_flash"
- name: "nvs_sec_provider"
path: "/home/king/esp/esp-idf/components/nvs_sec_provider"
- name: "openthread"
path: "/home/king/esp/esp-idf/components/openthread"
- name: "partition_table"
path: "/home/king/esp/esp-idf/components/partition_table"
- name: "perfmon"
path: "/home/king/esp/esp-idf/components/perfmon"
- name: "protobuf-c"
path: "/home/king/esp/esp-idf/components/protobuf-c"
- name: "protocomm"
path: "/home/king/esp/esp-idf/components/protocomm"
- name: "pthread"
path: "/home/king/esp/esp-idf/components/pthread"
- name: "riscv"
path: "/home/king/esp/esp-idf/components/riscv"
- name: "sdmmc"
path: "/home/king/esp/esp-idf/components/sdmmc"
- name: "soc"
path: "/home/king/esp/esp-idf/components/soc"
- name: "spi_flash"
path: "/home/king/esp/esp-idf/components/spi_flash"
- name: "spiffs"
path: "/home/king/esp/esp-idf/components/spiffs"
- name: "tcp_transport"
path: "/home/king/esp/esp-idf/components/tcp_transport"
- name: "touch_element"
path: "/home/king/esp/esp-idf/components/touch_element"
- name: "ulp"
path: "/home/king/esp/esp-idf/components/ulp"
- name: "unity"
path: "/home/king/esp/esp-idf/components/unity"
- name: "usb"
path: "/home/king/esp/esp-idf/components/usb"
- name: "vfs"
path: "/home/king/esp/esp-idf/components/vfs"
- name: "wear_levelling"
path: "/home/king/esp/esp-idf/components/wear_levelling"
- name: "wifi_provisioning"
path: "/home/king/esp/esp-idf/components/wifi_provisioning"
- name: "wpa_supplicant"
path: "/home/king/esp/esp-idf/components/wpa_supplicant"
- name: "xtensa"
path: "/home/king/esp/esp-idf/components/xtensa"
- name: "main"
path: "/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/main"
- name: "esp_jpeg"
path: "/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/esp_jpeg"
- name: "esp_lvgl_port"
path: "/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/esp_lvgl_port"
- name: "esp_mmap_assets"
path: "/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/esp_mmap_assets"
- name: "esp_wrover_kit"
path: "/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/esp_wrover_kit"
- name: "espressif__cmake_utilities"
path: "/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/espressif__cmake_utilities"
- name: "espressif__esp-dsp"
path: "/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/espressif__esp-dsp"
- name: "espressif__freetype"
path: "/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/espressif__freetype"
- name: "espressif__jsmn"
path: "/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/espressif__jsmn"
- name: "espressif__nghttp"
path: "/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/espressif__nghttp"
- name: "lvgl__lvgl"
path: "/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/lvgl__lvgl"
CMake Error at CMakeLists.txt:5 (include):
include could not find requested file:
/CMakeLists.txt
CMake Error at CMakeLists.txt:5 (include):
include could not find requested file:
/CMakeLists.txt
-- IDF_TARGET is not set, guessed 'esp32' from sdkconfig '/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/sdkconfig'
-- Found Git: /usr/bin/git (found version "2.34.1")
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- git rev-parse returned 'fatal: not a git repository (or any parent up to mount point /mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).'
-- Could not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32
Manifest files have changed, solving dependencies.
Using component placed at /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/esp_lvgl_port for dependency espressif/esp_lvgl_port(^2)(introduced by component esp_wrover_kit)
Using component placed at /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/esp_mmap_assets for dependency espressif/esp_mmap_assets(==1.0.0), specified in /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/main/idf_component.yml
Using component placed at /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/espressif__freetype for dependency espressif/freetype(2.*), specified in /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/main/idf_component.yml
Using component placed at /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/lvgl__lvgl for dependency lvgl/lvgl(~8.4.0), specified in /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/main/idf_component.yml
Using component placed at /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/espressif__cmake_utilities for dependency espressif/cmake_utilities(0.*)(introduced by component esp_mmap_assets), specified in /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/main/idf_component.yml
-- IDF_TARGET is not set, guessed 'esp32' from sdkconfig '/mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/sdkconfig'
-- Found Git: /usr/bin/git (found version "2.34.1")
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/king/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- git rev-parse returned 'fatal: not a git repository (or any parent up to mount point /mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).'
-- Could not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32
Manifest files have changed, solving dependencies.
Using component placed at /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/esp_lvgl_port for dependency espressif/esp_lvgl_port(^2)(introduced by component esp_wrover_kit)
Using component placed at /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/esp_mmap_assets for dependency espressif/esp_mmap_assets(==1.0.0), specified in /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/main/idf_component.yml
Using component placed at /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/espressif__freetype for dependency espressif/freetype(2.*), specified in /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/main/idf_component.yml
Using component placed at /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/lvgl__lvgl for dependency lvgl/lvgl(~8.4.0), specified in /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/main/idf_component.yml
Using component placed at /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/components/espressif__cmake_utilities for dependency espressif/cmake_utilities(0.*)(introduced by component esp_mmap_assets), specified in /mnt/hgfs/Shared/yedea-c011-M/yedea-c011-l/main/idf_component.yml
...@@ -9,721 +9,9 @@ ...@@ -9,721 +9,9 @@
#include "Telltales_user.h" #include "Telltales_user.h"
#include "Telltales_Lib.h" #include "Telltales_Lib.h"
static const char *ProtocolTAG = "MCU_Core_Protocol"; static const char *ProtocolTAG = "MCU_Core_Protocol";
static LineData_un_t unDataLine;
static AnaData_t Data_Analog;
static _ID12_Data_un_t Data_Uart_SendID12;
static _ID13_Data_un_t Data_Uart_SendID13;
static _ID14_Data_un_t Data_Uart_SendID14;
static _ID15_Data_un_t Data_Uart_SendID15;
static _ID17_Data_un_t Data_Uart_SendID17;
static _ID18_Data_un_t Data_Uart_SendID18;
static _ID19_Data_un_t Data_Uart_SendID19;
static bool BackLightEn = 0;
static bool Lcd_En = 0;
static bool G031_Update_Flag = 0;
void Mcu_Core_Protocol_Init(void)
{
G031_Update_Flag = 0;
}
/**
* @brief 读取硬线数据
* @param data 传入数据
* @param len 传入数据长度
*/
void Read_Line_Data(const uint8_t *data, uint8_t len)
{
if (len > 4)
{
ESP_LOGW(ProtocolTAG, "Invalid Len !!!!");
return;
}
for (uint8_t i = 0; i < len; i++)
{
unDataLine.Msg[i] = data[i];
// printf("Data_Line.Msg = %x\r\n", Data_Line.Msg[i]);
}
//printf("Data_Line.Msg END !!!! \r\n");
}
/**
* @brief 读取模拟量数据
* @param data 传入数据
* @param len 传入数据长度
*/
void Read_AnaLog_Data(const uint8_t *data, uint8_t len)
{
if (len > 3)
{
ESP_LOGW(ProtocolTAG, "Invalid Len !!!!");
return;
}
for (uint8_t i = 0; i < len; i++)
{
Data_Analog.Msg[i] = data[i];
// printf("Data_Analog.Msg = %x\r\n", Data_Analog.Msg[i]);
}
// printf("Data_Analog.Msg END !!!! \r\n");
}
/**
* @brief 获取确认按键信号
* @return 0 无效 1 短按 2 长按
*/
bool Get_Line_Confirm(void)
{
return unDataLine.Sig.ButtonConfirm;
}
/**
* @brief 获取取消按键信号
* @return 0 无效 1 短按 2 长按
*/
bool Get_Line_Cancel(void)
{
return unDataLine.Sig.ButtonCancel;
}
/**
* @brief 获取向下按键信号
* @return 0 无效 1 短按 2 长按
*/
bool Get_Line_Down(void)
{
return unDataLine.Sig.ButtonDown;
}
/**
* @brief 获取向上按键信号
* @return 0 无效 1 短按 2 长按
*/
bool Get_Line_Up(void)
{
return unDataLine.Sig.ButtonUp;
}
/**
* @brief 获取向左按键信号
* @return 0 无效 1 短按 2 长按
*/
bool Get_Line_Left(void)
{
return unDataLine.Sig.ButtonLeft;
}
/**
* @brief 获取向右按键信号
* @return 0 无效 1 短按 2 长按
*/
bool Get_Line_Right(void)
{
return unDataLine.Sig.ButtonRight;
}
/**
* @brief 获取左转硬线信号
* @return 0 无效 1 有效
*/
bool Get_Line_LeftTurn(void)
{
// if(!Data_Line.Sig.TurnLeft)
// {
// printf("left = %d \n",Data_Line.Sig.TurnLeft);
// }
return unDataLine.Sig.TurnLeft;
}
/**
* @brief 获取右转硬线信号
* @return 0 无效 1 有效
*/
bool Get_Line_RightTurn(void)
{
return unDataLine.Sig.TurnRight;
}
/**
* @brief 获取近光灯硬线信号
* @return 0 无效 1 有效
*/
bool Get_Line_LowBeam(void)
{
return unDataLine.Sig.LowBeam;
}
/**
* @brief 获取远光灯硬线信号
* @return 0 无效 1 有效
*/
bool Get_Line_HighBeam(void)
{
return unDataLine.Sig.HightBeam;
}
/**
* @brief 获取位置灯硬线信号
* @return 0 无效 1 有效
*/
bool Get_Line_Position(void)
{
return unDataLine.Sig.Position;
}
/**
* @brief 获取双闪信号
* @return 0 无效 1 有效
*/
bool Get_Line_DoubleFlash(void)
{
return unDataLine.Sig.DoubleFlash;
}
/**
* @brief 获取复位信号
* @return 0 无效 1 有效
*/
bool Get_Line_Reset(void)
{
return unDataLine.Sig.Reset;
}
/**
* @brief 获取Blutooth信号
* @return 0 无效 1 有效
*/
bool Get_Line_Bluetooth(void)
{
return unDataLine.Sig.Bluetooth;
}
// /**
// * @brief 获取蓝牙指示灯硬线信号
// * @return 0 无效 1 有效
// */
// bool Get_Line_Buletooth(void)
// {
// //printf("Data_Line.Sig.Buletooth = %d \n",Data_Line.Sig.Buletooth);
// return unDataLine.Sig.Buletooth;
// }
// /**
// * @brief 获取光感输出使能
// * @return 0 无效 1 有效
// */
// bool Get_Line_LightSensorEn(void)
// {
// return Data_Line.Sig.LightSensorEn;
// }
/**
* @brief 获取ACC电压值
* @return ACC电压值。单位,mv
*/
uint32_t Get_ACC_Value(void)
{
uint32_t ACC = 0;
ACC = Comm_Make_Long(Data_Analog.Sig.ACC_L, Data_Analog.Sig.ACC_M, Data_Analog.Sig.ACC_H);
//printf("ACC = %d\r\n", ACC);
return ACC;
}
/**
* @brief 发送ID12数据 50ms周期调用
*
*/
void Core_ID12_Service(void)
{
memset(Data_Uart_SendID12.Msg, 0, sizeof(Data_Uart_SendID12.Msg));
Data_Uart_SendID12.Sig.u8LEDLeft = Turn.Left;
Data_Uart_SendID12.Sig.u8LEDPosition = Get_TelltalesLedSts(LED_Position);
Data_Uart_SendID12.Sig.u8LEDAUTO = Get_TelltalesLedSts(LED_AUTOHeadlight);
Data_Uart_SendID12.Sig.u8LEDLowBeam = Get_TelltalesLedSts(LED_DippedHead);
Data_Uart_SendID12.Sig.u8LEDHighBeam = Get_TelltalesLedSts(LED_HighBeam);
Data_Uart_SendID12.Sig.u8LEDTCS = Get_TelltalesLedSts(LED_TCS);
Data_Uart_SendID12.Sig.u8LEDReady = Get_TelltalesLedSts(LED_READY);
Data_Uart_SendID12.Sig.u8LEDSystemFault = Get_TelltalesLedSts(LED_FaultStatus);
Data_Uart_SendID12.Sig.u8LEDCharging = Get_TelltalesLedSts(LED_ChargeLineConnect);
Data_Uart_SendID12.Sig.u8LEDBluetooth = Get_TelltalesLedSts(LED_BluetoothConnect);
Data_Uart_SendID12.Sig.u8LEDRight = Turn.Right;
Data_Uart_SendID12.Sig.u8LEDCruiseWork = Get_TelltalesLedSts(LED_CruiseWork);
Data_Uart_SendID12.Sig.u8LEDHDC = Get_TelltalesLedSts(LED_HDC);
Data_Uart_SendID12.Sig.u8LEDLimping = Get_TelltalesLedSts(LED_Limping);
Data_Uart_SendID12.Sig.u8LEDSupport = Get_TelltalesLedSts(LED_Support);
Protocol_Send(DATA_ID12, Data_Uart_SendID12.Msg, sizeof(Data_Uart_SendID12.Msg));
}
void Core_ID13_Service(void)
{
memset(Data_Uart_SendID13.Msg, 0, sizeof(Data_Uart_SendID13.Msg));
Data_Uart_SendID13.Sig.u8VspeedValue = (uint8_t)((Get_Dis_Vspeed() / 10) & 0x7F);
Data_Uart_SendID13.Sig.u8VspeedValid = Get_Vspeed_Valid();
Data_Uart_SendID13.Sig.DriveMode = Get_Driver_Mode();
Protocol_Send(DATA_ID13, Data_Uart_SendID13.Msg, sizeof(Data_Uart_SendID13.Msg));
}
void Core_ID14_Service(void)
{
uint16_t u16Endurance = Get_Endurance_Value();
memset(Data_Uart_SendID14.Msg, 0, sizeof(Data_Uart_SendID14.Msg));
Data_Uart_SendID14.Sig.u8EnduranceH = (u16Endurance >> 8) & 0xFF;
Data_Uart_SendID14.Sig.u8EnduranceL = u16Endurance & 0xFF;
Data_Uart_SendID14.Sig.u8EnduranceOn = Get_Endurance_Set_Flag();
Data_Uart_SendID14.Sig.u8EnduranceValid = Get_Endurance_Valid();
Protocol_Send(DATA_ID14, Data_Uart_SendID14.Msg, sizeof(Data_Uart_SendID14.Msg));
}
void Core_ID15_Service(void)
{
uint32_t u32ODO = User_Data_ODO_Read();
uint32_t u32Trip = User_Data_Trip_Read();
memset(Data_Uart_SendID15.Msg, 0, sizeof(Data_Uart_SendID15.Msg));
Data_Uart_SendID15.Sig.u8ODOH = (u32ODO >> 16) & 0xFF;
Data_Uart_SendID15.Sig.u8ODOM = (u32ODO >> 8) & 0xFF;
Data_Uart_SendID15.Sig.u8ODOL = u32ODO & 0xFF;
Data_Uart_SendID15.Sig.u8TripH = (u32Trip >> 16) & 0xFF;
Data_Uart_SendID15.Sig.u8TripM = (u32Trip >> 8) & 0xFF;
Data_Uart_SendID15.Sig.u8TripL = u32Trip & 0xFF;
Data_Uart_SendID15.Sig.u8ODOH = 1;
Protocol_Send(DATA_ID15, Data_Uart_SendID15.Msg, sizeof(Data_Uart_SendID15.Msg));
}
void Core_ID17_Service(void)
{
memset(Data_Uart_SendID17.Msg, 0, sizeof(Data_Uart_SendID17.Msg));
Data_Uart_SendID17.Sig.u8Hour = Get_dispHour();
Data_Uart_SendID17.Sig.u8Minute = Get_dispMin();
Data_Uart_SendID17.Sig.u8TimeValid = Get_Data_Time_Valid();
Protocol_Send(DATA_ID17, Data_Uart_SendID17.Msg, sizeof(Data_Uart_SendID17.Msg));
}
void Core_ID18_Service(void)
{
memset(Data_Uart_SendID18.Msg, 0, sizeof(Data_Uart_SendID18.Msg));
Data_Uart_SendID18.Sig.u8SOCSeg = Get_Soc_Seg();
Data_Uart_SendID18.Sig.u8SOCLED = Get_Soc_Vaild();
Data_Uart_SendID18.Sig.u8SOCValue = Get_Soc_Value();
Protocol_Send(DATA_ID18, Data_Uart_SendID18.Msg, sizeof(Data_Uart_SendID18.Msg));
}
void Core_ID19_Service(void)
{
memset(Data_Uart_SendID19.Msg, 0, sizeof(Data_Uart_SendID19.Msg));
Data_Uart_SendID19.Sig.u8Uint = Get_UintSetting_Value();
Data_Uart_SendID19.Sig.u8RGB = 0;
Protocol_Send(DATA_ID19, Data_Uart_SendID19.Msg, sizeof(Data_Uart_SendID19.Msg));
}
/**
* @brief 设置LCD上电/下电
* @param
*/
void Set_LCD_EN(uint8_t FLAG)
{
Lcd_En = FLAG;
}
/**
* @brief 设置背光使能
* @param onoff 1 开启 0 关闭
*/
void Set_BacklightEn(uint8_t onoff)
{
BackLightEn = onoff;
// printf("BackLightEn %d\r\n",BackLightEn);
}
void Send_MCU_ID10(uint8_t Flag)
{
if (Flag != 1)
{
Protocol_Send(0x10, Protocol_NULL, 0);
// printf("Send_MCU_ID10 %d\r\n",Flag);
}
}
/**
* @brief 获取电源状态
* @return 1 IGON 0 IGOFF
*/
uint8_t Get_PowerStatus(void)
{
uint8_t Status = 0;
if(Get_Line_ACC1())
{
Status = 1;
}
else
{
Status = 0;
}
// printf("Get_Line_ACC1 = %d Get_Line_DC12V = % d \r\n",Get_Line_ACC1(),Get_Line_DC12V());
return Status;
}
/**
* @brief 获取背光状态
* @return 1 开启 0 关闭
*/
uint8_t Get_BackLightStatus(void)
{
uint8_t Status = 0;
if(Get_Line_DC12V())
{
Status = 1;
}
return Status;
}
uint8_t G031_Count = 0;
extern Protocol_uint32_t UpgradeStep;
void G031_Update_Service(void)
{
// if(Get_Boot_Animation_Flag())
// {
// G031_Update_Flag = 1;
// G031_Count = 0;
// }
// if(G031_Update_Flag)
// {
// if(G031_Count < 200)
// {
// G031_Count++;
// }
// //printf("G031_Count %d \r\n",G031_Count);
// if(G031_Count < 100)
// {
// Protocol_Send(G031_Boot_ID, Protocol_NULL, 0);
// }
// else if (G031_Count < 150)
// {
// Protocol_Send(G031_RESET_ID, Protocol_NULL, 0);
// // printf("Protocol_Send G031_RESET_ID \r\n");
// }
// // else if (G031_Count==200)
// // {
// // UpgradeStep=10;
// // G031_Count=210;//停止控制
// // }
// }
}
uint8_t setusrop[7]="\xEB\x90\x04\x00\x05\xF0\x02";
uint8_t setchipreset[7]="\xEB\x90\x04\x00\x0A\xB0\x06";
void G031toBoot(void)
{
printf("Protocol_Send G031_Boot_ID 1111 \r\n");
//Protocol_Send(G031_Boot_ID, Protocol_NULL, 0);
uart_wait_tx_done(ECHO_UART_PORT_NUM, 100); /* 等待数据发送完成 */
uart_write_bytes(ECHO_UART_PORT_NUM,setusrop,7);
}
void G031tReset(void)
{ printf("Protocol_Send G031_RESET_ID 2222 \r\n");
//Protocol_Send(G031_RESET_ID, Protocol_NULL, 0);
uart_wait_tx_done(ECHO_UART_PORT_NUM, 100); /* 等待数据发送完成 */
uart_write_bytes(ECHO_UART_PORT_NUM,setchipreset,7);
}
/*********************************************************************** */
/*********************************************************************** */
/*************************Menu********************************************** */
Menu_Item_en_t enMenuItemCurrent = MENU_ITEM_MAIN;
/*********************************************************************** */
/*********************************************************************** */
/*************************Menu********************************************** */
uint8_t u8MenuBTPairing = 0U; /*0:未开启。1:开启配对中 2:配对成功 */
uint8_t u8MenuNAV = 0U; /*导航状态 0:未开启。1:导航中 。2:导航结束*/
uint8_t u8MenuNAVBackup = 0U; /*导航状态 0:未开启。1:导航中 。2:导航结束*/
uint32_t u32MenuNAVTime = 0UL; /*导航结束计时*/
uint8_t u8MenuWorkMode = 0U; /*0:正常工作模式。 1:弹射模式。 2:能量回收模式*/
uint8_t u8MenuMusic = 0U; /*0:未开启。1:开启。*/
uint8_t u8MenuMusicBackup = 0U; /*0:未开启。1:开启。*/
uint8_t u8MenuCharge = 0U; /*0:未开启。1:开启。*/
uint8_t u8MenuChargeBackup = 0U; /*0:未开启。1:开启。*/
uint32_t u32MenuChargeTime = 0U; /*0:无法获取充满电时间。1:可获取充满电时间。*/
/*MS*/
void Menu_Time_Handle(uint8_t u8MenuTimeBase)
{
u32MenuNAVTime += u8MenuTimeBase;
if (u32MenuNAVTime >= 3000) /*计时3S*/
{
u32MenuNAVTime = 0;
if (enMenuItemCurrent == MENU_ITEM_NAV_FINISH)
{
enMenuItemCurrent = MENU_ITEM_MAIN;
}
}
u32MenuChargeTime += u8MenuTimeBase;
if (u32MenuChargeTime >= 15000) /*15S*/
{
u32MenuChargeTime = 0U;
if (enMenuItemCurrent == MENU_ITEM_CHARGE)
{
enMenuItemCurrent = MENU_ITEM_MAIN;
}
}
}
void Menu_Service(void)
{
/*状态发生变化*/
if (((u8MenuNAVBackup == 0) && (u8MenuNAV == 1)) || ((u8MenuMusicBackup == 0) && (u8MenuMusic == 1)))
{
if ((u8MenuMusic == 1) && (u8MenuNAV == 1)) /*导航,音乐同时开启*/
{
enMenuItemCurrent = MENU_ITEM_NAV_MUSIC;
}
else
{
if (u8MenuNAV == 1) /*只开导航*/
{
enMenuItemCurrent = MENU_ITEM_NAV;
}
if (u8MenuMusic == 1) /*只开音乐*/
{
enMenuItemCurrent = MENU_ITEM_MUSIC;
}
}
}
/*状态发生变化*/
if (((u8MenuNAVBackup == 1) && (u8MenuNAV == 0)) || ((u8MenuMusicBackup == 1) && (u8MenuMusic == 0)))
{
if (enMenuItemCurrent != MENU_ITEM_MAIN)
{
if (u8MenuNAV == 1) /*只开导航*/
{
enMenuItemCurrent = MENU_ITEM_NAV;
}
else if (u8MenuMusic == 1) /*只开音乐*/
{
enMenuItemCurrent = MENU_ITEM_MUSIC;
}
else
{
enMenuItemCurrent = MENU_ITEM_MAIN;
}
}
}
u8MenuMusicBackup = u8MenuMusic;
u8MenuNAVBackup = u8MenuNAV;
if ((u8MenuChargeBackup == 0) && (u8MenuCharge == 1))
{
enMenuItemCurrent = MENU_ITEM_CHARGE;
}
if ((u8MenuChargeBackup == 1) && (u8MenuCharge == 0))
{
enMenuItemCurrent = MENU_ITEM_MAIN;
}
u8MenuChargeBackup = u8MenuCharge;
}
void Menu_Set_Charge(uint8_t u8MenuData)
{
if (u8MenuCharge != u8MenuData)
{
u8MenuCharge = u8MenuData;
u32MenuChargeTime = 0U;
Menu_Service();
}
}
void Menu_Set_Music(uint8_t u8MenuData)
{
if (u8MenuMusic != u8MenuData)
{
u8MenuMusic = u8MenuData;
Menu_Service();
}
}
void Menu_Set_NAV(uint8_t u8MenuData)
{
if (u8MenuNAV != u8MenuData)
{
u32MenuNAVTime = 0;
u8MenuNAV = u8MenuData;
Menu_Service();
}
}
/*********************************************************************** */
/*********************************************************************** */
/*************************Button********************************************** */
typedef struct
{
uint8_t ButtonConfirm : 2;
uint8_t ButtonCancel : 2;
uint8_t ButtonDown : 2;
uint8_t ButtonUp : 2;
uint8_t ButtonLeft : 2;
uint8_t ButtonRight : 2;
uint8_t Reserved : 4;
} Btn_Event_st_t;
Btn_Event_st_t stBtnEventBackup;
Btn_Event_st_t stBtnEvent;
uint32_t u32BtnEventTime = 0UL;
void Btn_Event_Service(void)
{
stBtnEvent.ButtonConfirm = Get_Line_Confirm();
stBtnEvent.ButtonCancel = Get_Line_Cancel();
stBtnEvent.ButtonDown = Get_Line_Down();
stBtnEvent.ButtonUp = Get_Line_Up();
stBtnEvent.ButtonLeft = Get_Line_Left();
stBtnEvent.ButtonRight = Get_Line_Right();
if (u32BtnEventTime < 1000) /*按键累计超时间*/
{
u32BtnEventTime++;
}
else
{
u32BtnEventTime = 0UL;
}
if ((stBtnEventBackup.ButtonConfirm == 0) && (stBtnEvent.ButtonConfirm == 1))
{
u32BtnEventTime = 0UL;
}
else if ((stBtnEventBackup.ButtonConfirm == 0) && (stBtnEvent.ButtonConfirm == 2))
{
u32BtnEventTime = 0UL;
if (enMenuItemCurrent == MENU_ITEM_MAIN)
{
if ((u8MenuMusic == 1) && (u8MenuNAV == 1)) /*导航,音乐同时开启*/
{
enMenuItemCurrent = MENU_ITEM_NAV_MUSIC;
}
else
{
if (u8MenuNAV == 1) /*只开导航*/
{
enMenuItemCurrent = MENU_ITEM_NAV;
}
if (u8MenuMusic == 1) /*只开音乐*/
{
enMenuItemCurrent = MENU_ITEM_MUSIC;
}
}
}
else
{
if ((enMenuItemCurrent == MENU_ITEM_NAV_MUSIC) ||
(enMenuItemCurrent == MENU_ITEM_NAV) ||
(enMenuItemCurrent == MENU_ITEM_NAV_FINISH) ||
(enMenuItemCurrent == MENU_ITEM_MUSIC))
{
enMenuItemCurrent = MENU_ITEM_MAIN;
}
}
if (enMenuItemCurrent == MENU_ITEM_CHARGE)
{
enMenuItemCurrent = MENU_ITEM_MAIN;
}
}
stBtnEventBackup.ButtonConfirm = stBtnEvent.ButtonConfirm;
if ((stBtnEventBackup.ButtonCancel == 0) && (stBtnEvent.ButtonCancel == 1))
{
u32BtnEventTime = 0UL;
}
else if ((stBtnEventBackup.ButtonCancel == 0) && (stBtnEvent.ButtonCancel == 2))
{
u32BtnEventTime = 0UL;
}
stBtnEventBackup.ButtonCancel = stBtnEvent.ButtonCancel;
if ((stBtnEventBackup.ButtonDown == 0) && (stBtnEvent.ButtonDown == 1))
{
u32BtnEventTime = 0UL;
}
else if ((stBtnEventBackup.ButtonDown == 0) && (stBtnEvent.ButtonDown == 2))
{
u32BtnEventTime = 0UL;
}
stBtnEventBackup.ButtonDown = stBtnEvent.ButtonDown;
if ((stBtnEventBackup.ButtonUp == 0) && (stBtnEvent.ButtonUp == 1))
{
u32BtnEventTime = 0UL;
}
else if ((stBtnEventBackup.ButtonUp == 0) && (stBtnEvent.ButtonUp == 2))
{
u32BtnEventTime = 0UL;
}
stBtnEventBackup.ButtonUp = stBtnEvent.ButtonUp;
if ((stBtnEventBackup.ButtonLeft == 0) && (stBtnEvent.ButtonLeft == 1))
{
u32BtnEventTime = 0UL;
}
else if ((stBtnEventBackup.ButtonLeft == 0) && (stBtnEvent.ButtonLeft == 2))
{
u32BtnEventTime = 0UL;
}
stBtnEventBackup.ButtonLeft = stBtnEvent.ButtonLeft;
if ((stBtnEventBackup.ButtonRight == 0) && (stBtnEvent.ButtonRight == 1))
{
u32BtnEventTime = 0UL;
}
else if ((stBtnEventBackup.ButtonRight == 0) && (stBtnEvent.ButtonRight == 2))
{
u32BtnEventTime = 0UL;
}
stBtnEventBackup.ButtonRight = stBtnEvent.ButtonRight;
}
/*********************************************************************** */
/*********************************************************************** */
/*************************Button********************************************** */
static _ID19_Data_un_t Data_Uart_SendID10;
static _ID12_Data_un_t Data_Uart_SendID12;
static _ID02_Data_un_t Data_Uart_SendID02;
static _ID04_Data_un_t Data_Uart_SendID04;
Menu_Item_en_t Get_Current_Item(void)
{
return enMenuItemCurrent;
}
...@@ -7,188 +7,68 @@ ...@@ -7,188 +7,68 @@
#define LINE_DATA_PROTOCOL_ID 0x01 #define LINE_DATA_PROTOCOL_ID 0x01
#define ANALOG_DATA_PROTOCOL_ID 0X02 #define ANALOG_DATA_PROTOCOL_ID 0X02
#define MCU_DATA_PROTOCOL_ID 0X20 #define MCU_DATA_PROTOCOL_ID 0X20
#define DATA_ID12 0x12
#define DATA_ID13 0x13
#define DATA_ID14 0x14
#define DATA_ID15 0x15
#define DATA_ID17 0x17
#define DATA_ID18 0x18
#define DATA_ID19 0x19
#define G031_Boot_ID 0x5
#define G031_RESET_ID 0XA
typedef union
{
uint8_t Msg[4u];
struct
{
/* Byte 5 */
uint8_t HightBeam : 1;
uint8_t LowBeam : 1;
uint8_t DoubleFlash : 1;
uint8_t Reset : 1;
uint8_t TurnRight : 1;
uint8_t TurnLeft : 1;
uint8_t Position : 1;
uint8_t Bluetooth :1;
/* Byte 6 */ #define DATA_ID10 0x10U
uint8_t ButtonConfirm : 2; #define DATA_ID12 0x12U
uint8_t ButtonCancel : 2; #define DATA_ID02 0x02U
uint8_t ButtonDown : 2; #define DATA_ID04 0x04U
uint8_t ButtonUp : 2;
/* Byte 7 */
uint8_t ButtonLeft : 2;
uint8_t ButtonRight : 2;
uint8_t res : 4;
/* Byte 8 */
uint8_t res2 : 8;
} Sig;
} LineData_un_t;
typedef union typedef union
{ {
uint8_t Msg[3u]; uint8_t Msg[1u];
struct struct
{ {
uint8_t ACC_L : 8; /* Byte5 ACC采集 */ uint8_t u8StartSta : 1;
uint8_t ACC_M : 8; /* Byte6 ACC采集*/ uint8_t u8Res : 7;
uint8_t ACC_H : 8; /* Byte7 ACC采集*/
} Sig; } Sig;
} AnaData_t; } _ID10_Data_un_t;
typedef union typedef union
{ {
uint8_t Msg[3u]; uint8_t Msg[1u];
struct struct
{ {
uint8_t u8LEDLeft : 1; uint8_t u8AutoConnectSta : 1;
uint8_t u8LEDPosition : 1; uint8_t u8Res : 7;
uint8_t u8LEDAUTO : 1;
uint8_t u8LEDLowBeam : 1;
uint8_t u8LEDHighBeam : 1;
uint8_t u8LEDABS : 1;
uint8_t u8LEDTCS : 1;
uint8_t u8LEDReady : 1;
uint8_t u8LEDSystemFault : 1;
uint8_t u8LEDCharging : 1;
uint8_t u8LEDMotoFault : 1;
uint8_t u8LEDMCUFault : 1;
uint8_t u8LEDHandleFault : 1;
uint8_t u8LEDBluetooth : 1;
uint8_t u8LEDRight : 1;
uint8_t u8LEDOpenBox : 1;
uint8_t u8LEDCruiseWork : 1;
uint8_t u8LEDHDC : 1;
uint8_t u8LEDLimping : 1;
uint8_t u8LEDSOC : 1;
uint8_t u8LEDSupport : 1;
uint8_t u8LEDVietnam : 1;
uint8_t res : 2;
} Sig; } Sig;
} _ID12_Data_un_t; } _ID12_Data_un_t;
typedef union
{
uint8_t Msg[2u];
struct
{
uint8_t u8VspeedValue : 7;
uint8_t u8VspeedValid : 1;
uint8_t DriveMode: 8;
} Sig;
} _ID13_Data_un_t;
typedef union
{
uint8_t Msg[3u];
struct
{
uint8_t u8EnduranceH : 8;
uint8_t u8EnduranceL : 8;
uint8_t u8EnduranceOn : 2;
uint8_t u8EnduranceValid : 2;
uint8_t res : 4;
} Sig;
} _ID14_Data_un_t;
typedef union typedef union
{ {
uint8_t Msg[7u]; uint8_t Msg[25u];
struct struct
{ {
uint8_t u8ODOH : 8; uint8_t u8BluetoothSta : 2;
uint8_t u8ODOM : 8; uint8_t u8Res : 6;
uint8_t u8ODOL : 8;
uint8_t u8TripH : 8;
uint8_t u8TripM : 8;
uint8_t u8TripL : 8;
uint8_t u8ODOTrip : 8; uint8_t u8BtPhoneTimeH : 8;
uint8_t u8BtPhoneTimeHM : 8;
uint8_t u8BtPhoneTimeLM : 8;
uint8_t u8BtPhoneTimeL : 8;
uint8_t u8BtPhoneNum[20];
} Sig; } Sig;
} _ID15_Data_un_t; } _ID02_Data_un_t;
typedef union
{
uint8_t Msg[3u];
struct
{
uint8_t u8Hour : 8;
uint8_t u8Minute : 8;
uint8_t u8TimeValid : 8;
} Sig;
} _ID17_Data_un_t;
typedef union typedef union
{ {
uint8_t Msg[3u]; uint8_t Msg[151u];
struct struct
{ {
uint8_t u8MusicSta : 2;
uint8_t u8Res : 6;
uint8_t u8SOCSeg : 8; uint8_t u8MusicLyrics[50];
uint8_t u8SOCLED : 8; uint8_t u8MusicActor[50];
uint8_t u8SOCValue : 8; uint8_t u8MusicAlbum[50];
} Sig; } Sig;
} _ID18_Data_un_t; } _ID04_Data_un_t;
typedef union
{
uint8_t Msg[2u];
struct
{
uint8_t u8RGB : 8;
uint8_t u8Uint : 8;
} Sig;
} _ID19_Data_un_t;
typedef enum
{
MENU_ITEM_MAIN = 0U, /**< 主界面*/
MENU_ITEM_CHARGE, /**< 充电界面,*/
MENU_ITEM_MUSIC, /**< 音乐界面 */
// MENU_ITEM_BT_PAIRING, /**< 蓝牙配对界面 */
MENU_ITEM_NAV, /**< 简易导航 */
MENU_ITEM_NAV_MUSIC, /**< 简易导航,蓝牙音乐 共同显示 */
MENU_ITEM_NAV_FINISH, /**< 导航 目的地已到达 */
MENU_ITEM_, /**< 预留 */
MENU_ITEM_MAX,
} Menu_Item_en_t;
extern void Set_BacklightEn(uint8_t onoff); extern void Set_BacklightEn(uint8_t onoff);
extern void Read_Line_Data(const uint8_t *data, uint8_t len); extern void Read_Line_Data(const uint8_t *data, uint8_t len);
extern void Read_AnaLog_Data(const uint8_t *data, uint8_t len); extern void Read_AnaLog_Data(const uint8_t *data, uint8_t len);
...@@ -216,13 +96,8 @@ extern uint32_t Get_ACC_Value(void); ...@@ -216,13 +96,8 @@ extern uint32_t Get_ACC_Value(void);
extern uint32_t Get_ACC1_Value(void); extern uint32_t Get_ACC1_Value(void);
extern uint32_t Get_DC12_Value(void); extern uint32_t Get_DC12_Value(void);
extern void Core_ID12_Service(void);
extern void Core_ID13_Service(void);
extern void Core_ID14_Service(void);
extern void Core_ID15_Service(void);
extern void Core_ID17_Service(void);
extern void Core_ID18_Service(void);
extern void Core_ID19_Service(void);
extern void Send_MCU_ID10(uint8_t Flag); extern void Send_MCU_ID10(uint8_t Flag);
extern void Set_LCD_EN(uint8_t FLAG); extern void Set_LCD_EN(uint8_t FLAG);
......
...@@ -70,8 +70,7 @@ static void Power_KL30_Init(void) ...@@ -70,8 +70,7 @@ static void Power_KL30_Init(void)
// Sys_On_Init(); // Sys_On_Init();
// Popup_Scheduler_Init(); // Popup_Scheduler_Init();
Telltales_Init();
Telltales_User_Init();
// Common_DataInit(); // Common_DataInit();
// u32PwrOFFDelay = 0UL; // u32PwrOFFDelay = 0UL;
...@@ -87,8 +86,7 @@ static void Power_Wakeup_Init(void) ...@@ -87,8 +86,7 @@ static void Power_Wakeup_Init(void)
// Sys_WakeUp_Init(); // Sys_WakeUp_Init();
// Sys_WAKEUP_Init(); // Sys_WAKEUP_Init();
// // Sys_On_Init(); // // Sys_On_Init();
Telltales_Init();
Telltales_User_Init();
// Common_DataInit(); // Common_DataInit();
// u32PwrOFFDelay = 0UL; // u32PwrOFFDelay = 0UL;
// u8WakeUpFlag = 1; // u8WakeUpFlag = 1;
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#define UART_TX_MAX_DEPTH 1024UL //(2 * 1024UL) // 4K #define UART_TX_MAX_DEPTH 1024UL //(2 * 1024UL) // 4K
#define UART_RX_MAX_DEPTH (2 * 1024UL) // 4K #define UART_RX_MAX_DEPTH (2 * 1024UL) // 4K
#define UART_DATA_BUF_LEN (2 * 1024UL) // 4K #define UART_DATA_BUF_LEN (2 * 1024UL) // 4K
Prot_State_st_t Prot_State;
extern void OTA_IC_To_Master(uint8_t len); extern void OTA_IC_To_Master(uint8_t len);
static Protocol_uint8_t HandshakeFlag = 0; static Protocol_uint8_t HandshakeFlag = 0;
...@@ -188,17 +190,59 @@ static Protocol_uint32_t Protocol_UartSend(const Protocol_uint8_t *pData, Protoc ...@@ -188,17 +190,59 @@ static Protocol_uint32_t Protocol_UartSend(const Protocol_uint8_t *pData, Protoc
static void Protocol_UartHandle(const Protocol_Data_t *pData) static void Protocol_UartHandle(const Protocol_Data_t *pData)
{ {
if (pData->CmdID == 0x01U) if (pData->CmdID == 0x20U)//esp收到底板发送20
{
if(Prot_State.State < PROT_START)
{
Prot_State.State = PROT_START;//esp停止发送10,开始发1帧12,底板收到12后,停发20
}
}
else if (pData->CmdID == 0x03U)//底板控制蓝牙电话
{
if(pData->Data[0] == 1U)
{
Bt_Call_Auto_Answer();
}
else if(pData->Data[0] == 2U)
{
Bt_Call_Auto_Reject();
}
else
{
;
}
}
else if (pData->CmdID == 0x05U)//底板控制蓝牙音乐
{
if(pData->Data[0] == 1U)
{
Bt_Music_Play();
}
else if(pData->Data[0] == 2U)
{
Bt_Music_Stop();
}
else if(pData->Data[0] == 3U)
{ {
Read_Line_Data(pData->Data, pData->DataLen); Bt_Music_Next();
} }
else if (pData->CmdID == 2) else if(pData->Data[0] == 4U)
{ {
// Read_AnaLog_Data(pData->Data, pData->DataLen); Bt_Music_Previous();
} }
else if (pData->CmdID == 3) else if(pData->Data[0] == 5U)
{ {
HandshakeFlag = 1; Bt_Music_Volume_Up();
}
else if(pData->Data[0] == 6U)
{
Bt_Music_Volume_Down();
}
else
{
;
}
} }
else else
{ {
...@@ -209,6 +253,69 @@ static void Protocol_UartHandle(const Protocol_Data_t *pData) ...@@ -209,6 +253,69 @@ static void Protocol_UartHandle(const Protocol_Data_t *pData)
ESP_LOGW(ProtocolUser, "HandshakeFlag %x\r\n", HandshakeFlag); ESP_LOGW(ProtocolUser, "HandshakeFlag %x\r\n", HandshakeFlag);
} }
void Protocol_User_Ctrl_Init(void)
{
Prot_State.State = PROT_IDLE;
}
void Prot_Send_Msg_Process(void)
{
if(Prot_State.State < PROT_START)
{
Core_ID10_Service();
}
if(Prot_State.State >= PROT_START)
{
if(Prot_State.u8TimeDelay == 0)
{
Core_ID12_Service();
Prot_State.u8TimeDelay = 1;
}
Core_ID02_Service();
Core_ID04_Service();
}
}
void Core_ID10_Service(void)//esp32发送启动完成给底板
{
memset(Data_Uart_SendID10.Msg, 0, sizeof(Data_Uart_SendID10.Msg));
Data_Uart_SendID10.Sig.u8StartSta = 1;
Protocol_Send(DATA_ID10, Data_Uart_SendID10.Msg, sizeof(Data_Uart_SendID10.Msg));
}
void Core_ID12_Service(void)//收到底板发送的20后发送12
{
uint8_t u8AutoConnectBt = Auto_Connect_Bt();
memset(Data_Uart_SendID12.Msg, 0, sizeof(Data_Uart_SendID12.Msg));
Data_Uart_SendID12.Sig.u8AutoConnectSta = u8AutoConnectBt;
Protocol_Send(DATA_ID12, Data_Uart_SendID12.Msg, sizeof(Data_Uart_SendID12.Msg));
}
void Core_ID02_Service(void)//esp32发送蓝牙电话状态
{
uint8_t u8BtPhoneStatus = Get_Bt_Phone_Status();
memset(Data_Uart_SendID02.Msg, 0, sizeof(Data_Uart_SendID02.Msg));
Data_Uart_SendID02.Sig.u8BluetoothSta = u8BtPhoneStatus;
Data_Uart_SendID02.Sig.u8BtPhoneTimeH = 1;
Data_Uart_SendID02.Sig.u8BtPhoneTimeHM = 1;
Data_Uart_SendID02.Sig.u8BtPhoneTimeLM = 1;
Data_Uart_SendID02.Sig.u8BtPhoneTimeL = 1;
Data_Uart_SendID02.Sig.u8BtPhoneNum = Get_Bt_Phone_Num();
Protocol_Send(DATA_ID02, Data_Uart_SendID02.Msg, sizeof(Data_Uart_SendID02.Msg));
}
void Core_ID04_Service(void)//esp32发送蓝牙音乐播放状态和音乐信息
{
uint8_t u8BtMusicStatus = Get_Bt_Music_Status();
memset(Data_Uart_SendID04.Msg, 0, sizeof(Data_Uart_SendID04.Msg));
Data_Uart_SendID04.Sig.u8MusicSta = u8BtMusicStatus;
Data_Uart_SendID04.Sig.u8MusicLyrics = Get_BT_Music_Lyrics();
Data_Uart_SendID04.Sig.u8MusicActor = Get_BT_Music_Actor();
Data_Uart_SendID04.Sig.u8MusicAlbum = Get_BT_Music_Album();
Protocol_Send(DATA_ID04, Data_Uart_SendID04.Msg, sizeof(Data_Uart_SendID04.Msg));
}
void UART_Put(Protocol_uint16_t Data) void UART_Put(Protocol_uint16_t Data)
{ {
Protocol_uint32_t nextPos = 0u; Protocol_uint32_t nextPos = 0u;
......
...@@ -5,13 +5,26 @@ ...@@ -5,13 +5,26 @@
#include "Protocol_Lib.h" #include "Protocol_Lib.h"
typedef enum
{
PROT_IDLE = 0,
PROT_STARTING,
PROT_START,
PROT_NORMAL,
}Prot_State_en_t;
typedef struct
{
uint8_t u8State;
uint8_t u8TimeDelay;
}Prot_State_st_t;
void Protocol_KL30_Wakeup_Init(void); void Protocol_KL30_Wakeup_Init(void);
void Protocol_Send_Service(void); // 10ms任务调用 void Protocol_Send_Service(void); // 10ms任务调用
void UART_Put(Protocol_uint16_t Data); void UART_Put(Protocol_uint16_t Data);
void Protocol_User_Ctrl_Init(void);
void Prot_Send_Msg_Process(void);
extern uint8_t Get_HandshakeFlag(void); extern uint8_t Get_HandshakeFlag(void);
......
#include "R485_User.h"
_ID0X40h_Data R485_ID40h;
_ID0X48h_Data R485_ID48h;
_ID0X41h_Data R485_ID41h;
_ID0X49h_Data R485_ID49h;
_ID0X42h_Data R485_ID42h;
_ID0X4Ah_Data R485_ID4Ah;
const st_R485MsgAttribute CAN_CH0_CAN_MSG_CONST_ARRAY[R485_ID_TOTAL_MAX] =
{
/* ID lost timer */
{0X41, 3000ul},
};
void R485_Receive_Analysis(_st_R485_Receive *R485RxMsgOP)
{
}
// #define R485IDMAX 5
// uint8_t R485_Receive_ID[R485IDMAX] =
// {
// 0X40,
// 0X48,
// 0X41,
// 0X49,
// 0X42,
// 0X4A,
// };
// /**
// * 起始字节 ID 数据长度 数据内容 校验字节 结束字节
// * 0 1 2 3 64字节 4+len 5+len 6+len
// * 0X59 0X44 ID LEN DATA CHECKSUM 0X4B 0X4A
// */
// #define R485_LEN 71
// #define LIN_RX_MAX 50U
// #define LIN_TX_MAX 50U
// uint8_t u8LinId11Flag = 0;
// uint8_t u8LinId11Data[16];
// uint8_t u8LinRxId = 0;
// uint8_t u8LinRxData[LIN_RX_MAX];
// uint8_t u8LinRxDataCount = 0;
// uint8_t u8LinRxDataBegin = 0;
// uint8_t u8LinRxDataRe = 0;
// uint8_t u8LinTxDataId18[LIN_TX_MAX];
// uint8_t u8LinTxDataId19[LIN_TX_MAX];
// uint8_t Yadi_CAL_Data_Sum(uint8_t *pu8LinData, uint8_t u8LinLen)
// {
// uint8_t u8LinSum = 0U;
// uint8_t i = 0;
// for (i = 0; i < u8LinLen; i++)
// {
// u8LinSum = (uint8_t)(u8LinSum + pu8LinData[i]);
// }
// return u8LinSum;
// }
// #define FrameHeader1 0X59
// #define FrameHeader2 0X44
// #define R485LEN 0x40
// #define FrameEnd1 0x4B
// #define FrameEnd2 0x4A
// #define R485MAXLEN 0X47
#ifndef R485_USER_H__
#define R485_USER_H__
#include <stdint.h>
typedef enum
{
R485_SIG_NORMAL = 0u,
R485_SIG_LOST = 0x55U,
} R485_MSG_Status_t;
typedef struct
{
R485_MSG_Status_t u8Status; /* 0:normal, 0x55:lost */
uint32_t R485_Lost; /* lost time */
}_st_R485MsgStruct;
typedef struct
{
uint32_t R485_ID;
uint32_t Time_Out_Val;
}st_R485MsgAttribute;
typedef enum
{
R485_ID_0X41,
R485_ID_TOTAL_MAX,
} CAN_CH0_CAN_MSG_ID_t;
typedef struct
{
_st_R485MsgStruct *R485_MSG_Analysis;
const st_R485MsgAttribute *R485_MSG_Attribute;
}_st_R485_Receive;
typedef union
{
uint8_t Msg[64];
struct
{
/* Byte 0*/
uint8_t HardwareVer :8; /* 硬件版本号 */
/* Byte 1 */
uint8_t ProducerIdNumber1 :8; /* 产商识别码 */
/* Byte 2 */
uint8_t FixedValue :8; /* 固定值“-” */
/* Byte 3 */
uint8_t ProductIdNumber1 :8; /* 产品识别码 */
/* Byte 4 */
uint8_t MainSoftwareVer :8; /* 主软件版本号 */
/* Byte 5 */
uint8_t SecondarySoftwareVer :8; /* 次软件版本号 */
/* Byte 6 */
uint8_t ProductModel1 :8; /* 产品型号 */
/* Byte 7 */
uint8_t CommunicationID :8; /* 通信识别码 */
/* Byte 8 */
uint8_t BOOTSoftwareUnderlyingVer :8; /* BOOT软件底层版本 */
/* Byte 9 */
uint8_t BOOTUpgradingProtocolVer :8; /* BOOT升级协议版本 */
/* Byte 10 */
uint8_t SecCommunicationProtocolVer :8; /* 次通信协议版本 */
/* Byte 11 */
uint8_t MainCommunicationProtocolVer :8; /* 主通信协议版本 */
/* Byte 12 */
uint8_t IOTBuiltInSecVer :8; /* IOT内置模块次版本 */
/* Byte 13 */
uint8_t IOTBuiltInMainVer :8; /* IOT内置模块主版本 */
/* Byte 14 */
uint8_t BackupZoneSecSoftwareVer :8; /* 备份区次软件版本号 */
/* Byte 15 */
uint8_t BackupZoneMainSoftwareVer :8; /* 备份区主软件版本号 */
/* Byte 16 */
uint8_t ProductIdNumber2 :8; /* 产品识别码 */
/* Byte 17 */
uint8_t ProducerIdNumber2 :8; /* 产商识别码 */
/* Byte 18 */
uint8_t CustomerIdNumber :8; /* 客户识别码 */
/* Byte 19 */
uint8_t ProductionMonth :8; /* 生产月份 */
/* Byte 20 */
uint8_t ProductionYear_10Digits :8; /* 生产年份(十位) */
/* Byte 21 */
uint8_t ProductionYear_SingleDigits :8; /* 生产年份(个位) */
/* Byte 22 23 */
uint16_t OTAPartEncoding :16; /* OTA零部件编码 */
/* Byte 24*/
uint8_t FlowCode5th :8; /* 流水码第5位 */
/* Byte 25 */
uint8_t FlowCode4th :8; /* 流水码第4位 */
/* Byte 26 */
uint8_t FlowCode3rd :8; /* 流水码第3位 */
/* Byte 27 */
uint8_t FlowCode2nd :8; /* 流水码第2位 */
/* Byte 28 */
uint8_t FlowCode1st :8; /* 流水码第1位 */
/* Byte 29 */
uint8_t FlowCode0th :8; /* 流水码第0位 */
/* Byte 30 */
uint8_t :8; /* 预留 */
/* Byte 31 */
uint8_t :3; /* 预留 */
uint8_t BootRecordSignal :5; /* Boot记录信号 */
/* Byte 32 */
uint8_t IOTMinimumOperatingVol :8; /* IOT最低工作电压 */
/* Byte 33 */
uint8_t IOTHighestOperatingVoltage :8; /* IOT最高工作电压 */
/* Byte 34 35 */
uint16_t IOTRatedOperatingCurrent :16; /* IOT额定工作电流 */
/* Byte 36 */
uint8_t IOTQuiescentOperatingCurrent:8; /* IOT静态工作电流 */
/* Byte 37 */
uint8_t IOTMobileNetworkHighestMode :3; /* IOT移动网络最高模式 */
uint8_t :5; /* 预留 */
/* Byte 38 39*/
uint16_t :16; /* 预留 */
/* Byte 40 */
uint8_t IMEI_14th :8; /* IMEI第14位 */
/* Byte 41 */
uint8_t IMEI_13_12th :8; /* IMEI第13、12位 */
/* Byte 42 */
uint8_t IMEI_11_10th :8; /* IMEI第11、10位 */
/* Byte 43 */
uint8_t IMEI_9_8th :8; /* IMEI第9、8位 */
/* Byte 44 */
uint8_t IMEI_7_6th :8; /* IMEI第7、6位 */
/* Byte 45 */
uint8_t IMEI_5_4th :8; /* IMEI第5、4位 */
/* Byte 46 */
uint8_t IMEI_3_2th :8; /* IMEI第3、2位 */
/* Byte 47 */
uint8_t IMEI_1_0th :8; /* IMEI第1、0位 */
/* Byte 48 */
uint8_t ICCID_19_18th :8; /* ICCID第19、18位 */
/* Byte 49 */
uint8_t ICCID_17_16th :8; /* ICCID第17、16位 */
/* Byte 50 */
uint8_t ICCID_15_14th :8; /* ICCID第15、14位 */
/* Byte 51 */
uint8_t ICCID_13_12th :8; /* ICCID第13、12位 */
/* Byte 52 */
uint8_t ICCID_11_10th :8; /* ICCID第11、10位 */
/* Byte 53 */
uint8_t ICCID_9_8th :8; /* ICCID第9、8位 */
/* Byte 54 */
uint8_t ICCID_7_6th :8; /* ICCID第7、6位 */
/* Byte 55 */
uint8_t ICCID_5_4th :8; /* ICCID第5、4位 */
/* Byte 56 */
uint8_t ICCID_3_2th :8; /* ICCID第3、2位 */
/* Byte 57 */
uint8_t ICCID_1_10th :8; /* ICCID第1、0位 */
/* Byte 58 59 60 61 */
uint32_t :32; /* 预留 */
/* Byte 62 */
uint8_t VoiceprintWakeUpSignal :2; /* 仪表声纹唤醒信号 */
uint8_t AlarmStatus :4; /* 报警器报警状态 */
uint8_t :2; /* 预留 */
/* Byte 63 */
uint8_t BatteryType :4; /* 电池类型 */
uint8_t WholePowerMode :4; /* 整车电源模式 */
}Sig;
}_ID0X40h_Data;
typedef union
{
uint8_t Msg[64];
struct
{
/* Byte 0*/
uint8_t HardwareVer :8; /* 硬件版本号 */
/* Byte 1 */
uint8_t ProducerIdNumber3 :8; /* 产商识别码 */
/* Byte 2 */
uint8_t FixedValue :8; /* 固定值“-” */
/* Byte 3 */
uint8_t ProductIdNumber3 :8; /* 产品识别码 */
/* Byte 4 */
uint8_t MCUSecSoftwareVer :8; /* 次MCU软件版本号 */
/* Byte 5 */
uint8_t MCUMainSoftwareVer :8; /* 主MCU软件版本号 */
/* Byte 6 */
uint8_t ProductModel2 :8; /* 产品型号 */
/* Byte 7 */
uint8_t CommunicationID :8; /* 通信识别码 */
/* Byte 8 */
uint8_t BOOTSoftwareUnderlyingVer :8; /* BOOT软件底层版本 */
/* Byte 9 */
uint8_t BOOTUpgradingProtocolVer :8; /* BOOT升级协议版本 */
/* Byte 10 */
uint8_t SecCommunicationProtocolVer :8; /* 次通信协议版本 */
/* Byte 11 */
uint8_t MainCommunicationProtocolVer :8; /* 主通信协议版本 */
/* Byte 12 */
uint8_t CPUSecSoftWareVer :8; /* 系统次软件版本号(CPU) */
/* Byte 13 */
uint8_t CPUMainSoftWareVer :8; /* 系统主软件版本号(CPU) */
/* Byte 14 */
uint8_t ProductModel3 :8; /* 产品型号 */
/* Byte 15 */
uint8_t CommunicationIdfiers :8; /* 通信识别码 */
/* Byte 16 */
uint8_t ProductIdNumber4 :8; /* 产品识别码 */
/* Byte 17 */
uint8_t ProducerIdNumber4 :8; /* 产商识别码 */
/* Byte 18 */
uint8_t CustomerIdNumber :8; /* 客户识别码 */
/* Byte 19 */
uint8_t ProductionMonth :8; /* 生产月份 */
/* Byte 20 */
uint8_t ProductionYear_10Digits :8; /* 生产年份(十位) */
/* Byte 21 */
uint8_t ProductionYear_SingleDigits :8; /* 生产年份(个位) */
/* Byte 22 23*/
uint16_t :16; /* 预留 */
/* Byte 24*/
uint8_t FlowCode5th :8; /* 流水码第5位 */
/* Byte 25 */
uint8_t FlowCode4th :8; /* 流水码第4位 */
/* Byte 26 */
uint8_t FlowCode3rd :8; /* 流水码第3位 */
/* Byte 27 */
uint8_t FlowCode2nd :8; /* 流水码第2位 */
/* Byte 28 */
uint8_t FlowCode1st :8; /* 流水码第1位 */
/* Byte 29 */
uint8_t FlowCode0th :8; /* 流水码第0位 */
/* Byte 30 */
uint8_t VendorCodeDigit_5th:8; /* 供应商代码第5位 */
/* Byte 31 */
uint8_t VendorCodeDigit_4th :8; /* 供应商代码第4位 */
/* Byte 32 */
uint8_t VendorCodeDigit_3rd :8; /* 供应商代码第3位 */
/* Byte 33 */
uint8_t VendorCodeDigit_2nd :8; /* 供应商代码第2位 */
/* Byte 34 */
uint8_t VendorCodeDigit_1st :8; /* 供应商代码第1位 */
/* Byte 35 */
uint8_t GaugeType :3; /* 仪表类型 */
uint8_t :5; /* 预留 */
/* Byte 36 */
uint8_t BackupZoneSecSoftwareVer :8; /* 备份区次软件版本号 */
/* Byte 37 */
uint8_t BackupZoneMainSoftwareVer :8; /* 备份区主软件版本号 */
/* Byte 38 */
uint8_t OTAPartEncoding :8; /* OTA零部件编码 */
/* Byte 39 */
uint8_t :8; /* 预留 */
/* Byte 40 */
uint8_t :8; /* 预留 */
/* Byte 41 */
uint8_t :8; /* 预留 */
/* Byte 42 */
uint8_t :8; /* 预留 */
/* Byte 43 */
uint8_t :8; /* 预留 */
/* Byte 44 */
uint8_t :8; /* 预留 */
/* Byte 45 */
uint8_t :8; /* 预留 */
/* Byte 46 */
uint8_t :8; /* 预留 */
/* Byte 47 */
uint8_t :8; /* 预留 */
/* Byte 48 */
uint8_t :8; /* 预留 */
/* Byte 49 */
uint8_t :8; /* 预留 */
/* Byte 50 */
uint8_t :8; /* 预留 */
/* Byte 51 */
uint8_t :8; /* 预留 */
/* Byte 52 */
uint8_t :8; /* 预留 */
/* Byte 53 */
uint8_t :8; /* 预留 */
/* Byte 54 */
uint8_t :8; /* 预留 */
/* Byte 55 */
uint8_t :8; /* 预留 */
/* Byte 56 */
uint8_t :8; /* 预留 */
/* Byte 57 */
uint8_t :8; /* 预留 */
/* Byte 58 */
uint8_t :8; /* 预留 */
/* Byte 59 */
uint8_t :8; /* 预留 */
/* Byte 60 */
uint8_t :8; /* 预留 */
/* Byte 61 */
uint8_t :8; /* 预留 */
/* Byte 62 */
uint8_t :8; /* 预留 */
/* Byte 63 */
uint8_t :3; /* 预留 */
uint8_t BootRecordSignal :5; /* boot记录信号 */
}Sig;
}_ID0X48h_Data;
typedef union
{
uint8_t Msg[64];
struct
{
/* Byte 0*/
uint8_t VehicleStatus :3; /* 整车状态 */
uint8_t ElectricalAutoLoopOvervoltage :1; /* 电自主回路电压过压 */
uint8_t VehicleHighPressureState :2; /* 整车高压状态 */
uint8_t VehicleLowPressureState :2; /* 整车低压状态 */
/* Byte 1 */
uint8_t VehicleACCState :2; /* 整车ACC1状态 */
uint8_t MechanicalKeyStatus :2; /* 机械钥匙状态 */
uint8_t LeftLightStatus :2; /* 左转向灯状态 */
uint8_t RightLightStatus :2; /* 右转向灯状态 */
/* Byte 2 */
uint8_t BreakSwitchSignal :2; /* 刹车开关信号 */
uint8_t VehicleACC2State :2; /* 整车ACC2状态 */
uint8_t OTAModeCommands :2; /* OTA模式指令 */
uint8_t OTAUpGradeCommands :2; /* OTA升级指令 */
/* Byte 3 */
uint8_t BrakeValue :8; /* 刹把值 */
/* Byte 4 */
uint8_t HandleValue :8; /* 转把值 */
/* Byte 5 */
uint8_t AlarmStatus :4; /* 报警器报警状态 */
uint8_t SensorAlarmStatus_IOTBuiltIn :4; /* 传感器报警状态(IOT内置) */
/* Byte 6 */
uint8_t UpgradeResultFeedbackStatus :2; /* 仪表升级结果反馈指令接收状态 */
uint8_t VehiclePowerMode :4; /* 整车电源模式 */
uint8_t SupportSwitchSignalFeedback :2; /* 边撑开关信号反馈 */
/* Byte 7 */
uint8_t OTARollbackInstructions :4; /* OTA回滚指令 */
uint8_t NavigationGuideDirections :4; /* 导航引导方向 */
/* Byte 8 */
uint8_t BatteryWorkingState :4; /* 电池工作状态 */
uint8_t SubbatteryAccessState :2; /* 副电池接入状态 */
uint8_t VoiceprintWakeupSignal :2; /* 仪表声纹唤醒信号 */
/* Byte 9 */
uint8_t ChargeState :3; /* 充电状态 */
uint8_t EleHeadlightFunctionSettings :2; /* 电子大灯功能设置 */
uint8_t ElectronicCushionLockStatus :3; /* 电子坐垫锁状态 */
/* Byte 10 */
uint8_t VoltagePercentage :8; /* 母线电压百分比 */
/* Byte 11 */
uint8_t CurrentPercemtage :8; /* 母线电流百分比 */
/* Byte 12 13*/
uint16_t TotalBatteryVoltage :16; /* 总电池电压 */
/* Byte 14 */
uint16_t TotalBatteryCurrent :16; /* 总电池电流 */
/* Byte 16 */
uint8_t TotalBatterySOC :8; /* 主电池电量百分比SOC */
/* Byte 17 */
uint8_t GuidesRemindDistances :8; /* 导航引导提醒距离 */
/* Byte 18 */
uint8_t KnobLockStatus :2; /* 旋钮锁锁舌状态 */
uint8_t KnobLockResetStatus :2; /* 旋钮锁锁舌复位状态 */
uint8_t ElectronicCushionStatus :2; /* 电子坐垫状态 */
uint8_t AutoBacklightFunctionSetting :2; /* 自动背光功能设置 */
/* Byte 19 */
uint8_t DIYBacklightSetting :8; /* 自定义背光亮度设置 */
/* Byte 20 */
uint8_t DumpReminderFunctionSetting:2; /* 倾倒提醒功能设置指令 */
uint8_t CallMessageReminderSettingCommands :2; /* 来电、信息提醒设置指令 */
uint8_t VehicleShutdownEnablesSignal :2; /* 车辆关机倒计时使能信号 */
uint8_t RecuperationStatusFeedback :2; /* 能量回收功能状态反馈(滑行) */
/* Byte 21 */
uint8_t SubbatterySOC :8; /* 副电池电量百分比SOC */
/* Byte 22 23*/
uint16_t MainBatteryTotalVoltage :16; /* 主电池总电压 */
/* Byte 24 */
uint8_t Place1:6; /* 占位 */
uint8_t FaultCorrecting:1; /* 故障修复模式 */
uint8_t Place2:1; /* 占位 */
/* Byte 25*/
uint8_t Place3 :8; /* 占位 */
/* Byte 26 */
uint8_t BusOvervoltageProtection :2; /* MCU告警状态:母线过压保护 */
uint8_t BusUndervoltageProtection :2; /* MCU告警状态:母线欠压保护 */
uint8_t BusOvercurrentProtection :2; /* MCU告警状态:母线过流保护 */
uint8_t BrakeLeverFault:2; /* MCU故障状态:刹把故障(线性刹把) */
/* Byte 27 */
uint8_t PhaseLossFault :2; /* MCU故障状态:缺相故障 */
uint8_t MCUOverTempProtection :2; /* MCU告警状态:MCU过温保护 */
uint8_t MotorOvertempProtection :2; /* MCU告警状态:电机过温保护 */
uint8_t RotorLocked :2; /* MCU告警状态:堵转保护 */
/* Byte 28 */
uint8_t BMS_0CommunicationStatus :2; /* 与BMS_0通讯状态 */
uint8_t MCUCommunicationStatus :2; /* 与MCU通讯状态 */
uint8_t ALMCommunicationStatus :2; /* 与ALM通讯状态 */
uint8_t ICMCommunicationStatus :2; /* 与ICM通讯状态 */
/* Byte 29 */
uint8_t UUpBridgeArmMosFault :2; /* MCU故障状态:MOS故障(U相上桥臂MOS故障) */
uint8_t UDownBridgeArmMosFault :2; /* MCU故障状态:MOS故障(U相下桥臂MOS故障) */
uint8_t VUpBridgeArmMosFault :2; /* MCU故障状态:MOS故障(V相上桥臂MOS故障) */
uint8_t VDownBridgeArmMosFault :2; /* MCU故障状态:MOS故障(V相下桥臂MOS故障) */
/* Byte 30 */
uint8_t WUpBridgeArmMosFault :2; /* MCU故障状态:MOS故障(W相上桥臂MOS故障) */
uint8_t WDownBridgeArmMosFault :2; /* MCU故障状态:MOS故障(W相下桥臂MOS故障) */
uint8_t MCUFaultStateU_PhaseHallFault :2; /* MCU故障状态:霍尔故障(U相霍尔故障) */
uint8_t MCUFaultStateV_PhaseHallFault :2; /* MCU故障状态:霍尔故障(V相霍尔故障) */
/* Byte 31 */
uint8_t MCUFaultStateW_PhaseHallFault :2; /* MCU故障状态:霍尔故障(W相霍尔故障) */
uint8_t MCUFaultStatus_HandlebarFault :2; /* MCU故障状态:转把故障 */
uint8_t MainNodeComponentType :2; /* 主节点元器件类型 */
uint8_t MetricImperialSetting :2; /* 公英制设置 */
/* Byte 32 */
uint8_t HeadlampIndicator :1; /* 前照灯指示灯 */
uint8_t HighBeamIndicator :1; /* 远光灯指示灯 */
uint8_t PositionLightIndicator :1; /* 位置灯指示灯 */
uint8_t AutomaticHeadlightIndicator :1; /* 自动大灯指示灯 */
uint8_t LeftTurnSignal :1; /* 左转向灯 */
uint8_t RightTurnSignal :1; /* 右转向灯 */
uint8_t GaugeThemeSettings :2; /* 仪表主题设置 */
/* Byte 33 */
uint8_t GSMStatusIndication :1; /* GSM状态指示 */
uint8_t GPSStatusIndication :1; /* GPS状态指示 */
uint8_t BLEStatusIndication :1; /* BLE状态指示 */
uint8_t CallIndication :1; /* 来电提醒指示 */
uint8_t MessageIndcation :1; /* 短信提醒指示 */
uint8_t DisplayModeSwitching :3; /* 仪表显示模式界面切换 */
/* Byte 34 */
uint8_t BacklightLevelSetting :3; /* 背光亮度等级设置 */
uint8_t SmartKeyStatusIndication :1; /* SmartKey状态指示 */
uint8_t WrenchSymbolIndicatior :1; /* 扳手符号-故障指示灯 */
uint8_t TriangleSymbolIndicatior :1; /* 三角符号-警告指示灯 */
uint8_t EngineSymbolIndicatior :1; /* 引擎符号-MCU故障指示灯 */
uint8_t MotorSymbolIndicatior :1; /* 电机符号-电机故障指示灯 */
/* Byte 35 */
uint8_t SpeedGear :3; /* 车速档位 */
uint8_t CruiseMode :1; /* 巡航模式 */
uint8_t CartMode :1; /* 推车模式 */
uint8_t ReverseMode :1; /* 倒车模式 */
uint8_t SlopePattern :1; /* 坡行模式 */
uint8_t Low_speedCruiseMode :1; /* 低速巡航模式 */
/* Byte 36 37*/
uint16_t BCMRemainingMileage :16; /* 剩余里程当前值(BCM计数) */
/* Byte 38 */
uint8_t ExternalKeyInputs :3; /* 外部按键输入 */
uint8_t HandlebarFaultIndicator :1; /* 转把符号-转把故障指示灯 */
uint8_t ParkingGear :2; /* 驻车档位 */
uint8_t CushionSensorStatus :2; /* 坐垫传感器状态 */
/* Byte 39 */
uint8_t IOTRealTime_Year :8; /* IOT实时时间-年 */
/* Byte 40 */
uint8_t IOTRealTime_Month :8; /* IOT实时时间-月 */
/* Byte 41 */
uint8_t IOTRealTime_Day :8; /* IOT实时时间-日 */
/* Byte 42 */
uint8_t IOTRealTime_Hour :8; /* IOT实时时间-时 */
/* Byte 43 */
uint8_t IOTRealTime_Minute :8; /* IOT实时时间-分 */
/* Byte 44 */
uint8_t IOTRealTime_Second :8; /* IOT实时时间-秒 */
/* Byte 45 */
uint8_t DisableSpeedLimitModeFeedback :2; /* 解除限速模式反馈 */
uint8_t BatteryVoltageLevel :4; /* 电池电压等级 */
uint8_t TRIPMileageReset :2; /* TRIP里程清零 */
/* Byte 46 47 */
uint16_t ICMCalculatesVehicleSpeed:16; /* 车速霍尔值:200ms内Hall计数值(ICM计算车速) */
/* Byte 48 49 */
uint16_t BCMCalculatedSpeed :16; /* 车速当前值(BCM计算车速)注:本信号与“车速霍尔值”复用 */
/* Byte 50 51*/
uint16_t BCMTripValue :16; /* TRIP当前值(BCM计数) */
/* Byte 52 53 54 55 */
uint32_t HallTripValue :32; /* 里程小计霍尔值:ACC开启后Hall累计计数值*/
/* Byte 56 57 58 59*/
uint32_t ODOValue :32; /* ODO当前值(BCM计算ODO)注:本信号与“里程小计霍尔值”复用 */
/* Byte 60 */
uint8_t TempUnitSettingCommand :2; /* 温度单位设置指令 */
uint8_t ODOMileageReset :2; /* ODO里程清零 */
uint8_t RemainingMileageDisplaySettings :2; /* 剩余里程显示设置 */
uint8_t TPower :2; /* T动力 */
/* Byte 61 */
uint8_t VehicleOperationStatusFeedback :3; /* 整车操作状态反馈 */
uint8_t RampParkedState :2; /* 坡道驻停状态 */
uint8_t SlopeDescentFunctionStatus :2; /* 陡坡缓降功能状态 */
uint8_t TCSActivation :1; /* TCS激活 */
/* Byte 62 */
uint8_t ElecTapLockStatus :2; /* 电子龙头锁状态 */
uint8_t ElecFaucetLockDeadboltFailure :2; /* 电子龙头锁锁舌故障 */
uint8_t ElecFaucetLockMotorFailure :2; /* 电子龙头锁电机故障 */
uint8_t TCSFunctionalStatus :2; /* TCS功能状态 */
/* Byte 63 */
uint8_t BatteryHandshakeFeedback :2; /* 电池互认握手反馈 */
uint8_t Week :2; /* 星期 */
uint8_t CatapultMode :2; /* 弹射模式 */
uint8_t SteepHillDescentEnable :2; /* 陡坡缓降激活 */
}Sig;
}_ID0X41h_Data;
typedef union
{
uint8_t Msg[64];
struct
{
/* Byte 0*/
uint8_t PhotosensitiveElementOutput :3; /* 光敏元件输出 */
uint8_t KeyOutput :3; /* 按键输出 */
uint8_t OTACommandStatusFeedback :2; /* OTA模式指令执行状态反馈 */
/* Byte 1 */
uint8_t BacklightLevelStatusFeedback :3; /* 背光亮度等级状态反馈 */
uint8_t GaugeTopicStatusFeedback :2; /* 仪表主题状态反馈 */
uint8_t EleCushionSwitchCommand :2; /* 电动坐垫开关指令(语音控制) */
uint8_t TripResetSoftSwitch :1; /* 小计里程清零指令—软开关 */
/* Byte 2 */
uint8_t OTAUpdateResult :2; /* OTA升级结果反馈 */
uint8_t UnlockCommand :2; /* 解锁指令(声纹) */
uint8_t LeftTurnSignalCommand :2; /* 左转向灯指令(语音控制) */
uint8_t RightTurnSignalCommand :2; /* 右转向灯指令(语音控制) */
/* Byte 3 */
uint8_t WarningCommand :2; /* 危险报警灯指令(语音控制) */
uint8_t HighBeamCommand :2; /* 远光灯指令(语音控制) */
uint8_t SeatCommand :1; /* 坐桶锁指令(语音控制) */
uint8_t ABSstatus :1; /* ABS激活状态 */
uint8_t OTARollbackCommand :2; /* OTA回滚指令执行结果 */
/* Byte 4 */
uint8_t CallMessageReminderFeedback :2; /* 来电/信息提醒功能状态反馈 */
uint8_t DumpReminderStatusFeedback :2; /* 倾倒提醒功能状态反馈 */
uint8_t DumpCategory :2; /* 倾倒类别 */
uint8_t AutoBacklightFeedback :2; /* 自动背光功能状态反馈 */
/* Byte 5 */
uint8_t ActualBacklightFeedback :8; /* 实际背光亮度状态反馈 */
/* Byte 6 */
uint8_t ABSSelfcheckStatus :2; /* ABS自检状态 */
uint8_t ABSdefault :1; /* ABS故障 */
uint8_t ABSOLStatus :1; /* ABS在线状态 */
uint8_t :4; /* 预留 */
/* Byte 7 */
uint8_t MetricImperialStatus :2; /* 公英制状态 */
uint8_t ODOResetstatus :3; /* 总计里程清零结果状态反馈 */
uint8_t :3; /* 预留 */
/* Byte 8 9 */
uint16_t VehicleSpeedFadeback :16; /* 车速当前值反馈(ICM计算) */
/* Byte 10 11 */
uint16_t TripCurrentValueFeedback :16; /* TRIP当前值反馈(ICM计算) */
/* Byte 12 13 14 15*/
uint32_t ODOCurrentValueFeedback :32; /* ODO当前值反馈(ICM计算) */
/* Byte 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31*/
uint64_t :64; /* 预留 */
uint64_t :64; /* 预留 */
/* Byte 32 */
uint8_t Faultybacklight :2; /* 背光灯故障 */
uint8_t EEPROMdefault :2; /* EEPROM故障 */
uint8_t SunlightSensordefault :2; /* 阳光传感器故障 */
uint8_t LeftTurnDefault :2; /* 左转向灯故障 */
/* Byte 33 */
uint8_t RightTurnDefault :2; /* 右转向灯故障 */
uint8_t Autoheadlightstatus :2; /* 自动大灯功能状态反馈 */
uint8_t KnobLockStatus :2; /* 旋钮锁舌状态 */
uint8_t KnobLockResetStatus :2; /* 旋钮锁舌复位状态 */
/* Byte 34 */
uint8_t UpButtonStatus :1; /* 上按键状态 */
uint8_t DownButtonStatus :1; /* 下按键状态 */
uint8_t TempUnitStatus :2; /* 温度单位状态反馈 */
uint8_t RemainingMileagefeedback :2; /* 剩余里程显示状态反馈 */
uint8_t :2; /* 预留 */
/* Byte 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63*/
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
}Sig;
}_ID0X49h_Data;
typedef union
{
uint8_t Msg[64];
struct
{
/* Byte 0*/
uint8_t VINCodeLength :8; /* Vin号长度 */
/* Byte 1 */
uint8_t VINCode_1st :8; /* Vin号1位 */
/* Byte 2 */
uint8_t VINCode_2nd :8; /* Vin号2位 */
/* Byte 3 */
uint8_t VINCode_3rd :8; /* Vin号3位 */
/* Byte 4 */
uint8_t VINCode_4th :8; /* Vin号4位 */
/* Byte 5 */
uint8_t VINCode_5th :8; /* Vin号5位 */
/* Byte 6 */
uint8_t VINCode_6th :8; /* Vin号6位 */
/* Byte 7 */
uint8_t VINCode_7th :8; /* Vin号7位 */
/* Byte 8 */
uint8_t VINCode_8th :8; /* Vin号8位 */
/* Byte 9 */
uint8_t VINCode_9th :8; /* Vin号9位 */
/* Byte 10 */
uint8_t VINCode_10th :8; /* Vin号10位 */
/* Byte 11 */
uint8_t VINCode_11th :8; /* Vin号11位 */
/* Byte 12 */
uint8_t VINCode_12th :8; /* Vin号12 */
/* Byte 13 */
uint8_t VINCode_13th :8; /* Vin号13 */
/* Byte 14 */
uint8_t VINCode_14th :8; /* Vin号14 */
/* Byte 15 */
uint8_t VINCode_15th :8; /* Vin号15 */
/* Byte 16 */
uint8_t VINCode_16th :8; /* Vin号16 */
/* Byte 17 */
uint8_t VINCode_17th :8; /* Vin号17 */
/* Byte 18 */
uint8_t SteerPrioritySwitch :2; /* 转向优先开关设置指令 */
uint8_t :6; /* 预留 */
/* Byte 19 */
uint8_t WarningWeather :8; /* 预警天气类型 */
/* Byte 20 */
uint8_t CurrentWeatherType :8; /* 当前天气类型 */
/* Byte 21 */
uint8_t CurrentWeatherTemp :8; /* 当前天气温度 */
/* Byte 22 */
uint8_t WevereWeatherType :8; /* 恶劣天气类型 */
/* Byte 23*/
uint8_t WeatherWarningLevel :3; /* 天气预警等级 */
uint8_t WeverWeatherTime :5; /* 恶劣天气发生时间 */
/* Byte 24 */
uint8_t PasswordUnlockCommand :2; /* 仪表密码解锁唤醒指令 */
uint8_t PasswordAuthResult :2; /* 密码认证结果 */
uint8_t PasswordCanbeEnter :3; /* 密码可输入剩余次数 */
uint8_t FailoverMode :1; /* 故障修复模式 */
/* Byte 25 */
uint8_t TimeRemainingCharge :8; /* 总电池电量剩余充满时间 与通信协议出入 */
/* Byte 26-63*/
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
}Sig;
}_ID0X42h_Data;
typedef union
{
uint8_t Msg[64];
struct
{
/* Byte 0*/
uint8_t ReceiveVINFeedback :2; /* 接收VIN状态反馈 */
uint8_t SteeringPrioritySwitchFeedback :2; /* 转向优先开关设置反馈 */
uint8_t :4; /* 预留 */
/* Byte 1 2*/
uint16_t UserPassword :16; /* 用户输入密码值 */
/* Byte 3-63 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
uint8_t :8; /* 预留 */
}Sig;
}_ID0X4Ah_Data;
extern _ID0X40h_Data R485_ID40h;
extern _ID0X48h_Data R485_ID48h;
extern _ID0X41h_Data R485_ID41h;
extern _ID0X49h_Data R485_ID49h;
extern _ID0X42h_Data R485_ID42h;
extern _ID0X4Ah_Data R485_ID4Ah;
#endif
/**
* @file Services_Mileage.c
* @brief 里程服务函数
* @details 里程服务函数,包括大计、小计
* @author myliu
* @date 2022.05.10
* @version V1.0
* @copyright myiu
*/
#ifndef SERVICE_MILEAGE_H
#define SERVICE_MILEAGE_H
/*
Platform_32Bit
Platform_16Bit
*/
#ifdef Platform_16Bit
#define Millib_uint8_t unsigned char
#define Millib_uint16_t unsigned int
#define Millib_uint32_t unsigned long
#else
#define Millib_uint8_t unsigned char
#define Millib_uint16_t unsigned short
#define Millib_uint32_t unsigned int
#define Millib_uint64_t unsigned long long
#endif
#ifndef Millib_NULL
#define Millib_NULL (void *)0u
#endif /* NULL */
/**@enum 小计里程枚举
* @brief 用来区分每个小计里程数
*/
typedef enum
{
EM_TRIP_A,
EM_TRIP_B,
EM_TRIP_C,
EM_TRIP_D,
EM_TRIP_MAX,
} DataTripEnum_t;
/**@enum EEPROM存储块枚举类型
* @brief 用来区分EEPORM存储区域
*/
typedef enum
{
EM_MILEAGE_BLOCK = 0u, /**< 累计里程 */
EM_ODO_BLOCK, /**< 总计里程 */
EM_TRIP_BLOCK, /**< 小计里程 */
EM_Maintenance_BLOCK, /**< 保养里程 */
EM_ODOSYNC_CNT_BLOCK, /**< 里程备份次数 */
} Data_EEPROM_Enum_t;
typedef void (*EEPromWrite)(Data_EEPROM_Enum_t BlockID, Millib_uint32_t u32Data[], Millib_uint16_t u16Len);
typedef struct
{
Millib_uint8_t (*Get_Sys_IG_Sts)(void); /**< 获取系统电源状态,请务必填写函数名或NULL */
Millib_uint8_t (*Get_Act_V_Speed_Valid)(void); /**< 实际车速有效位,请务必填写函数名或NULL */
Millib_uint16_t (*Get_Act_V_Speed)(void); /**< 实际车速,请务必填写函数名或NULL */
Millib_uint16_t (*Get_TireSize)(void); /**< 轮胎系数,请务必填写函数名或NULL */
EEPromWrite EEPromWrite_Cbk; /**< 写EEPROM回调函数,请务必填写函数名或NULL */
} Mileage_Func_t;
typedef struct
{
Millib_uint32_t Mileage; /**< KL30初始化时,从EEPROM读取的数据 */
} Mileage_Init_t;
typedef struct
{
Millib_uint32_t Stamp; /**< 在Mileage上记录的里程戳 */
Millib_uint32_t Offset; /**< 里程偏移量,暂不使用,预留 */
Millib_uint32_t MaxValue; /**< 最大的总计里程,单位100m */
} ODO_Init_t;
typedef struct
{
Millib_uint32_t Stamp; /**< 在Mileage上记录的里程戳 */
Millib_uint32_t MaxValue; /**< 最大的小计里程,单位100m */
Millib_uint8_t IsRestart; /**< 小计里程达到最大值后,是否自动从0开始,重新累计小计里程 */
} Trip_Init_t;
#define Data_MEM_Block_Mileage ((Millib_uint8_t)12u)
#define Data_MEM_Block_ODO ((Millib_uint8_t)16u)
#define Data_MEM_Block_Trip ((Millib_uint8_t)16u)
/*
total size =Data_MEM_Block_Trip*EM_TRIP_MAX
*/
/**
* @brief 里程服务初始化,KL30调用,必须调用,否则造成空指针
* @param[in] pMemSpace 内存空间,需要的空间大小至少大于Data_MEM_Block_Mileage,此内存需在休眠唤醒后不丢失
* @param[in] pInitData 从EEPROM读取上次下电前累计的里程
* @param[in] pFunc 底层发送回调函数, 详见Mileage_Func_t
*
* @warning 此函数必须后于EEPROM初始化,因为要读取EEPROM数据,否则每次都是从0开始
*
* @since 1.0.0
*/
void Data_Mileage_KL30_Init(Millib_uint8_t *pMemSpace,
Mileage_Init_t *pInitData, Mileage_Func_t *pFunc);
/**
* @brief 里程服务初始化,唤醒时调用,必须调用,否则造成空指针
* @param[in] pMemSpace 内存空间,需要的空间大小至少大于Data_MEM_Block_Mileage,此内存需在休眠唤醒后不丢失
* @param[in] pFunc 底层发送回调函数, 详见Mileage_Func_t
*
* @since 1.0.0
*/
void Data_Mileage_Wakeup_Init(Millib_uint8_t *pMemSpace, Mileage_Func_t *pFunc);
/**
* @brief 里程累计服务,在100ms中断调用
*
* @since 1.0.0
*/
void Data_Mileage_ISR(void);
/**
* @brief 里程读取
* @return 当前累计里程数,单位100m
* @warning 此数据非总计里程,总计里程属于此里程数的一部分
*
* @since 1.0.0
*/
Millib_uint32_t Data_Mileage_Read(void);
/**
* @brief 里程读取
* @return 当前累计里程数,单位mm
* @warning 此数据非总计里程,总计里程属于此里程数的一部分
*
* @since 1.0.0
*/
Millib_uint32_t Data_Mileage_Readmm(void);
/**
* @brief 写里程
* @param[in] NewMileage 新里程数,单位100m
* @return 成功 - 1 失败 - 0
* @warning 调用此函数前,需要调用Data_Mileage_Clear函数
*
* @since 1.0.0
*/
Millib_uint8_t Data_Mileage_Write(Millib_uint32_t NewMileage);
/**
* @brief 清里程,出厂时使用
* @warning 此函数包含功能:清Mileage,清ODO以及清trip,调用此函数后,需要复位后,里程才会继续走动
*
* @since 1.0.0
*/
void Data_Mileage_Clear(void);
/**
* @brief 清里程,出厂时使用
* @warning 此函数包含功能:清Mileage,清ODO以及清Trip,调用此函数,不影响里程的走动
*
* @since 1.0.0
*/
void Data_Mileage_Clear_GoOn(void);
/**
* @brief 将累计的里程存入EEPROM, 10ms任务中调用
*
* @since 1.0.0
*/
void Data_Mileage_Write_EEPROM(void);
/**
* @brief 获取里程库软件版本号
* @return 版本号 1.01
* @since 1.0.0
*/
Millib_uint8_t *Get_Data_Mileage_Version(void);
/**
* @brief 总计里程初始化,KL30调用,必须调用,否则造成空指针
* @param[in] pMemSpace 内存空间,需要的空间大小至少大于Data_MEM_Block_ODO,此内存需在休眠唤醒后不丢失
* @param[in] pInitData 详见ODO_Init_t
* @param[in] Func 写EEPROM回调函数
*
* @warning 在Data_Mileage_KL30_Init之后调用
*
* @since 1.0.0
*/
void Data_ODO_KL30_Init(Millib_uint8_t *pMemSpace, ODO_Init_t *pInitData, EEPromWrite Func);
/**
* @brief 总计里程初始化,唤醒调用,必须调用,否则造成空指针
* @param[in] pMemSpace 内存空间,需要的空间大小至少大于Data_MEM_Block_ODO,此内存需在休眠唤醒后不丢失
* @param[in] Func 写EEPROM回调函数
*
* @warning 在Data_Mileage_Wakeup_Init之后调用
*
* @since 1.0.0
*/
void Data_ODO_Wakeup_Init(Millib_uint8_t *pMemSpace, EEPromWrite Func);
/**
* @brief 总计里程计算服务,为了其他服务获取总计里程无0.1m的偏差,需要此服务函数
*
* @warning 在100ms任务重调用
*
* @since 1.0.0
*/
void Data_ODO_Processing(void);
/**
* @brief 总计里程读取
* @return 当前总计里程数,单位100m
* @warning 此数据为上次Data_ODO_Clear后,到调用此函数为止,累计的Mileage,属于Mileage的一部分
*
* @since 1.0.0
*/
Millib_uint32_t Data_ODO_Read(void);
/**
* @brief 清总计里程,车厂使用
* @warning 此函数只是将总计里程的里程戳标记为当前的Mileage,不属于完全清除,如出厂请调用Data_Mileage_Clear
*
* @since 1.0.0
*/
void Data_ODO_Clear(void);
/**
* @brief 总计里程偏移量读取
* @return 当前偏移量,单位100m
* @warning 里程备份时使用
*
* @since 1.0.0
*/
Millib_uint32_t Data_Offset_Read(void);
/**
* @brief 总计里程偏移量修改
* @return 当前偏移量,单位100m
* @warning 里程备份时使用
*
* @since 1.0.0
*/
void Data_ODO_Modify(Millib_uint32_t Offset);
/**
* @brief 小计里程初始化,KL30调用,必须调用,否则造成空指针
* @param[in] pMemSpace 内存空间,需要的空间大小至少大于Data_MEM_Block_Trip*EM_TRIP_MAX,此内存需在休眠唤醒后不丢失
* @param[in] pInitData Trip_Init_t
* @param[in] TotalTrip 小计总数,(例如:1个小计, 2个小计,3个小计)
* @param[in] Func 写EEPROM回调函数
*
* @warning 在Data_Mileage_KL30_Init之后调用
*
* @since 1.0.0
*/
void Data_Trip_KL30_Init(Millib_uint8_t *pMemSpace, Trip_Init_t *pInitData, Millib_uint8_t TotalTrip, EEPromWrite pFunc);
/**
* @brief 小计里程初始化,唤醒调用,必须调用,否则造成空指针
* @param[in] pMemSpace 内存空间,需要的空间大小至少大于Data_MEM_Block_Trip*EM_TRIP_MAX,此内存需在休眠唤醒后不丢失
* @param[in] TotalTrip 小计总数,(例如:1个小计, 2个小计,3个小计)
* @param[in] Func 写EEPROM回调函数
*
* @warning 在Data_Mileage_Wakeup_Init之后调用
*
* @since 1.0.0
*/
void Data_Trip_Wakeup_Init(Millib_uint8_t *pMemSpace, Millib_uint8_t TotalTrip, EEPromWrite pFunc);
/**
* @brief 小计里程计算服务,为了其他服务获取小计里程无0.1m的偏差,需要此服务函数
*
* @warning 在100ms任务重调用
*
* @since 1.0.0
*/
void Data_Trip_Processing(void);
/**
* @brief 清小计里程
* @param[in] TripN DataTripEnum_t
* @warning 此函数只是将小计里程的里程戳标记为当前的Mileage,不属于完全清除,如出厂请调用Data_Mileage_Clear
*
* @since 1.0.0
*/
void Data_Clear_Trip(DataTripEnum_t TripN);
/**
* @brief 清小计里程
* @warning 此函数只是将小计里程的里程戳标记为当前的Mileage,不属于完全清除,如出厂请调用Data_Mileage_Clear
*
* @since 1.0.0
*/
void Data_Clear_Trip_All(void);
/**
* @brief 小计里程读取
* @param[in] TripN DataTripEnum_t
* @return 当前小计里程数,单位100m
* @warning 此数据为上次Data_ODO_Clear后,到调用此函数为止,累计的Mileage,属于Mileage的一部分
*
* @since 1.0.0
*/
Millib_uint32_t Data_Read_Trip(DataTripEnum_t TripN);
#endif
#include "Services_Mileage.h"
#include <stdint.h>
#include "Services_Mileage_User.h"
#include "eepromManage.h"
#include <stdio.h>
#include "Common_Interface.h"
uint8_t DataMilleageBuf[Data_MEM_Block_Mileage];
uint8_t DataODOBuf[Data_MEM_Block_ODO];
uint8_t DataTripBuf[Data_MEM_Block_Trip * EM_TRIP_MAX];
Mileage_t g_WriteMileage;
Mileage_t g_ReadMileage;
uint32_t Milleage_InitFlag = 0U;
static uint8_t YEDEA_CLEAR_FLAG = 0;
uint8_t odo_writeState;
uint8_t odo_readState;
uint32_t Milleage_UseIICFlag = 0;
typedef union
{
struct
{
uint32_t Count;
uint32_t Value;
} Sig;
uint8_t Data[8];
} _St_Mileage_Clear;
_St_Mileage_Clear Data_MileageClear;
static void Data_User_EEPROM_Write(Data_EEPROM_Enum_t BlockID, uint32_t u32Data[], uint16_t u16Len)
{
Milleage_UseIICFlag = 0;
// //printf("BlockID is : %d ; u32Data[0] is : %ld . u32Data[1] is %ld . \r\n", BlockID, u32Data[0], u32Data[1]);
switch (BlockID)
{
case EM_MILEAGE_BLOCK:
if (u32Data[0] == 0)
{
eeprom_ClearOdoSection();
}
else
{
g_WriteMileage.Odo = u32Data[0];
odo_writeState = eeprom_WriteODO(&g_WriteMileage, distance_1m, 1);
}
/// printf("odo_writeState = %d,g_WriteMileage.Odo = %d \r\n",odo_writeState,g_WriteMileage.Odo );
// eeprom_WriteRecord(EEPROM_BLOCK_00, ( uint8_t * )u32Data, u16Len * 4);
break;
case EM_ODO_BLOCK:
eeprom_WriteRecord(EEPROM_BLOCK_01, (uint8_t *)u32Data, u16Len * 4);
break;
case EM_TRIP_BLOCK:
eeprom_WriteRecord(EEPROM_BLOCK_03, (uint8_t *)u32Data, u16Len * 4);
break;
default:
break;
}
Milleage_UseIICFlag = 0X5AA53AA3UL;
}
uint32_t Data_User_EEPROM_Read(uint16_t u16BlockID, uint32_t u32Data[], uint16_t u16Len)
{
Milleage_UseIICFlag = 0;
switch (u16BlockID)
{
case EM_MILEAGE_BLOCK:
odo_readState = eeprom_ReadODO(&g_ReadMileage);
u32Data[0] = g_ReadMileage.Odo;
// eeprom_ReadRecord(EEPROM_BLOCK_00, ( uint8_t * )u32Data, u16Len * 4);
break;
case EM_ODO_BLOCK:
eeprom_ReadRecord(EEPROM_BLOCK_01, (uint8_t *)u32Data, u16Len * 4);
break;
case EM_TRIP_BLOCK:
eeprom_ReadRecord(EEPROM_BLOCK_03, (uint8_t *)u32Data, u16Len * 4);
break;
default:
break;
}
Milleage_UseIICFlag = 0X5AA53AA3UL;
return 0;
}
void Data_User_Mileage_KL30Init(void)
{
uint32_t TempBuf[7] = {0};
Mileage_Init_t MileInit = {0};
Mileage_Func_t Func = {0};
ODO_Init_t ODOInit = {0};
Trip_Init_t TripInit[4] = {0};
Milleage_InitFlag = 0U;
(void)Data_User_EEPROM_Read(EM_MILEAGE_BLOCK, TempBuf, 1);
if (TempBuf[0] == 0xFFFFFFFF)
{
MileInit.Mileage = 0u;
}
else
{
MileInit.Mileage = TempBuf[0];
}
Func.Get_Sys_IG_Sts = Common_Get_IG_Sts; // Get_Pwr_Sts;
Func.Get_Act_V_Speed_Valid = Common_Get_Act_V_Speed_Valid; // Get_VechileSpeedValid;
Func.Get_Act_V_Speed = Common_Get_Act_V_Speed; // Get_Vehicle_ActSpeed;
Func.Get_TireSize = (void *)0;
Func.EEPromWrite_Cbk = Data_User_EEPROM_Write;
Data_Mileage_KL30_Init(DataMilleageBuf, &MileInit, &Func);
(void)Data_User_EEPROM_Read(EM_ODO_BLOCK, TempBuf + 1, 2);
if (TempBuf[1] == 0xFFFFFFFF)
{
ODOInit.Stamp = 0;
}
else
{
ODOInit.Stamp = TempBuf[1];
}
if (TempBuf[1] == 0xFFFFFFFF)
{
ODOInit.Offset = 0;
}
else
{
ODOInit.Offset = TempBuf[2];
}
ODOInit.MaxValue = 9999999; // 9999999;
Data_ODO_KL30_Init(DataODOBuf, &ODOInit, Func.EEPromWrite_Cbk);
(void)Data_User_EEPROM_Read(EM_TRIP_BLOCK, TempBuf + 3, 4);
TripInit[EM_TRIP_A].Stamp = 0xFFFFFFFFu;
TripInit[EM_TRIP_A].MaxValue = 9999;
TripInit[EM_TRIP_A].IsRestart = 0u;
TripInit[EM_TRIP_B].Stamp = 0xFFFFFFFFu;
TripInit[EM_TRIP_B].MaxValue = 9999;
TripInit[EM_TRIP_B].IsRestart = 1u;
TripInit[EM_TRIP_C].Stamp = 0xFFFFFFFFu;
TripInit[EM_TRIP_C].MaxValue = 9999;
TripInit[EM_TRIP_C].IsRestart = 1u;
TripInit[EM_TRIP_D].Stamp = 0xFFFFFFFFu;
TripInit[EM_TRIP_D].MaxValue = 9999;
TripInit[EM_TRIP_D].IsRestart = 1u;
Data_Trip_KL30_Init(DataTripBuf, TripInit, EM_TRIP_MAX, Func.EEPromWrite_Cbk);
Milleage_InitFlag = 0X5AA53AA3UL;
/* 读取大计里程清零次数及上次清零时大计的里程值 */
(void)eeprom_ReadRecord(EEPROM_BLOCK_10, Data_MileageClear.Data, 8);
YEDEA_CLEAR_FLAG = 0;
}
void Data_User_Mileage_WakeupInit(void)
{
Mileage_Func_t Func = {0};
Func.Get_Sys_IG_Sts = NULL; // Get_Pwr_Sts;
Func.Get_Act_V_Speed_Valid = NULL; // Get_VechileSpeedValid;
Func.Get_Act_V_Speed = NULL; // Get_Vehicle_ActSpeed;
Func.Get_TireSize = (void *)0;
Func.EEPromWrite_Cbk = Data_User_EEPROM_Write; //???��????
Data_Mileage_Wakeup_Init(DataMilleageBuf, &Func);
Data_ODO_Wakeup_Init(DataODOBuf, Func.EEPromWrite_Cbk);
// Automatic = 0u;
Data_Trip_Wakeup_Init(DataTripBuf, EM_TRIP_MAX, Func.EEPromWrite_Cbk);
}
void Data_User_Mileage_OFF_Init(void)
{
Data_Clear_Trip(EM_TRIP_A);
}
void Data_User_Mileage_ISR(void)
{
if (Milleage_InitFlag == 0X5AA53AA3UL)
{
Data_Mileage_ISR();
Data_ODO_Processing();
Data_Trip_Processing();
}
}
uint32_t User_Data_ODO_Read(void)
{
if (Milleage_InitFlag == 0X5AA53AA3UL)
{
// printf("Data_ODO_Read %d \n",Data_ODO_Read());
return Data_ODO_Read();
}
return 0;
}
uint32_t User_Data_Trip_Read(void)
{
if (Milleage_InitFlag == 0X5AA53AA3UL)
{
return Data_Read_Trip(EM_TRIP_A);
}
return 0;
}
#ifndef SERVICE_MILEAGE_USER_H
#define SERVICE_MILEAGE_USER_H
#define EEPROM_BLOCK_00 0
#define EEPROM_BLOCK_01 16
#define EEPROM_BLOCK_02 32
#define EEPROM_BLOCK_03 48
#define EEPROM_BLOCK_04 64 // 诊断使用 27
#define EEPROM_BLOCK_05 80 // 诊断使用 2E
// #define EEPROM_BLOCK_06 96
// #define EEPROM_BLOCK_07 112
#define EEPROM_BLOCK_08 128 // 诊断使用 DTC
#define EEPROM_BLOCK_09 144
#define EEPROM_BLOCK_10 160
#define EEPROM_BLOCK_11 176
#define EEPROM_BLOCK_12 192
#define EEPROM_BLOCK_13 208
#define EEPROM_BLOCK_14 224
#define EEPROM_BLOCK(n) (n*16)
#define EEPROM_BLOCK_05_SIZE 48 // 当前使用35字节,向上对齐48字节
#define EEPROM_BLOCK_08_SIZE 48 // 占用48字节
void Data_User_Mileage_KL30Init(void);
void Data_User_Mileage_ISR(void);
uint32_t User_Data_ODO_Read(void);
void Data_User_Mileage_WakeupInit(void);
uint32_t Data_User_EEPROM_Read(uint16_t u16BlockID, uint32_t u32Data[], uint16_t u16Len);
uint32_t User_Data_Trip_Read(void);
extern uint32_t Milleage_InitFlag;
extern void YEDEA_Clear_Mileage_Service(void);
extern void Mileage_KL15_Init(void);
extern void Data_User_Mileage_OFF_Init(void);
extern void Can_Id_0c10ffd0_Receive(uint8_t CopyData[]);
extern void Can_Id_0C25FFD3_Receive(uint8_t CopyData[]);
extern void TYW_Clear_Mileage_Service(void);
extern uint8_t Get_Tyw_Clear_Flag(void);
extern void TYW_LCD_Check(void);
extern uint8_t Get_Lcd_Check(void);
#endif
...@@ -153,30 +153,6 @@ monitorlib_uint8_t System_LINE_KL15(void) ...@@ -153,30 +153,6 @@ monitorlib_uint8_t System_LINE_KL15(void)
void Common_BlockDelay(monitorlib_uint32_t u32Ms) void Common_BlockDelay(monitorlib_uint32_t u32Ms)
{ {
vTaskDelay(pdMS_TO_TICKS(1)); vTaskDelay(pdMS_TO_TICKS(1));
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
// ;
} }
void Sys_LogicProcess(void) void Sys_LogicProcess(void)
......
#ifndef TELLTALES_H
#define TELLTALES_H
/*
Platform_32Bit
Platform_16Bit
*/
#ifdef Platform_16Bit
#define Tellib_uint8_t unsigned char
#define Tellib_uint16_t unsigned int
#define Tellib_uint32_t unsigned long
#else
#define Tellib_uint8_t unsigned char
#define Tellib_uint16_t unsigned short
#define Tellib_uint32_t unsigned int
#define Tellib_uint64_t unsigned long long
#endif
#define Tel_MEM_Block_Addition ((Tellib_uint8_t)16u)
#define Tel_MEM_Block_Size (((Tellib_uint8_t)2u))
/*
total size =Tel_MEM_Block_Size*LED_Max+Tel_MEM_Block_Addition
*/
#define LED_OFF (Tellib_uint8_t)(0x00u) /**< 指示灯点亮状态 */
#define LED_ON (Tellib_uint8_t)(0x01u) /**< 指示灯熄灭状态 */
#define Diag_LED_OFF (Tellib_uint8_t)(0x10u) /**< 指示灯点亮状态,诊断控制 */
#define Diag_LED_ON (Tellib_uint8_t)(0x11u) /**< 指示灯熄灭状态,诊断控制 */
#define NoSelfCheck (Tellib_uint8_t)(0x00u) /**< 指示灯不需要执行内部自检 */
#define SelfCheck (Tellib_uint8_t)(0x01u) /**< 指示灯需要执行内部自检,即自检期间强制点亮 */
#define LED_Exist (Tellib_uint8_t)(0x00u)
#define LED_NOExist (Tellib_uint8_t)(0x01u)
#define AllowBreak (Tellib_uint8_t)(0x00u)
#define NoBreak (Tellib_uint8_t)(0x01u)
#define NoExterNalCheck (Tellib_uint8_t)(0x00u) /**< 指示灯自检期间,不响应外部信号 */
#define ExterNalCheck (Tellib_uint8_t)(0x01u) /**< 指示灯自检期间,根据外部信号执行 */
#define LED_IGN_OFF (Tellib_uint8_t)(0x00u) /**< 指示灯工作在IG OFF下 */
#define LED_IGN_ON (Tellib_uint8_t)(0x01u) /**< 指示灯工作在IG ON下 */
#define LED_IGN_ON_OFF (Tellib_uint8_t)(0x02u) /**< 指示灯工作在IG ON/OFF下 */
#define LED_PWR_OFF (Tellib_uint8_t)(0x00u) /**< 指示灯模块所获取的外部电源状态为IG OFF */
#define LED_PWR_ON (Tellib_uint8_t)(0x01u) /**< 指示灯模块所获取的外部电源状态为IG ON */
#define LED_CheckNoFinish (Tellib_uint8_t)(0x00u) /**< 外部设置自检未结束 */
#define LED_CheckFinished (Tellib_uint8_t)(0x01u) /**< 外部设置自检结束,用于打断自检 */
#define LED_OFF_State (Tellib_uint8_t)(0x00u) /**< 指示灯当前状态为OFF */
#define LED_ON_State (Tellib_uint8_t)(0x01u) /**< 指示灯当前状态为ON */
typedef Tellib_uint16_t (*LED_Judgment)(void); /**< 指示灯逻辑判断回调函数原型 */
typedef void (*LED_Execution)(Tellib_uint16_t led_status); /**< 指示灯执行回调函数原型 */
typedef Tellib_uint8_t (*LED_PowerSts)(void); /**< 指示灯电源获取函数 回调函数原型 */
typedef Tellib_uint32_t (*LED_PowerONTimer)(void); /**< 指示灯IG ON时间戳 回调函数原型 */
typedef Tellib_uint32_t (*LED_PowerOFFTimer)(void); /**< 指示灯IG OFF时间戳 回调函数原型 */
/**@struct TelExtPara
* @brief 指示灯初始化结构体 \n
* 定义指示灯初始化结构体属性
*/
typedef struct
{
Tellib_uint32_t TotalLength; /**< 指示灯总数量 */
LED_PowerOFFTimer LED_PowerOFF_TimerCbk; /**< IG OFF下计时时间戳回调函数 */
LED_PowerONTimer LED_PowerON_TimerCbk; /**< IG ON下计时时间戳回调函数 */
LED_PowerSts LED_PowerCbk; /**< IG电源状态回调函数 */
} TelExtPara;
/**@struct LED_Attribute_st
* @brief 指示灯属性结构体 \n
* 定义指示灯结构体属性
*/
typedef struct
{
Tellib_uint16_t LED_Index; /**< 指示灯序号 */
Tellib_uint16_t isSelfCheck; /**< 指示灯是否执行自检 */
Tellib_uint16_t isExCheck; /**< 指示灯是否按内部信号强制自检 */
Tellib_uint16_t WorkSts; /**< 指示灯工作的电源状态 */
Tellib_uint32_t CheckStart; /**< 指示灯自检起始时间点,单位ms */
Tellib_uint32_t CheckEnd; /**< 指示灯自检结束时间点,单位ms */
LED_Judgment LED_Judgment_Cbk; /**< 指示灯工作条件判断函数 */
LED_Execution LED_Execution_Cbk; /**< 指示灯工作条件执行函数 */
} LED_Attribute_st;
Tellib_uint16_t Get_TelltalesLedSts(Tellib_uint32_t LedIdx);
Tellib_uint16_t Tel_VersionGet(void);
void Telltales_Management(void);
void Test_LED_AllLight(Tellib_uint16_t LedSts);
void Telltales_KL30_Wakeup_Init(Tellib_uint8_t *MemSpace, const LED_Attribute_st *Array, TelExtPara *para);
void Telltales_DiagCtrl(Tellib_uint32_t ledIdx, Tellib_uint8_t LED_Sts);
void Telltales_DiagRelease(Tellib_uint32_t ledIdx);
void Telltales_KL15_Init(void);
void Telltales_SetCheckFinish(Tellib_uint8_t CheckFinish);
#endif
#include "Telltales_Lib.h"
#include "Telltales_user.h"
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "app_dataProcess.h"
#include "R485_User.h"
#include "Common_Interface.h"
// #include "aes_test.h"
// #include "esp_log.h"
// #define TAG "Telltales"
Tellib_uint8_t Tel_Mem[Tel_MEM_Block_Size * LED_Max + Tel_MEM_Block_Addition];
/********************************************************************************************************/
Led_LIGHTS_Status Telltales_Status;
Led_AUTO_Condition Telltales_AUTO_STATUS;
Led_ONOFF_Condition Telltales_Condition;
_st_turn Turn;
static LED_BLE_OUT = 0;
static Tellib_uint16_t LED_ChargeLineConnect_lamp_Judge(void);
static Tellib_uint16_t LED_FaultStatus_lamp_Judge(void);
static Tellib_uint16_t LED_BluetoothConnect_lamp_Judge(void);
static Tellib_uint16_t LED_NetworkSignal_lamp_Judge(void);
static Tellib_uint16_t LED_GPSSignal_lamp_Judge(void);
static Tellib_uint16_t LED_CruiseWork_lamp_Judge(void);
static Tellib_uint16_t LED_READY_lamp_Judge(void);
static Tellib_uint16_t LED_Support_lamp_Judge(void);
static Tellib_uint16_t LED_TapLoc_lamp_Judge(void);
static Tellib_uint16_t LED_HighBeam_lamp_Judge(void);
static Tellib_uint16_t LED_AUTOHeadlight_lamp_Judge(void);
static Tellib_uint16_t LED_Position_lamp_Judge(void);
static Tellib_uint16_t LED_DippedHead_lamp_Judge(void);
static Tellib_uint16_t LED_Limping_lamp_Judge(void);
static Tellib_uint16_t LED_TPower_lamp_Judge(void);
static Tellib_uint16_t LED_TCS_lamp_Judge(void);
static Tellib_uint16_t LED_HDC_lamp_Judge(void);
const LED_Attribute_st LED_Attribute[LED_Max] =
{
/*充电枪连接指示灯*/ {
LED_ChargeLineConnect,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON,
0ul,
2000ul,
LED_ChargeLineConnect_lamp_Judge,
NULL,
},
/*整车故障指示灯*/ {
LED_FaultStatus,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON,
0ul,
2000ul,
LED_FaultStatus_lamp_Judge,
NULL,
},
/*蓝牙连接*/ {
LED_BluetoothConnect,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON_OFF,
0ul,
2000ul,
LED_BluetoothConnect_lamp_Judge,
NULL,
},
/*网络信号*/ {
LED_NetworkSignal,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON,
0ul,
2000ul,
LED_NetworkSignal_lamp_Judge,
NULL,
},
/*GPS信号*/ {
LED_GPSSignal,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON,
0ul,
2000ul,
LED_GPSSignal_lamp_Judge,
NULL,
},
/*巡航指示灯*/ {
LED_CruiseWork,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON,
0ul,
2000ul,
LED_CruiseWork_lamp_Judge,
NULL,
},
/*READY指示灯*/ {
LED_READY,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON,
0ul,
2000ul,
LED_READY_lamp_Judge,
NULL,
},
/*边撑指示*/ {
LED_TapLoc,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON,
0ul,
2000ul,
LED_TapLoc_lamp_Judge,
NULL,
},
/*龙头锁指示*/ {
LED_Support,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON,
0ul,
2000ul,
LED_Support_lamp_Judge,
NULL,
},
/*远光灯*/ {
LED_HighBeam,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON,
0ul,
2000ul,
LED_HighBeam_lamp_Judge,
NULL,
},
/*自动大灯*/ {
LED_AUTOHeadlight,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON,
0ul,
2000ul,
LED_AUTOHeadlight_lamp_Judge,
NULL,
},
/*位置灯*/ {
LED_Position,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON,
0ul,
2000ul,
LED_Position_lamp_Judge,
NULL,
},
/*近光灯*/ {
LED_DippedHead,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON,
0ul,
2000ul,
LED_DippedHead_lamp_Judge,
NULL,
},
/*车辆跛行*/ {
LED_Limping,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON,
0ul,
2000ul,
LED_Limping_lamp_Judge,
NULL,
},
/*T动力*/ {
LED_TPower,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON,
0ul,
2000ul,
LED_TPower_lamp_Judge,
NULL,
},
/*TCS*/ {
LED_TCS,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON,
0ul,
2000ul,
LED_TCS_lamp_Judge,
NULL,
},
/*HDC陡坡缓降*/ {
LED_HDC,
NoSelfCheck,
ExterNalCheck,
LED_IGN_ON,
0ul,
2000ul,
LED_HDC_lamp_Judge,
NULL,
},
};
void Telltales_Init(void)
{
TelExtPara m_ExtPara;
m_ExtPara.TotalLength = LED_Max;
m_ExtPara.LED_PowerOFF_TimerCbk = Common_GetIgnOffTime;
m_ExtPara.LED_PowerON_TimerCbk = Common_GetIgnOnTime;
m_ExtPara.LED_PowerCbk = Common_Get_IG_Sts;
memset(Tel_Mem, 0, sizeof(Tel_Mem));
Telltales_KL30_Wakeup_Init((Tellib_uint8_t *)Tel_Mem, LED_Attribute, &m_ExtPara);
Telltales_KL15_Init();
}
void Telltales_User_Init(void)
{
LED_BLE_OUT = 0;
Turn.Left = 0;
Turn.Right = 0;
}
static Tellib_uint16_t LED_ChargeLineConnect_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
if( R485_ID41h_LOST )
{
LED_Status = 1;
}
else
{
if ( R485_ID41h.Sig.VehiclePowerMode == 1)
{
LED_Status = 1;
}
else
{
LED_Status = 0;
}
}
return LED_Status;
}
static Tellib_uint16_t LED_FaultStatus_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
if( R485_ID41h_LOST )
{
LED_Status = 1;
}
else
{
if ( (R485_ID41h.Sig.WrenchSymbolIndicatior == 1) || (R485_ID41h.Sig.TriangleSymbolIndicatior == 1) ||(R485_ID41h.Sig.EngineSymbolIndicatior == 1) ||(R485_ID41h.Sig.MotorSymbolIndicatior == 1) || (R485_ID41h.Sig.HandlebarFaultIndicator == 1) )
{
if(R485_ID41h.Sig.HandlebarFaultIndicator == 1)
{
Telltales_Status.LED_Tape_lights = 1; //灯带红色
}
else
{
Telltales_Status.LED_Tape_lights = 0; //关闭红色
}
LED_Status = 1;
}
else
{
LED_Status = 0;
Telltales_Status.LED_Tape_lights = 0; //关闭红色
}
}
return LED_Status;
}
static Tellib_uint16_t LED_BluetoothConnect_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
if(Get_Line_Bluetooth()) //PIN26高电平
{
LED_BLE_OUT = 1;
}
else
{
LED_BLE_OUT = 0;
}
if(Common_Get_IG_Sts() == 1)
{
if ( R485_ID41h.Sig.BLEStatusIndication == 1)
{
LED_Status = 1;
}
else
{
LED_Status = 0;
}
}
return LED_Status;
}
static Tellib_uint16_t LED_NetworkSignal_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
if( R485_ID41h_LOST )
{
LED_Status = 0; //点亮x图标
}
else
{
if ( R485_ID41h.Sig.GSMStatusIndication == 1)
{
LED_Status = 1; //点亮连接图标
}
else
{
LED_Status = 0;
}
}
return LED_Status;
}
static Tellib_uint16_t LED_GPSSignal_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
if( R485_ID41h_LOST )
{
LED_Status = 0; //点亮\图标
}
else
{
if ( R485_ID41h.Sig.GPSStatusIndication == 1)
{
LED_Status = 1; //点亮连接图标
}
else
{
LED_Status = 0;
}
}
return LED_Status;
}
static Tellib_uint16_t LED_CruiseWork_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
if( R485_ID41h_LOST )
{
LED_Status = 0; //熄灭指示灯,取消文字显示
Telltales_Status.LED_CruiseWork_st = 0;
}
else
{
if ( R485_ID41h.Sig.CruiseMode == 1)
{
LED_Status = 1; //点亮指示灯,显示底部文字
Telltales_Status.LED_CruiseWork_st = 1; //巡航模式开启,按档位显示灯带颜色
}
else
{
LED_Status = 0;
Telltales_Status.LED_CruiseWork_st = 0; //巡航模式关闭,不按档位显示灯带颜色
}
}
return LED_Status;
}
static Tellib_uint16_t LED_READY_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
if( R485_ID41h_LOST )
{
LED_Status = 0;
}
else
{
if ((R485_ID41h.Sig.VehicleStatus == 3) && (Get_Dis_Vspeed() != 0) && (Get_Vspeed_Valid() == 1))
{
LED_Status = 1; //点亮指示灯
}
else
{
LED_Status = 0;
}
}
return LED_Status;
}
static Tellib_uint16_t LED_Support_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
if( R485_ID41h_LOST )
{
LED_Status = 0;
}
else
{
if (R485_ID41h.Sig.SupportSwitchSignalFeedback == 1)
{
LED_Status = 1; //点亮指示灯
}
else
{
LED_Status = 0;
}
}
return LED_Status;
}
static Tellib_uint16_t LED_TapLoc_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
if( R485_ID41h_LOST )
{
LED_Status = 1;
}
else
{
if((R485_ID41h.Sig.ElecFaucetLockDeadboltFailure == 1) || (R485_ID41h.Sig.ElecFaucetLockDeadboltFailure == 2) ||
(R485_ID41h.Sig.ElecFaucetLockMotorFailure == 1) || (R485_ID41h.Sig.ElecFaucetLockMotorFailure == 2) ||
(R485_ID41h.Sig.ElecTapLockStatus == 1) || (R485_ID41h.Sig.ElecTapLockStatus == 2))
{
LED_Status = 1;
}
else if (R485_ID41h.Sig.VehicleOperationStatusFeedback == 3)
{
if(1) //指示灯1HZ闪烁
{
LED_Status = 1;
}
else
{
LED_Status = 0;
}
}
else
{
LED_Status = 0;
}
}
return LED_Status;
}
static Tellib_uint16_t LED_HighBeam_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
if (Get_Line_HighBeam()) //PIN14高电平
{
LED_Status = 1; //点亮指示灯
}
else
{
LED_Status = 0;
}
return LED_Status;
}
static Tellib_uint16_t LED_AUTOHeadlight_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
//自动大灯开启关闭条件,用于判断大灯的开启和关闭,外发且存储
if(R485_ID41h.Sig.EleHeadlightFunctionSettings == 1) //自动大灯功能的开启条件:自动大灯功能设置=1,外发自动大灯功能状态反馈=1;
{
Telltales_AUTO_STATUS.LED_AUTO_TX = 1;
}
else if (R485_ID41h.Sig.EleHeadlightFunctionSettings == 0)
{
Telltales_AUTO_STATUS.LED_AUTO_TX = 0;
}
else
{
;
}
//AUTO图标点亮及熄灭
if ((R485_ID41h.Sig.EleHeadlightFunctionSettings == 1) && (Get_Line_Position())) //PIN15高电平
{
LED_Status = 1;
}
else if ((R485_ID41h.Sig.EleHeadlightFunctionSettings == 0) || (0))
{
LED_Status = 0;
}
else
{
;
}
//近光灯开启及关闭
if ((R485_ID41h.Sig.EleHeadlightFunctionSettings == 1) && (Get_Line_Position()) && (1)) //PIN15高电平 光感连续2S检测亮度为<100LX,光感有效
{
Telltales_AUTO_STATUS.LED_DippedHead_Condition = 1; // 近光灯点亮,PIN31输出低有效
}
else
{
Telltales_AUTO_STATUS.LED_DippedHead_Condition = 0; // 近光灯熄灭,PIN31不输出低有效
}
return LED_Status;
}
static Tellib_uint16_t LED_Position_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
if (Get_Line_Position()) //PIN15高电平
{
LED_Status = 1; //点亮指示灯
}
else
{
LED_Status = 0;
}
return LED_Status;
}
static Tellib_uint16_t LED_DippedHead_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
if (Get_Line_LowBeam()) //PIN16高电平
{
LED_Status = 1; //点亮指示灯
}
else
{
LED_Status = 0;
}
return LED_Status;
}
static Tellib_uint16_t LED_Limping_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
if( R485_ID41h_LOST )
{
LED_Status = 0;
}
else
{
if ((R485_ID41h.Sig.SlopePattern == 1) || (R485_ID41h.Sig.FaultCorrecting == 0))
{
LED_Status = 1; //点亮指示灯
}
else
{
LED_Status = 0;
}
}
return LED_Status;
}
static Tellib_uint16_t LED_TPower_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
if( R485_ID41h_LOST )
{
LED_Status = 0;
}
else
{
if (R485_ID41h.Sig.CatapultMode == 1)
{
LED_Status = 1; //点亮指示灯
}
else
{
LED_Status = 0;
}
}
return LED_Status;
}
static Tellib_uint16_t LED_TCS_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
if( R485_ID41h_LOST )
{
LED_Status = 0;
Telltales_Condition.LED_TCS_Status = 0;
}
else
{
if (R485_ID41h.Sig.TCSActivation == 0)
{
if (5) //指示灯 5hz闪烁,底部文字提示
{
LED_Status = 1;
}
else
{
LED_Status = 0;
}
Telltales_Condition.LED_TCS_Status = 1;
}
else if(R485_ID41h.Sig.TCSFunctionalStatus == 1)
{
LED_Status = 1; //点亮指示灯,关闭底部提示
Telltales_Condition.LED_TCS_Status = 0;
}
else
{
LED_Status = 0;
Telltales_Condition.LED_TCS_Status = 0;
}
}
return LED_Status;
}
static Tellib_uint16_t LED_HDC_lamp_Judge(void)
{
Tellib_uint16_t LED_Status = 0u;
if( R485_ID41h_LOST )
{
LED_Status = 0;
}
else
{
if (R485_ID41h.Sig.SlopeDescentFunctionStatus == 1)
{
LED_Status = 1; //点亮指示灯
}
else
{
LED_Status = 0;
}
}
return LED_Status;
}
/*4-右转向 5-双闪 6-左转向 7-复位 11-左故障 22-右故障*/
/*0-熄灭 1-65闪烁 2-130闪烁*/
void Turn_Service(void)
{
if(1) //IGON
{
if(Get_Line_Reset())
{
Turn.Left = 0;
Turn.Right = 0;
}
else
{
if (Get_Line_RightTurn())
{
Turn.Left = 0;
Turn.Right = 1;
}
else if (Get_Line_LeftTurn())
{
Turn.Left = 1;
Turn.Right = 0;
}
else if (Get_Line_DoubleFlash())
{
if ((Turn.Left == 0) || (Turn.Right = 0))
{
Turn.Left = 1;
Turn.Right = 1;
}
else
{
Turn.Left = 0;
Turn.Right = 0;
}
}
else
{
Turn.Left = 0;
Turn.Right = 0;
}
if((11) && (Turn.Left == 1))
{
Turn.Left = 2;
}
else
{
;
}
if((22) && (Turn.Right == 1))
{
Turn.Right = 2;
}
else
{
;
}
}
}
else
{
Turn.Left = 0;
Turn.Right = 0;
}
}
/*获取左右转向状态:0-熄灭 1-65闪烁 2-130闪烁*/
uint8_t GET_TURN_L(void)
{
return Turn.Left;
}
uint8_t GET_TURN_R(void)
{
return Turn.Right;
}
/*近光灯点亮条件:1-近光灯点亮 PIN31输出低有效 0-近光灯熄灭 PIN31不输出低有效*/
uint8_t GET_LowBeam_Condition (void)
{
return Telltales_AUTO_STATUS.LED_DippedHead_Condition;
}
/*TCS弹窗报警触发条件: 1-弹出弹窗 2-取消弹窗*/
uint8_t GET_TCS_Popup (void)
{
return Telltales_Condition.LED_TCS_Status;
}
/*自动大灯功能状态反馈(用于外发和存储): 1-开启 0-关闭*/ //ee存储,上电先读取,赋值给Telltales_AUTO_STATUS.LED_AUTO_TX,与存储值不同时存储一下
uint8_t GET_AUTO_TX (void)
{
return Telltales_AUTO_STATUS.LED_AUTO_TX;
}
#ifndef TELLTALES_USER_H
#define TELLTALES_USER_H
#include <stdint.h>
typedef enum
{
LED_ChargeLineConnect, //充电枪连接指示灯
LED_FaultStatus, //整车故障指示灯
LED_BluetoothConnect, //蓝牙连接
LED_NetworkSignal, //网络信号
LED_GPSSignal, //GPS信号
LED_CruiseWork, //巡航指示灯
LED_READY, //READY指示灯
LED_Support, //边撑指示
LED_TapLoc, //龙头锁
LED_HighBeam, //远光灯
LED_AUTOHeadlight, //自动大灯
LED_Position, //位置灯
LED_DippedHead, //近光灯
LED_Limping, //车辆跛行
LED_TPower, //T动力
LED_TCS, //TCS
LED_HDC, //HDC陡坡缓降
LED_Max,
} LED_Idx_t;
typedef struct
{
uint8_t LED_Tape_lights; //仪表两侧灯带 0-熄灭 1-红色
uint8_t LED_CruiseWork_st; //定速巡航状态:1开启,根据档位显示灯带颜色 0关闭
}Led_LIGHTS_Status;
extern Led_LIGHTS_Status Telltales_Status;
typedef struct
{
uint8_t LED_TCS_Status; //TCS功能已激活标志,用于弹窗显示,1:显示弹窗 0:关闭弹窗
}Led_ONOFF_Condition;
extern Led_ONOFF_Condition Telltales_Condition;
typedef struct
{
uint8_t LED_DippedHead_Condition; //自动大灯逻辑中近光灯点亮条件,用于近光灯点亮判断。也用于判断PIN31输出低有效:1输出低有效,0不输出低有效
uint8_t LED_AUTO_TX; //外发自动大灯功能状态反馈 1-开启 0-关闭
}Led_AUTO_Condition;
extern Led_AUTO_Condition Telltales_AUTO_STATUS;
typedef struct
{
uint8_t Left;
uint8_t Right;
}_st_turn;
extern _st_turn Turn;
void Telltales_Init(void);
void Telltales_User_Init(void);
uint8_t GET_TURN_L(void);
uint8_t GET_TURN_R(void);
uint8_t GET_LowBeam_Condition (void);
uint8_t GET_TCS_Popup (void);
uint8_t GET_AUTO_TX (void);
void Turn_Service(void);
#endif
...@@ -83,7 +83,7 @@ extern void BT_Sleep_Init(void); ...@@ -83,7 +83,7 @@ extern void BT_Sleep_Init(void);
* @return - 0:没有执行连接操作或连接操作失败或已连接; * @return - 0:没有执行连接操作或连接操作失败或已连接;
* - 1:发起连接操作。 * - 1:发起连接操作。
*/ */
extern uint8_t Auto_Connect_Bt(void); extern uint8_t Auto_Connect_Bt(void);//握手成功就开始调用
/* -----------------------------------------蓝牙电话相关-------------------------------------- */ /* -----------------------------------------蓝牙电话相关-------------------------------------- */
...@@ -97,7 +97,7 @@ extern uint8_t Auto_Connect_Bt(void); ...@@ -97,7 +97,7 @@ extern uint8_t Auto_Connect_Bt(void);
* *
* @return uint8_t 返回执行结果,1表示成功发起断开连接操作,0表示未执行断开操作。 * @return uint8_t 返回执行结果,1表示成功发起断开连接操作,0表示未执行断开操作。
*/ */
extern uint8_t Bt_AutoCut_Phone(void); extern uint8_t Bt_AutoCut_Phone(void);//蓝牙音频切换到手机音频
/** /**
* @brief 自动接听蓝牙电话 * @brief 自动接听蓝牙电话
* 该函数用于配置蓝牙耳机自动接听电话。当有来电时,无需用户操作,耳机将自动接听电话。 * 该函数用于配置蓝牙耳机自动接听电话。当有来电时,无需用户操作,耳机将自动接听电话。
......
#include "app_dataProcess.h"
#include "R485_User.h"
#include "bsp_SysTime.h"
#include "a2dp_sink_and_hfp.h"
#include "MCU_Core_Protocol.h"
// void test_app(void)
// {
// R485_ID40h.Sig.AlarmStatus = 0;
// }
static void Data_Password_Service(void);
static void Data_Weather_Service(void);
static void Data_Endurance_Mileage_Service(void);
static void Data_Time_Service(void);
static void Data_Charge_Service(void);
static void Data_DriverMode_Service(void);
static void Data_Gear_Service(void);
static void Data_Vspeed_Service(void);
static void Data_Soc_Service(void);
static void Data_OutPower_Recycle_Service(void);
static uint8_t Get_Power_Seg(uint16_t Current, uint8_t Symbol);
static void Data_UINT_Service(void);
uint8_t u8UintSetting = 0;
void Data_UINT_Service(void)
{
uint8_t u8CarStatus = R485_ID41h.Sig.VehicleStatus;
uint8_t u8Uint = R485_ID41h.Sig.MetricImperialSetting;
if (u8CarStatus == 2U)
{
u8UintSetting = u8Uint;
}
else
{
;
}
}
/**
* @brief 获取当前单位设置 0-KM 1-MILE
*/
uint8_t Get_UintSetting_Value(void)
{
return u8UintSetting;
}
_data_soc Data_Soc;
void Data_Soc_Service(void)
{
uint8_t soc = R485_ID41h.Sig.TotalBatterySOC;
if ((R485_ID41h_LOST))
{
Data_Soc.Soc = 0;
Data_Soc.Valid = 0;
Data_Soc.Seg = 0;
}
else
{
if (soc != 0xFF)
{
soc /= 2;
soc += 9;
Data_Soc.Seg = soc / 10;
Data_Soc.Soc = soc;
if(Data_Soc.Seg <= 1)
{
Data_Soc.Valid = 0;
}
else
{
Data_Soc.Valid = 1;
}
}
else
{
Data_Soc.Valid = 0;
}
if (Data_Soc.Soc >= 100)
{
Data_Soc.Soc = 100;
}
if (Data_Soc.Seg >= 10)
{
Data_Soc.Seg = 10;
}
}
}
/**
* @brief 获取当前SOC值
* @return 0-100;
*/
uint8_t Get_Soc_Value(void)
{
return Data_Soc.Soc;
}
/**
* @brief 获取当前SOC格数
* @return 0~10
*/
uint8_t Get_Soc_Seg(void)
{
return Data_Soc.Seg;
}
/**
* @brief 获取当前SOC有效
* @return 0 无效:点亮报警指示灯,无弹窗 1 有效:根据格数显示
*/
uint8_t Get_Soc_Vaild(void)
{
return Data_Soc.Valid;
}
/******************************************************************************************************************/
_Data_Vspeed Data_Vspeed;
DataVSPeedDampingStruct DataVSPeedDamping;
void Data_Vspeed_Service(void)
{
uint16_t CurrentVspeed = R485_ID41h.Sig.BCMCalculatedSpeed;
uint16_t HallVspeed = R485_ID41h.Sig.ICMCalculatesVehicleSpeed;
uint32_t wtemp = 0;
uint32_t VSpeed = 0;
uint16_t Delta = 0;
if (R485_ID41h_LOST)
{
Data_Vspeed.Valid = 0;
}
else
{
Data_Vspeed.Valid = 1;
if (CurrentVspeed <= 0x0BB8)
{
Data_Vspeed.AvtVspeed = CurrentVspeed;
wtemp = CurrentVspeed;
wtemp *= 105;
wtemp /= 100;
wtemp += 9;
VSpeed = wtemp;
}
else
{
if (HallVspeed != 0xFFFF)
{
wtemp = HallVspeed;
wtemp *= 26376;
wtemp /= 15625;
Data_Vspeed.AvtVspeed = wtemp / 10;
wtemp += 9;
wtemp /= 10;
VSpeed = wtemp;
}
else
{
;
}
}
}
if ( VSpeed > Data_Vspeed.DisVspeed ) // 实际值比当前显示值大时
{
Delta = ( uint16_t )VSpeed - Data_Vspeed.DisVspeed;
if ( DataVSPeedDamping.Dir == DATA_APPR_DIR_INC ) // 显示值正在向实际值增加,则维持当前方向调节增加速度
{
if ( DataVSPeedDamping.Delta < Delta ) // 当前增量小于显示值与实际值的差值,则提升增加的速度
{
DataVSPeedDamping.Delta += DATA_VSPEED_INC_STEP;
if ( DataVSPeedDamping.Delta > Delta )
DataVSPeedDamping.Delta = Delta;
}
else // 当前增量大于等于显示值与实际值的差值,保持增量与当前差值同步,增加的速度即逐步减小
DataVSPeedDamping.Delta = Delta;
Delta = DataVSPeedDamping.Delta;
Delta /= DATA_VSPEED_DAMPING_FACTOR;
if ( Delta < DATA_VSPEED_APPR_SPEED_MIN )
Delta = DATA_VSPEED_APPR_SPEED_MIN;
Data_Vspeed.DisVspeed += Delta;
if ( Data_Vspeed.DisVspeed > VSpeed )
Data_Vspeed.DisVspeed = ( uint16_t )VSpeed;
}
else // 显示值正在减小,则尽快减速至速度为最小时更换方向
{
if ( DataVSPeedDamping.Delta > DATA_VSPEED_DEC_STEP )
DataVSPeedDamping.Delta -= DATA_VSPEED_DEC_STEP;
else
DataVSPeedDamping.Delta = 0;
Delta = DataVSPeedDamping.Delta;
Delta /= DATA_VSPEED_DAMPING_FACTOR;
if ( Delta < DATA_VSPEED_APPR_SPEED_MIN ) // 已减速至最小速度
DataVSPeedDamping.Dir = DATA_APPR_DIR_INC; // 更换方向
else
{
if ( Data_Vspeed.DisVspeed > Delta )
Data_Vspeed.DisVspeed -= Delta;
else
Data_Vspeed.DisVspeed = 0;
}
}
}
else if ( VSpeed < Data_Vspeed.DisVspeed ) // 实际值比当前显示值小时
{
Delta = Data_Vspeed.DisVspeed - ( uint16_t )VSpeed;
if ( DataVSPeedDamping.Dir == DATA_APPR_DIR_INC ) // 显示值仍在增加,则尽快减速至速度为最小时更换方向
{
if ( DataVSPeedDamping.Delta > DATA_VSPEED_DEC_STEP )
DataVSPeedDamping.Delta -= DATA_VSPEED_DEC_STEP;
else
DataVSPeedDamping.Delta = 0;
Delta = DataVSPeedDamping.Delta;
Delta /= DATA_VSPEED_DAMPING_FACTOR;
if ( Delta < DATA_VSPEED_APPR_SPEED_MIN ) // 已减速至最小速度
DataVSPeedDamping.Dir = DATA_APPR_DIR_DEC; // 更换方向
else
{
Data_Vspeed.DisVspeed += Delta;
if ( Data_Vspeed.DisVspeed > 990 )
Data_Vspeed.DisVspeed = 990;
}
}
else // 显示值正在向实际值减小,则维持当前方向调节增加速度
{
if ( DataVSPeedDamping.Delta < Delta ) // 当前(负)增量小于显示值与实际值的差值,则提升减小的速度
{
DataVSPeedDamping.Delta += DATA_VSPEED_INC_STEP;
if ( DataVSPeedDamping.Delta > Delta )
DataVSPeedDamping.Delta = Delta;
}
else // 当前(负)增量大于等于显示值与实际值的差值,保持(负)增量与当前差值同步,减小的速度即逐步减小
DataVSPeedDamping.Delta = Delta;
Delta = DataVSPeedDamping.Delta;
Delta /= DATA_VSPEED_DAMPING_FACTOR;
if ( Delta < DATA_VSPEED_APPR_SPEED_MIN )
Delta = DATA_VSPEED_APPR_SPEED_MIN;
if ( Data_Vspeed.DisVspeed < VSpeed + Delta )
Data_Vspeed.DisVspeed = ( uint16_t )VSpeed;
else
Data_Vspeed.DisVspeed -= Delta;
}
}
else // 实际值与当前显示值相等时
{
Delta = DataVSPeedDamping.Delta;
Delta /= DATA_VSPEED_DAMPING_FACTOR;
if ( Delta > DATA_VSPEED_APPR_SPEED_MIN ) // 当前的速度不是最小,说明数值正在增加/减小中,则继续原过程
{
if ( DataVSPeedDamping.Delta > DATA_VSPEED_DEC_STEP ) // 显示值越过了实际值,必然要先减速至最小速度,再改变方向返回实际值
DataVSPeedDamping.Delta -= DATA_VSPEED_DEC_STEP;
else
DataVSPeedDamping.Delta = 0;
Delta = DataVSPeedDamping.Delta;
Delta /= DATA_VSPEED_DAMPING_FACTOR;
if ( DataVSPeedDamping.Dir == DATA_APPR_DIR_INC ) // 显示值当前是增加方向
{
if ( Delta < DATA_VSPEED_APPR_SPEED_MIN ) // 已减速至最小速度
DataVSPeedDamping.Dir = DATA_APPR_DIR_DEC; // 更换方向
else
{
Data_Vspeed.DisVspeed += Delta;
if ( Data_Vspeed.DisVspeed > 990 )
Data_Vspeed.DisVspeed = 990;
}
}
else // 显示值当前是减小方向
{
if ( Delta < DATA_VSPEED_APPR_SPEED_MIN ) // 已减速至最小速度
DataVSPeedDamping.Dir = DATA_APPR_DIR_INC; // 更换方向
else
{
if ( Data_Vspeed.DisVspeed > Delta )
Data_Vspeed.DisVspeed -= Delta;
else
Data_Vspeed.DisVspeed = 0;
}
}
}
}
if (Data_Vspeed.DisVspeed >= 990)
{
Data_Vspeed.DisVspeed = 990;
}
}
/**
* @brief 获取真实车速值 10倍
* @return 0~0xffff
*/
uint16_t Get_Act_Vspeed(void)
{
return Data_Vspeed.AvtVspeed;
}
/**
* @brief 获取显示车速 10倍
* @return 0~990
*/
uint16_t Get_Dis_Vspeed(void)
{
uint16_t Data = 0U;
if(Get_UintSetting_Value() == 1)
{
Data = (Data_Vspeed.DisVspeed * 64U) /103U;
}
else
{
Data = Data_Vspeed.DisVspeed;
}
return Data;
}
/**
* @brief 获取车速有效
* @return 0 无效 1 有效
*/
uint8_t Get_Vspeed_Valid(void)
{
return Data_Vspeed.Valid;
}
/******************************************************************************************************* */
_Data_Gear Data_Gear;
_Gear_Mode Data_Popup;
static uint8_t GearArray[maxgear] = {Gear_Max};
void Request_Gear(uint8_t Gear)
{
/* 向后移动 */
for (int i = maxgear - 1; i > 0; i--)
{
GearArray[i] = GearArray[i - 1];
}
/* 新触发信号放到数组0 */
GearArray[0] = Gear;
}
void Delete_Gear(uint8_t Gear)
{
int Index = -1;
/* 寻找此信号是否存在 */
for (int i = 0; i < maxgear; i++)
{
if (GearArray[i] == Gear)
{
Index = i;
break;
}
}
/* 存在赋值Gear_Max并数组以此向前移动一个位置 */
if (Index != -1)
{
for (int i = Index; i < maxgear - 1; i++)
{
GearArray[i] = GearArray[i + 1];
}
GearArray[maxgear - 1] = Gear_Max;
}
}
void Data_Gear_Service(void)
{
uint8_t Car_Status = R485_ID41h.Sig.VehicleStatus;
uint8_t Reverse_Mode = R485_ID41h.Sig.ReverseMode;
uint8_t Cart_Mode = R485_ID41h.Sig.CartMode;
if (R485_ID41h_LOST)
{
Data_Gear.Gear = Gear_P;
Data_Popup.GEAR_Popup = Popup_Max;
Data_Popup.valid = 0;
}
else
{
if (Car_Status == 2)
{
Data_Gear.Gear = Gear_P;
Data_Popup.GEAR_Popup = Popup_P;
Data_Popup.valid = 0;
}
else if (Car_Status == 3)
{
Data_Popup.valid = 1;
Data_Gear.Gear = Gear_Max;
if (Reverse_Mode == 1)
{
Data_Gear.Reverse_Gear = Gear_R;
}
else
{
Data_Gear.Reverse_Gear = Gear_Max;
}
if (Cart_Mode == 1)
{
Data_Gear.Cart_Gear = Gear_A;
}
else
{
Data_Gear.Cart_Gear = Gear_Max;
}
}
else
{
Data_Popup.valid = 0;
}
}
if (Data_Gear.Gear != Gear_P)
{
if ((Data_Gear.Reverse_Gear_Back != Data_Gear.Reverse_Gear))
{
if (Data_Gear.Reverse_Gear == Gear_R)
{
Request_Gear(Gear_R);
}
else
{
Delete_Gear(Gear_R);
}
Data_Gear.Reverse_Gear_Back = Data_Gear.Reverse_Gear;
}
if ((Data_Gear.Cart_Gear != Data_Gear.Cart_Gear))
{
if (Data_Gear.Cart_Gear == Gear_A)
{
Request_Gear(Gear_A);
}
else
{
Delete_Gear(Gear_A);
}
Data_Gear.Cart_Gear = Data_Gear.Cart_Gear;
}
Data_Gear.Gear = GearArray[0];
}
}
/**
* @brief 获取当前挡位模式
* @return 详见枚举
*/
_GearSts Get_Gear_Mode(void)
{
return Data_Gear.Gear;
}
_DriverMode Data_DriverMode;
void Data_DriverMode_Service(void)
{
uint8_t DriverMode = R485_ID41h.Sig.SpeedGear;
if (R485_ID41h_LOST)
{
Data_DriverMode.DriverMode = ECO_MODE;
}
else
{
switch (DriverMode)
{
case 1:
Data_DriverMode.DriverMode = ECO_MODE;
break;
case 2:
Data_DriverMode.DriverMode = CITY_MODE;
break;
case 3:
Data_DriverMode.DriverMode = SPORT_MODE;
break;
default:
break;
}
}
}
/**
* @brief 获取当前驾驶模式
* @return 详见_DriverMode枚举
*/
_Driverenum Get_Driver_Mode(void)
{
return Data_DriverMode.DriverMode;
}
/**
* @brief 获取驾驶模式有效
* @return 0 无效 1 有效
*/
uint8_t Get_Driver_Valid(void)
{
return Data_Popup.valid;
}
/********************************************************************************************************/
_Data_Power_st_t stData_Power;
uint8_t Get_Power_Seg(uint16_t Current, uint8_t Symbol)
{
uint8_t Seg = 0U;
if (Symbol == DATA_POWER_OUTPUT)
{
}
else if (Symbol == DATA_POWER_RECYCLE)
{
if (Current > 0U && Current <= 5U)
{
Seg = 1;
}
else if (Current > 5U && Current <= 10U)
{
Seg = 2;
}
else if (Current > 10U && Current <= 15U)
{
Seg = 3;
}
else if (Current > 15U && Current <= 20U)
{
Seg = 4;
}
else if (Current > 20U && Current <= 25U)
{
Seg = 5;
}
else if (Current > 25U && Current <= 30U)
{
Seg = 6;
}
else if (Current > 30U && Current <= 35U)
{
Seg = 7;
}
else if (Current > 35U && Current <= 40U)
{
Seg = 8;
}
else if (Current > 400)
{
Seg = 9;
}
}
return Seg;
}
void Data_OutPower_Recycle_Service(void)
{
uint8_t u8DriverMode = R485_ID41h.Sig.SpeedGear;
uint16_t u16voltage = R485_ID41h.Sig.TotalBatteryVoltage;
uint16_t u16Current = R485_ID41h.Sig.TotalBatteryCurrent;
uint8_t u8PowerStatus = R485_ID41h.Sig.RecuperationStatusFeedback;
if ((R485_ID41h_LOST) || ((u8DriverMode != 1U) && (u8DriverMode != 2U) && (u8DriverMode != 3U)))
{
stData_Power.u8Valid = 0U; /*无效,不显示功率输出及能量回收*/
}
else
{
stData_Power.u8Valid = 1U;
if (u16Current < 1000UL)
{
stData_Power.u8Symbol = DATA_POWER_OUTPUT;
u16Current = 1000UL - u16Current;
stData_Power.u16Power = u16voltage * u16Current / 100U; /*10倍功率*/
stData_Power.u8PowerPercent = u16voltage * u16Current / 1500U;
if (stData_Power.u16Power >= 999UL)
{
stData_Power.u16Power = 999UL;
}
if (stData_Power.u8PowerPercent >= 3U)
{
stData_Power.u8PowerPercent -= 3U;
if (stData_Power.u8PowerPercent >= 100U)
{
stData_Power.u8PowerPercent = 100U;
}
}
else
{
stData_Power.u8PowerPercent = 0U;
}
stData_Power.u8PowerOutSeg = Get_Power_Seg(u16Current, stData_Power.u8Symbol);
stData_Power.u8PowerRecycleSeg = 0U;
}
else if ((u16Current >= 1000UL) && (u8PowerStatus == 1))
{
stData_Power.u8Symbol = DATA_POWER_RECYCLE;
u16Current = u16Current - 1000UL;
stData_Power.u16Power = u16voltage * u16Current / 100U; /*10倍功率*/
stData_Power.u8PowerPercent = u16voltage * u16Current / 1500U;
if (stData_Power.u16Power >= 999UL)
{
stData_Power.u16Power = 999UL;
}
if (stData_Power.u8PowerPercent >= 100U)
{
stData_Power.u8PowerPercent = 100U;
}
stData_Power.u8PowerOutSeg = 0U;
stData_Power.u8PowerRecycleSeg = Get_Power_Seg(u16Current, stData_Power.u8Symbol);;
}
else
{
;
}
}
}
/**
* @brief 获取功率回收格数
* @return 0-9
*/
uint16_t Get_Power_RecycleSeg(void)
{
return stData_Power.u8PowerRecycleSeg;
}
/**
* @brief 获取功率输出格数
* @return
*/
uint16_t Get_Power_OutSeg(void)
{
return stData_Power.u8PowerOutSeg;
}
/**
* @brief 获取功率输出还是回收是否显示的标志
* @return 0-不显示 1-显示
*/
uint16_t Get_Power_Valid(void)
{
return stData_Power.u8Valid;
}
/**
* @brief 获取功率输出还是回收的标志
* @return 0-输出 1-回收
*/
uint16_t Get_Power_Symbol(void)
{
return stData_Power.u8Symbol;
}
/**
* @brief 获取功率值
* @return 0 ~ 99.9KM unit 0.1kw
*/
uint16_t Get_Power_Value(void)
{
return stData_Power.u16Power;
}
/**
* @brief 获取功率百分比
* @return 0 ~ 100%
*/
uint16_t Get_Power_Percent(void)
{
return stData_Power.u8PowerPercent;
}
/************************************************************************************************* */
_Data_Charge Data_Charge;
void Data_Charge_Service(void)
{
uint8_t Power_Status = R485_ID41h.Sig.VehiclePowerMode;
uint8_t Charge_Status = R485_ID41h.Sig.ChargeState;
if (Power_Status == 1)
{
Data_Charge.Led = 1;
if ((Charge_Status == 1) || (Charge_Status == 2) || (Charge_Status == 3))
{
if (Data_Charge.Timer <= 1500)
{
Data_Charge.Timer++;
Data_Charge.Type = Charge_Status;
}
else
{
Data_Charge.Type = ChargeMax;
}
}
else
{
Data_Charge.Timer = 0;
Data_Charge.Type = ChargeMax;
}
}
else
{
Data_Charge.Timer = 0;
Data_Charge.Led = 0;
Data_Charge.Type = ChargeMax;
}
}
/**
* @brief 获取充电界面
* @return 详见枚举_ChargeType
*/
_ChargeType Get_Charge_Type(void)
{
return Data_Charge.Type;
}
/**
* @brief 获取充电连接指示灯
* @return 1 点亮 0 熄灭
*/
uint8_t Get_Charge_Led(void)
{
return Data_Charge.Led;
}
/**************************************************************************************************************** */
/**
* @brief 获取时间有效,此函数会判断大小月及是否是闰年
* @return 1 有效 0 无效
*/
bool Get_Timer_Valid(int year, int month, int day, int hour, int min, int sec)
{
int ActYear = year + 2000;
bool leapYear = ((ActYear % 4 == 0 && ActYear % 100 != 0) || (ActYear % 400 == 0));
if (year <= 0x63 && month > 0 && month <= 12 && day > 0 && day <= 0x1F &&
hour >= 0 && hour <= 0x17 && min > 0 && min <= 0x3B && sec > 0 && sec <= 0x3B)
{
switch (month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
return (day <= 31);
case 4:
case 6:
case 9:
case 11:
return (day <= 30);
case 2:
return (leapYear ? day <= 29 : day <= 28);
}
}
return false;
}
_st_Data_Time Data_Time;
void Data_Time_Service(void)
{
bool Valid = 0;
uint8_t LeapYear = 0;
// if (1)
// {
Valid = Get_Timer_Valid(R485_ID41h.Sig.IOTRealTime_Year, R485_ID41h.Sig.IOTRealTime_Month, R485_ID41h.Sig.IOTRealTime_Day, R485_ID41h.Sig.IOTRealTime_Hour, R485_ID41h.Sig.IOTRealTime_Minute, R485_ID41h.Sig.IOTRealTime_Second);
if ((R485_ID41h_LOST) || (Valid != 1))
{
if (R485_ID41h_LOST)
{
if (Data_Time.Valid) /* 补偿报文掉线时间 */
{
if (Data_Time.Second + 5 > 59)
{
Data_Time.Second = 60 - Data_Time.Second;
Data_Time.Second = 5 - Data_Time.Second;
if (Data_Time.Minute + 1 > 59)
{
Data_Time.Hour += 1;
Data_Time.Minute = 0;
}
else
{
Data_Time.Minute += 1;
}
}
else
{
Data_Time.Second += 5;
}
set_local_time(&Data_Time, 0);
Data_Time.Valid = 0;
}
}
else
{
Data_Time.Valid = 0;
}
}
else
{
Data_Time.Valid = 1;
Data_Time.Year = R485_ID41h.Sig.IOTRealTime_Year;
Data_Time.Month = R485_ID41h.Sig.IOTRealTime_Month;
Data_Time.Day = R485_ID41h.Sig.IOTRealTime_Day;
Data_Time.Hour = R485_ID41h.Sig.IOTRealTime_Hour;
Data_Time.Minute = R485_ID41h.Sig.IOTRealTime_Minute;
Data_Time.Second = R485_ID41h.Sig.IOTRealTime_Second;
// printf("Data_Time.Hour %d\r\n", Data_Time.Hour);
/* 时间有效对时 */
set_local_time(&Data_Time, 0);
}
}
/**
* @brief 获取时间有效标志
* @return 1 有效 0 无效
*/
uint8_t Get_Data_Time_Valid(void)
{
return Data_Time.Valid;
}
/**
* @brief 获取时间小时
*/
uint8_t Get_Data_Time_Hour(void)
{
return Data_Time.Hour;
}
/**
* @brief 获取时间分钟
*/
uint8_t Get_Data_Time_Minute(void)
{
return Data_Time.Minute;
}
/***********************************************************************************************/
Data_Endurance_st_t stDataEndurance;
void Data_Endurance_Mileage_Service(void)
{
stDataEndurance.u16DataEnduranceValue = R485_ID41h.Sig.BCMRemainingMileage;
if (R485_ID41h.Sig.RemainingMileageDisplaySettings == 1U)
{
stDataEndurance.u8DataEnduranceSetFlag = 1U;
}
else
{
stDataEndurance.u8DataEnduranceSetFlag = 0U;
}
if ((R485_ID41h_LOST) || (stDataEndurance.u16DataEnduranceValue == 0xFFFF))
{
stDataEndurance.u8DataEnduranceValid = 0U;
}
else
{
if (stDataEndurance.u16DataEnduranceValue > 999UL)
{
stDataEndurance.u16DataEnduranceValue = 999UL;
}
}
}
/*获取剩余里程显示状态反馈 用于存储及外发 1-点亮续航里程 0-熄灭续航里程*/
uint8_t Get_Endurance_Set_Flag(void)
{
return stDataEndurance.u8DataEnduranceSetFlag;
}
/*获取剩余里程有效标志 1-正常显示续航里程 0-显示“--km” */
uint8_t Get_Endurance_Valid(void)
{
return stDataEndurance.u8DataEnduranceValid;
}
/*获取剩余里程值 范围:0-999*/
uint8_t Get_Endurance_Value(void)
{
uint16_t Data = 0U;
if(Get_UintSetting_Value() == 1)
{
Data = (stDataEndurance.u16DataEnduranceValue * 64U) /103U;
}
else
{
Data = stDataEndurance.u16DataEnduranceValue;
}
return Data;
}
/************************************************************************************************** */
_st_Data_Weather Data_Weather;
void Data_Weather_Service(void)
{
uint8_t Type = 0;
uint8_t Level = 0;
uint8_t Valid = 1;
Type = R485_ID42h.Sig.WarningWeather;
Level = R485_ID42h.Sig.WeatherWarningLevel;
uint8_t CurrentWeatherType = R485_ID42h.Sig.CurrentWeatherType;
uint8_t CurrentTemp = R485_ID42h.Sig.CurrentWeatherTemp;
if ((Type > 0X14) || (Level > 4) || ((Type != 0) && (Level == 0)))
{
Valid = 0;
}
else
{
;
}
if (!R485_ID41h_LOST)
{
if (Valid != 1)
{
Data_Weather.Valid = 0;
Data_Weather.Type = 0;
Data_Weather.Level = 0;
Data_Weather.BackLevel = Level_Max;
Data_Weather.BackType = Type_Max;
Data_Weather.Timer = 50;
}
else
{
switch (Type)
{
case 0X00:
Data_Weather.Type = Type_Wind;
break;
case 0x01:
Data_Weather.Type = Type_Rainstorm;
break;
case 0x02:
Data_Weather.Type = Type_Blizzard;
break;
case 0x03:
Data_Weather.Type = Type_Gale;
break;
case 0x04:
Data_Weather.Type = Type_DustStorm;
break;
case 0x05:
Data_Weather.Type = Type_HighTemp;
break;
case 0x06:
Data_Weather.Type = Type_ThousandDrough;
break;
case 0x07:
Data_Weather.Type = Type_Lightning;
break;
case 0x08:
Data_Weather.Type = Type_Thunder;
break;
case 0x09:
Data_Weather.Type = Type_Hail;
break;
case 0x0A:
Data_Weather.Type = Type_Frost;
break;
case 0x0B:
Data_Weather.Type = Type_Fog;
break;
case 0x0C:
Data_Weather.Type = Type_Haze;
break;
case 0x0D:
Data_Weather.Type = Type_RoadIce;
break;
case 0x0E:
Data_Weather.Type = Type_Tide;
break;
case 0x0F:
Data_Weather.Type = Type_WireIcing;
break;
case 0x10:
Data_Weather.Type = Type_SustainedLowTemp;
break;
case 0x11:
Data_Weather.Type = Type_ThunderStorm;
break;
case 0x12:
Data_Weather.Type = Type_ForestFireLine;
break;
case 0x13:
Data_Weather.Type = Type_DryHotAir;
break;
case 0x14:
Data_Weather.Type = Type_Frozen;
break;
default:
Data_Weather.Type = Type_Max;
break;
}
switch (Level)
{
case 0:
Data_Weather.Level = Level_White;
break;
case 1:
Data_Weather.Level = Level_Blue;
break;
case 2:
Data_Weather.Level = Level_Yellow;
break;
case 3:
Data_Weather.Level = Level_Orange;
break;
case 4:
Data_Weather.Level = Level_Red;
break;
default:
break;
}
if ((Data_Weather.Level != Data_Weather.BackLevel) || (Data_Weather.Type != Data_Weather.BackType))
{
Data_Weather.BackLevel = Data_Weather.Level;
Data_Weather.BackType = Data_Weather.Type;
Data_Weather.Timer = 50;
}
if (Data_Weather.Timer > 0)
{
Data_Weather.Timer--;
Data_Weather.Valid = 1;
}
else
{
Data_Weather.Valid = 0;
}
}
}
else
{
Data_Weather.Valid = 0;
Data_Weather.Type = 0;
Data_Weather.Level = 0;
Data_Weather.BackLevel = Level_Max;
Data_Weather.BackType = Type_Max;
Data_Weather.Timer = 50;
}
if (CurrentWeatherType <= 34)
{
Data_Weather.CurrentType = CurrentWeatherType;
}
else
{
Data_Weather.CurrentType = 0XFF;
}
if (CurrentTemp >= 100)
{
CurrentTemp -= 100;
Data_Weather.CurrentTemp = CurrentTemp;
Data_Weather.Symbol = 1;
}
else
{
CurrentTemp = 100 - CurrentTemp;
Data_Weather.CurrentTemp = CurrentTemp;
Data_Weather.Symbol = 0;
}
if(Data_Weather.CurrentTemp >= 100)
{
Data_Weather.CurrentTemp = 100;
}
}
/**
* @brief 获取天气显示信息有效性
* @return 1 有效显示 0 无效不显示
*/
uint8_t Get_Weather_Valid(void)
{
return Data_Weather.Valid;
}
/**
* @brief 获取预警天气报警等级
* @return _Weather_Level 详见枚举
*/
_Weather_Level Get_Weather_Level(void)
{
return Data_Weather.Level;
}
/**
* @brief 获取预警天气报警类型
* @return _Weather_Type 详见枚举
*/
_Weather_Type Get_Weather_Type(void)
{
return Data_Weather.Type;
}
/**
* @brief 获取当前显示温度
* @return 0 ~ 100
*/
uint8_t Get_Current_Temp(void)
{
return Data_Weather.CurrentTemp;
}
/**
* @brief 获取当前显示温度符号
* @return 0 - 1 +
*/
uint8_t Get_Current_Temp_Symbol(void)
{
return Data_Weather.Symbol;
}
/**
* @brief 获取当前天气类型
* @return
*/
uint8_t Get_Current_Type(void)
{
return Data_Weather.CurrentType;
}
/*********************************************************************************************************** */
void Menu_u8Data_Updata_Process(uint8_t updateDir , uint8_t datMax, uint8_t datMin, uint8_t datStep, uint8_t *dat)
{
uint8_t temp = *dat;
if(datMax > datMin)
{
if(updateDir == 1u)
{
if(temp < datMax)
{
if((temp) <= (255u-datStep))
{
temp += datStep;
}
}
else
{
temp = datMin;
}
}
else if(updateDir == 2u)
{
if(temp > datMin)
{
if(temp >= datStep)
{
temp -= datStep;
}
}
else
{
temp = datMax;
}
}
else
{
}
}
else
{
}
*dat = temp;
}
_st_Data_Password Data_Password;
void Data_Password_Service(void)
{
uint8_t updataDir = 0u;
uint8_t datmax = 0u;
uint8_t datmin = 0u;
Data_Password.Unlock_Instruction = R485_ID42h.Sig.PasswordUnlockCommand;
Data_Password.Check_Result = R485_ID42h.Sig.PasswordAuthResult;
Data_Password.Chance = R485_ID42h.Sig.PasswordCanbeEnter;
if ((1) && (Data_Password.Unlock_Instruction == 1)) //ACC1电
{
Data_Password.PasswordType = 1; //1-密码解锁界面
if (Data_Password.Chance <= 6)
{
Data_Password.ChanceValid = 1; //判断是否显示密码剩余次数
}
else
{
Data_Password.ChanceValid = 0;
}
//1-左按键 2-右按键 3-上按键 4-下按键 5-确认按键
if(Data_Password.Cursor == 0)//光标在第一位密码上
{
if(4)
{
updataDir = 1;
datmax = 9u;
datmin = 0u;
Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(Data_Password.Password1));
}
else if (3)
{
updataDir = 2;
datmax = 9u;
datmin = 0u;
Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(Data_Password.Password1));
}
else if ((5) || (2))
{
Data_Password.Cursor = 1;
}
else
{
;
}
}
else if (Data_Password.Cursor == 1)//光标在第二位密码上
{
if(4)
{
updataDir = 1;
datmax = 9u;
datmin = 0u;
Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(Data_Password.Password2));
}
else if (3)
{
updataDir = 2;
datmax = 9u;
datmin = 0u;
Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(Data_Password.Password2));
}
else if ((5) || (2))
{
Data_Password.Cursor = 2;
}
else if (1)
{
Data_Password.Cursor = 0;
}
else
{
;
}
}
else if (Data_Password.Cursor == 2)//光标在第三位密码上
{
if(4)
{
updataDir = 1;
datmax = 9u;
datmin = 0u;
Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(Data_Password.Password3));
}
else if (3)
{
updataDir = 2;
datmax = 9u;
datmin = 0u;
Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(Data_Password.Password3));
}
else if ((5) || (2))
{
Data_Password.Cursor = 3;
}
else if (1)
{
Data_Password.Cursor = 1;
}
else
{
;
}
}
else if (Data_Password.Cursor == 3) //光标在第四位密码上,按键确认后
{
if(4)
{
updataDir = 1;
datmax = 9u;
datmin = 0u;
Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(Data_Password.Password2));
}
else if (3)
{
updataDir = 2;
datmax = 9u;
datmin = 0u;
Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(Data_Password.Password2));
}
else if (1)
{
Data_Password.Cursor = 2;
}
else
{
;
}
if(5)
{
Data_Password.Password = (Data_Password.Password1 << 24) | (Data_Password.Password1 << 16) | (Data_Password.Password3 << 8) | (Data_Password.Password4);
Data_Password.Password_TX = 1; //外发标志,1-开始外发密码三帧,发完之后赋值0
}
}
if (Data_Password.Check_Result == 0)
{
Data_Password.Power = 1; //密码正确 开机
Data_Password.PasswordType = 0;
}
else if(Data_Password.Check_Result == 1)
{
Data_Password.Power = 0;
Data_Password.IGONFlag = 1; //密码错误,今日还可尝试N-1次
Data_Password.Cursor = 0; //光标回到首位
}
}
}
/*剩余输入密码次数 */
uint8_t Get_Password_Chance_Sigle(void)
{
return Data_Password.Chance;
}
/*密码界面光标 0-3 4位密码位置从左至右 */
uint8_t Get_Password_Cursor_Sigle(void)
{
return Data_Password.Cursor;
}
/*密码界面标志 1-密码解锁界面 0-不进入密码界面 */
uint8_t Get_Password_Type_Sigle(void)
{
return Data_Password.PasswordType;
}
/*开机指令 1-开机 0-不开机 */
uint8_t Get_Password_IGON_Sigle(void)
{
return Data_Password.Power;
}
/*外发密码指令 1-外发三帧 0-不外发 */
uint8_t Get_Password_TX_Sigle(void)
{
return Data_Password.Password_TX;
}
/*外发密码值 */
uint8_t Get_Password_Value_Sigle(void)
{
return Data_Password.Password;
}
/*获取次数显示标志 1-每日仅限输错N次 2-其他 */
uint8_t Get_Password_IGONFlag_Sigle(void)
{
return Data_Password.IGONFlag;
}
/*********************************************************************************************************** */
uint32_t Damping_Pro(uint16_t Val_In, _Damping_Container_Obj_Enum Damp_Obj)
{
uint16_t Deltaa = 0;
if (Damp_Obj >= Dampe_Obj_Max)
{
return 0;
}
if (Val_In > Damping_Container[Damp_Obj].Val_Out)
{
Deltaa = Val_In - Damping_Container[Damp_Obj].Val_Out;
if (Damping_Container[Damp_Obj].Dir == DATA_APPR_DIR_DEC)
{
if (Dparam[Damp_Obj].Factor1 > 1)
{
if (Damping_Container[Damp_Obj].Delta > Dparam[Damp_Obj].Delta_DEC_STEP * Dparam[Damp_Obj].Factor1)
{
Damping_Container[Damp_Obj].Delta -= Damping_Container[Damp_Obj].Delta / Dparam[Damp_Obj].Factor1;
}
else if (Damping_Container[Damp_Obj].Delta > Dparam[Damp_Obj].Delta_DEC_STEP)
{
Damping_Container[Damp_Obj].Delta -= Dparam[Damp_Obj].Delta_DEC_STEP;
}
else
{
Damping_Container[Damp_Obj].Delta = 0;
}
}
else
{
if (Damping_Container[Damp_Obj].Delta > Dparam[Damp_Obj].Delta_DEC_STEP)
{
Damping_Container[Damp_Obj].Delta -= Dparam[Damp_Obj].Delta_DEC_STEP;
}
else
{
Damping_Container[Damp_Obj].Delta = 0;
}
}
}
else
{
if ((Damping_Container[Damp_Obj].Delta += Dparam[Damp_Obj].Delta_INC_STEP) > Deltaa)
{
Damping_Container[Damp_Obj].Delta = Deltaa;
}
}
}
else if (Val_In < Damping_Container[Damp_Obj].Val_Out)
{
Deltaa = Damping_Container[Damp_Obj].Val_Out - Val_In;
if (Damping_Container[Damp_Obj].Dir == DATA_APPR_DIR_DEC)
{
if ((Damping_Container[Damp_Obj].Delta += Dparam[Damp_Obj].Delta_INC_STEP) > Deltaa)
{
Damping_Container[Damp_Obj].Delta = Deltaa;
}
}
else
{
if (Dparam[Damp_Obj].Factor1 > 1)
{
if (Damping_Container[Damp_Obj].Delta > Dparam[Damp_Obj].Delta_DEC_STEP * Dparam[Damp_Obj].Factor1)
{
Damping_Container[Damp_Obj].Delta -= Damping_Container[Damp_Obj].Delta / Dparam[Damp_Obj].Factor1;
}
else if (Damping_Container[Damp_Obj].Delta > Dparam[Damp_Obj].Delta_DEC_STEP)
{
Damping_Container[Damp_Obj].Delta -= Dparam[Damp_Obj].Delta_DEC_STEP;
}
else
{
Damping_Container[Damp_Obj].Delta = 0;
}
}
else
{
if (Damping_Container[Damp_Obj].Delta > Dparam[Damp_Obj].Delta_DEC_STEP)
{
Damping_Container[Damp_Obj].Delta -= Dparam[Damp_Obj].Delta_DEC_STEP;
}
else
{
Damping_Container[Damp_Obj].Delta = 0;
}
}
}
}
else
{
Deltaa = Damping_Container[Damp_Obj].Delta / Dparam[Damp_Obj].AVOL;
if (Deltaa < Dparam[Damp_Obj].Delta_Minimum)
{
Deltaa = Dparam[Damp_Obj].Delta_Minimum;
}
if (Deltaa > Dparam[Damp_Obj].Delta_Minimum)
{
if (Damping_Container[Damp_Obj].Delta > Dparam[Damp_Obj].Delta_DEC_STEP * Dparam[Damp_Obj].Factor2)
{
Damping_Container[Damp_Obj].Delta -= Damping_Container[Damp_Obj].Delta / Dparam[Damp_Obj].Factor2;
}
else if (Damping_Container[Damp_Obj].Delta > Dparam[Damp_Obj].Delta_DEC_STEP)
{
Damping_Container[Damp_Obj].Delta -= Dparam[Damp_Obj].Delta_DEC_STEP;
}
else
{
Damping_Container[Damp_Obj].Delta = 0;
}
}
}
Deltaa = Damping_Container[Damp_Obj].Delta / Dparam[Damp_Obj].AVOL;
if (Deltaa < Dparam[Damp_Obj].Delta_Minimum)
{
Deltaa = Dparam[Damp_Obj].Delta_Minimum;
}
if (Damping_Container[Damp_Obj].Dir == DATA_APPR_DIR_DEC)
{
if (Damping_Container[Damp_Obj].Val_Out >= Val_In)
{
if (Damping_Container[Damp_Obj].Val_Out > Deltaa + Val_In)
{
Damping_Container[Damp_Obj].Val_Out -= Deltaa;
}
else
{
Damping_Container[Damp_Obj].Val_Out = Val_In;
}
}
else
{
if (Deltaa <= Dparam[Damp_Obj].Delta_Minimum)
{
Damping_Container[Damp_Obj].Dir = DATA_APPR_DIR_INC;
}
else
{
if (Damping_Container[Damp_Obj].Val_Out > Deltaa)
{
Damping_Container[Damp_Obj].Val_Out -= Deltaa;
}
else
{
Damping_Container[Damp_Obj].Val_Out = Dparam[Damp_Obj].Amplitude_valley;
}
}
}
}
else
{
if (Damping_Container[Damp_Obj].Val_Out > Val_In)
{
if (Deltaa <= Dparam[Damp_Obj].Delta_Minimum)
{
Damping_Container[Damp_Obj].Dir = DATA_APPR_DIR_DEC;
}
else
{
Damping_Container[Damp_Obj].Val_Out += Deltaa;
if (Damping_Container[Damp_Obj].Val_Out >= Dparam[Damp_Obj].Amplitude_peak)
{
Damping_Container[Damp_Obj].Val_Out = Dparam[Damp_Obj].Amplitude_peak;
}
}
}
else
{
Damping_Container[Damp_Obj].Val_Out += Deltaa;
if (Damping_Container[Damp_Obj].Val_Out >= Val_In)
{
Damping_Container[Damp_Obj].Val_Out = Val_In;
}
}
}
return Damping_Container[Damp_Obj].Val_Out;
}
void Data_UE_Service(void)
{
if(Get_Bt_Music_Status() != status_max)
{
Menu_Set_Music(1);
}
else
{
Menu_Set_Music(0);
}
if(Nav_Status() == 1)
{
Menu_Set_NAV(1);
}
else
{
Menu_Set_NAV(0);
}
if(Get_Charge_Type() != ChargeMax)
{
Menu_Set_Charge(1);
}
else
{
Menu_Set_Charge(0);
}
}
/***********************************************************************************************/
void DataProcess_Init(void)
{
Data_Soc.Soc = 0;
Data_Soc.Valid = 0;
Data_Soc.Seg = 0;
Data_Vspeed.Valid = 0;
Data_Vspeed.AvtVspeed = 0;
Data_Vspeed.DisVspeed = 0;
DataVSPeedDamping.Dir = DATA_APPR_DIR_INC;
DataVSPeedDamping.Delta = 0;
Data_Gear.Gear = Gear_P;
Data_DriverMode.DriverMode = ECO_MODE;
Data_Popup.valid = 0;
Data_Charge.Timer = 0;
Data_Charge.Led = 0;
Data_Charge.Type = ChargeMax;
Data_Password.PasswordType = 0;
Data_Password.Cursor = 0;
Data_Password.IGONFlag = 0xFF;
Data_Password.Power = 0;
Data_Password.ChanceValid = 0;
Data_Password.Password = 0;
Data_Password.Password1 = 0;
Data_Password.Password2 = 0;
Data_Password.Password3 = 0;
Data_Password.Password4 = 0;
}
void DataProcess_Sleep_Init(void)
{
Data_Soc.Soc = 0;
Data_Soc.Valid = 0;
Data_Soc.Seg = 0;
Data_Vspeed.Valid = 0;
Data_Vspeed.AvtVspeed = 0;
Data_Vspeed.DisVspeed = 0;
DataVSPeedDamping.Dir = DATA_APPR_DIR_INC;
DataVSPeedDamping.Delta = 0;
Data_Gear.Gear = Gear_P;
Data_DriverMode.DriverMode = ECO_MODE;
Data_Popup.valid = 0;
Data_Charge.Timer = 0;
Data_Charge.Led = 0;
Data_Charge.Type = ChargeMax;
Data_Password.PasswordType = 0;
Data_Password.Cursor = 0;
Data_Password.IGONFlag = 0xFF;
Data_Password.Power = 0;
Data_Password.ChanceValid = 0;
Data_Password.Password = 0;
Data_Password.Password1 = 0;
Data_Password.Password2 = 0;
Data_Password.Password3 = 0;
Data_Password.Password4 = 0;
}
void DataProcess_Service(void)
{
Data_Soc_Service();
Data_Vspeed_Service();
Data_Gear_Service();
Data_DriverMode_Service();
Data_Endurance_Mileage_Service();
Data_Charge_Service();
Data_Time_Service();
Data_UINT_Service();
Data_Weather_Service();
Data_Password_Service();
Data_OutPower_Recycle_Service();
Data_UE_Service();
}
#ifndef __APP_DATAPROCESS_H_
#define __APP_DATAPROCESS_H_
#include <stdint.h>
#include <stdbool.h>
#define R485_ID40h_LOST 0
#define R485_ID48h_LOST 0
#define R485_ID41h_LOST 0
#define R485_ID49h_LOST 0
#define R485_ID42h_LOST 0
#define R485_ID4Ah_LOST 0
#define DATA_APPR_DIR_INC 0x00
#define DATA_APPR_DIR_DEC 0x01
typedef struct
{
uint8_t Soc;
uint8_t Seg;
uint8_t Valid;
} _data_soc;
extern _data_soc Data_Soc;
typedef struct
{
uint16_t AvtVspeed;
uint16_t DisVspeed;
uint16_t Valid;
} _Data_Vspeed;
extern _Data_Vspeed Data_Vspeed;
typedef struct
{
uint16_t Speed;
uint16_t Delta;
uint8_t Dir;
} DataVSPeedDampingStruct;
extern DataVSPeedDampingStruct DataVSPeedDamping;
#define DATA_VSPEED_DAMPING_FACTOR 3 //阻尼系数
#define DATA_VSPEED_INC_STEP 2 //速度增加时慢加速速度变化步长
#define DATA_VSPEED_DEC_STEP 6 //方向改变时急减速速度变化步长
#define DATA_VSPEED_APPR_SPEED_MIN 2 //最小逼近速度
#define maxgear 2
typedef enum
{
Gear_P = 0,
Gear_A,
Gear_R,
Gear_Max,
} _GearSts;
typedef struct
{
_GearSts Gear;
uint8_t Reverse_Gear;
uint8_t Reverse_Gear_Back;
uint8_t Cart_Gear;
uint8_t Cart_Gear_Back;
} _Data_Gear;
extern _Data_Gear Data_Gear;
typedef enum
{
Popup_P = 0,
Popup_D,
Popup_R,
Popup_Max,
} _PopupSts;
typedef struct
{
_PopupSts GEAR_Popup;
uint8_t valid;
} _Gear_Mode;
extern _Gear_Mode Data_Popup;
typedef enum
{
ECO_MODE = 0,
CITY_MODE,
SPORT_MODE,
MODE_MAX,
} _Driverenum;
typedef struct
{
_Driverenum DriverMode;
uint8_t Valid;
} _DriverMode;
extern _DriverMode Data_DriverMode;
typedef enum
{
Charge = 1,
Charging,
ChargeFinish,
ChargeMax,
} _ChargeType;
typedef struct
{
uint8_t Led;
uint8_t Type;
uint16_t Timer;
} _Data_Charge;
extern _Data_Charge Data_Charge;
typedef struct
{
uint8_t Year;
uint8_t Month;
uint8_t Day;
uint8_t Hour;
uint8_t Minute;
uint8_t Second;
uint8_t Valid;
} _st_Data_Time;
extern _st_Data_Time Data_Time;
typedef enum
{
Dampe_V_S = 0,
Dampe_Obj_Max,
} _Damping_Container_Obj_Enum;
typedef struct
{
uint16_t Val_Out;
uint16_t Delta;
uint8_t Dir;
} _Damping_Container_Struct;
static _Damping_Container_Struct Damping_Container[Dampe_Obj_Max];
typedef struct
{
uint16_t Factor1;
uint16_t Factor2;
uint8_t Delta_DEC_STEP;
uint8_t Delta_INC_STEP;
uint8_t Delta_Minimum;
uint8_t AVOL;
uint16_t Amplitude_peak;
uint8_t Amplitude_valley;
} _Damping_Container_Param_Struct;
static _Damping_Container_Param_Struct Dparam[Dampe_Obj_Max];
typedef enum
{
Level_Blue = 0,
Level_Orange,
Level_Red,
Level_Yellow,
Level_White,
Level_Max,
} _Weather_Level;
typedef enum
{
Type_Blizzard = 0, // 0X02暴雪、
Type_Rainstorm, // 0X01暴雨、
Type_Hail, // 0X09冰雹、
Type_Frozen, // 0X14冰冻、
Type_SustainedLowTemp, // 0X10持续低温、
Type_Gale, // 0X03大风、
Type_Fog, // 0XOB大雾、
Type_RoadIce, // OXOD道路结冰、
Type_WireIcing, // OXOF电线积冰、
Type_ThousandDrough, // 0X06千旱、
Type_DryHotAir, // 0X13干热风、
Type_HighTemp, // 0X05高温、
Type_Tide, // OXOE潮、
Type_ThunderStorm, // 0X11雷雨大风、
Type_Lightning, // 0X07雷电,
Type_Thunder, // 0X08雷电、
Type_Haze, // OXOC霾、
Type_ForestFireLine, // 0X12森林火险,
Type_DustStorm, // 0X04沙尘暴、
Type_Frost, // 0XOA 霜冻、
Type_Wind, // 0X00合风、
Type_Max, // 0X15 Void(默认);
} _Weather_Type;
typedef struct
{
_Weather_Level Level;
_Weather_Type Type;
_Weather_Level BackLevel;
_Weather_Type BackType;
uint8_t CurrentType;
uint8_t CurrentTemp;
uint8_t Symbol;
uint8_t Valid;
uint8_t Timer;
} _st_Data_Weather;
extern _st_Data_Weather Data_Weather;
typedef struct
{
uint8_t Unlock_Instruction;
uint8_t Power;
uint8_t Cursor;
uint8_t Password_TX;
uint8_t Check_Result;
uint8_t Chance;
uint8_t ChanceValid;
uint8_t PasswordType;
uint8_t Password1;
uint8_t Password2;
uint8_t Password3;
uint8_t Password4;
uint32_t Password;
uint8_t IGONFlag;
} _st_Data_Password;
extern _st_Data_Password Data_Password;
typedef struct
{
uint16_t u16Power;
uint8_t u8PowerPercent;
uint8_t u8Valid;
uint8_t u8Symbol;
uint8_t u8Status;
uint8_t u8PowerOutSeg;
uint8_t u8PowerRecycleSeg;
} _Data_Power_st_t;
extern _Data_Power_st_t stData_Power;
#define DATA_POWER_OUTPUT 0x00U
#define DATA_POWER_RECYCLE 0x01U
typedef struct
{
uint8_t u8DataEnduranceSetFlag;
uint8_t u8DataEnduranceValid;
uint16_t u16DataEnduranceValue;
} Data_Endurance_st_t;
extern Data_Endurance_st_t stDataEndurance;
extern void DataProcess_Service(void);
extern void DataProcess_Sleep_Init(void);
extern void DataProcess_Init(void);
extern uint32_t Damping_Pro(uint16_t Val_In, _Damping_Container_Obj_Enum Damp_Obj);
extern uint8_t Get_Password_IGONFlag_Sigle(void);
extern uint8_t Get_Password_Value_Sigle(void);
extern uint8_t Get_Password_TX_Sigle(void);
extern uint8_t Get_Password_IGON_Sigle(void);
extern uint8_t Get_Password_Type_Sigle(void);
extern uint8_t Get_Password_Cursor_Sigle(void);
extern uint8_t Get_Password_Chance_Sigle(void);
extern void Menu_u8Data_Updata_Process(uint8_t updateDir , uint8_t datMax, uint8_t datMin, uint8_t datStep, uint8_t *dat);
extern uint8_t Get_Current_Type(void);
extern uint8_t Get_Current_Temp_Symbol(void);
extern uint8_t Get_Current_Temp(void);
extern _Weather_Type Get_Weather_Type(void);
extern _Weather_Level Get_Weather_Level(void);
extern uint8_t Get_Weather_Valid(void);
extern uint16_t Get_Mileage_Trip_Value(void);
extern uint32_t Get_Mileage_ODO_Value(void);
extern uint8_t Get_Mileage_Valid(void);
extern bool Get_Timer_Valid(int year, int month, int day, int hour, int min, int sec);
extern uint8_t Get_Charge_Led(void);
extern _ChargeType Get_Charge_Type(void);
extern uint16_t Get_OutPower_Percent(void);
extern uint16_t Get_OutPowre_Value(void);
extern uint8_t Get_Driver_Valid(void);
extern _Driverenum Get_Driver_Mode(void);
extern _GearSts Get_Gear_Mode(void);
extern void Delete_Gear(uint8_t Gear);
extern void Request_Gear(uint8_t Gear);
extern uint8_t Get_Vspeed_Valid(void);
extern uint16_t Get_Dis_Vspeed(void);
extern uint16_t Get_Act_Vspeed(void);
extern uint8_t Get_Soc_Vaild(void);
extern uint8_t Get_Soc_Seg(void);
extern uint8_t Get_Soc_Value(void);
extern uint16_t Get_Power_RecycleSeg(void);
extern uint16_t Get_Power_OutSeg(void);
extern uint16_t Get_Power_Valid(void);
extern uint16_t Get_Power_Symbol(void);
extern uint16_t Get_Power_Value(void);
extern uint16_t Get_Power_Percent(void);
extern uint8_t Get_Data_Time_Valid(void);
extern uint8_t Get_Data_Time_Hour(void);
extern uint8_t Get_Data_Time_Minute(void);
extern void Data_UE_Service(void);
#endif
#include "app_flash_hz.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
typedef struct
{
/* data */
uint8_t F_04Hz;
uint8_t F_05Hz;
uint8_t F_1Hz;
uint8_t F_2Hz;
uint8_t F_4Hz;
uint8_t F_5Hz;
uint8_t F_2_5Hz;
uint8_t F_1_25Hz;
uint16_t F_04Hz_T;
uint16_t F_05Hz_T;
uint16_t F_1Hz_T;
uint16_t F_2Hz_T;
uint16_t F_4Hz_T;
uint16_t F_5Hz_T;
uint16_t F_2_5Hz_T;
uint16_t F_1_25Hz_T;
}Sys_Flash_Hz_Ctrl_Struct;
Sys_Flash_Hz_Ctrl_Struct SysFlashHz;
uint8_t Get_Flash_04Hz(void )
{
return SysFlashHz.F_04Hz;
}
uint8_t Get_Flash_05Hz(void )
{
return SysFlashHz.F_05Hz;
}
uint8_t Get_Flash_1Hz(void )
{
return SysFlashHz.F_1Hz;
}
uint8_t Get_Flash_2Hz(void )
{
return SysFlashHz.F_2Hz;
}
uint8_t Get_Flash_4Hz(void )
{
return SysFlashHz.F_4Hz;
}
uint8_t Get_Flash_5Hz(void )
{
return SysFlashHz.F_5Hz;
}
uint8_t Get_Flash_2_5Hz(void )
{
return SysFlashHz.F_2_5Hz;
}
uint8_t Get_Flash_1_25Hz(void )
{
return SysFlashHz.F_1_25Hz;
}
void Flash_Hz_Generate(void)
{
// SysFlashHz.F_4Hz = !SysFlashHz.F_4Hz;
if(SysFlashHz.F_1_25Hz_T < 400)
{
SysFlashHz.F_1_25Hz_T ++;
}
else
{
SysFlashHz.F_1_25Hz_T = 0;
SysFlashHz.F_1_25Hz = !SysFlashHz.F_1_25Hz;
}
if(SysFlashHz.F_2_5Hz_T < 200)
{
SysFlashHz.F_2_5Hz_T ++;
}
else
{
SysFlashHz.F_2_5Hz_T = 0;
SysFlashHz.F_2_5Hz = !SysFlashHz.F_2_5Hz;
}
if(SysFlashHz.F_4Hz_T < 125)
{
SysFlashHz.F_4Hz_T ++;
}
else
{
SysFlashHz.F_4Hz_T = 0;
SysFlashHz.F_4Hz = !SysFlashHz.F_4Hz;
}
if(SysFlashHz.F_5Hz_T < 100)
{
SysFlashHz.F_5Hz_T ++;
}
else
{
SysFlashHz.F_5Hz_T = 0;
SysFlashHz.F_5Hz = !SysFlashHz.F_4Hz;
}
if(SysFlashHz.F_2Hz_T < 250)
{
SysFlashHz.F_2Hz_T ++;
}
else
{
SysFlashHz.F_2Hz_T = 0;
SysFlashHz.F_2Hz = !SysFlashHz.F_2Hz;
}
if(SysFlashHz.F_1Hz_T < 500)
{
SysFlashHz.F_1Hz_T ++;
}
else
{
SysFlashHz.F_1Hz_T = 0;
SysFlashHz.F_1Hz = !SysFlashHz.F_1Hz;
}
if(SysFlashHz.F_05Hz_T < 1000)
{
SysFlashHz.F_05Hz_T ++;
}
else
{
SysFlashHz.F_05Hz_T = 0;
SysFlashHz.F_05Hz = !SysFlashHz.F_05Hz;
}
if(SysFlashHz.F_04Hz_T < 1250)
{
SysFlashHz.F_04Hz_T ++;
}
else
{
SysFlashHz.F_04Hz_T = 0;
SysFlashHz.F_04Hz = !SysFlashHz.F_04Hz;
}
}
void Flash_Hz_Init(void )
{
SysFlashHz.F_05Hz = 0;
SysFlashHz.F_1Hz = 0;
SysFlashHz.F_2Hz = 0;
SysFlashHz.F_4Hz = 0;
SysFlashHz.F_5Hz = 0;
SysFlashHz.F_2_5Hz = 0;
SysFlashHz.F_1_25Hz = 0;
SysFlashHz.F_05Hz_T = 0;
SysFlashHz.F_1Hz_T = 0;
SysFlashHz.F_2Hz_T = 0;
SysFlashHz.F_4Hz_T = 0;
SysFlashHz.F_5Hz_T = 0;
SysFlashHz.F_1_25Hz_T = 0;
SysFlashHz.F_2_5Hz_T = 0;
}
\ No newline at end of file
#ifndef __APP_FLASH_HZ_H_
#define __APP_FLASH_HZ_H_
#include <stdint.h>
void Flash_Hz_Init(void );
void Flash_Hz_Generate(void);
uint8_t Get_Flash_04Hz(void );
uint8_t Get_Flash_05Hz(void );
uint8_t Get_Flash_1Hz(void );
uint8_t Get_Flash_2Hz(void );
uint8_t Get_Flash_4Hz(void );
uint8_t Get_Flash_5Hz(void );
uint8_t Get_Flash_2_5Hz(void );
uint8_t Get_Flash_1_25Hz(void );
#endif
\ No newline at end of file
/* UART Echo Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/uart.h"
#include "driver/gpio.h"
#include "sdkconfig.h"
#include "esp_log.h"
#include "bsp_R485.h"
#include "string.h"
#include "bsp_Gpio.h"
#include "R485_User.h"
/**
* This is an example which echos any data it receives on configured UART back to the sender,
* with hardware flow control turned off. It does not use UART driver event queue.
*
* - Port: configured UART
* - Receive (Rx) buffer: on
* - Transmit (Tx) buffer: off
* - Flow control: off
* - Event queue: off
* - Pin assignment: see defines below (See Kconfig)
*/
/********************************LIN*******************************************************************/
#define R485_BUF_SIZE (1024)
#define R485_UART_PORT (1)
static QueueHandle_t R485_queue;
/***********************************************************/
#define RS485_RX_BUF_LEN 1024
#define RS485_RX_DATA_LEN 64
#define RS485_RECEIVE_ID_0X40 0X40
#define RS485_RECEIVE_ID_0X41 0X41
#define RS485_RECEIVE_ID_0X42 0X42
typedef enum
{
RS485_Rx_ID40_Idx = 0,
RS485_Rx_ID41_Idx,
RS485_Rx_ID42_Idx,
RS485_Rx_ID_Idx_Max,
}RS485_Receive_ID_Idx_en_t;
typedef enum
{
RS485_Tx_ID48_Idx = 0,
RS485_Tx_ID49_Idx,
RS485_Tx_ID4A_Idx,
RS485_Tx_ID_Idx_Max,
}RS485_Transmit_ID_Idx_en_t;
typedef struct
{
uint8_t RS485Data[RS485_RX_BUF_LEN - 1];
uint8_t length;
} RS485DataPacket;
typedef struct
{
uint8_t u8RecVal[RS485_RX_DATA_LEN];
uint8_t u8Received;
} RS485ValidDataPacket_st_t;
typedef struct
{
uint8_t u8TxTime;
uint8_t u8TxEnable;
} RS485_Tx_Data_Ctrl_st_t;
static RS485DataPacket stRS485DataRx;
static RS485ValidDataPacket_st_t stRS485RxVldData[RS485_Rx_ID_Idx_Max];
static uint32_t u32RS485RxDataBegin = 0;
static uint32_t u32RS485RxDataRe = 0;
static uint32_t u32RS485RxDataValidLenTem = 0;
static uint32_t u32RS485DataBufLen = 0;
static uint8_t RS485DataBuf[RS485_RX_BUF_LEN];
static uint32_t u32RS485RxDataValidLen = 0;
static uint8_t RS485ValidData[RS485_RX_DATA_LEN];
static uint8_t u8RS485RecVldID[RS485_Rx_ID_Idx_Max];
RS485_Tx_Data_Ctrl_st_t stRS485TxData[RS485_Tx_ID_Idx_Max];
uint8_t Yadi_CAL_Data_Sum(uint8_t *pu8LinData, uint8_t u8LinLen)
{
uint8_t u8LinSum = 0U;
uint8_t i = 0;
for (i = 0; i < u8LinLen; i++)
{
u8LinSum = (uint8_t)(u8LinSum + pu8LinData[i]);
}
return u8LinSum;
}
static int RS485_Uart_Send_Data(uint8_t * data , unsigned int len)
{
int txBytes = uart_write_bytes(R485_UART_PORT, data, len);
uart_wait_tx_idle_polling(R485_UART_PORT);
return txBytes;
}
static void RS485_Receive_Data_Analysis(void )
{
if ((u32RS485DataBufLen + stRS485DataRx.length) >= RS485_RX_BUF_LEN)
{
u32RS485DataBufLen = 0;
RS485DataBuf[0] = 0;
}
else
{
memcpy(&RS485DataBuf[u32RS485DataBufLen], stRS485DataRx.RS485Data, stRS485DataRx.length);
u32RS485DataBufLen += stRS485DataRx.length;
}
if (u32RS485DataBufLen > 4)
{
u32RS485RxDataBegin = 0;
while (u32RS485RxDataBegin < (u32RS485DataBufLen - 4))
{
if ((RS485DataBuf[0 + u32RS485RxDataBegin] != 'Y') ||
(RS485DataBuf[1 + u32RS485RxDataBegin] != 'D') ||
((RS485DataBuf[2 + u32RS485RxDataBegin] != RS485_RECEIVE_ID_0X40) &&
(RS485DataBuf[2 + u32RS485RxDataBegin] != RS485_RECEIVE_ID_0X41) &&
(RS485DataBuf[2 + u32RS485RxDataBegin] != RS485_RECEIVE_ID_0X42)))
{
u32RS485RxDataBegin++;
continue;
}
u32RS485RxDataValidLenTem = RS485DataBuf[3 + u32RS485RxDataBegin];
if (u32RS485RxDataValidLenTem != RS485_RX_DATA_LEN)
{
u32RS485RxDataBegin++;
continue;
}
u32RS485RxDataRe = u32RS485DataBufLen - u32RS485RxDataBegin;
if (u32RS485RxDataRe >= (u32RS485RxDataValidLenTem + 5))
{
// DATA CHECK
uint8_t u8YadiDataSum = 0;
u8YadiDataSum = Yadi_CAL_Data_Sum(&RS485DataBuf[2 + u32RS485RxDataBegin], (u32RS485RxDataValidLenTem + 2));
// printf("u8YadiDataSum %x \n", u8YadiDataSum);
ESP_LOGE("R485","CheckSum %d",u8YadiDataSum);
if (u8YadiDataSum != RS485DataBuf[u32RS485RxDataValidLenTem + 4 + u32RS485RxDataBegin])
{
u32RS485RxDataBegin++;
continue;
}
}
else
{
break;
}
u32RS485RxDataRe = u32RS485DataBufLen - u32RS485RxDataBegin;
if (u32RS485RxDataRe >= (u32RS485RxDataValidLenTem + 7))
{
if ((RS485DataBuf[u32RS485RxDataValidLenTem + 5 + u32RS485RxDataBegin] != 0x4B) ||
(RS485DataBuf[u32RS485RxDataValidLenTem + 6 + u32RS485RxDataBegin] != 0x4A))
{
u32RS485RxDataBegin++;
continue;
}
else
{
switch(RS485DataBuf[2 + u32RS485RxDataBegin])
{
case RS485_RECEIVE_ID_0X40:
{
if(stRS485RxVldData[RS485_Rx_ID40_Idx].u8Received == 0)
{
memcpy(stRS485RxVldData[RS485_Rx_ID40_Idx].u8RecVal, &RS485DataBuf[4 + u32RS485RxDataBegin], u32RS485RxDataValidLenTem);
stRS485RxVldData[RS485_Rx_ID40_Idx].u8Received = 1;
stRS485TxData[RS485_Tx_ID48_Idx].u8TxTime = 10; //ms
stRS485TxData[RS485_Tx_ID48_Idx].u8TxEnable = 1;
}
break;
}
case RS485_RECEIVE_ID_0X41:
{
if(stRS485RxVldData[RS485_Rx_ID41_Idx].u8Received == 0)
{
memcpy(stRS485RxVldData[RS485_Rx_ID41_Idx].u8RecVal, &RS485DataBuf[4 + u32RS485RxDataBegin], u32RS485RxDataValidLenTem);
stRS485RxVldData[RS485_Rx_ID41_Idx].u8Received = 1;
stRS485TxData[RS485_Tx_ID49_Idx].u8TxTime = 10; //ms
stRS485TxData[RS485_Tx_ID49_Idx].u8TxEnable = 1;
}
break;
}
case RS485_RECEIVE_ID_0X42:
{
if(stRS485RxVldData[RS485_Rx_ID42_Idx].u8Received == 0)
{
memcpy(stRS485RxVldData[RS485_Rx_ID42_Idx].u8RecVal, &RS485DataBuf[4 + u32RS485RxDataBegin], u32RS485RxDataValidLenTem);
stRS485RxVldData[RS485_Rx_ID42_Idx].u8Received = 1;
stRS485TxData[RS485_Tx_ID4A_Idx].u8TxTime = 10; //ms
stRS485TxData[RS485_Tx_ID4A_Idx].u8TxEnable = 1;
}
break;
}
default:
{
break;
}
}
u32RS485RxDataValidLen = u32RS485RxDataValidLenTem;
u32RS485RxDataBegin += (u32RS485RxDataValidLenTem + 7);
// ESP_LOGE(GATTS_TARS485_TAG, "RS485ValidData, value len = %d, value :", u32RS485RxDataValidLenTem);
// for (int i = 0; i < u32RS485RxDataValidLenTem; i++)
// {
// ESP_LOGE(GATTS_TARS485_TAG,"RS485ValidData[%x]",RS485ValidData[i]);
// }
// esp_log_buffer_hex(GATTS_TARS485_TAG, RS485ValidData, u32RS485RxDataValidLenTem);
continue;
}
}
else
{
break;
}
}
if (u32RS485RxDataBegin > 0)
{
// for (j = 0; j < (u32RS485DataBufLen - u32RS485RxDataBegin); j++)
// {
// RS485DataBuf[j] = RS485DataBuf[j + u32RS485RxDataBegin];
// }
memcpy(RS485DataBuf, &RS485DataBuf[u32RS485RxDataBegin], (u32RS485DataBufLen - u32RS485RxDataBegin));
u32RS485DataBufLen -= u32RS485RxDataBegin;
}
}
}
void RS485_User_Get_Rx_Data(void )
{
if(stRS485RxVldData[RS485_Rx_ID40_Idx].u8Received == 1)
{
memcpy(R485_ID40h.Msg, stRS485RxVldData[RS485_Rx_ID40_Idx].u8RecVal, RS485_RX_DATA_LEN);
stRS485RxVldData[RS485_Rx_ID40_Idx].u8Received = 0;
}
if(stRS485RxVldData[RS485_Rx_ID41_Idx].u8Received == 1)
{
memcpy(R485_ID41h.Msg, stRS485RxVldData[RS485_Rx_ID41_Idx].u8RecVal, RS485_RX_DATA_LEN);
stRS485RxVldData[RS485_Rx_ID41_Idx].u8Received = 0;
}
if(stRS485RxVldData[RS485_Rx_ID42_Idx].u8Received == 1)
{
memcpy(R485_ID42h.Msg, stRS485RxVldData[RS485_Rx_ID42_Idx].u8RecVal, RS485_RX_DATA_LEN);
stRS485RxVldData[RS485_Rx_ID42_Idx].u8Received = 0;
}
}
void RS485_User_Tx_Data(void )
{
for(uint8_t i=0; i<RS485_Tx_ID_Idx_Max; i++)
{
if(stRS485TxData[i].u8TxEnable)
{
if(stRS485TxData[i].u8TxTime > 0)
{
stRS485TxData[i].u8TxTime -- ;
}
else
{
stRS485TxData[i].u8TxEnable = 0;
}
}
}
}
void R485_RX_task(void *pvParameters)
{
uint8_t *RxDataBuf = (uint8_t *)malloc(RS485_RX_BUF_LEN);
while (1)
{
// printf("start \n");
int rxBytes = uart_read_bytes(R485_UART_PORT, &RxDataBuf[0], 1, portMAX_DELAY);
// printf("bytes %d\n", rxBytes);
if (rxBytes > 0)
{
size_t rxBytes1 = 0;
int rxBytes2 = 0;
uint32_t i = 0;
uint32_t j = 0;
uart_get_buffered_data_len(R485_UART_PORT, &rxBytes1);
// printf("bytes all %d\n", rxBytes);
rxBytes2 = 0;
if (rxBytes1 > 0)
{
rxBytes2 = uart_read_bytes(R485_UART_PORT, &RxDataBuf[rxBytes], rxBytes1, 0);
}
esp_log_buffer_hex("485 ", RxDataBuf, rxBytes2);
rxBytes2 += rxBytes;
stRS485DataRx.length = rxBytes2;
memcpy(stRS485DataRx.RS485Data, RxDataBuf, rxBytes2);
RS485_Receive_Data_Analysis();
}
}
free(RxDataBuf);
}
typedef struct
{
uint16_t ID;
uint8_t Data[64];
} _R485_Send;
void R485_Send_Service(_R485_Send *Msg)
{
}
/***********************************************************/
#define R485_TX_OUT_MCU R485_TX
#define R485_RX_IN_MCU R485_RX
void bsp_R485_Init(void)
{
// esp_log_level_set(TAG, ESP_LOG_INFO);
/* Configure parameters of an UART driver,
* communication pins and install the driver */
uart_config_t uart_config = {
.baud_rate = 115200,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
.source_clk = UART_SCLK_DEFAULT,
};
/* Install UART driver */
uart_driver_install(R485_UART_PORT, R485_BUF_SIZE * 2, R485_BUF_SIZE * 2, 20, R485_queue, 0);
/* Configure UART parameters */
uart_param_config(R485_UART_PORT, &uart_config);
// Set UART pins
ESP_ERROR_CHECK(uart_set_pin(R485_UART_PORT, R485_TX_OUT_MCU, R485_RX_IN_MCU, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));
/*!< mode: regular UART mode*/
ESP_ERROR_CHECK(uart_set_mode(R485_UART_PORT, UART_MODE_RS485_HALF_DUPLEX));
// Set read timeout of UART TOUT feature
// ESP_ERROR_CHECK(uart_set_rx_timeout(uart_num, ECHO_READ_TOUT));
// uart_set_line_inverse(R485_UART_PORT, UART_SIGNAL_RXD_INV | UART_SIGNAL_TXD_INV);
// Create a task to handler UART event from ISR
// xTaskCreate(uart_event_task, "uart_event_task", 2048, NULL, 12, NULL);
}
void Uart_Uninstall(void)
{
uart_driver_delete(R485_UART_PORT);
}
uint8_t uartarray[4] = {0X11, 0x22, 0x33, 0x44};
void UART_TEST(void)
{
// printf("test \n");
// gpio_set_level(R485_EN, 1);
// int size = uart_write_bytes(R485_UART_PORT, u8R485TXDataId48, R485_TX_MAX);
// uart_wait_tx_done(R485_UART_PORT, 100);
// // gpio_set_level(R485_EN, 0);
// printf("test %d \n",size);
}
#ifndef BSP_R485_H__
#define BSP_R485_H__
#include <stdint.h>
void bsp_Uart_Init(void);
void uart_event_task(void *pvParameters);
extern void R485_RX_task(void *pvParameters);
extern void bsp_R485_Init(void);
extern void Uart_Uninstall(void);
extern uint8_t Yadi_CAL_Data_Sum(uint8_t *pu8LinData, uint8_t u8LinLen);
void Config_ESP32_UartBaud(uint32_t BAUD);
extern void UART_TEST(void);
// extern int RS485_Uart_Send_Data(uint8_t * data , unsigned int len);
extern void RS485_User_Get_Rx_Data(void );
extern void RS485_User_Tx_Data(void );
#endif
#include "bsp_iic_aw8839.h"
#include <stdlib.h>
#include "driver/gpio.h"
#include <stdio.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "bsp_Gpio.h"
void IIC_Delay_AW8839(void);
void IIC_Delay_AW8839(void);
uint8_t IICReceivedACK_AW8839;
#define IIC_ACK_AW8839 0
#define IIC_NAK_AW8839 1
#define IIC_INVALID_ACK_AW8839 2
#define IIC_FREQ_CALIBRATION_AW8839 50
#define IIC_AW8839_SCL_DIR_IN gpio_set_direction(IIC_SCL, GPIO_MODE_INPUT)
#define IIC_AW8839_SDA_DIR_IN gpio_set_direction(IIC_SDA, GPIO_MODE_INPUT)
#define IIC_AW8839_SCL_LOW gpio_set_direction(IIC_SCL, GPIO_MODE_OUTPUT_OD); gpio_set_level(IIC_SCL, 0)
#define IIC_AW8839_SDA_LOW gpio_set_direction(IIC_SDA, GPIO_MODE_OUTPUT_OD); gpio_set_level(IIC_SDA, 0)
#define IIC_IN_SDA gpio_get_level(IIC_SDA)
typedef struct msm_camera_i2c_reg_conf
{
uint8_t addr; /*!< */
uint16_t RegVal; /*!< */
} msm_camera_i2c_reg_conf_t;
static const msm_camera_i2c_reg_conf_t AW88298_IIC_DAC_Int[] = {
{0x03,0xEFBF,},
{0x04,0x4440,},
{0x05,0x0068,},
{0x06,0x1C03,},//C:L$R 4:L E:64FS 0:32FS 4:22.05k 7:44.1k 8:48k
{0x07,0x0361,},
{0x08,0x210C,},
{0x09,0x6672,},//0x3C43:8om 1w 0x3B42:4ohm 2w
{0x0A,0x0030,},
{0x0B,0x01E0,},
{0x0C,0x0064,},
{0x0D,0xA0DB,},
{0x0E,0x2716,},
{0x0F,0x1F00,},
{0x20,0x0001,},
{0x38,0x0060,},
{0x50,0x0282,},
{0x52,0x20C6,},
{0x53,0xA040,},
{0x54,0xFF19,},
{0x55,0x00D8,},
{0x56,0x22D1,},
{0x59,0x000C,},
{0x5A,0x2100,},
{0x60,0x0C0B,},
{0x61,0x1379,},
{0x62,0x04F1,},
{0x63,0x260F,},
{0x64,0x15C3,},
{0x65,0x3D82,},
{0x66,0x3F07,},
{0x67,0x0002,},
{0x68,0x3002,},
{0x69,0x04A0,},
{0x6A,0xA068,},
{0x6B,0x8884,},
{0x70,0xFF00,},
{0x71,0x00C0,},
};
#define AW88298_IIC_SCL_HIGH gpio_set_direction(IIC_SCL, GPIO_MODE_INPUT)
#define AW88298_IIC_SCL_LOW gpio_set_direction(IIC_SCL, GPIO_MODE_OUTPUT_OD); gpio_set_level(IIC_SCL, 0)
#define AW88298_IIC_SDA_HIGH gpio_set_direction(IIC_SDA, GPIO_MODE_INPUT)
#define AW88298_IIC_SDA_LOW gpio_set_direction(IIC_SDA, GPIO_MODE_OUTPUT_OD); gpio_set_level(IIC_SDA, 0)
#define AW88298_IIC_DeviceAddr (0x34 << 1)
void AW88298_PowerPinGpioConfig(void)
{
// vTaskDelay(pdMS_TO_TICKS(2));
// gpio_set_direction(AW88298_EN_NUM, GPIO_MODE_OUTPUT);
// gpio_set_level(AW88298_EN_NUM, 1);
// vTaskDelay(pdMS_TO_TICKS(1));
// gpio_set_direction(AW88298_VCC18EN_NUM, GPIO_MODE_OUTPUT);
// gpio_set_level(AW88298_VCC18EN_NUM, 1);
// vTaskDelay(pdMS_TO_TICKS(1));
// gpio_set_direction(AW88298_RSTN_NUM, GPIO_MODE_OUTPUT);
// gpio_set_level(AW88298_RSTN_NUM, 1);
// vTaskDelay(pdMS_TO_TICKS(1));
}
void AW88298_IIC_DelayUs(uint32_t time);
void AW88298_IIC_DelayUs(uint32_t time)
{
uint32_t i;
for (i = 0; i < (time); i++) { //this counts only adapt s6j324
;
}
}
void AW88298_IIC_SDA_IN(void);
void AW88298_IIC_SDA_IN(void)
{
gpio_set_direction(IIC_SDA, GPIO_MODE_INPUT);
}
void AW88298_IIC_SDA_OUT(void);
void AW88298_IIC_SDA_OUT(void)
{
gpio_set_direction(IIC_SDA, GPIO_MODE_OUTPUT_OD);
AW88298_IIC_SDA_LOW;
}
void AW88298_IIC_SCL_OUT(void);
void AW88298_IIC_SCL_OUT(void)
{
gpio_set_direction(IIC_SCL, GPIO_MODE_OUTPUT_OD);
}
uint8_t AW88298_IIC_SDA_GetValue(void);
uint8_t AW88298_IIC_SDA_GetValue(void)
{
uint8_t i;
i = gpio_get_level(IIC_SDA);
return i;
}
void AW88298_IIC_Start(void);
void AW88298_IIC_Start(void)
{
AW88298_IIC_SDA_OUT();
AW88298_IIC_DelayUs(6);
AW88298_IIC_SDA_HIGH;
AW88298_IIC_DelayUs(6);
AW88298_IIC_SCL_HIGH;
AW88298_IIC_DelayUs(6);
AW88298_IIC_SDA_LOW;
AW88298_IIC_DelayUs(6);
AW88298_IIC_SCL_LOW;
AW88298_IIC_DelayUs(300);
}
void AW88298_IIC_Stop(void);
void AW88298_IIC_Stop(void)
{
AW88298_IIC_SDA_OUT();
AW88298_IIC_DelayUs(6);
AW88298_IIC_SCL_LOW;
AW88298_IIC_DelayUs(6);
AW88298_IIC_SDA_LOW;
AW88298_IIC_DelayUs(6);
AW88298_IIC_SCL_HIGH;
AW88298_IIC_DelayUs(6);
AW88298_IIC_SDA_HIGH;
AW88298_IIC_DelayUs(300);
}
void AW88298_IIC_ACK(void);
void AW88298_IIC_ACK(void)
{
AW88298_IIC_SDA_OUT();
AW88298_IIC_DelayUs(6);
AW88298_IIC_SDA_LOW;
AW88298_IIC_DelayUs(6);
AW88298_IIC_SCL_HIGH;
AW88298_IIC_DelayUs(6);
AW88298_IIC_SCL_LOW;
AW88298_IIC_DelayUs(6);
AW88298_IIC_SDA_HIGH;
AW88298_IIC_DelayUs(6);
}
void AW88298_IIC_NACK(void);
void AW88298_IIC_NACK(void)
{
AW88298_IIC_SDA_OUT();
AW88298_IIC_DelayUs(6);
AW88298_IIC_SDA_HIGH;
AW88298_IIC_DelayUs(6);
AW88298_IIC_SCL_HIGH;
AW88298_IIC_DelayUs(6);
AW88298_IIC_SCL_LOW;
AW88298_IIC_DelayUs(6);
}
uint8_t AW88298_IIC_WaitAck(void);
uint8_t AW88298_IIC_WaitAck(void)
{
uint8_t ack = 1;
uint16_t i = 8500;
AW88298_IIC_SDA_IN();
AW88298_IIC_DelayUs(6);
AW88298_IIC_SCL_HIGH;
AW88298_IIC_DelayUs(6);
while((ack) && (--i != 0)) {
ack = AW88298_IIC_SDA_GetValue();
//ClearWatchdog();
}
AW88298_IIC_DelayUs(6);
AW88298_IIC_SCL_LOW;
AW88298_IIC_DelayUs(6);
return(ack);
}
uint8_t AW88298_IIC_SendByte(uint8_t Data);
uint8_t AW88298_IIC_SendByte(uint8_t Data)
{
uint8_t temp;
uint8_t d = Data;
AW88298_IIC_SDA_OUT();
AW88298_IIC_DelayUs(6);
for (temp = 8; temp != 0; temp--) {
if (d & 0x80) {
AW88298_IIC_SDA_HIGH;
} else {
AW88298_IIC_SDA_LOW;
}
AW88298_IIC_DelayUs(6);
AW88298_IIC_SCL_HIGH;
AW88298_IIC_DelayUs(6);
AW88298_IIC_SCL_LOW;
AW88298_IIC_DelayUs(6);
d = d <<1;
AW88298_IIC_DelayUs(6);
}
AW88298_IIC_DelayUs(6);
return 1;
}
uint8_t AW88298_IIC_ReadByte(void);
uint8_t AW88298_IIC_ReadByte(void)
{
uint8_t temp;
uint8_t rbyte = 0;
uint8_t SDA = 0;
AW88298_IIC_SDA_IN();
AW88298_IIC_DelayUs(6);
for (temp = 8; temp != 0; temp--) {
AW88298_IIC_SCL_HIGH;
AW88298_IIC_DelayUs(6);
rbyte = rbyte << 1;
AW88298_IIC_DelayUs(6);
SDA = AW88298_IIC_SDA_GetValue();
rbyte = rbyte | ((uint8_t)(SDA));
AW88298_IIC_DelayUs(6);
AW88298_IIC_SCL_LOW;
AW88298_IIC_DelayUs(6);
}
return(rbyte);
}
uint8_t AW88298_IIC_WritePage(uint8_t PhyAdd, uint8_t MemAdd, uint8_t *Data, uint8_t len);
uint8_t AW88298_IIC_WritePage(uint8_t PhyAdd, uint8_t MemAdd, uint8_t *Data, uint8_t len)
{
uint8_t b = 3;
uint8_t i;
uint8_t *OldData;
OldData = Data;
do {
Data = OldData;
AW88298_IIC_Start();
AW88298_IIC_SendByte(PhyAdd);
if (AW88298_IIC_WaitAck()) {
AW88298_IIC_Stop();
b--;
if (b) {
continue;
} else {
break;
}
}
AW88298_IIC_SendByte(MemAdd);
if (AW88298_IIC_WaitAck()) {
AW88298_IIC_Stop();
b--;
if (b) {
continue;
} else {
break;
}
}
for (i = 0; i < len; i++) {
AW88298_IIC_SendByte(*Data);
if (AW88298_IIC_WaitAck()) {
AW88298_IIC_Stop();
break;
}
Data++;
}
AW88298_IIC_Stop();
return 1;
} while (1);
return 0;
}
uint8_t AW88298_IIC_ReadPage(uint8_t PhyAdd, uint8_t MemAdd, uint8_t *Data, uint8_t len);
uint8_t AW88298_IIC_ReadPage(uint8_t PhyAdd, uint8_t MemAdd, uint8_t *Data, uint8_t len)
{
uint8_t b = 3;
uint8_t i;
do {
AW88298_IIC_Start();
AW88298_IIC_SendByte(PhyAdd);
if (AW88298_IIC_WaitAck()) {
AW88298_IIC_Stop();
b--;
if (b) {
continue;
} else {
break;
}
}
AW88298_IIC_SendByte(MemAdd);
if (AW88298_IIC_WaitAck()) {
AW88298_IIC_Stop();
b--;
if (b) {
continue;
} else {
break;
}
}
AW88298_IIC_Start();
AW88298_IIC_SendByte(PhyAdd | 0x01);
if (AW88298_IIC_WaitAck()) {
AW88298_IIC_Stop();
b--;
if (b) {
continue;
} else {
break;
}
}
for(i = 0 ; i < (len -1); i++) {
*Data = AW88298_IIC_ReadByte();
AW88298_IIC_ACK();
Data++;
}
*Data = AW88298_IIC_ReadByte();
AW88298_IIC_NACK();
AW88298_IIC_Stop();
return 1;
} while (1);
return 0;
}
static void AW88298_IIC_WriteReg(uint8_t addr, uint16_t data)
{
uint8_t TmpData[2] = {(data >> 8 & 0xff), (data & 0xff)};
AW88298_IIC_WritePage(AW88298_IIC_DeviceAddr, addr, TmpData, 2);
}
static uint16_t AW88298_IIC_ReadReg(uint8_t addr)
{
uint8_t data[2];
AW88298_IIC_ReadPage(AW88298_IIC_DeviceAddr, addr, data, 2);
return ((data[0] << 8) + data[1]);
}
void AW88298_Set_Volume(uint8_t u8Vol)
{
uint8_t u8Attenuate;
uint8_t u8AttenuateH;
uint8_t u8AttenuateL;
uint16_t u16RegVal;
if (u8Vol >= 100U)
{
u8Attenuate = 0U;
}
else if (u8Vol <= 4U)
{
u8Attenuate = 96U;
}
else
{
u8Attenuate = 100U - u8Vol;
}
u8AttenuateH = u8Attenuate / 6U; /* Bit 7~4: -6dB step */
u8AttenuateL = (u8Attenuate % 6U) * 2U; /* Bit 3~0: -0.5dB step */
u16RegVal = ((uint16_t)u8AttenuateH << 12) | ((uint16_t)u8AttenuateL << 8) | 0x0064U;
AW88298_IIC_WriteReg(0x0CU, u16RegVal);
}
uint8_t regaddr = 0;
uint8_t regdata = 0;
uint8_t wregaddr = 0;
uint8_t wregdata = 0;
void InitAW88298_IIC(void)
{
uint16_t i;
uint16_t TmpBuffer[(sizeof(AW88298_IIC_DAC_Int) / sizeof(AW88298_IIC_DAC_Int[0]))];
uint8_t ResetFlag = 0;
uint8_t InitCount = 0;
AW88298_PowerPinGpioConfig();
AW88298_IIC_SCL_OUT();
if (1) {
AW88298_IIC_SCL_HIGH;
AW88298_IIC_SDA_HIGH;
AW88298_IIC_DelayUs(300);
for(i = 0;i < (sizeof(AW88298_IIC_DAC_Int) / sizeof(AW88298_IIC_DAC_Int[0])); i++)
{
AW88298_IIC_WriteReg(AW88298_IIC_DAC_Int[i].addr, AW88298_IIC_DAC_Int[i].RegVal);
esp_rom_delay_us(50 );
TmpBuffer[i] = AW88298_IIC_ReadReg(AW88298_IIC_DAC_Int[i].addr);
AW88298_IIC_DelayUs(30);
if (InitCount < 10) {
if (TmpBuffer[i] != AW88298_IIC_DAC_Int[i].RegVal) {
printf("AW88298 iic init, write config failed, the i is %d !!\r\n", i);
i = 0;
InitCount ++;
}
}
}
// //printf("AW88298 iic init, the times of sucessful write config into chip is %d !!\r\n", i);
}
AW88298_Set_Volume(100);
// extend_IIC_Init();
vTaskDelay(10 );
}
void AW88298_IIC_Sleep(void)
{
uint16_t i;
uint8_t InitCount = 0;
uint16_t ReadData = 0;
if (1) {
AW88298_IIC_SCL_HIGH;
AW88298_IIC_SDA_HIGH;
AW88298_IIC_DelayUs(300);
for (i = 0; i < 10; i ++) {
AW88298_IIC_WriteReg(0x4, 0x4443);
AW88298_IIC_DelayUs(30);
ReadData = AW88298_IIC_ReadReg(0x4);
if (ReadData == 0x4443) {
break;
}
}
// //printf("AW88298 iic sleep init read right times is %d !!\r\n", i);
// AW88298_IIC_SCL_LOW;
// AW88298_IIC_SDA_LOW;
AW88298_IIC_SCL_HIGH;
AW88298_IIC_SDA_HIGH;
}
// gpio_set_direction(AW88298_RSTN_NUM, GPIO_MODE_OUTPUT);
// gpio_set_level(AW88298_RSTN_NUM, 0);
// vTaskDelay(pdMS_TO_TICKS(1));
// gpio_set_direction(AW88298_VCC18EN_NUM, GPIO_MODE_OUTPUT);
// gpio_set_level(AW88298_VCC18EN_NUM, 0);
// vTaskDelay(pdMS_TO_TICKS(1));
// gpio_set_direction(AW88298_EN_NUM, GPIO_MODE_OUTPUT);
// gpio_set_level(AW88298_EN_NUM, 0);
// vTaskDelay(pdMS_TO_TICKS(1));
}
#ifndef _BSP_IIC_AW8839_H_
#define _BSP_IIC_AW8839_H_
extern void InitAW88298_IIC(void);
extern void AW88298_IIC_Sleep(void);
#endif
description: YADEA-C001-L-3-TFT description: YADEA-C001-L-3-TFT
dependencies: dependencies:
espressif/esp_mmap_assets: "==1.0.0" espressif/esp_mmap_assets: "==1.0.0"
# esp32_s3_lcd_ev_board: "*" #esp32_s3_lcd_ev_board: "*"
espressif/freetype: "2.*" espressif/freetype: "2.*"
lvgl/lvgl: "~8.4.0" lvgl/lvgl: "~8.4.0"
...@@ -33,23 +33,7 @@ static uint32_t Sys_1ms_Cnt = 0; ...@@ -33,23 +33,7 @@ static uint32_t Sys_1ms_Cnt = 0;
static const char *TAGmain = "main"; static const char *TAGmain = "main";
#define SYS_RUN_TASK_1MS (1) #define SYS_RUN_TASK_1MS (1)
#define SYS_RUN_TASK_2MS ((Sys_1ms_Cnt + 1) % 2 == 0) #define SYS_RU
#define SYS_RUN_TASK_10MS ((Sys_1ms_Cnt + 2) % 10 == 0)
#define SYS_RUN_TASK_20MS ((Sys_1ms_Cnt + 3) % 20 == 0)
#define SYS_RUN_TASK_50MS ((Sys_1ms_Cnt + 4) % 50 == 0)
#define SYS_RUN_TASK_100MS ((Sys_1ms_Cnt + 5) % 100 == 0)
#define SYS_RUN_TASK_2S ((Sys_1ms_Cnt + 6) % (2 * 1000) == 0)
// void task_list()
// {
// static char InfoBuffer[512] = {0};
// vTaskList((char *) &InfoBuffer);
// printf("任务名 任务状态 优先级 剩余栈 任务序号\r\n");
// printf("\r\n%s\r\n", InfoBuffer);
// }
uint8_t G031UARTTEST[4] = {0X23, 0X09, 0X10, 0X77};
void Sys_Run_Task(void *arg) void Sys_Run_Task(void *arg)
{ {
...@@ -80,9 +64,7 @@ void Sys_Run_Task(void *arg) ...@@ -80,9 +64,7 @@ void Sys_Run_Task(void *arg)
Power_Management_Service(); Power_Management_Service();
if (SYS_RUN_TASK_1MS) if (SYS_RUN_TASK_1MS)
{ {
RS485_User_Get_Rx_Data();
// COM_RX_Process();
Flash_Hz_Generate();
} }
if (SYS_RUN_TASK_2MS) if (SYS_RUN_TASK_2MS)
...@@ -94,8 +76,6 @@ void Sys_Run_Task(void *arg) ...@@ -94,8 +76,6 @@ void Sys_Run_Task(void *arg)
if (SYS_RUN_TASK_10MS) if (SYS_RUN_TASK_10MS)
{ {
Protocol_Send_Service(); Protocol_Send_Service();
Turn_Service();
Core_ID12_Service();
} }
if (SYS_RUN_TASK_20MS) if (SYS_RUN_TASK_20MS)
...@@ -104,21 +84,12 @@ void Sys_Run_Task(void *arg) ...@@ -104,21 +84,12 @@ void Sys_Run_Task(void *arg)
if (SYS_RUN_TASK_50MS) if (SYS_RUN_TASK_50MS)
{ {
Data_UE_Service(); Prot_Send_Msg_Process();
Telltales_Management();
} }
if (SYS_RUN_TASK_100MS) if (SYS_RUN_TASK_100MS)
{ {
Time_Display_Update();
DataProcess_Service();
// Protocol_Send(0x10, G031UARTTEST, sizeof(G031UARTTEST));
Core_ID13_Service();
Core_ID14_Service();
Core_ID15_Service();
Core_ID17_Service();
Core_ID18_Service();
Core_ID19_Service();
} }
if (SYS_RUN_TASK_2S) if (SYS_RUN_TASK_2S)
...@@ -156,11 +127,11 @@ static void IIC_Service_task(void *arg) ...@@ -156,11 +127,11 @@ static void IIC_Service_task(void *arg)
IIC_1ms_Cnt = 0; IIC_1ms_Cnt = 0;
} }
eeprom_1ms_timeCount();
if (IIC_TASK_10MS) if (IIC_TASK_10MS)
{ {
Data_Mileage_Write_EEPROM();
} }
if (IIC_TASK_100MS) if (IIC_TASK_100MS)
...@@ -195,10 +166,8 @@ void APP_SYS_Init(void) ...@@ -195,10 +166,8 @@ void APP_SYS_Init(void)
APP_Sys_Startup_Init(); APP_Sys_Startup_Init();
Sys_KL30_Init(); Sys_KL30_Init();
Protocol_KL30_Wakeup_Init(); Protocol_KL30_Wakeup_Init();
eeprom_StoreInfo_Init(); Protocol_User_Ctrl_Init();
Data_User_Mileage_KL30Init();
// InitAW88298_IIC();
} }
void app_main(void) void app_main(void)
...@@ -220,8 +189,6 @@ void app_main(void) ...@@ -220,8 +189,6 @@ void app_main(void)
my_Timer_Driver_Init(); my_Timer_Driver_Init();
bsp_R485_Init();
// // // esp_intr_dump(stdout); // // // esp_intr_dump(stdout);
// // // vTaskDelay(pdMS_TO_TICKS(1000)); // // // vTaskDelay(pdMS_TO_TICKS(1000));
...@@ -229,9 +196,6 @@ void app_main(void) ...@@ -229,9 +196,6 @@ void app_main(void)
APP_SYS_Init(); APP_SYS_Init();
// // printf("free_heap_size = %d\n", esp_get_free_heap_size()); // // printf("free_heap_size = %d\n", esp_get_free_heap_size());
Telltales_Init();
Telltales_User_Init();
xTaskCreatePinnedToCore(Sys_Run_Task, "Sys_Run_Task", 4096, NULL, 6, &Sys_Run_hdl, 1); xTaskCreatePinnedToCore(Sys_Run_Task, "Sys_Run_Task", 4096, NULL, 6, &Sys_Run_hdl, 1);
xTaskCreate(adc_oneshot_read_task, "adc_oneshot_read_task", 4096, NULL, 5, &adc_oneshot_read_hdl); xTaskCreate(adc_oneshot_read_task, "adc_oneshot_read_task", 4096, NULL, 5, &adc_oneshot_read_hdl);
xTaskCreatePinnedToCore(R485_RX_task, "R485_RX_task", 1024 * 4, NULL, 6, &R485_RX_hdl, 1); xTaskCreatePinnedToCore(R485_RX_task, "R485_RX_task", 1024 * 4, NULL, 6, &R485_RX_hdl, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment