Files
ESP32_ZACUS/plip_voice/main/board_config.h
T
clemsail f531bf3e55 feat(plip): SLIC control — power-up (PD OD-HIGH), hook on SHK GPIO23, ring RM/FR
- board_config.h: add PLIP_SLIC_RM=18, FR=5, SHK=23, PD=19 (A1S KEY3-6 repurposed)
- slic.c/slic.h: new ESP-IDF module porting Ks0835SlicController:
    * slic_init(): RM/FR output LOW, SHK input+pullup, PD open-drain HIGH (power-up)
    * slic_is_offhook(): reads SHK GPIO23, HIGH = off-hook (active-high, matches A252ConfigStore default)
    * slic_ring_start/stop(): RM HIGH + FreeRTOS task toggles FR at 25 Hz (20 ms period)
- CMakeLists.txt: add slic.c to SRCS, esp_driver_gpio to PRIV_REQUIRES
- Kconfig: PLIP_HOOK_GPIO default 4→23, add PLIP_HOOK_ACTIVE_HIGH (default y)
- phone.c: hook reads SHK GPIO23 via HOOK_OFFHOOK_LEVEL/HOOK_PULSE_OPEN macros (active-HIGH);
    phone_ring_start/stop() now drives slic_ring_start/stop() for physical bell + audio tone
- main.c: slic_init() called early in boot_task before audio_init

Root cause fixed: SLIC was never powered (PD never released from reset state).
Hook was read on wrong GPIO (4) with wrong polarity. Ring drove only audio, not bell.
2026-06-15 00:26:35 +02:00

50 lines
2.1 KiB
C

#pragma once
/*
* AI-Thinker ESP32-A1S Audio Kit V2.2 — Hardware Pin Configuration
* ES8388 codec (I2C control + I2S data), SD card (SPI), power amp.
* DIP switch: 1=OFF, 2=ON, 3=ON, 4=OFF, 5=OFF (SD active, KEY2 busy)
*/
/* ---------- I2C Bus (ES8388 control) ---------- */
#define PLIP_I2C_PORT I2C_NUM_0
#define PLIP_I2C_SCL 32
#define PLIP_I2C_SDA 33
#define PLIP_I2C_FREQ_HZ 400000
/* ---------- ES8388 Audio Codec (I2C address) ---------- */
#define PLIP_ES8388_ADDR 0x10 /* 7-bit: 0x10 with ADDR pin low */
/* ---------- I2S Audio Data ---------- */
#define PLIP_I2S_NUM I2S_NUM_0
#define PLIP_I2S_MCLK 0 /* GPIO0 — must be 0/1/3 on original ESP32 */
#define PLIP_I2S_BCLK 27
#define PLIP_I2S_WS 25 /* LRCK */
#define PLIP_I2S_DOUT 26 /* DAC → speaker */
#define PLIP_I2S_DIN 35 /* ADC ← mic (input-only, ES8388 ASDOUT) */
/* ---------- Power Amplifier ---------- */
#define PLIP_PA_ENABLE 21 /* Active HIGH, drives NS4150 amp */
/* ---------- SD Card (SPI / HSPI) ---------- */
#define PLIP_SD_CS 13
#define PLIP_SD_MOSI 15
#define PLIP_SD_MISO 2
#define PLIP_SD_SCK 14
#define PLIP_SD_MOUNT "/sdcard"
/* ---------- Audio Parameters ---------- */
#define PLIP_SAMPLE_RATE 16000
#define PLIP_BITS_PER_SAMPLE 16
#define PLIP_CHANNELS 2 /* ES8388 I2S always stereo; output averaged */
/* ---------- Off-hook GPIO (dev kit uses BOOT/KEY1 GPIO4 as stand-in) ---------- */
/* Actual value comes from CONFIG_PLIP_HOOK_GPIO (Kconfig) */
/* ---------- SLIC K50835F / AG1171-class front-end (A1S board wiring) ---------- */
/* KEY3=GPIO19, KEY4=GPIO23, KEY5=GPIO18, KEY6=GPIO5 share these pins — reassigned to SLIC */
#define PLIP_SLIC_RM 18 /* Ring Mode output — HIGH = ring burst active */
#define PLIP_SLIC_FR 5 /* Forward/Reverse output — toggled at 25 Hz for bell */
#define PLIP_SLIC_SHK 23 /* Switch Hook input — HIGH = off-hook (active-high) */
#define PLIP_SLIC_PD 19 /* Power Down (open-drain) — HIGH = SLIC active */