/* UA1ZBE Custom Firmware - Mode Dispatcher
 *
 * Manages switching between operating modes:
 *   MODE_VFO       — Main VFO mode (default)
 *   MODE_POCSAG    — POCSAG decoder
 *   MODE_SPECTRUM  — Spectrum analyzer
 *   MODE_FM        — FM radio receiver
 *
 * Key mappings:
 *   KEY_SIDE2 (SK2) → POCSAG mode
 *   KEY_SIDE1 (SK1) → Spectrum mode
 *   KEY_EXIT        → Return to VFO
 *   KEY_0 (short)   → FM mode
 */

#ifndef APP_MODE_H
#define APP_MODE_H

#include <stdint.h>
#include <stdbool.h>

/* Operating modes */
typedef enum {
    MODE_VFO = 0,
    MODE_POCSAG,
    MODE_SPECTRUM,
    MODE_FM,
    MODE_COUNT
} op_mode_t;

/* Get current mode */
op_mode_t MODE_GetCurrent(void);

/* Switch to a mode */
void MODE_Switch(op_mode_t mode);

/* Initialize mode dispatcher (call once at boot) */
void MODE_Init(void);

/* Call from 10ms timeslice */
void MODE_TimeSlice10ms(void);

/* Call from 500ms timeslice */
void MODE_TimeSlice500ms(void);

/* Process key press for mode switching.
 * Returns true if the key was consumed by mode switch. */
bool MODE_ProcessKey(int key, bool pressed, bool held);

#endif
