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

Add a function to set the version of the hardware the software is running on.

parent 495d11ad
{
"name": "opalib_quick_start",
"version": "1.2.0",
"version": "1.3.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.",
"keywords": "OwnTech Power API"
}
......@@ -31,6 +31,8 @@
#include "comparator.h"
#include "dac.h"
#include "opalib_quick_start.h"
/////
// Timer defines
......@@ -103,4 +105,16 @@ void opalib_quick_start_init_current(void (*periodic_task)(), uint32_t task_peri
void opalib_quick_start_launch_task()
{
timer_start(timer6, period);
}
\ No newline at end of file
}
#include <stm32g4xx_ll_lpuart.h>
void opalib_quick_start_set_hardware_version(hardware_version_t hardware_version)
{
if (hardware_version == v_1_1_2)
{
LL_LPUART_Disable(LPUART1);
LL_LPUART_SetTXRXSwap(LPUART1, LL_LPUART_TXRX_SWAPPED);
LL_LPUART_Enable(LPUART1);
}
}
......@@ -38,6 +38,16 @@
extern "C" {
#endif
/** Hardware version. See
* https://gitlab.laas.fr/owntech/1leg/-/wikis/Releases
* for the list and specificities of versions.
*/
typedef enum
{
v_0_0, // No power converter attached, the software is running on Nucleo G474RE
v_0_9,
v_1_1_2
} hardware_version_t;
/**
* @brief Library initialization function for voltage mode.
......@@ -72,6 +82,14 @@ void opalib_quick_start_init_current(void (*periodic_task)(), uint32_t task_peri
*/
void opalib_quick_start_launch_task();
/**
* @brief Sets the version of the underlying hardware.
* Depending on the hardware version, some software
* configuration, such as pinout, has to be tweaked.
* @param hardware_version Enum representing the hardware version.
*/
void opalib_quick_start_set_hardware_version(hardware_version_t hardware_version);
#ifdef __cplusplus
}
#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