commeownder/main/config.h

90 lines
4.2 KiB
C

#pragma once
// ── Buttons ───────────────────────────────────────────────────────────────────
#define BTN_RIGHT_GPIO 23
#define BTN_LEFT_GPIO 4
#define BTN_MID_GPIO 5
// ── RGB LED ───────────────────────────────────────────────────────────────────
#define LED_R_GPIO 13
#define LED_G_GPIO 14
#define LED_B_GPIO 27
// ── I2C / OLED ────────────────────────────────────────────────────────────────
#define I2C_PORT I2C_NUM_0
#define I2C_SDA_GPIO 21
#define I2C_SCL_GPIO 22
#define I2C_FREQ_HZ 400000
#define OLED_ADDR 0x3C
#define OLED_WIDTH 128
#define OLED_PAGES 8
#define HEADER_PAGES 2
// ── Button timing ─────────────────────────────────────────────────────────────
#define HOLD_DELAY 50
#define HOLD_REPEAT 10
#define MID_HOLD_MENU 15
#define MID_HOLD_SETTINGS 100
// ── BLE ───────────────────────────────────────────────────────────────────────
#define BLE_MFR_MAGIC_0 0xC0
#define BLE_MFR_MAGIC_1 0xDE
#define BLE_GAME_ID_0 0x42
#define BLE_GAME_ID_1 0x42
#define BLE_MAX_PLAYERS 5
#define MAX_BLE_PEERS 4
#define BLE_PEER_TIMEOUT 3000
// ── Menus ─────────────────────────────────────────────────────────────────────
#define NUM_MENUS 4
#define MENU_LIFE 0
#define MENU_CMDR 1
#define MENU_COUNTERS 2
#define MENU_SETTINGS 3
extern const int menu_slot[NUM_MENUS];
// ── Settings ──────────────────────────────────────────────────────────────────
#define NUM_SETTINGS 8
#define SET_BRIGHTNESS 0
#define SET_START_LIFE 1
#define SET_NUM_OPP 2
#define SET_BLE 3
#define SET_RESET 4
#define SET_RESET_ALL 5
#define SET_PLAYER_NAME 7
#define SET_GAME_ID 6
#define BRIGHTNESS_MIN 1
#define BRIGHTNESS_MAX 100
#define PLAYER_NAME_LEN 8
#define GAME_ID_DIGITS 4
extern const char *setting_names[NUM_SETTINGS];
extern const int start_life_opts[];
#define NUM_LIFE_OPTS 3
extern const char NAME_CHARS[];
#define NUM_NAME_CHARS 37
#define NUM_HEX_CHARS 16
// ── Counters ──────────────────────────────────────────────────────────────────
#define NUM_COUNTERS 4
extern const char *counter_names[NUM_COUNTERS];
// ── Opponents ─────────────────────────────────────────────────────────────────
#define MAX_OPPONENTS 4
// ── Font / display ────────────────────────────────────────────────────────────
#define SCALE 5
#define CHAR_WIDTH (5 * SCALE + SCALE)
#define CHAR_PAGES 5
#define START_PAGE (HEADER_PAGES + (OLED_PAGES - HEADER_PAGES - CHAR_PAGES + 1) / 2)
#define SEG_W 16
#define ICON_W 16
#define FONT_BASE 0x20
#define FONT_MAX 0x5A
// ── NVS ───────────────────────────────────────────────────────────────────────
#define NVS_NS "settings"
#define SAVE_DELAY 300