analog anemometer driver and dallas one wire drivers ported to stm32l4 platform

pull/4/head
Mateusz Lubecki 2021-05-30 13:54:25 +02:00
rodzic 3a99c8d94f
commit 095a594cab
46 zmienionych plików z 451298 dodań i 54 usunięć

Wyświetl plik

@ -274,7 +274,7 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nomoveloopinvariants.1624857343" name="Disable loop invariant move (-fno-move-loop-invariants)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nomoveloopinvariants" useByScannerDiscovery="true" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.1518763105" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name" useByScannerDiscovery="false" value="GNU Tools for ARM Embedded Processors" valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.450005916" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" useByScannerDiscovery="false" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family.2006565958" name="Arm family (-mcpu)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family" useByScannerDiscovery="false" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.mcpu.cortex-m3" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family.2006565958" name="Arm family (-mcpu)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family" useByScannerDiscovery="false" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.mcpu.cortex-m4" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.959843368" name="Instruction set" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset" useByScannerDiscovery="false" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.thumb" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix.1894225623" name="Prefix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix" useByScannerDiscovery="false" value="arm-none-eabi-" valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.c.378770902" name="C compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.c" useByScannerDiscovery="false" value="gcc" valueType="string"/>
@ -289,6 +289,8 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize.102761195" name="Print size" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.id.469842076" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.id" useByScannerDiscovery="false" value="1287942917" valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting.334972576" name="Create extended listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting" useByScannerDiscovery="false"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.1424219558" name="FPU Type" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.fpv4spd16" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.930718540" name="Float ABI" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.hard" valueType="enumerated"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.667157001" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
<builder buildPath="${workspace_loc:/proba3-vldiscovery}/Debug" id="ilg.gnuarmeclipse.managedbuild.cross.builder.1265798606" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.1741171867" name="Cross ARM GNU Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
@ -296,15 +298,18 @@
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths.1580258863" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;../include&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/cmsis&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/stm32f1-stdperiph&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/cmsis/stm32l4xx&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/cmsis/stm32l4xx/device&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/stm32l4-hal-driver&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/stm32l4-hal-driver/Legacy&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs.890816174" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="DEBUG"/>
<listOptionValue builtIn="false" value="TRACE"/>
<listOptionValue builtIn="false" value="USE_FULL_LL_DRIVER"/>
<listOptionValue builtIn="false" value="STM32L471xx"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.undefs.544345491" name="Undefined symbols (-U)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.undefs" useByScannerDiscovery="true" valueType="undefDefinedSymbols">
<listOptionValue builtIn="false" value="STM32F10X_MD_VL"/>
<listOptionValue builtIn="false" value="USE_STDPERIPH_DRIVER"/>
<listOptionValue builtIn="false" value="HSE_VALUE=8000000"/>
</option>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.1990933962" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
</tool>
@ -313,18 +318,25 @@
<listOptionValue builtIn="false" value="&quot;../include&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/aprs&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/cmsis&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/stm32f1-stdperiph&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/cmsis/stm32l4xx&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/cmsis/stm32l4xx/device&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/stm32l4-hal-driver&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/stm32l4-hal-driver/Legacy&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.1292756395" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="DEBUG"/>
<listOptionValue builtIn="false" value="TRACE"/>
<listOptionValue builtIn="false" value="STM32F10X_MD_VL"/>
<listOptionValue builtIn="false" value="USE_STDPERIPH_DRIVER"/>
<listOptionValue builtIn="false" value="HSE_VALUE=8000000"/>
<listOptionValue builtIn="false" value="USE_FULL_LL_DRIVER"/>
<listOptionValue builtIn="false" value="STM32L471xx"/>
<listOptionValue builtIn="false" value="PARAMETEO"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.otherwarnings.732697847" name="Other warning flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.otherwarnings" useByScannerDiscovery="true" value="-Wunused-function -Wall" valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.asmlisting.1330635812" name="Generate assembler listing (-Wa,-adhlns=&quot;$@.lst&quot;)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.asmlisting" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.undef.1384539304" name="Undefined symbols (-U)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.undef" useByScannerDiscovery="true" valueType="undefDefinedSymbols">
<listOptionValue builtIn="false" value="STM32F10X_MD_VL"/>
<listOptionValue builtIn="false" value="PARATNC_HWREV_A"/>
<listOptionValue builtIn="false" value="PARATNC_HWREV_B"/>
<listOptionValue builtIn="false" value="PARATNC_HWREV_C"/>
</option>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.29354374" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
</tool>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1656265940" name="Cross ARM C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler">
@ -332,8 +344,10 @@
<listOptionValue builtIn="false" value="&quot;../include&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/aprs&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/cmsis&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/stm32f1-stdperiph&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/cmsis/stm32l4xx&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/cmsis/stm32l4xx/device&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/stm32l4-hal-driver&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/include/stm32l4-hal-driver/Legacy&quot;"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.noexceptions.903856849" name="Do not use exceptions (-fno-exceptions)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.noexceptions" useByScannerDiscovery="true" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.nortti.712193131" name="Do not use RTTI (-fno-rtti)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.nortti" useByScannerDiscovery="true" value="true" valueType="boolean"/>
@ -341,12 +355,13 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.nothreadsafestatics.1399018897" name="Do not use thread-safe statics (-fno-threadsafe-statics)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.nothreadsafestatics" useByScannerDiscovery="true" value="true" valueType="boolean"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.1523453296" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="DEBUG"/>
<listOptionValue builtIn="false" value="TRACE"/>
<listOptionValue builtIn="false" value="STM32F10X_MD_VL"/>
<listOptionValue builtIn="false" value="USE_STDPERIPH_DRIVER"/>
<listOptionValue builtIn="false" value="HSE_VALUE=8000000"/>
<listOptionValue builtIn="false" value="USE_FULL_LL_DRIVER"/>
<listOptionValue builtIn="false" value="STM32L471xx"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.otherwarnings.1696759087" name="Other warning flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.otherwarnings" useByScannerDiscovery="true" value="-Wunused-function" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.undef.961854105" name="Undefined symbols (-U)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.undef" useByScannerDiscovery="true" valueType="undefDefinedSymbols">
<listOptionValue builtIn="false" value="STM32F10X_MD_VL"/>
</option>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.671886381" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input"/>
</tool>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.1277580970" name="Cross ARM C Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker">
@ -366,7 +381,8 @@
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.233822233" name="Cross ARM C++ Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections.810848127" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.paths.12619762" name="Library search path (-L)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.paths" useByScannerDiscovery="false" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/ldscripts/stm32l476}&quot;"/>
<listOptionValue builtIn="false" value="&quot;../ldscripts/stm32l476}&quot;"/>
<listOptionValue builtIn="false" value="&quot;../system/src/dsp&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.scriptfile.1693346665" name="Script files (-T)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.scriptfile" useByScannerDiscovery="false" valueType="stringList">
<listOptionValue builtIn="false" value="STM32L471RETx_FLASH.ld"/>
@ -458,7 +474,7 @@
</folderInfo>
<sourceEntries>
<entry excluding="Timer.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry excluding="src/stm32f1-stdperiph/stm32f10x_adc.c|src/stm32f1-stdperiph/stm32f10x_wwdg.c|src/drivers/tm_stm32fonewire/tm_stm32f1_onewire.c|src/stm32f1-stdperiph/stm32f10x_bkp.c|src/stm32f1-stdperiph/stm32f10x_dac.c|src/stm32f1-stdperiph/stm32f10x_can.c|src/stm32f1-stdperiph/stm32f10x_spi.c|src/stm32f1-stdperiph/stm32f10x_pwr.c|src/stm32f1-stdperiph/stm32f10x_sdio.c|src/stm32f1-stdperiph/stm32f10x_fsmc.c|src/stm32f1-stdperiph/stm32f10x_cec.c" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="system"/>
<entry excluding="src/drivers/f1|src/cmsis/vectors_stm32f10x.c|src/cmsis/system_stm32f10x.c|src/cortexm|src/stm32f1-stdperiph|src/stm32f1-stdperiph/stm32f10x_adc.c|src/stm32f1-stdperiph/stm32f10x_wwdg.c|src/drivers/tm_stm32fonewire/tm_stm32f1_onewire.c|src/stm32f1-stdperiph/stm32f10x_bkp.c|src/stm32f1-stdperiph/stm32f10x_dac.c|src/stm32f1-stdperiph/stm32f10x_can.c|src/stm32f1-stdperiph/stm32f10x_spi.c|src/stm32f1-stdperiph/stm32f10x_pwr.c|src/stm32f1-stdperiph/stm32f10x_sdio.c|src/stm32f1-stdperiph/stm32f10x_fsmc.c|src/stm32f1-stdperiph/stm32f10x_cec.c" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="system"/>
</sourceEntries>
</configuration>
</storageModule>

