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

Adapt the library to the new OwnTech Power API module structure:...

Adapt the library to the new OwnTech Power API module structure: initialization is done in the independent libraries depending on their specific needs.
parent 9fe3b919
{ {
"name": "opalib_quick_start", "name": "opalib_quick_start",
"version": "1.3.0", "version": "2.0.0",
"description": "OwnTech Power API Library Quick Start initializes all required OwnTech Power API drivers. It allows the user to define a function that will be called periodically.", "description": "OwnTech Power API Library Quick Start allows the user to define a function that will be called periodically.",
"keywords": "OwnTech Power API" "keywords": "OwnTech Power API"
} }
...@@ -22,15 +22,11 @@ ...@@ -22,15 +22,11 @@
*/ */
///// // Zephyr
// OwnTech Power API includes #include <zephyr.h>
// OwnTech Power API
#include "timer.h" #include "timer.h"
#include "hrtim.h"
#include "data_acquisition.h"
#include "comparator.h"
#include "dac.h"
#include "opalib_quick_start.h" #include "opalib_quick_start.h"
...@@ -62,39 +58,8 @@ static void _opalib_init_task(void (*periodic_task)(), uint32_t task_period_us) ...@@ -62,39 +58,8 @@ static void _opalib_init_task(void (*periodic_task)(), uint32_t task_period_us)
///// /////
// Public API // Public API
void opalib_quick_start_init_voltage(void (*periodic_task)(), uint32_t task_period_us) void opalib_quick_start_init(void (*periodic_task)(), uint32_t task_period_us)
{ {
// ADC
data_acquisition_init();
// HRTIM
hrtim_init_voltage();
// DAC
owntech_dac_dac2_constant_init();
// User task
if (periodic_task != NULL)
{
_opalib_init_task(periodic_task, task_period_us);
}
}
void opalib_quick_start_init_current(void (*periodic_task)(), uint32_t task_period_us)
{
// ADC
data_acquisition_init();
// Comparator
comparator_init();
// HRTIM
hrtim_init_current();
// DAC
owntech_dac_dac2_constant_init();
owntech_dac_dac1_dac3_current_mode_init();
// User task // User task
if (periodic_task != NULL) if (periodic_task != NULL)
{ {
......
...@@ -19,9 +19,7 @@ ...@@ -19,9 +19,7 @@
/** /**
* @brief This library provides a quick start configuration * @brief This library provides a quick start configuration
* by configuring the paripherals to perform a measure * by running a user-defined task periodically.
* on all defined ADCs, and running a user-defined
* task periodically.
* *
* @author Clément Foucher <clement.foucher@laas.fr> * @author Clément Foucher <clement.foucher@laas.fr>
*/ */
...@@ -50,9 +48,9 @@ typedef enum ...@@ -50,9 +48,9 @@ typedef enum
} hardware_version_t; } hardware_version_t;
/** /**
* @brief Library initialization function for voltage mode. * @brief Library initialization function.
* This function uses Timer 6 is a user periodic * This function uses Timer 6 to execute the periodic
* task is to be executed. * user task.
* *
* @param periodic_task Pointer to the void(void) function * @param periodic_task Pointer to the void(void) function
* to be executed periodically. * to be executed periodically.
...@@ -61,21 +59,7 @@ typedef enum ...@@ -61,21 +59,7 @@ typedef enum
* Allowed range: 1 to 6553 µs. * Allowed range: 1 to 6553 µs.
* Value is ignored if first parameter is NULL. * Value is ignored if first parameter is NULL.
*/ */
void opalib_quick_start_init_voltage(void (*periodic_task)(), uint32_t task_period_us); void opalib_quick_start_init(void (*periodic_task)(), uint32_t task_period_us);
/**
* @brief Library initialization function for current mode.
* This function uses Timer 6 is a user periodic
* task is to be executed.
*
* @param periodic_task Pointer to the void(void) function
* to be executed periodically.
* Can be NULL if no task has to be executed.
* @param task_period_us Period of the function in µs.
* Allowed range: 1 to 6553 µs.
* Value is ignored if first parameter is NULL.
*/
void opalib_quick_start_init_current(void (*periodic_task)(), uint32_t task_period_us);
/** /**
* @brief Begins the periodic run of the task. * @brief Begins the periodic run of the task.
...@@ -90,6 +74,7 @@ void opalib_quick_start_launch_task(); ...@@ -90,6 +74,7 @@ void opalib_quick_start_launch_task();
*/ */
void opalib_quick_start_set_hardware_version(hardware_version_t hardware_version); void opalib_quick_start_set_hardware_version(hardware_version_t hardware_version);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
Markdown is supported
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