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

Add a VREFBUF Driver Module to control the reference voltage.

parent dc309e52
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()
config OWNTECH_VREFBUF_DRIVER
bool "Enable OwnTech VREFBUF driver for STM32"
default y
name: owntech_vrefbuf_driver
build:
cmake: zephyr
kconfig: zephyr/Kconfig
/*
* Copyright (c) 2021 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
*/
/**
* @author Clément Foucher <clement.foucher@laas.fr>
*/
// Zephyr
#include <zephyr.h>
#include <device.h>
// STM32 LL
#include "stm32_ll_bus.h"
#include "stm32_ll_system.h"
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;
}
DEVICE_DEFINE(vrefbuf_driver,
"vrefbuf_driver",
vrefbuf_init,
device_pm_control_nop,
NULL,
NULL,
PRE_KERNEL_1,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
NULL
);
......@@ -45,3 +45,4 @@ CONFIG_ASSERT=y
#CONFIG_OWNTECH_LEG_DRIVER=n
#CONFIG_OWNTECH_NGND_DRIVER=n
#CONFIG_OWNTECH_DATA_ACQUISITION=n
#CONFIG_OWNTECH_VREFBUF_DRIVER=n
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