1
.gitignore vendored
Wyświetl plik

@ -8,3 +8,4 @@ Release/
*.elf
/STM32F100/
/STM32F100_ParaTNC/
/STM32L476_ParaMETEO/

Wyświetl plik

@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="893947698641861052" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="910025024327584425" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

Wyświetl plik

@ -11,7 +11,14 @@
// PC8 - LED1 - upper
// PC9 - LED2 - lower
#ifdef STM32F10X_MD_VL
#include <stm32f10x.h>
#endif
#ifdef STM32L471xx
#include <stm32l4xx.h>
#include <stm32l4xx_ll_gpio.h>
#endif
#include <stdint.h>
#include <stdbool.h>
@ -30,6 +37,7 @@ void led_config(void);
void led_init(void);
void led_service_blink(void);
#ifdef STM32F10X_MD_VL
inline void led_control_led1_upper(bool _in) {
if (_in == true) {
GPIOC->BSRR |= GPIO_BSRR_BS8;
@ -78,6 +86,59 @@ inline void led_blink_led2_botoom(void) {
led_flip_led2_bottom();
}
#endif
#ifdef STM32L471xx
inline void led_control_led1_upper(bool _in) {
if (_in == true) {
GPIOC->BSRR |= GPIO_BSRR_BS8;
}
else {
GPIOC->BSRR |= GPIO_BSRR_BR8;
}
}
inline void led_control_led2_bottom(bool _in) {
if (_in == true) {
GPIOC->BSRR |= GPIO_BSRR_BS9;
}
else {
GPIOC->BSRR |= GPIO_BSRR_BR9;
}
}
inline void led_flip_led1_upper(void) {
if ((GPIOC->ODR & GPIO_ODR_ODR_8) == GPIO_ODR_ODR_8) {
GPIOC->BSRR |= GPIO_BSRR_BR8;
}
else {
GPIOC->BSRR |= GPIO_BSRR_BS8;
}
}
inline void led_flip_led2_bottom(void) {
if ((GPIOC->ODR & GPIO_ODR_ODR_9) == GPIO_ODR_ODR_9) {
GPIOC->BSRR |= GPIO_BSRR_BR9;
}
else {
GPIOC->BSRR |= GPIO_BSRR_BS9;
}
}
inline void led_blink_led1_upper(void) {
led_blinking_led1 = BLINK_DURATION_MSEC;
led_flip_led1_upper();
}
inline void led_blink_led2_botoom(void) {
led_blinking_led2 = BLINK_DURATION_MSEC;
led_flip_led2_bottom();
}
#endif
#ifdef __cplusplus
}

Wyświetl plik

@ -20,9 +20,7 @@
/* MODES OF OPERATION */
/* ------------------ */
//#define PARATNC_HWREV_A
//#define PARATNC_HWREV_B
#define PARATNC_HWREV_C
/* ---------------------------- */
/* WEATHER/METEO CONFIGURATION */

Wyświetl plik

@ -0,0 +1,16 @@
/*
* station_config_target_hw.h
*
* Created on: May 30, 2021
* Author: mateusz
*/
#ifndef STATION_CONFIG_TARGET_HW_H_
#define STATION_CONFIG_TARGET_HW_H_
//#define PARATNC_HWREV_A
//#define PARATNC_HWREV_B
//#define PARATNC_HWREV_C
#define PARAMETEO
#endif /* STATION_CONFIG_TARGET_HW_H_ */

Wyświetl plik

@ -1,12 +1,21 @@
#ifdef STM32F10X_MD_VL
#include <stm32f10x_rcc.h>
#include <stm32f10x_iwdg.h>
#include <stm32f10x.h>
#include <drivers/gpio_conf_stm32f1x.h>
#endif
#ifdef STM32L471xx
#include <stm32l4xx.h>
#include <stm32l4xx_ll_iwdg.h>
#include <stm32l4xx_ll_rcc.h>
#endif
#include <delay.h>
#include <LedConfig.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stm32f10x_rcc.h>
#include <stm32f10x_iwdg.h>
#include <stm32f10x.h>
#include "drivers/gpio_conf.h"
#include "main.h"
#include "packet_tx_handler.h"
@ -130,10 +139,8 @@ int32_t main_ten_second_pool_timer = 10000;
// serial context for UART used to KISS
srl_context_t main_kiss_srl_ctx;
#if defined(PARATNC_HWREV_B) || defined(PARATNC_HWREV_C)
// serial context for UART used for comm with wx sensors
srl_context_t main_wx_srl_ctx;
#endif
// a pointer to KISS context
srl_context_t* main_kiss_srl_ctx_ptr;

Wyświetl plik

@ -1,10 +1,10 @@
#ifndef AFSK_H_
#define AFSK_H_
#ifndef CCC
#include "stm32f10x_conf.h"
#endif
//
//#ifndef CCC
//#include "stm32f10x_conf.h"
//#endif
#include <stdbool.h>

Wyświetl plik

@ -1,9 +1,9 @@
#ifndef AX25_H_
#define AX25_H_
#ifndef CCC
#include "stm32f10x_conf.h"
#endif
//#ifndef CCC
//#include "stm32f10x_conf.h"
//#endif
#include <stdbool.h>
#include "cfifo.h"

Wyświetl plik

@ -0,0 +1,254 @@
/**
******************************************************************************
* @file stm32l4xx.h
* @author MCD Application Team
* @brief CMSIS STM32L4xx Device Peripheral Access Layer Header File.
*
* The file is the unique include file that the application programmer
* is using in the C source code, usually in main.c. This file contains:
* - Configuration section that allows to select:
* - The STM32L4xx device used in the target application
* - To use or not the peripherals drivers in application code(i.e.
* code will be based on direct access to peripherals registers
* rather than drivers API), this option is controlled by
* "#define USE_HAL_DRIVER"
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under Apache License, Version 2.0,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/Apache-2.0
*
******************************************************************************
*/
/** @addtogroup CMSIS
* @{
*/
/** @addtogroup stm32l4xx
* @{
*/
#ifndef __STM32L4xx_H
#define __STM32L4xx_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** @addtogroup Library_configuration_section
* @{
*/
/**
* @brief STM32 Family
*/
#if !defined (STM32L4)
#define STM32L4
#endif /* STM32L4 */
/* Uncomment the line below according to the target STM32L4 device used in your
application
*/
#if !defined (STM32L412xx) && !defined (STM32L422xx) && \
!defined (STM32L431xx) && !defined (STM32L432xx) && !defined (STM32L433xx) && !defined (STM32L442xx) && !defined (STM32L443xx) && \
!defined (STM32L451xx) && !defined (STM32L452xx) && !defined (STM32L462xx) && \
!defined (STM32L471xx) && !defined (STM32L475xx) && !defined (STM32L476xx) && !defined (STM32L485xx) && !defined (STM32L486xx) && \
!defined (STM32L496xx) && !defined (STM32L4A6xx) && \
!defined (STM32L4P5xx) && !defined (STM32L4Q5xx) && \
!defined (STM32L4R5xx) && !defined (STM32L4R7xx) && !defined (STM32L4R9xx) && !defined (STM32L4S5xx) && !defined (STM32L4S7xx) && !defined (STM32L4S9xx)
/* #define STM32L412xx */ /*!< STM32L412xx Devices */
/* #define STM32L422xx */ /*!< STM32L422xx Devices */
/* #define STM32L431xx */ /*!< STM32L431xx Devices */
/* #define STM32L432xx */ /*!< STM32L432xx Devices */
/* #define STM32L433xx */ /*!< STM32L433xx Devices */
/* #define STM32L442xx */ /*!< STM32L442xx Devices */
/* #define STM32L443xx */ /*!< STM32L443xx Devices */
/* #define STM32L451xx */ /*!< STM32L451xx Devices */
/* #define STM32L452xx */ /*!< STM32L452xx Devices */
/* #define STM32L462xx */ /*!< STM32L462xx Devices */
/* #define STM32L471xx */ /*!< STM32L471xx Devices */
/* #define STM32L475xx */ /*!< STM32L475xx Devices */
/* #define STM32L476xx */ /*!< STM32L476xx Devices */
/* #define STM32L485xx */ /*!< STM32L485xx Devices */
/* #define STM32L486xx */ /*!< STM32L486xx Devices */
/* #define STM32L496xx */ /*!< STM32L496xx Devices */
/* #define STM32L4A6xx */ /*!< STM32L4A6xx Devices */
/* #define STM32L4P5xx */ /*!< STM32L4Q5xx Devices */
/* #define STM32L4R5xx */ /*!< STM32L4R5xx Devices */
/* #define STM32L4R7xx */ /*!< STM32L4R7xx Devices */
/* #define STM32L4R9xx */ /*!< STM32L4R9xx Devices */
/* #define STM32L4S5xx */ /*!< STM32L4S5xx Devices */
/* #define STM32L4S7xx */ /*!< STM32L4S7xx Devices */
/* #define STM32L4S9xx */ /*!< STM32L4S9xx Devices */
#endif
/* Tip: To avoid modifying this file each time you need to switch between these
devices, you can define the device in your toolchain compiler preprocessor.
*/
#if !defined (USE_HAL_DRIVER)
/**
* @brief Comment the line below if you will not use the peripherals drivers.
In this case, these drivers will not be included and the application code will
be based on direct access to peripherals registers
*/
/*#define USE_HAL_DRIVER */
#endif /* USE_HAL_DRIVER */
/**
* @brief CMSIS Device version number
*/
#define __STM32L4_CMSIS_VERSION_MAIN (0x01) /*!< [31:24] main version */
#define __STM32L4_CMSIS_VERSION_SUB1 (0x07) /*!< [23:16] sub1 version */
#define __STM32L4_CMSIS_VERSION_SUB2 (0x01) /*!< [15:8] sub2 version */
#define __STM32L4_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */
#define __STM32L4_CMSIS_VERSION ((__STM32L4_CMSIS_VERSION_MAIN << 24)\
|(__STM32L4_CMSIS_VERSION_SUB1 << 16)\
|(__STM32L4_CMSIS_VERSION_SUB2 << 8 )\
|(__STM32L4_CMSIS_VERSION_RC))
/**
* @}
*/
/** @addtogroup Device_Included
* @{
*/
#if defined(STM32L412xx)
#include "stm32l412xx.h"
#elif defined(STM32L422xx)
#include "stm32l422xx.h"
#elif defined(STM32L431xx)
#include "stm32l431xx.h"
#elif defined(STM32L432xx)
#include "stm32l432xx.h"
#elif defined(STM32L433xx)
#include "stm32l433xx.h"
#elif defined(STM32L442xx)
#include "stm32l442xx.h"
#elif defined(STM32L443xx)
#include "stm32l443xx.h"
#elif defined(STM32L451xx)
#include "stm32l451xx.h"
#elif defined(STM32L452xx)
#include "stm32l452xx.h"
#elif defined(STM32L462xx)
#include "stm32l462xx.h"
#elif defined(STM32L471xx)
#include "stm32l471xx.h"
#elif defined(STM32L475xx)
#include "stm32l475xx.h"
#elif defined(STM32L476xx)
#include "stm32l476xx.h"
#elif defined(STM32L485xx)
#include "stm32l485xx.h"
#elif defined(STM32L486xx)
#include "stm32l486xx.h"
#elif defined(STM32L496xx)
#include "stm32l496xx.h"
#elif defined(STM32L4A6xx)
#include "stm32l4a6xx.h"
#elif defined(STM32L4P5xx)
#include "stm32l4p5xx.h"
#elif defined(STM32L4Q5xx)
#include "stm32l4q5xx.h"
#elif defined(STM32L4R5xx)
#include "stm32l4r5xx.h"
#elif defined(STM32L4R7xx)
#include "stm32l4r7xx.h"
#elif defined(STM32L4R9xx)
#include "stm32l4r9xx.h"
#elif defined(STM32L4S5xx)
#include "stm32l4s5xx.h"
#elif defined(STM32L4S7xx)
#include "stm32l4s7xx.h"
#elif defined(STM32L4S9xx)
#include "stm32l4s9xx.h"
#else
#error "Please select first the target STM32L4xx device used in your application (in stm32l4xx.h file)"
#endif
/**
* @}
*/
/** @addtogroup Exported_types
* @{
*/
typedef enum
{
RESET = 0,
SET = !RESET
} FlagStatus, ITStatus;
typedef enum
{
DISABLE = 0,
ENABLE = !DISABLE
} FunctionalState;
#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
typedef enum
{
SUCCESS = 0,
ERROR = !SUCCESS
} ErrorStatus;
/**
* @}
*/
/** @addtogroup Exported_macros
* @{
*/
#define SET_BIT(REG, BIT) ((REG) |= (BIT))
#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
#define READ_BIT(REG, BIT) ((REG) & (BIT))
#define CLEAR_REG(REG) ((REG) = (0x0))
#define WRITE_REG(REG, VAL) ((REG) = (VAL))
#define READ_REG(REG) ((REG))
#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
/**
* @}
*/
#if defined (USE_HAL_DRIVER)
#include "stm32l4xx_hal.h"
#endif /* USE_HAL_DRIVER */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __STM32L4xx_H */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

Wyświetl plik

@ -0,0 +1,107 @@
/**
******************************************************************************
* @file system_stm32l4xx.h
* @author MCD Application Team
* @brief CMSIS Cortex-M4 Device System Source File for STM32L4xx devices.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under Apache License, Version 2.0,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/Apache-2.0
*
******************************************************************************
*/
/** @addtogroup CMSIS
* @{
*/
/** @addtogroup stm32l4xx_system
* @{
*/
/**
* @brief Define to prevent recursive inclusion
*/
#ifndef __SYSTEM_STM32L4XX_H
#define __SYSTEM_STM32L4XX_H
#ifdef __cplusplus
extern "C" {
#endif
/** @addtogroup STM32L4xx_System_Includes
* @{
*/
/**
* @}
*/
/** @addtogroup STM32L4xx_System_Exported_Variables
* @{
*/
/* The SystemCoreClock variable is updated in three ways:
1) by calling CMSIS function SystemCoreClockUpdate()
2) by calling HAL API function HAL_RCC_GetSysClockFreq()
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
Note: If you use this function to configure the system clock; then there
is no need to call the 2 first functions listed above, since SystemCoreClock
variable is updated automatically.
*/
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */
extern const uint32_t MSIRangeTable[12]; /*!< MSI ranges table values */
/**
* @}
*/
/** @addtogroup STM32L4xx_System_Exported_Constants
* @{
*/
/**
* @}
*/
/** @addtogroup STM32L4xx_System_Exported_Macros
* @{
*/
/**
* @}
*/
/** @addtogroup STM32L4xx_System_Exported_Functions
* @{
*/
extern void SystemInit(void);
extern void SystemCoreClockUpdate(void);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /*__SYSTEM_STM32L4XX_H */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

Wyświetl plik

@ -8,12 +8,21 @@
#ifndef DALLAS_H
#define DALLAS_H
#include "station_config_target_hw.h"
/* C++ detection */
#ifdef __cplusplus
extern "C" {
#endif
#ifdef STM32F10X_MD_VL
#include <stm32f10x_gpio.h>
#endif
#ifdef STM32L471xx
#include <stm32l4xx.h>
#include <stm32l4xx_ll_gpio.h>
#endif
#include "station_config.h"
#define DALLAS_AVERAGE_LN 9

Wyświetl plik

@ -8,8 +8,16 @@
#ifndef INCLUDE_DRIVERS_DMA_HELPER_FUNCTIONS_H_
#define INCLUDE_DRIVERS_DMA_HELPER_FUNCTIONS_H_
#ifdef STM32F10X_MD_VL
#include <stm32f10x_dma.h>
void dma_helper_start_ch7(DMA_InitTypeDef* DMA_InitStruct);
#endif
#ifdef STM32L471xx
#include <stm32l4xx.h>
#include <stm32l4xx_ll_dma.h>
void dma_helper_start_ch7(LL_DMA_InitTypeDef* DMA_InitStruct);
#endif
#endif /* INCLUDE_DRIVERS_DMA_HELPER_FUNCTIONS_H_ */

Wyświetl plik

@ -1,6 +1,7 @@
#ifndef __GPIO_CONF_H
#define __GPIO_CONF_H
#ifdef STM32F10X_MD_VL
#include <stm32f10x.h>
@ -42,3 +43,5 @@
void Configure_GPIO(GPIO_TypeDef* gpio, uint8_t pin, uint8_t conf);
#endif
#endif

Wyświetl plik

@ -2,8 +2,14 @@
#define __SERIAL_H
#include "stdint.h"
#ifdef STM32F10X_MD_VL
#include <stm32f10x.h>
#include <stm32f10x_usart.h>
#endif
#ifdef STM32L471xx
#include <stm32l4xx.h>
#include <stm32l4xx_ll_usart.h>
#endif
#define RX_BUFFER_1_LN 512
#define TX_BUFFER_1_LN 512

Wyświetl plik

@ -6,24 +6,41 @@
*/
#include "station_config.h"
#include "station_config_target_hw.h"
#if defined(_ANEMOMETER_ANALOGUE_SPARKFUN) || defined(_ANEMOMETER_ANALOGUE)
#define WIND_DEBUG
#ifdef PARAMETEO
// those defines and an undef are only required for shitty Eclipse indexer to see anything from STM32L471xx target
#define STM32L471xx
#define USE_FULL_LL_DRIVER
#undef STM32F10X_MD_VL
#endif
#include "drivers/analog_anemometer.h"
#include <stdint.h>
#include <string.h>
#include <stm32f10x_tim.h>
#include <stm32f10x_dma.h>
#include "drivers/gpio_conf.h"
#include "drivers/dma_helper_functions.h"
#include "rte_wx.h"
#include "main.h"
#include "wx_handler.h"
#include "LedConfig.h"
#ifdef STM32F10X_MD_VL
#include <stm32f10x_tim.h>
#include <stm32f10x_dma.h>
#include <drivers/gpio_conf_stm32f1x.h>
#endif
#ifdef STM32L471xx
#include <stm32l4xx.h>
#include <stm32l4xx_ll_tim.h>
#include <stm32l4xx_ll_dma.h>
#include <stm32l4xx_ll_gpio.h>
#endif
#define MINUM_PULSE_LN 15
#define MAXIMUM_PULSE_SLEW_RATE 4000
@ -31,6 +48,13 @@
#define UPSCALED_MAX_ANGLE (360 * 100)
#define UPSCALED_MAX_ANGLE_2 (360 * 10)
#ifdef STM32F10X_MD_VL
DMA_InitTypeDef DMA_InitStruct;
#endif
#ifdef STM32L471xx
LL_DMA_InitTypeDef DMA_InitStruct;
#endif
// an array where DMA will store values of the timer latched by compare-capture input
uint16_t analog_anemometer_windspeed_pulses_time[ANALOG_ANEMOMETER_SPEED_PULSES_N];
@ -58,8 +82,6 @@ uint8_t analog_anemometer_deboucing_fired = 0;
uint8_t analog_anemometer_direction_doesnt_work = 0;
DMA_InitTypeDef DMA_InitStruct;
// direction recalculated from v/f
uint16_t analog_anemometer_direction = 0;
@ -106,7 +128,15 @@ const int16_t analog_anemometer_direction_sparkfun_ranges[16][3] = {
void analog_anemometer_init(uint16_t pulses_per_meter_second, uint8_t anemometer_lower_boundary,
uint8_t anemometer_upper_boundary, uint8_t direction_polarity) {
#ifdef STM32F10X_MD_VL
TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStruct;
#endif
#ifdef STM32L471xx
LL_TIM_InitTypeDef TIM_InitTypeDef;
LL_TIM_IC_InitTypeDef TIM_IC_InitTypeDef;
LL_GPIO_InitTypeDef GPIO_InitTypeDef;
#endif
analog_anemometer_pulses_per_m_s_constant = pulses_per_meter_second;
@ -128,6 +158,7 @@ void analog_anemometer_init(uint16_t pulses_per_meter_second, uint8_t anemometer
memset(analog_anemometer_direction_timer_values, 0x00, ANALOG_ANEMOMETER_SPEED_PULSES_N);
#endif
#ifdef STM32F10X_MD_VL
// enabling the clock for TIM17
RCC->APB2ENR |= RCC_APB2ENR_TIM17EN;
RCC->AHBENR |= RCC_AHBENR_DMA1EN;
@ -202,6 +233,77 @@ void analog_anemometer_init(uint16_t pulses_per_meter_second, uint8_t anemometer
// disable an interrupt from TIMER3
NVIC_DisableIRQ(TIM3_IRQn);
#endif
#ifdef STM32L471xx
// set parameters for TIM4 used for windspeed
TIM_InitTypeDef.Prescaler = 23999;
TIM_InitTypeDef.Autoreload = 60000;
TIM_InitTypeDef.CounterMode = LL_TIM_COUNTERMODE_UP;
TIM_InitTypeDef.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
TIM_InitTypeDef.RepetitionCounter = 0;
// deinitialize TIM4 (windspeed)
LL_TIM_DeInit(TIM4);
// initialize timer basics
LL_TIM_Init(TIM4, &TIM_InitTypeDef);
// set parameters for TIM4 capture/compare 3 mapped to TI4 (pin PB9)
TIM_IC_InitTypeDef.ICFilter = LL_TIM_IC_FILTER_FDIV1;
TIM_IC_InitTypeDef.ICPolarity = LL_TIM_IC_POLARITY_RISING;
TIM_IC_InitTypeDef.ICPrescaler = 0;
TIM_IC_InitTypeDef.ICActiveInput = LL_TIM_ACTIVEINPUT_INDIRECTTI; // 10: CC3 channel is configured as input, IC3 is mapped on TI4
// configure and activate fourth channel
LL_TIM_IC_Init(TIM4, LL_TIM_CHANNEL_CH3, &TIM_IC_InitTypeDef);
// enable DMA request for fourth channel
LL_TIM_EnableDMAReq_CC4(TIM4);
DMA_InitStruct.Direction = LL_DMA_DIRECTION_PERIPH_TO_MEMORY;
DMA_InitStruct.MemoryOrM2MDstAddress = (uint32_t)analog_anemometer_windspeed_pulses_time;
DMA_InitStruct.MemoryOrM2MDstDataSize = LL_DMA_MDATAALIGN_HALFWORD;
DMA_InitStruct.MemoryOrM2MDstIncMode = LL_DMA_MEMORY_INCREMENT;
DMA_InitStruct.Mode = LL_DMA_MODE_NORMAL;
DMA_InitStruct.NbData = ANALOG_ANEMOMETER_SPEED_PULSES_N;
DMA_InitStruct.PeriphOrM2MSrcAddress = (uint32_t)&TIM4->CCR3;
DMA_InitStruct.PeriphOrM2MSrcDataSize = LL_DMA_MDATAALIGN_HALFWORD;
DMA_InitStruct.PeriphOrM2MSrcIncMode = LL_DMA_MEMORY_NOINCREMENT;
DMA_InitStruct.PeriphRequest = LL_DMA_REQUEST_6; // LL_DMAMUX_REQ_TIM4_CH3
LL_DMA_Init(DMA1, LL_DMA_CHANNEL_5, &DMA_InitStruct);
LL_TIM_EnableCounter(TIM4);
NVIC_EnableIRQ( DMA1_Channel5_IRQn );
// direction
GPIO_InitTypeDef.Mode = LL_GPIO_MODE_INPUT;
GPIO_InitTypeDef.Pin = LL_GPIO_PIN_2;
GPIO_InitTypeDef.Pull = LL_GPIO_PULL_NO;
GPIO_InitTypeDef.Speed = LL_GPIO_SPEED_FREQ_MEDIUM;
GPIO_InitTypeDef.Alternate = LL_GPIO_AF_2;
LL_GPIO_Init(GPIOD, &GPIO_InitTypeDef);
LL_TIM_StructInit(&TIM_InitTypeDef);
LL_TIM_Init(TIM3, &TIM_InitTypeDef);
// TIM_ETRClockMode2Config(TIM3, TIM_ExtTRGPSC_OFF, TIM_ExtTRGPolarity_Inverted, 0);
LL_TIM_EnableExternalClock(TIM3);
// invert ETR polarity
//TIM3->SMCR |= (1 << 15);
LL_TIM_ConfigETR(TIM3, LL_TIM_ETR_POLARITY_INVERTED, LL_TIM_ETR_PRESCALER_DIV1, LL_TIM_ETR_FILTER_FDIV1);
LL_TIM_EnableCounter(TIM3);
NVIC_EnableIRQ( TIM3_IRQn );
#endif
analog_anemometer_timer_has_been_fired = 0;
return;
@ -370,6 +472,7 @@ void analog_anemometer_dma_irq(void) {
dma_helper_start_ch7(&DMA_InitStruct);
#ifdef STM32F10X_MD_VL
// Stopping timer
TIM_Cmd(TIM17, DISABLE);
@ -378,6 +481,17 @@ void analog_anemometer_dma_irq(void) {
// Enabling counter once again
TIM_Cmd(TIM17, ENABLE);
#endif
#ifdef STM32L471xx
LL_TIM_DisableCounter(TIM4);
LL_TIM_SetCounter(TIM4, 0);
LL_TIM_EnableCounter(TIM4);
#endif
return;
}
@ -402,10 +516,12 @@ uint32_t analog_anemometer_get_ms_from_pulse(uint16_t inter_pulse_time) {
int16_t analog_anemometer_direction_handler(void) {
TIM_Cmd(TIM3, DISABLE);
uint16_t downscaled_angle = 0;
#ifdef STM32F10X_MD_VL
TIM_Cmd(TIM3, DISABLE);
// getting current counter value
uint16_t current_value = TIM_GetCounter(TIM3);
@ -419,6 +535,26 @@ int16_t analog_anemometer_direction_handler(void) {
return rte_wx_winddirection_last;
}
#endif
#ifdef STM32L471xx
LL_TIM_DisableCounter(TIM3);
// getting current counter value
uint16_t current_value = LL_TIM_GetCounter(TIM3);//TIM_GetCounter(TIM3);
// if the counter value is zero it means that probably U/f converter isn't running
if (current_value == 0) {
LL_TIM_SetCounter(TIM3, 0);
LL_TIM_EnableCounter(TIM3);
analog_anemometer_direction_doesnt_work = 1;
return rte_wx_winddirection_last;
}
#endif
// update the last
wx_last_good_wind_time = main_get_master_time();
@ -478,9 +614,17 @@ int16_t analog_anemometer_direction_handler(void) {
led_control_led2_bottom(false);
}
#ifdef STM32F10X_MD_VL
TIM_SetCounter(TIM3, 0);
TIM_Cmd(TIM3, ENABLE);
#endif
#ifdef STM32L471xx
LL_TIM_SetCounter(TIM3, 0);
LL_TIM_EnableCounter(TIM3);
#endif
return downscaled_angle;
}
@ -507,6 +651,7 @@ int16_t analog_anemometer_direction_sparkfun(uint32_t timer_value) {
void analog_anemometer_direction_reset(void) {
#ifdef STM32F10X_MD_VL
// stopping the timer
TIM_Cmd(TIM3, DISABLE);
@ -515,6 +660,15 @@ void analog_anemometer_direction_reset(void) {
// end then restarting once again
TIM_Cmd(TIM3, ENABLE);
#endif
#ifdef STM32L471xx
LL_TIM_DisableCounter(TIM3);
LL_TIM_SetCounter(TIM3, 0);
LL_TIM_EnableCounter(TIM3);
#endif
}
analog_wind_qf_t analog_anemometer_get_qf(void) {

Wyświetl plik

@ -5,9 +5,24 @@
* Author: mateusz
*/
#include "drivers/dallas.h"
#ifdef PARAMETEO
// those defines and an undef are only required for shitty Eclipse indexer to see anything from STM32L471xx target
#define STM32L471xx
#define USE_FULL_LL_DRIVER
#undef STM32F10X_MD_VL
#endif
#ifdef STM32F10X_MD_VL
#include <stm32f10x.h>
#include <stm32f10x_gpio.h>
#endif
#ifdef STM32L471xx
#include <stm32l4xx.h>
#include <stm32l4xx_ll_gpio.h>
#endif
#include "drivers/dallas.h"
#include <string.h>
volatile int delay_5us = 0;
@ -17,6 +32,7 @@ dallas_struct_t dallas;
void dallas_init(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, uint16_t GPIO_PinSource, dallas_average_t* average) {
#ifdef STM32F10X_MD_VL
GPIO_InitTypeDef GPIO_input;
GPIO_InitTypeDef GPIO_output;
@ -34,6 +50,33 @@ void dallas_init(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, uint16_t GPIO_PinSource
dallas.GPIOx = GPIOx;
dallas.GPIO_Pin = GPIO_Pin;
dallas.GPIO_Pin_input = GPIO_Pin << 1;
#endif
#ifdef STM32L471xx
LL_GPIO_InitTypeDef GPIO_input, GPIO_output;
GPIO_output.Pin = GPIO_Pin;
GPIO_output.Mode = LL_GPIO_MODE_OUTPUT;
GPIO_output.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;
GPIO_output.Speed = LL_GPIO_SPEED_FREQ_MEDIUM;
//GPIO_output.Alternate = ;
GPIO_output.Pull = LL_GPIO_PULL_NO;
GPIO_input.Pin = GPIO_Pin << 1;
GPIO_input.Mode = LL_GPIO_MODE_INPUT;
//GPIO_input.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;
GPIO_input.Speed = LL_GPIO_SPEED_FREQ_MEDIUM;
//GPIO_output.Alternate = ;
GPIO_input.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOx, &GPIO_output);
LL_GPIO_Init(GPIOx, &GPIO_input);
dallas.GPIOx = GPIOx;
dallas.GPIO_Pin = GPIO_Pin;
dallas.GPIO_Pin_input = GPIO_Pin << 1;
#endif
for (int i = 0; i < DALLAS_AVERAGE_LN; i++) {
average->values[i] = DALLAS_INIT_VALUE;
@ -48,7 +91,7 @@ void dallas_config_timer(void) {
//NVIC_DisableIRQ( TIM3_IRQn ); // data transmission initializer
NVIC_DisableIRQ( TIM4_IRQn ); // data transmission initializer
NVIC_DisableIRQ( TIM7_IRQn ); // data transmission initializer
NVIC_DisableIRQ( 25 ); // anemometer
//NVIC_DisableIRQ( 25 ); // TODO: probably remainder of TX20 driver to be deleted
NVIC_SetPriority(TIM2_IRQn, 1);
TIM2->PSC = 0;
@ -67,7 +110,7 @@ void dallas_deconfig_timer(void) {
//NVIC_EnableIRQ( TIM3_IRQn ); // adc
NVIC_EnableIRQ( TIM4_IRQn ); // data transmission initializer
NVIC_EnableIRQ( TIM7_IRQn ); // data transmission initializer
NVIC_EnableIRQ( 25 ); // anemometer
//NVIC_EnableIRQ( 25 ); // TODO: probably remainder of TX20 driver to be deleted
// reverting back to APRS timings
//NVIC_SetPriority(TIM4_IRQn, 1);

Wyświetl plik

@ -5,9 +5,9 @@
* Author: mateusz
*/
#include "./drivers/dma_helper_functions.h"
#include <stm32f10x_dma.h>
#ifdef STM32F10X_MD_VL
void dma_helper_start_ch7(DMA_InitTypeDef* DMA_InitStruct) {
DMA_DeInit(DMA1_Channel7);
@ -15,3 +15,21 @@ void dma_helper_start_ch7(DMA_InitTypeDef* DMA_InitStruct) {
DMA1_Channel7->CCR |= DMA_CCR7_EN;
DMA1_Channel7->CCR |= DMA_CCR7_TCIE;
}
#endif
#ifdef STM32L471xx
void dma_helper_start_ch7(LL_DMA_InitTypeDef* DMA_InitStruct) {
//DMA_DeInit(DMA1_Channel7);
LL_DMA_DeInit(DMA1, LL_DMA_CHANNEL_5);
LL_DMA_Init(DMA1, LL_DMA_CHANNEL_5, DMA_InitStruct);
LL_DMA_EnableChannel(DMA1, LL_DMA_CHANNEL_5);
LL_DMA_EnableIT_TC(DMA1, LL_DMA_CHANNEL_5);
//DMA1_Channel7->CCR |= DMA_CCR7_EN;
//DMA1_Channel7->CCR |= DMA_CCR7_TCIE;
}
#endif

Wyświetl plik

@ -1,4 +1,4 @@
#include "drivers/gpio_conf.h"
#include <drivers/gpio_conf_stm32f1x.h>
void Configure_GPIO(GPIO_TypeDef* gpio, uint8_t pin, uint8_t conf){
volatile uint32_t *crPointer;

Wyświetl plik

@ -1,5 +1,5 @@
#include <drivers/gpio_conf_stm32f1x.h>
#include "drivers/i2c.h"
#include "drivers/gpio_conf.h"
#include <stm32f10x.h>
#include "main.h"

Wyświetl plik

@ -1,6 +1,5 @@
#include <drivers/gpio_conf_stm32f1x.h>
#include "drivers/serial.h"
#include "drivers/gpio_conf.h"
#include "station_config.h"
#include "diag/Trace.h"