M5UnitUnified 0.6.3 git rev:e38fc73
Loading...
Searching...
No Matches
identify_functions.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
3 *
4 * SPDX-License-Identifier: MIT
5 */
10#ifndef M5_UNIT_UNIFIED_IDENTIFY_FUNCTIONS_HPP
11#define M5_UNIT_UNIFIED_IDENTIFY_FUNCTIONS_HPP
12
13#if defined(ESP_PLATFORM)
14// Detect ESP-IDF version
15#if __has_include(<esp_idf_version.h>)
16#include <esp_idf_version.h>
17#else // esp_idf_version.h has been introduced in Arduino 1.0.5 (ESP-IDF3.3)
18#define ESP_IDF_VERSION_VAL(major, minor, patch) ((major << 16) | (minor << 8) | (patch))
19#define ESP_IDF_VERSION ESP_IDF_VERSION_VAL(3, 2, 0)
20#endif
21
22// RMT
23#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
24#define M5_UNIT_UNIFIED_USING_RMT_V2
25#define M5_UNIT_UNIFIED_USING_ADC_ONESHOT
26#endif
27
28// RMT availability: every ESP-IDF 4.x target has RMT; from 5.x follow SOC_RMT_SUPPORTED (C2 / C61 have none)
29#include <soc/soc_caps.h>
30#if !defined(M5_UNIT_UNIFIED_USING_RMT_V2) || (defined(SOC_RMT_SUPPORTED) && SOC_RMT_SUPPORTED)
31#define M5_UNIT_UNIFIED_HAS_RMT 1
32#else
33#define M5_UNIT_UNIFIED_HAS_RMT 0
34#endif
35#else
36#define M5_UNIT_UNIFIED_HAS_RMT 0
37#endif // ESP_PLATFORM
38
39#endif