# Main Kconfig settings

VERSION := $(shell, git describe --tags --long --always --dirty 2> /dev/null)

mainmenu "CanBoot Configuration $(VERSION)"

config LOW_LEVEL_OPTIONS
    bool
    default y

choice
    prompt "Micro-controller Architecture"
    config MACH_STM32
        bool "STMicroelectronics STM32"
    config MACH_LPC176X
        bool "LPC176x (Smoothieboard)"
endchoice

source "src/stm32/Kconfig"
source "src/lpc176x/Kconfig"

# Generic configuration options for serial ports
config SERIAL
    bool
config SERIAL_BAUD
    depends on SERIAL
    int "Baud rate for serial port" if LOW_LEVEL_OPTIONS
    default 250000
    help
        Specify the baud rate of the serial port. This should be set
        to 250000. Read the FAQ before changing this value.

# Generic configuration options for USB
config USBSERIAL
    bool
config USB_VENDOR_ID
    default 0x1d50
config USB_DEVICE_ID
    default 0x6177
config USB_SERIAL_NUMBER_CHIPID
    depends on HAVE_CHIPID && USBSERIAL
    default y
config USB_SERIAL_NUMBER
    default "12345"

menu "USB ids"
    depends on USBSERIAL && LOW_LEVEL_OPTIONS
config USB_VENDOR_ID
    hex "USB vendor ID" if USBSERIAL
config USB_DEVICE_ID
    hex "USB device ID" if USBSERIAL
config USB_SERIAL_NUMBER_CHIPID
    bool "USB serial number from CHIPID" if HAVE_CHIPID
config USB_SERIAL_NUMBER
    string "USB serial number" if !USB_SERIAL_NUMBER_CHIPID
endmenu

# Generic configuration options for CANbus
config CANSERIAL
    bool
config CANBUS
    bool
    default y if CANSERIAL
config CANBUS_FREQUENCY
    int "CAN bus speed" if CANBUS
    default 500000
config CANBUS_FILTER
    bool
    default y if CANSERIAL

config INITIAL_PINS
    string "GPIO pins to set on bootloader entry"
    depends on LOW_LEVEL_OPTIONS
    help
        One may specify a comma separated list of gpio pins to set
        during bootloader entry (these gpio pins are not set if the
        main application is started nor are they set while checking
        for a bootloader request). By default the pins will be set to
        output high - preface a pin with a '!' character to set that
        pin to output low.

config ENABLE_DOUBLE_RESET
    bool "Support bootloader entry on rapid double click of reset button"
    default y

config ENABLE_BUTTON
    bool "Enable bootloader entry on button (or gpio) state"
    default n

config BUTTON_PIN
    string "Button GPIO Pin"
    depends on ENABLE_BUTTON

config ENABLE_LED
    bool "Enable Status LED"
    default n

config STATUS_LED_PIN
    string "Status LED GPIO Pin"
    depends on ENABLE_LED

# The HAVE_x options allow boards to disable support for some commands
# if the hardware does not support the feature.
config HAVE_CHIPID
    bool
    default n
