Пины и ШИМ для S3 (не проверено)
This commit is contained in:
@@ -3,23 +3,43 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
// ------------------------- Hardware configuration -------------------------
|
||||
// Uncomment for the hand-wired prototype. The production PCB assignments
|
||||
// below follow the physical header positions shown in the schematic.
|
||||
// #define MAKETKA
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32C3
|
||||
constexpr bool TARGET_IS_C3 = true;
|
||||
constexpr uint8_t GPIO_PWM = 3;
|
||||
constexpr uint8_t GPIO_RX = 4;
|
||||
#ifdef MAKETKA
|
||||
constexpr uint8_t GPIO_BUTTON_MODE = 0;
|
||||
constexpr uint8_t GPIO_BUTTON_START = 1;
|
||||
#else
|
||||
constexpr uint8_t GPIO_BUTTON_MODE = 1;
|
||||
constexpr uint8_t GPIO_BUTTON_START = 0;
|
||||
#endif
|
||||
constexpr uint8_t GPIO_SDA = 6;
|
||||
constexpr uint8_t GPIO_SCL = 7;
|
||||
#elif CONFIG_IDF_TARGET_ESP32S3
|
||||
constexpr bool TARGET_IS_C3 = false;
|
||||
#ifdef MAKETKA
|
||||
constexpr uint8_t GPIO_PWM = 4;
|
||||
constexpr uint8_t GPIO_RX = 5;
|
||||
constexpr uint8_t GPIO_BUTTON_MODE = 6;
|
||||
constexpr uint8_t GPIO_BUTTON_START = 7;
|
||||
constexpr uint8_t GPIO_BUTTON_MODE = 0;
|
||||
constexpr uint8_t GPIO_BUTTON_START = 1;
|
||||
constexpr uint8_t GPIO_SDA = 8;
|
||||
constexpr uint8_t GPIO_SCL = 9;
|
||||
#else
|
||||
// The S3 SuperMini is fitted so its 5V and GND pins occupy the same PCB
|
||||
// contacts as on the C3 SuperMini. Signals therefore follow header position.
|
||||
constexpr uint8_t GPIO_PWM = 12;
|
||||
constexpr uint8_t GPIO_RX = 13;
|
||||
constexpr uint8_t GPIO_BUTTON_MODE = 10;
|
||||
constexpr uint8_t GPIO_BUTTON_START = 9;
|
||||
constexpr uint8_t GPIO_SDA = 44;
|
||||
constexpr uint8_t GPIO_SCL = 1;
|
||||
#endif
|
||||
#else
|
||||
#error "Only ESP32-C3 and ESP32-S3 are supported"
|
||||
#endif
|
||||
|
||||
@@ -75,18 +95,23 @@ constexpr uint32_t S3_STRICT_MAX_HZ = 1000000;
|
||||
// still fits both levels of the current PWM signal: 20, 40 or 80 MHz.
|
||||
constexpr uint32_t CAPTURE_RESOLUTION_OPTIONS_HZ[] = {20000000, 40000000, 80000000};
|
||||
constexpr uint32_t RMT_MAX_LEVEL_TICKS = 32766;
|
||||
// Arduino-ESP32 uses the 40 MHz crystal as the default LEDC clock on C3/S3.
|
||||
// C3 uses the 40 MHz crystal as the LEDC clock.
|
||||
// Keep this explicit so the resolution calculation never asks LEDC for an
|
||||
// impossible frequency/resolution combination.
|
||||
constexpr uint32_t LEDC_SOURCE_CLOCK_HZ = 40000000;
|
||||
constexpr uint8_t LEDC_CHANNEL = 0;
|
||||
constexpr uint8_t LEDC_MAX_BITS = 14;
|
||||
// S3 uses the dedicated MCPWM peripheral. A 40 MHz timer clock keeps the
|
||||
// longest 1 kHz period within the S3's 16-bit MCPWM counter and makes every
|
||||
// frequency in TEST_FREQUENCIES_HZ exact.
|
||||
constexpr uint32_t MCPWM_RESOLUTION_HZ = 40000000;
|
||||
constexpr uint32_t MCPWM_MAX_PERIOD_TICKS = 65535;
|
||||
|
||||
// -------------------------- Menu value arrays -----------------------------
|
||||
// START and END deliberately have separate, independently cycling menu lists.
|
||||
// Every value is exactly achievable from the 40 MHz XTAL with an integer LEDC
|
||||
// divider. The test itself walks TEST_FREQUENCIES_HZ between the selected
|
||||
// endpoints, so there is no separately configurable step.
|
||||
// Every value is exactly achievable from a 40 MHz timer clock. The test walks
|
||||
// TEST_FREQUENCIES_HZ between the selected endpoints, so there is no
|
||||
// separately configurable step.
|
||||
constexpr uint32_t START_FREQ_OPTIONS_HZ[] = {1000, 10000, 100000};
|
||||
constexpr uint32_t END_FREQ_OPTIONS_HZ[] = {100000, 500000, 1000000};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user