From 7bd9bdeafd2286c4aa0beb7eefdbe7d364b77776 Mon Sep 17 00:00:00 2001 From: Martin Jaeger <17674105+martinjaeger@users.noreply.github.com> Date: Sat, 4 Jan 2020 14:02:48 +0100 Subject: [PATCH] Kconfig: User-configuration added --- boards/Kconfig | 29 +-------- boards/Kconfig.hidden | 61 +++++++++++++++++++ boards/Kconfig.user | 134 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 198 insertions(+), 26 deletions(-) create mode 100644 boards/Kconfig.hidden create mode 100644 boards/Kconfig.user diff --git a/boards/Kconfig b/boards/Kconfig index ad694f2..3b80da0 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -1,32 +1,9 @@ # SPDX-License-Identifier: Apache-2.0 -# Copyright (c) 2019 Martin Jaeger (Libre Solar) +# Copyright (c) 2019 Martin Jäger (Libre Solar) # # Generic Libre Solar Charge Controller configuration # -# Invisible (hardware-specific) Kconfig symbols +source "$(BOARD_DIR)/../../Kconfig.hidden" -config HAS_DCDC_CONVERTER - bool - help - "Board has a DC/DC converter" - -config HAS_PWM_SWITCH - bool - help - "PCB has PWM power switch" - -config HAS_LOAD_OUTPUT - bool - help - "PCB has a load output" - -config NUM_LED_PINS - int - help - "Number of LED pins for charlieplexing" - -# Visible (user-configurable) Kconfig symbols - -config OLED_DISPLAY - bool "OLED display connected via UEXT" +source "$(BOARD_DIR)/../../Kconfig.user" diff --git a/boards/Kconfig.hidden b/boards/Kconfig.hidden new file mode 100644 index 0000000..62bc348 --- /dev/null +++ b/boards/Kconfig.hidden @@ -0,0 +1,61 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2019 Martin Jäger (Libre Solar) +# +# Invisible (hardware-specific) Kconfig symbols +# + +config DEVICE_TYPE + string + help + Device type name, e.g. MPPT-2420-LC + +config HARDWARE_VERSION + string + help + Version of the PCB + +config HAS_DCDC_CONVERTER + bool + help + Board has a DC/DC converter. + +if HAS_DCDC_CONVERTER + +config DCDC_PWM_FREQUENCY_KHZ + int + range 30 100 + help + PWM frequency of DC/DC converter in kHz, range 30 to 100. + +config DCDC_PWM_DEADTIME_NS + int + range 100 300 + help + Dead time for synchronous PWM generation in nanoseconds. + +endif # HAS_DCDC_CONVERTER + +config HAS_PWM_SWITCH + bool + help + PCB has PWM power switch. + +config HAS_LOAD_OUTPUT + bool + help + PCB has a load output. + +config NUM_LED_PINS + int + help + Number of LED pins for charlieplexing. + +config LOW_SIDE_VOLTAGE_MAX + int + help + Low side (usually battery) voltage maximum. + +config HIGH_SIDE_VOLTAGE_MAX + int + help + High side (usually solar panel) voltage maximum. diff --git a/boards/Kconfig.user b/boards/Kconfig.user new file mode 100644 index 0000000..acd58be --- /dev/null +++ b/boards/Kconfig.user @@ -0,0 +1,134 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2019 Martin Jäger (Libre Solar) +# +# Visible (user-configurable) Kconfig symbols +# + + +choice + prompt "High-voltage terminal" + depends on HAS_DCDC_CONVERTER + help + Select the device connected to the high-voltage + side terminal of the DC/DC converter. + + config HV_TERMINAL_SOLAR + bool "Solar panel" + + config HV_TERMINAL_NANOGRID + bool "DC nanogrid" + + config HV_TERMINAL_GENERATOR + bool "DC generator, e.g. wind turbine" + + config HV_TERMINAL_BATTERY + bool "Battery, e.g. electric bicycle" +endchoice + + +choice + prompt "Low-voltage terminal" + help + Select the device connected to the low-voltage side + of the charge controller (usually battery terminal). + + config LV_TERMINAL_BATTERY + depends on !HV_TERMINAL_BATTERY + bool "Battery 12V/24V" + + config LV_TERMINAL_SOLAR + depends on HV_TERMINAL_BATTERY || HV_TERMINAL_NANOGRID + bool "Solar panel" +endchoice + + +choice + prompt "PWM terminal" + depends on HAS_PWM_SWITCH + help + Select the device connected to the PWM switch (currently + only solar panel possible) + + config PWM_TERMINAL_SOLAR + depends on LV_TERMINAL_BATTERY && !HV_TERMINAL_SOLAR + bool "Solar panel" +endchoice + + +menu "Battery configuration" + +choice + prompt "Default battery cell type" + default BAT_DEFAULT_TYPE_GEL + help + Select the type of the single cells inside the battery + to determine voltage set points. Total voltage set points + are multiplied with the selected number of cells. + + config BAT_DEFAULT_TYPE_FLOODED + bool "Flooded (wet) lead-acid" + + config BAT_DEFAULT_TYPE_GEL + bool "VRLA gel, maintainance-free" + + config BAT_DEFAULT_TYPE_AGM + bool "AGM, maintainance-free" + + config BAT_DEFAULT_TYPE_LFP + bool "LiFePO4 Li-ion, 3.3V nominal" + + config BAT_DEFAULT_TYPE_NMC + bool "NMC/Graphite Li-ion, 3.7V nominal, 4.2V max" + + config BAT_DEFAULT_TYPE_NMC_HV + bool "NMC/Graphite High Voltage Li-ion, 3.7V nominal, 4.35 max" + +endchoice + +config BAT_DEFAULT_NUM_CELLS + int "Default number of battery cells" + default 6 + range 3 16 + help + Typical choices: + - 6 for 12V lead-acid battery + - 4 for 12V LiFePO4 battery + - 3 for 12V NMC Li-ion battery + + Remarks: + - If you choose settings for 12V system, 24V systems + (2 batteries in series) are recognized automatically + - Make sure the voltage of the used charge controller + is not exceeded. + +config BAT_DEFAULT_CAPACITY_AH + int "Default battery capacity in Ah" + range 10 200 + default 50 + +endmenu + + +menu "Extensions and interfaces" + +config EXT_OLED_DISPLAY + bool "OLED display at UEXT" + +config EXT_OLED_BRIGHTNESS + depends on EXT_OLED_DISPLAY + int "OLED display brightness" + range 1 255 + default 1 + +config EXT_THINGSET_SERIAL + bool "ThingSet serial interface" + +config EXT_THINGSET_CAN + depends on CAN + bool "ThingSet CAN interface" + +config DEVICE_ID + int "Initial device ID for communication interfaces" + default 0 + +endmenu