diff --git a/zephyr/boards/arm/owntech_board/dts/bindings/can-standby-switch.yaml b/zephyr/boards/arm/owntech_board/dts/bindings/gpio-device.yaml similarity index 65% rename from zephyr/boards/arm/owntech_board/dts/bindings/can-standby-switch.yaml rename to zephyr/boards/arm/owntech_board/dts/bindings/gpio-device.yaml index 09d96898b490e3cbfb03e5c13688df53c3aed8b5..3dd17d6501ad1127a4e1183e138f820d57fdaae1 100644 --- a/zephyr/boards/arm/owntech_board/dts/bindings/can-standby-switch.yaml +++ b/zephyr/boards/arm/owntech_board/dts/bindings/gpio-device.yaml @@ -1,11 +1,11 @@ -description: CAN Standby Switch +description: GPIO-controllable device -compatible: "can-standby-switch" +compatible: "gpio-device" child-binding: - description: CAN Stanby GPIO node + description: GPIO node properties: - can-standby-gpios: + gpios: type: phandle-array required: true label: diff --git a/zephyr/boards/arm/owntech_board/dts/bindings/ngnd-switch.yaml b/zephyr/boards/arm/owntech_board/dts/bindings/ngnd-switch.yaml deleted file mode 100644 index 59ffafc0721a8a7a6fee6ca026cf5aaa198e0753..0000000000000000000000000000000000000000 --- a/zephyr/boards/arm/owntech_board/dts/bindings/ngnd-switch.yaml +++ /dev/null @@ -1,14 +0,0 @@ -description: Neutral-Ground Switch - -compatible: "ngnd-switch" - -child-binding: - description: Neutral-Ground GPIO node - properties: - ngnd-gpios: - type: phandle-array - required: true - label: - required: true - type: string - description: Human readable string describing the device (used as device_get_binding() argument) diff --git a/zephyr/boards/arm/owntech_board/dts/can-standby-switch.dtsi b/zephyr/boards/arm/owntech_board/dts/can-standby-switch.dtsi index 7da3f815a0a7a5f2f2f2ca780aa38390ef3bf59f..5185624b0e4360c4aadb8bb2d9741e60ac87f601 100644 --- a/zephyr/boards/arm/owntech_board/dts/can-standby-switch.dtsi +++ b/zephyr/boards/arm/owntech_board/dts/can-standby-switch.dtsi @@ -6,10 +6,10 @@ / { can-standby-switch { - compatible = "can-standby-switch"; + compatible = "gpio-device"; label = "CAN_STANDBY"; can-standby-gpio-pin { - can-standby-gpios = <&gpiob 10 GPIO_ACTIVE_HIGH>; + gpios = <&gpiob 10 GPIO_ACTIVE_HIGH>; label = "CAN Standby output"; }; }; diff --git a/zephyr/boards/arm/owntech_board/dts/ngnd.dtsi b/zephyr/boards/arm/owntech_board/dts/ngnd.dtsi index 44a3852973eafea8972542549e2dc2dc9db4ba79..09a0e48370c5738b6270628233588310f1dee6b4 100644 --- a/zephyr/boards/arm/owntech_board/dts/ngnd.dtsi +++ b/zephyr/boards/arm/owntech_board/dts/ngnd.dtsi @@ -6,10 +6,10 @@ / { ngnd: ngnd-switch { - compatible = "ngnd-switch"; + compatible = "gpio-device"; label = "NGND"; ngnd-gpio-pin { - ngnd-gpios = <&gpiob 11 GPIO_ACTIVE_HIGH>; + gpios = <&gpiob 11 GPIO_ACTIVE_HIGH>; label = "Neutral to GND shunt"; }; }; diff --git a/zephyr/boards/arm/owntech_board/dts/pinctrl.dtsi b/zephyr/boards/arm/owntech_board/dts/pinctrl.dtsi index 9cdc791d00c63c6875ec50a5b9431e194f3884c4..421ef4f8b905a5ff4657c20a2dd5d237bd211a03 100644 --- a/zephyr/boards/arm/owntech_board/dts/pinctrl.dtsi +++ b/zephyr/boards/arm/owntech_board/dts/pinctrl.dtsi @@ -7,54 +7,6 @@ / { soc { pinctrl: pin-controller@48000000 { - hrtim1_cha1_pa8: hrtim1_cha1_pa8 { - pinmux = <STM32_PINMUX('A', 8, AF13)>; - }; - - hrtim1_cha2_pa9: hrtim1_cha2_pa9 { - pinmux = <STM32_PINMUX('A', 9, AF13)>; - }; - - hrtim1_chb1_pa10: hrtim1_chb1_pa10 { - pinmux = <STM32_PINMUX('A', 10, AF13)>; - }; - - hrtim1_chb2_pa11: hrtim1_chb2_pa11 { - pinmux = <STM32_PINMUX('A', 11, AF13)>; - }; - - hrtim1_chc1_pb12: hrtim1_chc1_pb12 { - pinmux = <STM32_PINMUX('B', 12, AF13)>; - }; - - hrtim1_chc2_pb13: hrtim1_chc2_pb13 { - pinmux = <STM32_PINMUX('B', 13, AF13)>; - }; - - hrtim1_chd1_pb14: hrtim1_chd1_pb14 { - pinmux = <STM32_PINMUX('B', 14, AF13)>; - }; - - hrtim1_chd2_pb15: hrtim1_chd2_pb15 { - pinmux = <STM32_PINMUX('B', 15, AF13)>; - }; - - hrtim1_che1_pc8: hrtim1_che1_pc8 { - pinmux = <STM32_PINMUX('C', 8, AF3)>; - }; - - hrtim1_che2_pc9: hrtim1_che2_pc9 { - pinmux = <STM32_PINMUX('C', 9, AF3)>; - }; - - hrtim1_chf1_pc6: hrtim1_chf1_pc6 { - pinmux = <STM32_PINMUX('C', 6, AF13)>; - }; - - hrtim1_chf2_pc7: hrtim1_chf2_pc7 { - pinmux = <STM32_PINMUX('C', 7, AF13)>; - }; - tim4_etr_pb3: tim4_etr_pb3 { pinmux = <STM32_PINMUX('B', 3, AF2)>; }; diff --git a/zephyr/modules/owntech_dac_driver/zephyr/CMakeLists.txt b/zephyr/modules/owntech_dac_driver/zephyr/CMakeLists.txt index ca08a948024dd87d061f6f76fca64797c5e3550d..b18b1ec40a820a45a6ac468a547d2e780730ff52 100644 --- a/zephyr/modules/owntech_dac_driver/zephyr/CMakeLists.txt +++ b/zephyr/modules/owntech_dac_driver/zephyr/CMakeLists.txt @@ -6,6 +6,5 @@ if(CONFIG_OWNTECH_DAC_DRIVER) # Select source files to be compiled zephyr_library_sources( ./src/stm32_dac_driver.c - ./src/owntech_dac_configure.c ) endif() diff --git a/zephyr/modules/owntech_dac_driver/zephyr/Kconfig b/zephyr/modules/owntech_dac_driver/zephyr/Kconfig index d1474cfc6de0de8f3486b92fed25adb2d5c6233d..cd7ea23434bb3c90138ba8281f7fcf77f1dcbd75 100644 --- a/zephyr/modules/owntech_dac_driver/zephyr/Kconfig +++ b/zephyr/modules/owntech_dac_driver/zephyr/Kconfig @@ -1,3 +1,4 @@ config OWNTECH_DAC_DRIVER bool "Enable OwnTech DAC driver" default y + depends on !DAC diff --git a/zephyr/modules/owntech_dac_driver/zephyr/public_include/dac.h b/zephyr/modules/owntech_dac_driver/zephyr/public_include/dac.h index cc1c8c6c48a599c30252e3ec73b440ab62200ce6..713f612777057076b17c59e561b0560cdba193c1 100644 --- a/zephyr/modules/owntech_dac_driver/zephyr/public_include/dac.h +++ b/zephyr/modules/owntech_dac_driver/zephyr/public_include/dac.h @@ -64,10 +64,10 @@ typedef struct uint32_t step_data; } dac_function_config_t; -typedef struct +typedef enum { - uint32_t pin_connect; - uint32_t pin_buffer_enable; + dac_pin_internal, + dac_pin_external } dac_pin_config_t; @@ -78,7 +78,7 @@ typedef void (*dac_api_setconstvalue) (const struct device* dev, uint8_t channel typedef void (*dac_api_setfunction) (const struct device* dev, uint8_t channel, const dac_function_config_t* config); typedef void (*dac_api_fn_upd_reset) (const struct device* dev, uint8_t channel, uint32_t reset_data); typedef void (*dac_api_fn_upd_step) (const struct device* dev, uint8_t channel, uint32_t step_data); -typedef void (*dac_api_pinconfigure) (const struct device* dev, uint8_t channel, const dac_pin_config_t* config); +typedef void (*dac_api_pinconfigure) (const struct device* dev, uint8_t channel, dac_pin_config_t config); typedef void (*dac_api_start) (const struct device* dev, uint8_t channel); typedef void (*dac_api_stop) (const struct device* dev, uint8_t channel); @@ -121,7 +121,7 @@ static inline void dac_function_update_step(const struct device* dev, uint8_t ch api->fn_upd_step(dev, channel, step_data); } -static inline void dac_pin_configure(const struct device* dev, uint8_t channel, const dac_pin_config_t* pin_config) +static inline void dac_pin_configure(const struct device* dev, uint8_t channel, dac_pin_config_t pin_config) { const struct dac_driver_api* api = (const struct dac_driver_api*)(dev->api); @@ -145,7 +145,6 @@ static inline void dac_stop(const struct device* dev, uint8_t channel) ///// // Owntech-specific config -void owntech_dac_dac2_constant_init(); void owntech_dac_dac1_dac3_current_mode_init(); diff --git a/zephyr/modules/owntech_dac_driver/zephyr/src/stm32_dac_driver.c b/zephyr/modules/owntech_dac_driver/zephyr/src/stm32_dac_driver.c index 43c4a42c9665d99404526813f2ef60a315b62a3f..d6005cab40e282943b86c75c8efd5af796756a77 100644 --- a/zephyr/modules/owntech_dac_driver/zephyr/src/stm32_dac_driver.c +++ b/zephyr/modules/owntech_dac_driver/zephyr/src/stm32_dac_driver.c @@ -183,14 +183,21 @@ static void dac_stm32_function_update_step(const struct device* dev, uint8_t cha } } -static void dac_stm32_pin_configure(const struct device* dev, uint8_t channel, const dac_pin_config_t* pin_config) +static void dac_stm32_pin_configure(const struct device* dev, uint8_t channel, dac_pin_config_t pin_config) { struct stm32_dac_driver_data* data = (struct stm32_dac_driver_data*)dev->data; DAC_TypeDef* dac_dev = data->dac_struct; uint8_t dac_channel = __LL_DAC_DECIMAL_NB_TO_CHANNEL(channel); - LL_DAC_ConfigOutput(dac_dev, dac_channel, LL_DAC_OUTPUT_MODE_NORMAL, pin_config->pin_buffer_enable, pin_config->pin_connect); + if (pin_config == dac_pin_internal) + { + LL_DAC_ConfigOutput(dac_dev, dac_channel, LL_DAC_OUTPUT_MODE_NORMAL, LL_DAC_OUTPUT_BUFFER_DISABLE, LL_DAC_OUTPUT_CONNECT_INTERNAL); + } + else if (pin_config == dac_pin_external) + { + LL_DAC_ConfigOutput(dac_dev, dac_channel, LL_DAC_OUTPUT_MODE_NORMAL, LL_DAC_OUTPUT_BUFFER_ENABLE, LL_DAC_OUTPUT_CONNECT_GPIO); + } } static void dac_stm32_start(const struct device* dev, uint8_t channel) diff --git a/zephyr/modules/owntech_dac_driver/zephyr/src/stm32_dac_driver.h b/zephyr/modules/owntech_dac_driver/zephyr/src/stm32_dac_driver.h index e467713c98d7652fd101dd9f19d9a44940f3d327..376473ade88f2216534540061efc99714f216546 100644 --- a/zephyr/modules/owntech_dac_driver/zephyr/src/stm32_dac_driver.h +++ b/zephyr/modules/owntech_dac_driver/zephyr/src/stm32_dac_driver.h @@ -50,7 +50,6 @@ typedef enum dac_mode_function } dac_mode_t; - struct stm32_dac_driver_data { DAC_TypeDef* dac_struct; @@ -70,7 +69,7 @@ static void dac_stm32_set_const_value(const struct device* dev, uint8_t channel, static void dac_stm32_set_function(const struct device* dev, uint8_t channel, const dac_function_config_t* function_config); static void dac_stm32_function_update_reset(const struct device* dev, uint8_t channel, uint32_t reset_data); static void dac_stm32_function_update_step(const struct device* dev, uint8_t channel, uint32_t step_data); -static void dac_stm32_pin_configure(const struct device* dev, uint8_t channel, const dac_pin_config_t* pin_config); +static void dac_stm32_pin_configure(const struct device* dev, uint8_t channel, dac_pin_config_t pin_config); static void dac_stm32_start(const struct device* dev, uint8_t channel); static void dac_stm32_stop(const struct device* dev, uint8_t channel); diff --git a/zephyr/modules/owntech_data_acquisition/zephyr/CMakeLists.txt b/zephyr/modules/owntech_data_acquisition/zephyr/CMakeLists.txt index 8856c5c64b47d6ba81e2f208a10a7abc16b89925..862d127ff2eb9c8cb9e21a564c7aae556a98d07b 100644 --- a/zephyr/modules/owntech_data_acquisition/zephyr/CMakeLists.txt +++ b/zephyr/modules/owntech_data_acquisition/zephyr/CMakeLists.txt @@ -1,8 +1,11 @@ - if(CONFIG_OWNTECH_DATA_ACQUISITION) + # Select directory to add to the include path zephyr_include_directories(./public_api) + # Define the current folder as a Zephyr library zephyr_library() + + # Select source files to be compiled zephyr_library_sources( ./adc/adc.c ./adc/adc_channels.c diff --git a/zephyr/modules/owntech_data_acquisition/zephyr/Kconfig b/zephyr/modules/owntech_data_acquisition/zephyr/Kconfig index 01b77a2495f2d7576f315748a1f3263c4cc1dea2..3265b02db714112491946641ac536139b693a11f 100644 --- a/zephyr/modules/owntech_data_acquisition/zephyr/Kconfig +++ b/zephyr/modules/owntech_data_acquisition/zephyr/Kconfig @@ -1,5 +1,5 @@ - config OWNTECH_DATA_ACQUISITION bool "Enable OwnTech data acquisition using ADCs" default y select DMA + depends on !ADC diff --git a/zephyr/modules/owntech_data_acquisition/zephyr/public_api/DataAcquisition.cpp b/zephyr/modules/owntech_data_acquisition/zephyr/public_api/DataAcquisition.cpp index f6be5a45868aaab7b0e83148a2f5c6cc80cc75b8..aac77f1bd8a88e2dcb40698221638ff2bd13d655 100644 --- a/zephyr/modules/owntech_data_acquisition/zephyr/public_api/DataAcquisition.cpp +++ b/zephyr/modules/owntech_data_acquisition/zephyr/public_api/DataAcquisition.cpp @@ -27,6 +27,9 @@ // Stdlib #include <string.h> +// STM32 LL +#include <stm32g4xx_ll_adc.h> + // OwnTech Power API #include "../adc/adc.h" #include "../dma/dma.h" @@ -67,8 +70,14 @@ void DataAcquisition::initialize() { if (initialized == 0) { + // Initialize the ADCs adc_init(); initialized = 1; + + // Perform default configration + configureAdcTriggerSource(1, hrtim1); + configureAdcTriggerSource(2, hrtim1); + configureAdcTriggerSource(3, software); } } @@ -115,7 +124,7 @@ void DataAcquisition::setChannnelAssignment(uint8_t adc_number, const char* cha ///// // Public static configuration functions -int8_t DataAcquisition::setAdc12DualMode(uint8_t dual_mode) +int8_t DataAcquisition::configureAdc12DualMode(uint8_t dual_mode) { ///// // Guard @@ -179,7 +188,7 @@ int8_t DataAcquisition::configureAdcChannels(uint8_t adc_number, const char* cha return NOERROR; } -int8_t DataAcquisition::configureAdcTriggerSource(uint8_t adc_number, uint32_t trigger_source) +int8_t DataAcquisition::configureAdcTriggerSource(uint8_t adc_number, adc_src_t trigger_source) { ///// // Guard @@ -199,12 +208,55 @@ int8_t DataAcquisition::configureAdcTriggerSource(uint8_t adc_number, uint32_t t ///// // Proceed + uint32_t trig; + switch (trigger_source) + { + case hrtim1: + trig = LL_ADC_REG_TRIG_EXT_HRTIM_TRG1; + break; + case software: + default: + trig = LL_ADC_REG_TRIG_SOFTWARE; + break; + } - adc_configure_trigger_source(adc_number, trigger_source); + adc_configure_trigger_source(adc_number, trig); return NOERROR; } +int8_t DataAcquisition::configureAdcDefaultAllMeasurements() +{ + uint8_t init_status; + + uint8_t number_of_channels_adc1 = 3; + uint8_t number_of_channels_adc2 = 3; + + const char* adc1_channels[] = + { + "V1_LOW", + "V2_LOW", + "V_HIGH" + }; + + const char* adc2_channels[] = + { + "I1_LOW", + "I2_LOW", + "I_HIGH" + }; + + init_status = dataAcquisition.configureAdcChannels(1, adc1_channels, number_of_channels_adc1); + + if (init_status != NOERROR) + { + return init_status; + } + + init_status = dataAcquisition.configureAdcChannels(2, adc2_channels, number_of_channels_adc2); + + return NOERROR; +} int8_t DataAcquisition::start() { diff --git a/zephyr/modules/owntech_data_acquisition/zephyr/public_api/DataAcquisition.h b/zephyr/modules/owntech_data_acquisition/zephyr/public_api/DataAcquisition.h index 65f0c41a0d22084b09aa159cf91d744bd16f6738..06a4722378123c20ec159ee2025c6147a5e19287 100644 --- a/zephyr/modules/owntech_data_acquisition/zephyr/public_api/DataAcquisition.h +++ b/zephyr/modules/owntech_data_acquisition/zephyr/public_api/DataAcquisition.h @@ -34,6 +34,15 @@ #include <arm_math.h> +///// +// Public enums +typedef enum +{ + hrtim1, + software +} adc_src_t; + + ///// // Static class definition @@ -56,21 +65,23 @@ public: /** * Use this function to set ADC 1 and ADC 2 in dual mode. + * By default, ADC 1 and 2 are not in dual mode. * - * This function must be called BEFORE DataAcquisition::start(). + * This function must be called BEFORE dataAcquisition.start(). * - * @param dual_mode Status of the dual mode: true to enable, - * false to disable. false by default. + * @param dual_mode Status of the dual mode: + * true to enable, + * false to disable. * @return 0 is everything went well, * EALREADYSTARTED if the module has already been started. */ - static int8_t setAdc12DualMode(uint8_t dual_mode); + static int8_t configureAdc12DualMode(uint8_t dual_mode); /** * This function is used to configure the channels to be * enabled on a given ADC. * - * This function must be called BEFORE DataAcquisition::start(). + * This function must be called BEFORE dataAcquisition.start(). * * @param adc_number Number of the ADC on which channel configuration is * to be done. @@ -88,19 +99,32 @@ public: static int8_t configureAdcChannels(uint8_t adc_number, const char* channel_list[], uint8_t channel_count); /** - * This function is used to configure the trigger source of an ADC. - * - * This function must be called BEFORE DataAcquisition::start(). + * This function is used to change the trigger source of an ADC. + * By default, triggger source for ADC 1 and ADC 2 is on HRTIM1, + * and ADC 3 is software-triggered. * - * TODO: Use an enumeration instead of LL constants for source. + * This function must be called BEFORE dataAcquisition.start(). * * @param adc_number Number of the ADC to configure - * @param trigger_source Source of the trigger as defined - * in stm32gxx_ll_adc.h (LL_ADC_REG_TRIG_***) + * @param trigger_source Source of the trigger + * @return 0 is everything went well, + * EALREADYSTARTED if the module has already been started. + */ + static int8_t configureAdcTriggerSource(uint8_t adc_number, adc_src_t trigger_source); + + /** + * This function is used to configure all ADC channels in default configuration. + * Channels will be attributed as follows: + * ADC1 - V1_LOW ADC2 - I1_LOW + * V2_LOW I2_LOW + * V_HIGH I_HIGH + * + * This function must be called BEFORE dataAcquisition.start(). + * * @return 0 is everything went well, * EALREADYSTARTED if the module has already been started. */ - static int8_t configureAdcTriggerSource(uint8_t adc_number, uint32_t trigger_source); + static int8_t configureAdcDefaultAllMeasurements(); /** * This functions starts the acquisition chain. It must be called diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/CMakeLists.txt b/zephyr/modules/owntech_hardware_configuration/zephyr/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..b525d58da4ed235810908b060320a35ea48f5312 --- /dev/null +++ b/zephyr/modules/owntech_hardware_configuration/zephyr/CMakeLists.txt @@ -0,0 +1,17 @@ +if(CONFIG_OWNTECH_HARDWARE_CONFIGURATION) + # Select directory to add to the include path + zephyr_include_directories(./public_api) + + # Define the current folder as a Zephyr library + zephyr_library() + + # Select source files to be compiled + zephyr_library_sources( + src/hardware_auto_configuration.cpp + src/dac_configuration.cpp + src/ngnd_configuration.cpp + src/led_configuration.cpp + src/timer_configuration.cpp + public_api/HardwareConfiguration.cpp + ) +endif() diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/Kconfig b/zephyr/modules/owntech_hardware_configuration/zephyr/Kconfig new file mode 100644 index 0000000000000000000000000000000000000000..579339337790720ca8dfa98f1cb7ed738d5c18a7 --- /dev/null +++ b/zephyr/modules/owntech_hardware_configuration/zephyr/Kconfig @@ -0,0 +1,6 @@ +config OWNTECH_HARDWARE_CONFIGURATION + bool "Enable OwnTech hardware configuration module" + default y + depends on OWNTECH_DAC_DRIVER + depends on OWNTECH_NGND_DRIVER + depends on OWNTECH_TIMER_DRIVER diff --git a/zephyr/modules/owntech_vrefbuf_driver/zephyr/module.yml b/zephyr/modules/owntech_hardware_configuration/zephyr/module.yml similarity index 56% rename from zephyr/modules/owntech_vrefbuf_driver/zephyr/module.yml rename to zephyr/modules/owntech_hardware_configuration/zephyr/module.yml index dd0020ef9423028d0f76952d6ce9d0df5b52879e..43a6a19951dc742f015b5066c0ca5b5d26dc0079 100644 --- a/zephyr/modules/owntech_vrefbuf_driver/zephyr/module.yml +++ b/zephyr/modules/owntech_hardware_configuration/zephyr/module.yml @@ -1,4 +1,4 @@ -name: owntech_vrefbuf_driver +name: owntech_hardware_configuration build: cmake: zephyr kconfig: zephyr/Kconfig diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/public_api/HardwareConfiguration.cpp b/zephyr/modules/owntech_hardware_configuration/zephyr/public_api/HardwareConfiguration.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6c76638af51755670a1113b3d7df93a33b82b0d7 --- /dev/null +++ b/zephyr/modules/owntech_hardware_configuration/zephyr/public_api/HardwareConfiguration.cpp @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2022 LAAS-CNRS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGLPV2.1 + */ + +/** + * @date 2022 + * @author Clément Foucher <clement.foucher@laas.fr> + */ + + +// OwnTech headers +#include "../src/dac_configuration.h" +#include "../src/ngnd_configuration.h" +#include "../src/led_configuration.h" +#include "../src/timer_configuration.h" + +// Current class header +#include "HardwareConfiguration.h" + + +///// +// Public object to interact with the class + +HardwareConfiguration hwConfig; + + +///// +// Public static configuration functions + + +///// +// DAC + +void HardwareConfiguration::initDac1Dac3CurrentMode() +{ + dac_config_dac1_dac3_current_mode_init(); +} + + +///// +// NGND + +void HardwareConfiguration::setNgndOn() +{ + ngnd_config_on(); +} + +void HardwareConfiguration::setNgndOff() +{ + ngnd_config_off(); +} + +///// +// LED + +void HardwareConfiguration::setLedOn() +{ + led_config_on(); +} + +void HardwareConfiguration::setLedOff() +{ + led_config_off(); +} + +void HardwareConfiguration::setLedToggle() +{ + led_config_toggle(); +} + +// Incremental encoder + +void HardwareConfiguration::startLoggingIncrementalEncoder() +{ + timer_incremental_encoder_tim4_start(); +} + +uint32_t HardwareConfiguration::getIncrementalEncoderValue() +{ + return timer_incremental_encoder_tim4_get_step(); +} diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/public_api/HardwareConfiguration.h b/zephyr/modules/owntech_hardware_configuration/zephyr/public_api/HardwareConfiguration.h new file mode 100644 index 0000000000000000000000000000000000000000..d3935362babea753ced973532f8046f64bd7e5e7 --- /dev/null +++ b/zephyr/modules/owntech_hardware_configuration/zephyr/public_api/HardwareConfiguration.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 LAAS-CNRS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGLPV2.1 + */ + +/** + * @date 2022 + * @author Clément Foucher <clement.foucher@laas.fr> + */ + + +#ifndef HARDWARECONFIGURATION_H_ +#define HARDWARECONFIGURATION_H_ + + +#include <stdint.h> + + +///// +// Static class definition + +class HardwareConfiguration +{ + +public: + // DAC + void initDac1Dac3CurrentMode(); + + // NGND + void setNgndOn(); + void setNgndOff(); + + // LED + void setLedOn(); + void setLedOff(); + void setLedToggle(); + + // Incremental encoder + void startLoggingIncrementalEncoder(); + uint32_t getIncrementalEncoderValue(); + +}; + + +///// +// Public object to interact with the class + +extern HardwareConfiguration hwConfig; + + + +#endif // HARDWARECONFIGURATION_H_ diff --git a/zephyr/modules/owntech_dac_driver/zephyr/src/owntech_dac_configure.c b/zephyr/modules/owntech_hardware_configuration/zephyr/src/dac_configuration.cpp similarity index 69% rename from zephyr/modules/owntech_dac_driver/zephyr/src/owntech_dac_configure.c rename to zephyr/modules/owntech_hardware_configuration/zephyr/src/dac_configuration.cpp index c7311016cc60606a63a93577149e1d16adc88e1e..cf19771e85ebb9f9e0f4521d821ba5a2d91e0e7d 100644 --- a/zephyr/modules/owntech_dac_driver/zephyr/src/owntech_dac_configure.c +++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/dac_configuration.cpp @@ -19,7 +19,6 @@ /** * @date 2022 - * * @author Clément Foucher <clement.foucher@laas.fr> */ @@ -34,24 +33,8 @@ #include "dac.h" -// TODO: this function must *always* be run. -// Write a driver to load on startup without user action? -void owntech_dac_dac2_constant_init() -{ - const struct device* dac2 = device_get_binding(DAC2_DEVICE); - - dac_pin_config_t pin_config = - { - .pin_connect = LL_DAC_OUTPUT_CONNECT_GPIO, - .pin_buffer_enable = LL_DAC_OUTPUT_BUFFER_ENABLE - }; - - dac_set_const_value(dac2, 1, 2048U); - dac_pin_configure(dac2, 1, &pin_config); - dac_start(dac2, 1); -} -void owntech_dac_dac1_dac3_current_mode_init() +void dac_config_dac1_dac3_current_mode_init() { const struct device* dac1 = device_get_binding(DAC1_DEVICE); const struct device* dac3 = device_get_binding(DAC3_DEVICE); @@ -66,15 +49,9 @@ void owntech_dac_dac1_dac3_current_mode_init() .step_data = 200 }; - dac_pin_config_t pin_config = - { - .pin_connect = LL_DAC_OUTPUT_CONNECT_INTERNAL, - .pin_buffer_enable = LL_DAC_OUTPUT_BUFFER_DISABLE - }; - // DAC 1 dac_set_function(dac1, 1, &function_config); - dac_pin_configure(dac1, 1, &pin_config); + dac_pin_configure(dac1, 1, dac_pin_internal); dac_start(dac1, 1); // DAC 3 @@ -82,6 +59,6 @@ void owntech_dac_dac1_dac3_current_mode_init() function_config.step_trigger_source = LL_DAC_TRIG_EXT_HRTIM_STEP_TRG2; dac_set_function(dac3, 1, &function_config); - dac_pin_configure(dac3, 1, &pin_config); + dac_pin_configure(dac3, 1, dac_pin_internal); dac_start(dac3, 1); } diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/dac_configuration.h b/zephyr/modules/owntech_hardware_configuration/zephyr/src/dac_configuration.h new file mode 100644 index 0000000000000000000000000000000000000000..fcd827ec0f47c56a868dec40c01c0cc2fb441270 --- /dev/null +++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/dac_configuration.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2022 LAAS-CNRS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGLPV2.1 + */ + +/** + * @date 2022 + * @author Clément Foucher <clement.foucher@laas.fr> + */ + + +#ifndef DAC_CONFIGURATION_H_ +#define DAC_CONFIGURATION_H_ + + +void dac_config_dac1_dac3_current_mode_init(); + + +#endif // DAC_CONFIGURATION_H_ diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/hardware_auto_configuration.cpp b/zephyr/modules/owntech_hardware_configuration/zephyr/src/hardware_auto_configuration.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d9167c8dbd1c3ea6257da3341f93bcccc8faa318 --- /dev/null +++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/hardware_auto_configuration.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2022 LAAS-CNRS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGLPV2.1 + */ + +/** + * @date 2022 + * @author Clément Foucher <clement.foucher@laas.fr> + * + * @brief This file automatically performs some hardware configuration + * using Zephyr macros. + * Configuration done in this file is low-level peripheral configuration + * required for OwnTech board to operate, do not mess with it unless you + * are absolutely sure of what you're doing. + * This file does not contain any public function. + */ + + +// Zephyr +#include <zephyr.h> +#include <device.h> + +// STM32 LL +#include <stm32_ll_bus.h> +#include <stm32_ll_system.h> + +// Owntech driver +#include "dac.h" + + +///// +// Functions to be run + +static int _vrefbuf_init(const struct device* dev) +{ + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SYSCFG); + LL_VREFBUF_SetVoltageScaling(LL_VREFBUF_VOLTAGE_SCALE0); + LL_VREFBUF_DisableHIZ(); + LL_VREFBUF_Enable(); + + return 0; +} + +static int _dac2_init(const struct device* dev) +{ + const struct device* dac2 = device_get_binding(DAC2_DEVICE); + + dac_set_const_value(dac2, 1, 2048U); + dac_pin_configure(dac2, 1, dac_pin_external); + dac_start(dac2, 1); + + return 0; +} + + +///// +// Zephyr macros to automatically run above functions + +SYS_INIT(_vrefbuf_init, + PRE_KERNEL_1, // To be run in the first init phase + CONFIG_KERNEL_INIT_PRIORITY_DEVICE + ); + +SYS_INIT(_dac2_init, + PRE_KERNEL_2, // To be run in the second init phase (depends on DAC driver initialization) + CONFIG_KERNEL_INIT_PRIORITY_DEVICE + ); diff --git a/zephyr/modules/owntech_vrefbuf_driver/zephyr/src/vrefbuf_driver.c b/zephyr/modules/owntech_hardware_configuration/zephyr/src/led_configuration.cpp similarity index 52% rename from zephyr/modules/owntech_vrefbuf_driver/zephyr/src/vrefbuf_driver.c rename to zephyr/modules/owntech_hardware_configuration/zephyr/src/led_configuration.cpp index c2064ae86240e568494e2413f479b756cbbacb81..cc637d854a9ec27c644b1c7963cb5cef3a66a410 100644 --- a/zephyr/modules/owntech_vrefbuf_driver/zephyr/src/vrefbuf_driver.c +++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/led_configuration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 LAAS-CNRS + * Copyright (c) 2022 LAAS-CNRS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -18,36 +18,52 @@ */ /** - * @author Clément Foucher <clement.foucher@laas.fr> + * @date 2022 + * @author Clément Foucher <clement.foucher@laas.fr> */ // Zephyr -#include <zephyr.h> -#include <device.h> +#include "zephyr.h" +#include "drivers/gpio.h" -// STM32 LL -#include "stm32_ll_bus.h" -#include "stm32_ll_system.h" +static struct gpio_dt_spec led_pin_spec = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios); +static bool init = false; -static int vrefbuf_init(const struct device* dev) + +void led_config_init() +{ + gpio_pin_configure_dt(&led_pin_spec, GPIO_OUTPUT_ACTIVE); + init = true; +} + +void led_config_on() { - LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SYSCFG); - LL_VREFBUF_SetVoltageScaling(LL_VREFBUF_VOLTAGE_SCALE0); - LL_VREFBUF_DisableHIZ(); - LL_VREFBUF_Enable(); + if (init == false) + { + led_config_init(); + } - return 0; + gpio_pin_set_dt(&led_pin_spec, 1); } -DEVICE_DEFINE(vrefbuf_driver, - "vrefbuf_driver", - vrefbuf_init, - NULL, - NULL, - NULL, - PRE_KERNEL_1, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - NULL - ); +void led_config_off() +{ + if (init == false) + { + led_config_init(); + } + + gpio_pin_set_dt(&led_pin_spec, 0); +} + +void led_config_toggle() +{ + if (init == false) + { + led_config_init(); + } + + gpio_pin_toggle_dt(&led_pin_spec); +} diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/led_configuration.h b/zephyr/modules/owntech_hardware_configuration/zephyr/src/led_configuration.h new file mode 100644 index 0000000000000000000000000000000000000000..17e65a7e0dd0f6bf33ed4dd511d04577d3e900cc --- /dev/null +++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/led_configuration.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2022 LAAS-CNRS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGLPV2.1 + */ + +/** + * @date 2022 + * @author Clément Foucher <clement.foucher@laas.fr> + */ + + +#ifndef LED_CONFIGURATION_H_ +#define LED_CONFIGURATION_H_ + + +void led_config_on(); +void led_config_off(); +void led_config_toggle(); + + +#endif // LED_CONFIGURATION_H_ diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/ngnd_configuration.cpp b/zephyr/modules/owntech_hardware_configuration/zephyr/src/ngnd_configuration.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0d6efc6f4dca24ad1930a5c50a8ec30f2f3ef9db --- /dev/null +++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/ngnd_configuration.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022 LAAS-CNRS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGLPV2.1 + */ + +/** + * @date 2022 + * @author Clément Foucher <clement.foucher@laas.fr> + */ + + +#include "ngnd.h" + +static const struct device* ngnd_switch = nullptr; + + +void ngnd_config_on() +{ + if (ngnd_switch == NULL) + { + ngnd_switch = device_get_binding(NGND_DEVICE); + } + + ngnd_set(ngnd_switch, 1); +} + +void ngnd_config_off() +{ + if (ngnd_switch == NULL) + { + ngnd_switch = device_get_binding(NGND_DEVICE); + } + + ngnd_set(ngnd_switch, 0); +} diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/ngnd_configuration.h b/zephyr/modules/owntech_hardware_configuration/zephyr/src/ngnd_configuration.h new file mode 100644 index 0000000000000000000000000000000000000000..4fb272685117ac87026c3b62d29e8deb47e2c65a --- /dev/null +++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/ngnd_configuration.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2022 LAAS-CNRS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGLPV2.1 + */ + +/** + * @date 2022 + * @author Clément Foucher <clement.foucher@laas.fr> + */ + + +#ifndef NGND_CONFIGURATION_H_ +#define NGND_CONFIGURATION_H_ + + +void ngnd_config_on(); +void ngnd_config_off(); + + +#endif // NGND_CONFIGURATION_H_ diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/timer_configuration.cpp b/zephyr/modules/owntech_hardware_configuration/zephyr/src/timer_configuration.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3fa04a63458741dd7ba823f208805db0fbaac4f3 --- /dev/null +++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/timer_configuration.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2022 LAAS-CNRS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGLPV2.1 + */ + +/** + * @date 2022 + * @author Clément Foucher <clement.foucher@laas.fr> + */ + +#include "timer.h" + + +static const struct device* timer4 = NULL; + +static bool timer4init = false; +static bool timer4started = false; + + +static void _timer_incremental_encoder_tim4_init() +{ + // Configure timer + timer4 = device_get_binding(TIMER4_DEVICE); + struct timer_config_t timer_cfg = + { + .timer_enable_irq = 0, + .timer_enable_encoder = 1, + .timer_enc_pin_mode = pull_up + + }; + timer_config(timer4, &timer_cfg); + timer4init = true; +} + +void timer_incremental_encoder_tim4_start() +{ + if (timer4init == false) + { + _timer_incremental_encoder_tim4_init(); + } + + if (timer4started == false) + { + timer_start(timer4); + timer4started = true; + } +} + +uint32_t timer_incremental_encoder_tim4_get_step() +{ + if (timer4started == true) + { + return timer_get_count(timer4); + } + else + { + return 0; + } +} diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/timer_configuration.h b/zephyr/modules/owntech_hardware_configuration/zephyr/src/timer_configuration.h new file mode 100644 index 0000000000000000000000000000000000000000..f29360d28f5db1f3b0db51b9ff18218f9f33e619 --- /dev/null +++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/timer_configuration.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022 LAAS-CNRS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGLPV2.1 + */ + +/** + * @date 2022 + * @author Clément Foucher <clement.foucher@laas.fr> + */ + + +#ifndef TIMER_CONFIGURATION_H_ +#define TIMER_CONFIGURATION_H_ + + +#include <stdint.h> + + +/** + * @brief Launches the timer4 which is adapted for reading an encoder. + */ +void timer_incremental_encoder_tim4_start(); + +/** + * @brief Gets the encoder step value. + * @return An uint32 value of the counter which corresponds to the step of the system. + */ +uint32_t timer_incremental_encoder_tim4_get_step(); + + +#endif // TIMER_CONFIGURATION_H_ diff --git a/zephyr/modules/owntech_ngnd_driver/zephyr/src/owntech_ngnd_driver.c b/zephyr/modules/owntech_ngnd_driver/zephyr/src/owntech_ngnd_driver.c index aef47a04f81eecf7259bdaf05f337cd4859526ae..d8271af88a294622f249e11ca23e78460064c470 100644 --- a/zephyr/modules/owntech_ngnd_driver/zephyr/src/owntech_ngnd_driver.c +++ b/zephyr/modules/owntech_ngnd_driver/zephyr/src/owntech_ngnd_driver.c @@ -44,7 +44,7 @@ static int ngnd_init(const struct device* dev) { struct owntech_ngnd_driver_dev_data* data = dev->data; - const struct gpio_dt_spec ngnd_spec = GPIO_DT_SPEC_GET(DT_CHILD(NGND_NODE, ngnd_gpio_pin), ngnd_gpios); + const struct gpio_dt_spec ngnd_spec = GPIO_DT_SPEC_GET(DT_CHILD(NGND_NODE, ngnd_gpio_pin), gpios); data->ngnd_pin_spec = ngnd_spec; gpio_pin_configure_dt(&data->ngnd_pin_spec, GPIO_OUTPUT_ACTIVE); diff --git a/zephyr/modules/owntech_vrefbuf_driver/zephyr/CMakeLists.txt b/zephyr/modules/owntech_vrefbuf_driver/zephyr/CMakeLists.txt deleted file mode 100644 index 0fd815f5eae4ca6c0904e08ee54d9a7ec905af38..0000000000000000000000000000000000000000 --- a/zephyr/modules/owntech_vrefbuf_driver/zephyr/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -if(CONFIG_OWNTECH_VREFBUF_DRIVER) - # Define the current folder as a Zephyr library - zephyr_library() - # Select source files to be compiled - zephyr_library_sources( - ./src/vrefbuf_driver.c - ) -endif() diff --git a/zephyr/modules/owntech_vrefbuf_driver/zephyr/Kconfig b/zephyr/modules/owntech_vrefbuf_driver/zephyr/Kconfig deleted file mode 100644 index a633c2283d1e03d643410331f7070ee6542c2322..0000000000000000000000000000000000000000 --- a/zephyr/modules/owntech_vrefbuf_driver/zephyr/Kconfig +++ /dev/null @@ -1,3 +0,0 @@ -config OWNTECH_VREFBUF_DRIVER - bool "Enable OwnTech VREFBUF driver for STM32" - default y diff --git a/zephyr/prj.conf b/zephyr/prj.conf index 0e06f53c304b4310198364daf95654f368af9616..0ae42f98b683a9a9a383d8b34e9ff8947cc305f3 100644 --- a/zephyr/prj.conf +++ b/zephyr/prj.conf @@ -36,6 +36,6 @@ CONFIG_ASSERT=y #CONFIG_OWNTECH_HRTIM_DRIVER=n #CONFIG_OWNTECH_NGND_DRIVER=n #CONFIG_OWNTECH_DATA_ACQUISITION=n -#CONFIG_OWNTECH_VREFBUF_DRIVER=n #CONFIG_OWNTECH_DAC_DRIVER=n #CONFIG_OWNTECH_COMPARATOR_DRIVER=n +#OWNTECH_HARDWARE_CONFIGURATION=n