Files
ESP32_ZACUS/plip_voice/main/phone.h
T
clement aa7ae277ed
CI / platformio (pull_request) Failing after 4m0s
CI / platformio (push) Failing after 14m58s
feat(plip): voice loop + DTMF + ring cadence
- hook polarity active-HIGH + auto-resync (was LOW)
- ring cadence FT 1.5s ON / 3.5s OFF
- DTMF Goertzel decoder (dtmf.c/h) + rotary debounce
- LISTEN half-duplex: capture → /v1/voice/reply → play
- WAV playback buffered PSRAM + mono→stereo upmix
- SPIFFS mount at boot for pre-loaded greetings
- ES8388: DAC digital vol + mic PGA + GPIO INPUT_OUTPUT
- turn_client multipart + 90s timeout + fixed routing
- debug endpoints: vol/dacvol/offhook/getfile/hookmon
2026-06-15 21:12:33 +02:00

42 lines
1.3 KiB
C

#pragma once
/*
* phone.h — Off-hook GPIO monitor + ring control for PLIP (Phase D).
*
* On the ESP32-A1S dev kit: BOOT button (GPIO4 = KEY1) acts as the
* off-hook stand-in (active LOW via INPUT_PULLUP, CONFIG_PLIP_HOOK_GPIO).
* On the Si3210 PCB target: replace with the SLIC interrupt GPIO.
*
* Ring: drives audio_ring_start() / audio_stop().
* Hook events: forwarded to hook_client_report().
*/
#include <stdbool.h>
#include "esp_err.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Initialise the off-hook GPIO and start the monitoring task.
* hook_client_init() and audio_init() must have been called first. */
esp_err_t phone_init(void);
/* Signal the phone to start ringing (called externally if needed). */
void phone_ring_start(void);
/* Stop ringing. */
void phone_ring_stop(void);
/* Returns true if the handset is currently off-hook (picked up).
* Safe to call from any task; backed by a volatile flag updated in phone_task. */
bool phone_is_offhook(void);
/* Debug: force the hook state, overriding the physical contact until reboot.
* off=true simulates pickup (→ DIALTONE), off=false simulates hangup (→ IDLE).
* Lets the voice loop be validated independently of a flaky cradle contact. */
void phone_force_offhook(bool off);
#ifdef __cplusplus
}
#endif