menuconfig BATT_MGMT
    bool "Battery Management"
    default y
    select ADC
    select EVENT_MGMT
    select GPIO
    select USB_MGMT
    select NRFX_SAADC
    help
      Library for initializing and managing the battery subsystem.

if BATT_MGMT
    config BATT_MGMT_EMPTY_THRESHOLD
        int "Battery Empty Voltage (mV)"
        default 3400
        help
          Voltage threshold treated as empty battery level (0/5).

    config BATT_MGMT_SHUTDOWN_THRESHOLD
        int "Critical shutdown voltage (mV)"
        default 3300
        help
          If measured battery voltage is less than or equal to this threshold,
          the device will power off to protect the battery.

    config BATT_MGMT_FULL_THRESHOLD
        int "Battery Full Voltage (mV)"
        default 3980
        help
          Set the voltage level (in millivolts) that represents a full battery. Default is 3980 mV.
    
    config BATT_MGMT_80P_THRESHOLD
        int "Battery 80% Voltage (mV)"
        default 3820
        help
          Set the voltage level (in millivolts) that represents 80% battery. Default is 3820 mV.
    
    config BATT_MGMT_50P_THRESHOLD
        int "Battery 50% Voltage (mV)"
        default 3720
        help
          Set the voltage level (in millivolts) that represents 50% battery. Default is 3720 mV.

    config BATT_MGMT_20P_THRESHOLD
        int "Battery 20% Voltage (mV)"
        default 3620
        help
          Set the voltage level (in millivolts) that represents 20% battery. Default is 3620 mV.

    config BATT_MGMT_CHG_BLINKING_WINDOW_MS
        int "Charger blinking detection window (ms)"
        default 700
        help
          Time window to detect charger pin blinking (state changes). If the pin state
          changes within this window, it's considered blinking (error state).

    config BATT_MGMT_STANDBY_MEASURE_INTERVAL_MIN
        int "Standby measurement interval (minutes)"
        default 360
        help
          Measurement interval while idle in standby (no charging, no BLE, no audio).

    config BATT_MGMT_ACTIVE_MEASURE_INTERVAL_MIN
        int "Active measurement interval (minutes)"
        default 1
        help
          Measurement interval while charging or BLE connected.

    config BATT_MGMT_AUDIO_COOLDOWN_SEC
        int "Audio cooldown before next measure (seconds)"
        default 60
        help
          Delay before restarting periodic battery measurement after audio playback ends.

    config BATT_MGMT_MONITOR_THREAD_STACK_SIZE
        int "Battery monitor thread stack size"
        default 1024
        help
          Stack size for the USB-triggered charger status monitor thread.

    config BATT_MGMT_MONITOR_THREAD_PRIORITY
        int "Battery monitor thread priority"
        default 7
        help
          Cooperative priority for the monitor thread (lower number = higher priority).

    config BATT_MGMT_BLINK_INTERVAL_LOGGING
        bool "Enable logging of charger pin blinking intervals"
        default n
        help
          If enabled, logs the time intervals between charger pin state changes, which can help diagnose charger connection issues.

    module = BATT_MGMT
    module-str = batt_mgmt
    source "subsys/logging/Kconfig.template.log_config"
endif # BATT_MGMT