64 lines
2.3 KiB
C++
64 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
|
|
// ------------------------- Hardware configuration -------------------------
|
|
#if CONFIG_IDF_TARGET_ESP32C3
|
|
constexpr bool TARGET_IS_C3 = true;
|
|
constexpr uint8_t GPIO_PWM = 3;
|
|
constexpr uint8_t GPIO_RX = 4;
|
|
constexpr uint8_t GPIO_BUTTON_START = 0;
|
|
constexpr uint8_t GPIO_BUTTON_MODE = 1;
|
|
constexpr uint8_t GPIO_SDA = 6;
|
|
constexpr uint8_t GPIO_SCL = 7;
|
|
#elif CONFIG_IDF_TARGET_ESP32S3
|
|
constexpr bool TARGET_IS_C3 = false;
|
|
constexpr uint8_t GPIO_PWM = 4;
|
|
constexpr uint8_t GPIO_RX = 5;
|
|
constexpr uint8_t GPIO_BUTTON_START = 6;
|
|
constexpr uint8_t GPIO_BUTTON_MODE = 7;
|
|
constexpr uint8_t GPIO_SDA = 8;
|
|
constexpr uint8_t GPIO_SCL = 9;
|
|
#else
|
|
#error "Only ESP32-C3 and ESP32-S3 are supported"
|
|
#endif
|
|
|
|
constexpr uint8_t OLED_ADDRESS = 0x3C;
|
|
constexpr uint8_t ESPNOW_WIFI_CHANNEL = 6;
|
|
constexpr uint32_t SERIAL_BAUD = 115200;
|
|
|
|
#define BUTTON_ACTIVE_LEVEL LOW
|
|
#define RX_SIGNAL_INVERTED false
|
|
#define PWM_SAFE_LEVEL LOW
|
|
#define PWM_SETTLE_CYCLES 5U
|
|
|
|
constexpr uint32_t BUTTON_DEBOUNCE_MS = 30;
|
|
constexpr uint32_t BUTTON_LONG_PRESS_MS = 800;
|
|
constexpr uint32_t BUTTON_REPEAT_DELAY_MS = 600;
|
|
constexpr uint32_t BUTTON_REPEAT_MS = 180;
|
|
constexpr uint32_t FACTORY_RESET_HOLD_MS = 1500;
|
|
|
|
constexpr uint32_t LINK_DISCOVERY_TIMEOUT_MS = 3000;
|
|
constexpr uint32_t LINK_REPLY_TIMEOUT_MS = 800;
|
|
constexpr uint8_t LINK_PACKET_RETRIES = 3;
|
|
constexpr uint32_t LINK_RETRY_INTERVAL_MS = 100;
|
|
constexpr uint8_t NO_SIGNAL_TIMEOUT_PERIODS = 8;
|
|
|
|
constexpr uint32_t C3_STRICT_MAX_HZ = 100000;
|
|
constexpr uint32_t S3_STRICT_MAX_HZ = 1000000;
|
|
constexpr uint32_t C3_GUARANTEED_HZ = 10000;
|
|
constexpr uint32_t CAPTURE_RESOLUTION_HZ = 80000000;
|
|
constexpr uint8_t LEDC_CHANNEL = 0;
|
|
constexpr uint8_t LEDC_MAX_BITS = 14;
|
|
|
|
// -------------------------- Menu value arrays -----------------------------
|
|
constexpr uint32_t START_FREQ_OPTIONS_HZ[] = {1000, 2000, 5000, 10000, 20000, 50000};
|
|
constexpr uint32_t END_FREQ_OPTIONS_HZ[] = {100000, 200000, 500000, 750000, 1000000};
|
|
constexpr uint32_t STEP_OPTIONS_HZ[] = {1000, 2000, 5000, 10000, 20000, 50000, 100000};
|
|
constexpr float ACCURACY_OPTIONS_PCT[] = {1.0f, 2.0f, 5.0f, 10.0f};
|
|
constexpr uint32_t TEST_TIME_OPTIONS_MS[] = {100, 250, 500, 1000, 2000, 5000};
|
|
constexpr uint8_t REPEAT_OPTIONS[] = {1, 2, 3, 5, 10};
|
|
constexpr uint8_t DUTY_OPTIONS_PCT[] = {10, 25, 50, 75, 90};
|
|
|
|
template <typename T, size_t N> constexpr size_t countOf(const T (&)[N]) { return N; }
|