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
572bacba
Commit
572bacba
authored
Jul 13, 2021
by
Clément Foucher
Browse files
Reorganized Hrtim Module to prepare for two different modes.
Leg Module merged with Hrtim Module voltage mode.
parent
e48bb87b
Changes
13
Hide whitespace changes
Inline
Side-by-side
zephyr/modules/owntech_hrtim_driver/zephyr/CMakeLists.txt
View file @
572bacba
if
(
CONFIG_OWNTECH_HRTIM_DRIVER
)
zephyr_include_directories
(
.
)
# 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
(
owntech_hrtim_driver.c
./src/voltage_mode/hrtim_voltage_mode.c
./src/voltage_mode/owntech_leg_driver.cpp
./src/hrtim_common.c
)
endif
()
zephyr/modules/owntech_hrtim_driver/zephyr/Kconfig
View file @
572bacba
config OWNTECH_HRTIM_DRIVER
bool "Enable OwnTech
hr
tim driver"
bool "Enable OwnTech
High-resolution
tim
er
driver
for STM32
"
default y
zephyr/modules/owntech_hrtim_driver/zephyr/public_include/hrtim.h
0 → 100644
View file @
572bacba
/*
* 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 HRTIM_H_
#define HRTIM_H_
#include <stdint.h>
#ifdef __cplusplus
extern
"C"
{
#endif
/**
* @brief HRTIM have 5 or 6 timing units
*/
#ifdef HRTIM_MCR_TFCEN
#define HRTIM_STU_NUMOF (6U)
/**< number of slave timing units */
#else
#define HRTIM_STU_NUMOF (5U)
#endif
/**
* @brief Default HRTIM type definition
*/
#ifndef HAVE_HRTIM_T
typedef
unsigned
int
hrtim_t
;
#endif
/**
* @brief HRTIM timing units definition
*/
typedef
enum
{
TIMA
,
TIMB
,
TIMC
,
TIMD
,
TIME
,
#if (HRTIM_STU_NUMOF == 6)
TIMF
,
#endif
MSTR
}
hrtim_tu_t
;
/**
* @brief Set the duty-cycle, dead-time and phase shift for a given
* timing unit of a given HRTIM device
*
* @param[in] dev HRTIM device
* @param[in] tu Timing unit
* @param[in] value Duty cycle
* @param[in] shift Phase shifting
*/
void
hrtim_pwm_set
(
hrtim_t
dev
,
hrtim_tu_t
tu
,
uint16_t
value
,
uint16_t
shift
);
void
hrtim_init_voltage
();
#ifdef __cplusplus
}
#endif
#endif // HRTIM_H_
zephyr/modules/owntech_
leg
_driver/zephyr/leg.h
→
zephyr/modules/owntech_
hrtim
_driver/zephyr/
public_include/
leg.h
View file @
572bacba
...
...
@@ -31,10 +31,13 @@
* @author Antoine Boche <antoine.boche@laas.fr>
*/
#ifndef LEG_H
#define LEG_H
#ifndef LEG_H
_
#define LEG_H
_
#include <assert.h>
#include <stdint.h>
#include <zephyr.h>
#include "hrtim.h"
...
...
@@ -114,5 +117,4 @@ uint16_t leg_get_freq(void);
}
#endif
#endif
/* LEG_H */
/** @} */
#endif // LEG_H_
zephyr/modules/owntech_hrtim_driver/zephyr/src/hrtim_common.c
0 → 100644
View file @
572bacba
/*
* 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>
*/
#include "voltage_mode/hrtim_voltage_mode.h"
#include "leg.h"
void
hrtim_init_voltage
()
{
leg_init
(
true
);
hrtim_adc_trigger_en
(
0
,
ADC1R
,
AD13_TAC3
);
hrtim_cmp_set
(
0
,
TIMA
,
CMP3xR
,
1
);
}
zephyr/modules/owntech_hrtim_driver/zephyr/
owntech_hrtim_driver
.c
→
zephyr/modules/owntech_hrtim_driver/zephyr/
src/voltage_mode/hrtim_voltage_mode
.c
View file @
572bacba
...
...
@@ -29,7 +29,7 @@
* @author Antoine Boche <antoine.boche@laas.fr>
*/
#include "hrtim.h"
#include "hrtim
_voltage_mode
.h"
#include "assert.h"
static
const
struct
soc_gpio_pinctrl
tim_pinctrl
[]
=
ST_STM32_DT_INST_PINCTRL
(
0
,
0
);
...
...
zephyr/modules/owntech_hrtim_driver/zephyr/
hrtim
.h
→
zephyr/modules/owntech_hrtim_driver/zephyr/
src/voltage_mode/hrtim_voltage_mode
.h
View file @
572bacba
...
...
@@ -30,26 +30,20 @@
* @author Antoine Boche <antoine.boche@laas.fr>
*/
#ifndef HRTIM_
H
#define HRTIM_
H
#ifndef HRTIM_
VOLTAGE_MODE_H_
#define HRTIM_
VOLTAGE_MODE_H_
#include <stdint.h>
#include <limits.h>
#include <pinmux/stm32/pinmux_stm32.h>
#include <hrtim.h>
#ifdef __cplusplus
extern
"C"
{
#endif
/**
* @brief HRTIM have 5 or 6 timing units
*/
#ifdef HRTIM_MCR_TFCEN
#define HRTIM_STU_NUMOF (6U)
/**< number of slave timing units */
#else
#define HRTIM_STU_NUMOF (5U)
#endif
#define DT_DRV_COMPAT hrtim
#define CLOCK_APB2 (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC / CONFIG_CLOCK_STM32_APB2_PRESCALER)
...
...
@@ -69,13 +63,6 @@ extern "C" {
#define HRTIM_UNDEF (UINT_MAX)
#endif
/**
* @brief Default HRTIM type definition
*/
#ifndef HAVE_HRTIM_T
typedef
unsigned
int
hrtim_t
;
#endif
/**
* @brief HRTIM Set/Reset trigger definition
*/
...
...
@@ -115,21 +102,6 @@ typedef enum {
to active) */
}
hrtim_cb_t
;
/**
* @brief HRTIM timing units definition
*/
typedef
enum
{
TIMA
,
TIMB
,
TIMC
,
TIMD
,
TIME
,
#if (HRTIM_STU_NUMOF == 6)
TIMF
,
#endif
MSTR
}
hrtim_tu_t
;
/**
* @brief HRTIM comparators definition
*/
...
...
@@ -370,17 +342,6 @@ typedef enum {
*/
uint16_t
hrtim_init
(
hrtim_t
dev
,
uint32_t
*
freq
,
uint16_t
dt
,
uint8_t
switch_convention
);
/**
* @brief Set the duty-cycle, dead-time and phase shift for a given
* timing unit of a given HRTIM device
*
* @param[in] dev HRTIM device
* @param[in] tu Timing unit
* @param[in] value Duty cycle
* @param[in] shift Phase shifting
*/
void
hrtim_pwm_set
(
hrtim_t
dev
,
hrtim_tu_t
tu
,
uint16_t
value
,
uint16_t
shift
);
/**
* @brief Initialize an HRTIM device master timer
*
...
...
@@ -562,4 +523,4 @@ void hrtim_adc_trigger_dis(hrtim_t dev, hrtim_adc_t adc, hrtim_adc_trigger_t evt
}
#endif
#endif
/
*
HRTIM_
H */
#endif /
/
HRTIM_
VOLTAGE_MODE_H_
zephyr/modules/owntech_
leg
_driver/zephyr/owntech_leg_driver.c
→
zephyr/modules/owntech_
hrtim
_driver/zephyr/
src/voltage_mode/
owntech_leg_driver.c
pp
View file @
572bacba
...
...
@@ -28,6 +28,7 @@
#include "leg.h"
#include "owntech_leg_driver.h"
#include "hrtim_voltage_mode.h"
static
uint16_t
period
,
min_pw
,
max_pw
,
dead_time
;
...
...
@@ -45,7 +46,7 @@ uint16_t leg_init(bool upper_switch_convention)
uint32_t
freq
=
LEG_FREQ
;
/* ensures that timing_unit can be used as leg identifier */
for
(
int
i
=
0
;
i
<
LEG_NUMOF
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
LEG_NUMOF
;
i
++
)
{
leg_conf
[
leg_config
[
i
].
timing_unit
]
=
leg_config
[
i
];
}
...
...
zephyr/modules/owntech_
leg
_driver/zephyr/owntech_leg_driver.h
→
zephyr/modules/owntech_
hrtim
_driver/zephyr/
src/voltage_mode/
owntech_leg_driver.h
View file @
572bacba
...
...
@@ -29,8 +29,8 @@
* @note This must only be included in owntech_leg_driver.c
*/
#ifndef
LEG_CONF
_H_
#define
LEG_CONF
_H_
#ifndef
OWNTECH_LEG_DRIVER
_H_
#define
OWNTECH_LEG_DRIVER
_H_
/**
* @brief Inverter leg configuration
...
...
@@ -72,4 +72,4 @@ static leg_conf_t leg_config[] = {
#define LEG_NUMOF ARRAY_SIZE(leg_config)
#endif
/
* LEG_CONF_H_ */
#endif /
/ OWNTECH_LEG_DRIVER_H_
zephyr/modules/owntech_leg_driver/zephyr/CMakeLists.txt
deleted
100644 → 0
View file @
e48bb87b
if
(
CONFIG_OWNTECH_LEG_DRIVER
)
zephyr_include_directories
(
.
)
zephyr_library
()
zephyr_library_sources
(
owntech_leg_driver.c
)
endif
()
zephyr/modules/owntech_leg_driver/zephyr/Kconfig
deleted
100644 → 0
View file @
e48bb87b
config OWNTECH_LEG_DRIVER
bool "Enable OwnTech leg driver"
default y
zephyr/modules/owntech_leg_driver/zephyr/module.yml
deleted
100644 → 0
View file @
e48bb87b
name
:
owntech_leg_driver
build
:
cmake
:
zephyr
kconfig
:
zephyr/Kconfig
zephyr/prj.conf
View file @
572bacba
...
...
@@ -42,7 +42,6 @@ CONFIG_ASSERT=y
# OwnTech modules: uncomment a line to exclude a module
#CONFIG_OWNTECH_TIMER_DRIVER=n
#CONFIG_OWNTECH_HRTIM_DRIVER=n
#CONFIG_OWNTECH_LEG_DRIVER=n
#CONFIG_OWNTECH_NGND_DRIVER=n
#CONFIG_OWNTECH_DATA_ACQUISITION=n
#CONFIG_OWNTECH_VREFBUF_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