Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Luiz Fernando Lavado Villa
Core
Commits
8d1d1274
Commit
8d1d1274
authored
Jul 23, 2021
by
Luiz-Fernando Lavado-Villa
Browse files
Added a module for the opamp3
parent
14a7fb7c
Changes
10
Hide whitespace changes
Inline
Side-by-side
zephyr/dts/bindings/opamp3-gpio.yaml
0 → 100644
View file @
8d1d1274
description
:
GPIO parent node
compatible
:
"
opamp3-gpio"
child-binding
:
description
:
OPAMP3 GPIO child node
properties
:
gpios
:
type
:
phandle-array
required
:
true
label
:
required
:
true
type
:
string
description
:
Human readable string describing the device (used as device_get_binding() argument)
zephyr/dts/opamp3.dtsi
0 → 100644
View file @
8d1d1274
/ {
opamp3-gpio {
compatible = "opamp3-gpio";
opamp3: op_amp3 {
gpios = <&gpiob 1 GPIO_ACTIVE_LOW >;
label = "OPAMP3";
};
};
aliases {
opamp3 = &opamp3;
};
};
\ No newline at end of file
zephyr/modules/owntech_opamp3_driver/zephyr/CMakeLists.txt
0 → 100644
View file @
8d1d1274
if
(
CONFIG_OWNTECH_OPAMP3_DRIVER
)
# Select directory to add to the include path
zephyr_include_directories
(
./public_include
)
# Define the current folder as a Zephyr library
zephyr_library
()
# Select source files to be compiled
zephyr_library_sources
(
src/owntech_opamp3_driver.c
)
endif
()
zephyr/modules/owntech_opamp3_driver/zephyr/Kconfig
0 → 100644
View file @
8d1d1274
config OWNTECH_OPAMP3_DRIVER
bool "Enable OwnTech opamp3 driver"
default y
zephyr/modules/owntech_opamp3_driver/zephyr/module.yml
0 → 100644
View file @
8d1d1274
name
:
owntech_opamp3_driver
build
:
cmake
:
zephyr
kconfig
:
zephyr/Kconfig
zephyr/modules/owntech_opamp3_driver/zephyr/public_include/opamp3.h
0 → 100644
View file @
8d1d1274
/*
* Copyright (c) 2020-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
*/
/**
* @brief Zephyr's defines for an opamp (PB1)
* @date 2021
* @author Luiz Villa <luiz.villa@laas.fr>
*/
#ifndef OPAMP3_H_
#define OPAMP3_H_
#ifdef __cplusplus
extern
"C"
{
#endif
#define OPAMP3_LABEL "OPAMP3"
void
opamp3_set
(
const
struct
device
*
dev
,
int
value
);
#ifdef __cplusplus
}
#endif
#endif // NGND_H_
zephyr/modules/owntech_opamp3_driver/zephyr/src/owntech_opamp3_driver.c
0 → 100644
View file @
8d1d1274
/*
* Copyright (c) 2020-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
*/
/**
* @brief Owntech board neutral to ground gpio pin implementation
*
* @author Clément Foucher <clement.foucher@laas.fr>
*/
// Zephyr
#include <drivers/gpio.h>
// Current file header
#include "owntech_opamp3_driver.h"
/////
// Private functions
static
struct
owntech_opamp3_driver_dev_data
{
const
struct
device
*
gpio_dev
;
}
data
;
static
int
opamp3_init
(
const
struct
device
*
dev
)
{
struct
owntech_opamp3_driver_dev_data
*
data
=
dev
->
data
;
data
->
gpio_dev
=
device_get_binding
(
OPAMP3_GPIO_LABEL
);
gpio_pin_configure
(
data
->
gpio_dev
,
OPAMP3_GPIO_PIN
,
GPIO_PUSH_PULL
|
OPAMP3_GPIO_FLAGS
);
OPAMP_InitStruct
.
PowerMode
=
LL_OPAMP_POWERMODE_NORMAL
;
OPAMP_InitStruct
.
FunctionalMode
=
LL_OPAMP_MODE_FOLLOWER
;
OPAMP_InitStruct
.
InputNonInverting
=
LL_OPAMP_INPUT_NONINVERT_DAC
;
//LL_OPAMP_StructInit(&OPAMP_InitStruct);
LL_OPAMP_SetInputsMuxMode
(
OPAMP3
,
LL_OPAMP_INPUT_MUX_DISABLE
);
LL_OPAMP_SetInternalOutput
(
OPAMP3
,
LL_OPAMP_INTERNAL_OUPUT_DISABLED
);
LL_OPAMP_SetTrimmingMode
(
OPAMP3
,
LL_OPAMP_TRIMMING_FACTORY
);
//LL_OPAMP_Init(OPAMP3, &OPAMP_InitStruct);// need to set the LL correctly
return
0
;
}
//////
// Device definition
DEVICE_DEFINE
(
owntech_opamp3_driver
,
OPAMP3_LABEL
,
opamp3_init
,
device_pm_control_nop
,
&
data
,
NULL
,
PRE_KERNEL_2
,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE
,
NULL
);
zephyr/modules/owntech_opamp3_driver/zephyr/src/owntech_opamp3_driver.h
0 → 100644
View file @
8d1d1274
/*
* 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>
*/
#ifndef OWNTECH_OPAMP3_DRIVER_H_
#define OWNTECH_OPAMP3_DRIVER_H_
// Public header
#include "opamp3.h"
#include "stm32_ll_opamp.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#define OPAMP3_GPIO_NODE DT_ALIAS(opamp3)
#define OPAMP3_GPIO_LABEL DT_GPIO_LABEL(OPAMP3_GPIO_NODE, gpios)
#define OPAMP3_GPIO_PIN DT_GPIO_PIN(OPAMP3_GPIO_NODE, gpios)
#define OPAMP3_GPIO_FLAGS DT_GPIO_FLAGS(OPAMP3_GPIO_NODE, gpios)
static
int
opamp3_init
(
const
struct
device
*
dev
);
static
LL_OPAMP_InitTypeDef
OPAMP_InitStruct
=
{
0
};
#ifdef __cplusplus
}
#endif
#endif // OWNTECH_NGND_DRIVER_H_
zephyr/nucleo_g474re.overlay
View file @
8d1d1274
#include "dts/hrtim.dtsi"
#include "dts/adc-channels.dtsi"
#include "dts/ngnd.dtsi"
#include "dts/opamp3.dtsi"
/*******/
/* ADC */
...
...
zephyr/prj.conf
View file @
8d1d1274
...
...
@@ -47,3 +47,4 @@ CONFIG_ASSERT=y
#CONFIG_OWNTECH_VREFBUF_DRIVER=n
#CONFIG_OWNTECH_DAC_DRIVER=n
#CONFIG_OWNTECH_COMPARATOR_DRIVER=n
#CONFIG_OWNTECH_OPAMP3_DRIVER=n
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment