# Copyright (c) 2021 The ZMK Contributors
# SPDX-License-Identifier: MIT

# Enable both USB and BLE
CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y

# Keyboard IDs
CONFIG_ZMK_KEYBOARD_NAME="Glove80 Left"
CONFIG_USB_DEVICE_PID=0x27db
CONFIG_USB_DEVICE_VID=0x16c0
CONFIG_USB_DEVICE_MANUFACTURER="MoErgo"
CONFIG_USB_DEVICE_SN="moergo.com:GLV80-0123456789ABCDEF"

CONFIG_BT_DIS_PNP_PID=0x27db
CONFIG_BT_DIS_PNP_VID=0x16c0
CONFIG_BT_DIS_MANUF="MoErgo"
CONFIG_BT_DIS_MODEL="Glove80"

CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

# Work-around for Windows bug with battery notifications
CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION=n

# Enable MPU
CONFIG_ARM_MPU=y

# Enable GPIO
CONFIG_GPIO=y

# Build configurations
CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_BUILD_OUTPUT_UF2_FAMILY_ID="0x9807B007"
CONFIG_USE_DT_CODE_PARTITION=y

# Flash configuration
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_NVS=y
CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

# Enable 32kHz crystal
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y

# Enable RGB underglow
CONFIG_ZMK_RGB_UNDERGLOW=y

CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER=y
CONFIG_ZMK_RGB_UNDERGLOW_ON_START=n
CONFIG_ZMK_RGB_UNDERGLOW_BRT_STEP=4
CONFIG_ZMK_RGB_UNDERGLOW_BRT_MIN=4

# DO NOT CHANGE CONFIG_ZMK_RGB_UNDERGLOW_BRT_MAX TO ABOVE 80. Configuring
# BRT_MAX above 80% will draw additional current and can potentially damage your
# computer. WARRANTY IS VOID IF BRT_MAX SET ABOVE 80.
CONFIG_ZMK_RGB_UNDERGLOW_BRT_MAX=80

CONFIG_ZMK_RGB_UNDERGLOW_EFF_START=3
CONFIG_ZMK_RGB_UNDERGLOW_HUE_START=285
CONFIG_ZMK_RGB_UNDERGLOW_SAT_START=75
CONFIG_ZMK_RGB_UNDERGLOW_BRT_START=16

# The power LED is implemented as a backlight
# For now, the power LED is acting as a "USB connected" indicator
CONFIG_ZMK_BACKLIGHT=y
CONFIG_ZMK_BACKLIGHT_ON_START=y
CONFIG_ZMK_BACKLIGHT_BRT_START=5
CONFIG_ZMK_BACKLIGHT_AUTO_OFF_IDLE=y
CONFIG_ZMK_BACKLIGHT_AUTO_OFF_USB=y

# The full two-byte consumer report space has compatibility issues with some
# operating systems, most notably macOS. Use the more basic single-byte usage
# space.
CONFIG_ZMK_HID_CONSUMER_REPORT_USAGES_BASIC=y

# Turn on debugging to disable optimization. Debug messages can result in larger
# stacks, so enable stack protection and particularly a larger BLE peripheral stack.
# CONFIG_DEBUG=y
# CONFIG_DEBUG_THREAD_INFO=y
# CONFIG_EXCEPTION_STACK_TRACE=y
# CONFIG_HW_STACK_PROTECTION=y
# CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_STACK_SIZE=1300

# Log via USB or Segger RTT
CONFIG_ZMK_USB_LOGGING=n
CONFIG_ZMK_RTT_LOGGING=n
