Commit e83f7bcf authored by Clément Foucher's avatar Clément Foucher
Browse files

Update comparator module structure.

parent 710731d0
if(CONFIG_OWNTECH_COMPARATOR_DRIVER)
# Select directory to add to the include path
zephyr_include_directories(./public_include)
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/comparator_driver.c
./public_api/comparator.c
)
endif()
/*
* 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>
*/
// Current module private functions
#include "../src/comparator_driver.h"
void comparator_init()
{
comparator_gpio_init();
comparator_comp1_init();
comparator_comp3_init();
}
/*
* Copyright (c) 2021 LAAS-CNRS
* Copyright (c) 2021-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,7 +18,8 @@
*/
/**
* @author Clément Foucher <clement.foucher@laas.fr>
* @date 2022
* @author Clément Foucher <clement.foucher@laas.fr>
*/
......@@ -34,15 +35,7 @@
#include "comparator_driver.h"
void comparator_init()
{
_comparator_gpio_init();
_comparator_comp1_init();
_comparator_comp3_init();
}
static void _comparator_gpio_init()
void comparator_gpio_init()
{
// TODO : use Zephyr gpio_pin_configure
......@@ -68,7 +61,7 @@ static void _comparator_gpio_init()
LL_GPIO_SetPinMode(GPIOC, LL_GPIO_PIN_1, LL_GPIO_MODE_ANALOG);
}
static void _comparator_comp1_init()
void comparator_comp1_init()
{
LL_COMP_ConfigInputs(COMP1, LL_COMP_INPUT_MINUS_DAC1_CH1, LL_COMP_INPUT_PLUS_IO1);
LL_COMP_SetInputHysteresis(COMP1, LL_COMP_HYSTERESIS_NONE);
......@@ -83,7 +76,7 @@ static void _comparator_comp1_init()
LL_COMP_Enable(COMP1);
}
static void _comparator_comp3_init()
void comparator_comp3_init()
{
LL_COMP_ConfigInputs(COMP3, LL_COMP_INPUT_MINUS_DAC3_CH1, LL_COMP_INPUT_PLUS_IO2);
LL_COMP_SetInputHysteresis(COMP3, LL_COMP_HYSTERESIS_NONE);
......
/*
* Copyright (c) 2021 LAAS-CNRS
* Copyright (c) 2021-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,7 +18,8 @@
*/
/**
* @author Clément Foucher <clement.foucher@laas.fr>
* @date 2022
* @author Clément Foucher <clement.foucher@laas.fr>
*/
#ifndef COMPARATOR_DRIVER_H_
......@@ -28,9 +29,9 @@
extern "C" {
#endif
static void _comparator_comp1_init();
static void _comparator_comp3_init();
static void _comparator_gpio_init();
void comparator_comp1_init();
void comparator_comp3_init();
void comparator_gpio_init();
#ifdef __cplusplus
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment