From 228b6f2f165597fe404f39993b14d7af9f2f9f7f Mon Sep 17 00:00:00 2001 From: Ole Odendahl Date: Fri, 16 Dec 2022 11:21:27 +0100 Subject: [PATCH] Making core log level configurable via Kconfig entry. --- .../prstlib/boards/arm/bparasite_nrf52833/Kconfig | 6 +++++- .../prstlib/boards/arm/bparasite_nrf52840/Kconfig | 6 +++++- code/nrf-connect/prstlib/src/adc.c | 2 +- code/nrf-connect/prstlib/src/button.c | 2 +- code/nrf-connect/prstlib/src/led.c | 2 +- code/nrf-connect/prstlib/src/sensors.c | 2 +- code/nrf-connect/prstlib/src/shtc3.c | 2 +- 7 files changed, 15 insertions(+), 7 deletions(-) diff --git a/code/nrf-connect/prstlib/boards/arm/bparasite_nrf52833/Kconfig b/code/nrf-connect/prstlib/boards/arm/bparasite_nrf52833/Kconfig index b6f2e0e..be20e5e 100644 --- a/code/nrf-connect/prstlib/boards/arm/bparasite_nrf52833/Kconfig +++ b/code/nrf-connect/prstlib/boards/arm/bparasite_nrf52833/Kconfig @@ -6,4 +6,8 @@ config BOARD_ENABLE_DCDC select SOC_DCDC_NRF52X default y -endif # BOARD_BPARASITE_NRF52833 \ No newline at end of file +endif # BOARD_BPARASITE_NRF52833 + +config CORE_LOG_LEVEL + int "Logging level in core prst library." + default 2 \ No newline at end of file diff --git a/code/nrf-connect/prstlib/boards/arm/bparasite_nrf52840/Kconfig b/code/nrf-connect/prstlib/boards/arm/bparasite_nrf52840/Kconfig index aa0eeee..e6418be 100644 --- a/code/nrf-connect/prstlib/boards/arm/bparasite_nrf52840/Kconfig +++ b/code/nrf-connect/prstlib/boards/arm/bparasite_nrf52840/Kconfig @@ -11,4 +11,8 @@ config BOARD_ENABLE_DCDC_HV select SOC_DCDC_NRF52X_HV default y -endif # BOARD_BPARASITE_NRF52840 \ No newline at end of file +endif # BOARD_BPARASITE_NRF52840 + +config CORE_LOG_LEVEL + int "Logging level in core prst library." + default 2 \ No newline at end of file diff --git a/code/nrf-connect/prstlib/src/adc.c b/code/nrf-connect/prstlib/src/adc.c index 1856f7e..69d32ad 100644 --- a/code/nrf-connect/prstlib/src/adc.c +++ b/code/nrf-connect/prstlib/src/adc.c @@ -9,7 +9,7 @@ #include "prstlib/macros.h" -LOG_MODULE_REGISTER(adc, LOG_LEVEL_WRN); +LOG_MODULE_REGISTER(adc, CONFIG_CORE_LOG_LEVEL); // PWM spec for square wave. Input to the soil sensing circuit. static const struct pwm_dt_spec soil_pwm_dt = diff --git a/code/nrf-connect/prstlib/src/button.c b/code/nrf-connect/prstlib/src/button.c index a27eda2..a545e9b 100644 --- a/code/nrf-connect/prstlib/src/button.c +++ b/code/nrf-connect/prstlib/src/button.c @@ -6,7 +6,7 @@ #include "prstlib/led.h" #include "prstlib/macros.h" -LOG_MODULE_REGISTER(button, LOG_LEVEL_WRN); +LOG_MODULE_REGISTER(button, CONFIG_CORE_LOG_LEVEL); static struct gpio_dt_spec button = GPIO_DT_SPEC_GET(DT_NODELABEL(button0), gpios); diff --git a/code/nrf-connect/prstlib/src/led.c b/code/nrf-connect/prstlib/src/led.c index 415296f..654339c 100644 --- a/code/nrf-connect/prstlib/src/led.c +++ b/code/nrf-connect/prstlib/src/led.c @@ -4,7 +4,7 @@ #include "prstlib/macros.h" -LOG_MODULE_REGISTER(led, LOG_LEVEL_WRN); +LOG_MODULE_REGISTER(led, CONFIG_CORE_LOG_LEVEL); struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_NODELABEL(led0), gpios); diff --git a/code/nrf-connect/prstlib/src/sensors.c b/code/nrf-connect/prstlib/src/sensors.c index e0b1ca9..218ea77 100644 --- a/code/nrf-connect/prstlib/src/sensors.c +++ b/code/nrf-connect/prstlib/src/sensors.c @@ -6,7 +6,7 @@ #include "prstlib/led.h" #include "prstlib/macros.h" -LOG_MODULE_REGISTER(sensors, LOG_LEVEL_WRN); +LOG_MODULE_REGISTER(sensors, CONFIG_CORE_LOG_LEVEL); int prst_sensors_read_all(prst_sensors_t *sensors) { RET_IF_ERR(prst_adc_batt_read(&sensors->batt)); diff --git a/code/nrf-connect/prstlib/src/shtc3.c b/code/nrf-connect/prstlib/src/shtc3.c index 90cd6ba..dc1c90b 100644 --- a/code/nrf-connect/prstlib/src/shtc3.c +++ b/code/nrf-connect/prstlib/src/shtc3.c @@ -6,7 +6,7 @@ #include "prstlib/macros.h" -LOG_MODULE_REGISTER(shtc3, LOG_LEVEL_WRN); +LOG_MODULE_REGISTER(shtc3, CONFIG_CORE_LOG_LEVEL); static const struct i2c_dt_spec shtc3 = I2C_DT_SPEC_GET(DT_NODELABEL(shtc3));