kopia lustrzana https://github.com/SP8EBC/ParaTNC
first sketch of a driver for analogue pulses/voltage anemometers
rodzic
1a08e27900
commit
4f8a3b2a49
|
@ -198,7 +198,7 @@
|
|||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="Timer.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
|
||||
<entry excluding="src/drivers/tm_stm32fonewire/tm_stm32f1_onewire.c|src/stm32f1-stdperiph/stm32f10x_wwdg.c|src/stm32f1-stdperiph/stm32f10x_spi.c|src/stm32f1-stdperiph/stm32f10x_sdio.c|src/stm32f1-stdperiph/stm32f10x_rtc.c|src/stm32f1-stdperiph/stm32f10x_pwr.c|src/stm32f1-stdperiph/stm32f10x_fsmc.c|src/stm32f1-stdperiph/stm32f10x_flash.c|src/stm32f1-stdperiph/stm32f10x_dma.c|src/stm32f1-stdperiph/stm32f10x_dbgmcu.c|src/stm32f1-stdperiph/stm32f10x_dac.c|src/stm32f1-stdperiph/stm32f10x_crc.c|src/stm32f1-stdperiph/stm32f10x_cec.c|src/stm32f1-stdperiph/stm32f10x_can.c|src/stm32f1-stdperiph/stm32f10x_bkp.c|src/stm32f1-stdperiph/stm32f10x_adc.c" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="system"/>
|
||||
<entry excluding="src/drivers/tm_stm32fonewire/tm_stm32f1_onewire.c|src/stm32f1-stdperiph/stm32f10x_wwdg.c|src/stm32f1-stdperiph/stm32f10x_spi.c|src/stm32f1-stdperiph/stm32f10x_sdio.c|src/stm32f1-stdperiph/stm32f10x_rtc.c|src/stm32f1-stdperiph/stm32f10x_pwr.c|src/stm32f1-stdperiph/stm32f10x_fsmc.c|src/stm32f1-stdperiph/stm32f10x_flash.c|src/stm32f1-stdperiph/stm32f10x_dbgmcu.c|src/stm32f1-stdperiph/stm32f10x_dac.c|src/stm32f1-stdperiph/stm32f10x_crc.c|src/stm32f1-stdperiph/stm32f10x_cec.c|src/stm32f1-stdperiph/stm32f10x_can.c|src/stm32f1-stdperiph/stm32f10x_bkp.c|src/stm32f1-stdperiph/stm32f10x_adc.c" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="system"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
|
@ -357,7 +357,7 @@
|
|||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="Timer.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
|
||||
<entry excluding="src/drivers/tm_stm32fonewire/tm_stm32f1_onewire.c|src/stm32f1-stdperiph/stm32f10x_wwdg.c|src/stm32f1-stdperiph/stm32f10x_tim.c|src/stm32f1-stdperiph/stm32f10x_spi.c|src/stm32f1-stdperiph/stm32f10x_sdio.c|src/stm32f1-stdperiph/stm32f10x_rtc.c|src/stm32f1-stdperiph/stm32f10x_pwr.c|src/stm32f1-stdperiph/stm32f10x_fsmc.c|src/stm32f1-stdperiph/stm32f10x_flash.c|src/stm32f1-stdperiph/stm32f10x_dma.c|src/stm32f1-stdperiph/stm32f10x_dbgmcu.c|src/stm32f1-stdperiph/stm32f10x_dac.c|src/stm32f1-stdperiph/stm32f10x_crc.c|src/stm32f1-stdperiph/stm32f10x_cec.c|src/stm32f1-stdperiph/stm32f10x_can.c|src/stm32f1-stdperiph/stm32f10x_bkp.c|src/stm32f1-stdperiph/stm32f10x_adc.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="system"/>
|
||||
<entry excluding="src/drivers/tm_stm32fonewire/tm_stm32f1_onewire.c|src/stm32f1-stdperiph/stm32f10x_wwdg.c|src/stm32f1-stdperiph/stm32f10x_tim.c|src/stm32f1-stdperiph/stm32f10x_spi.c|src/stm32f1-stdperiph/stm32f10x_sdio.c|src/stm32f1-stdperiph/stm32f10x_rtc.c|src/stm32f1-stdperiph/stm32f10x_pwr.c|src/stm32f1-stdperiph/stm32f10x_fsmc.c|src/stm32f1-stdperiph/stm32f10x_flash.c|src/stm32f1-stdperiph/stm32f10x_dbgmcu.c|src/stm32f1-stdperiph/stm32f10x_dac.c|src/stm32f1-stdperiph/stm32f10x_crc.c|src/stm32f1-stdperiph/stm32f10x_cec.c|src/stm32f1-stdperiph/stm32f10x_can.c|src/stm32f1-stdperiph/stm32f10x_bkp.c|src/stm32f1-stdperiph/stm32f10x_adc.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="system"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
C_SRCS += \
|
||||
../system/src/drivers/_dht22.c \
|
||||
../system/src/drivers/analog_anemometer.c \
|
||||
../system/src/drivers/dallas.c \
|
||||
../system/src/drivers/gpio_conf.c \
|
||||
../system/src/drivers/i2c.c \
|
||||
|
@ -15,6 +16,7 @@ C_SRCS += \
|
|||
|
||||
OBJS += \
|
||||
./system/src/drivers/_dht22.o \
|
||||
./system/src/drivers/analog_anemometer.o \
|
||||
./system/src/drivers/dallas.o \
|
||||
./system/src/drivers/gpio_conf.o \
|
||||
./system/src/drivers/i2c.o \
|
||||
|
@ -25,6 +27,7 @@ OBJS += \
|
|||
|
||||
C_DEPS += \
|
||||
./system/src/drivers/_dht22.d \
|
||||
./system/src/drivers/analog_anemometer.d \
|
||||
./system/src/drivers/dallas.d \
|
||||
./system/src/drivers/gpio_conf.d \
|
||||
./system/src/drivers/i2c.d \
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
C_SRCS += \
|
||||
../system/src/stm32f1-stdperiph/misc.c \
|
||||
../system/src/stm32f1-stdperiph/stm32f10x_dma.c \
|
||||
../system/src/stm32f1-stdperiph/stm32f10x_exti.c \
|
||||
../system/src/stm32f1-stdperiph/stm32f10x_gpio.c \
|
||||
../system/src/stm32f1-stdperiph/stm32f10x_i2c.c \
|
||||
|
@ -15,6 +16,7 @@ C_SRCS += \
|
|||
|
||||
OBJS += \
|
||||
./system/src/stm32f1-stdperiph/misc.o \
|
||||
./system/src/stm32f1-stdperiph/stm32f10x_dma.o \
|
||||
./system/src/stm32f1-stdperiph/stm32f10x_exti.o \
|
||||
./system/src/stm32f1-stdperiph/stm32f10x_gpio.o \
|
||||
./system/src/stm32f1-stdperiph/stm32f10x_i2c.o \
|
||||
|
@ -25,6 +27,7 @@ OBJS += \
|
|||
|
||||
C_DEPS += \
|
||||
./system/src/stm32f1-stdperiph/misc.d \
|
||||
./system/src/stm32f1-stdperiph/stm32f10x_dma.d \
|
||||
./system/src/stm32f1-stdperiph/stm32f10x_exti.d \
|
||||
./system/src/stm32f1-stdperiph/stm32f10x_gpio.d \
|
||||
./system/src/stm32f1-stdperiph/stm32f10x_i2c.d \
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
#include "aprs/ax25.h"
|
||||
|
||||
#define SW_VER "DE05"
|
||||
#define SW_DATE "22122019"
|
||||
#define SW_VER "DE06"
|
||||
#define SW_DATE "25122019"
|
||||
|
||||
#define SYSTICK_TICKS_PER_SECONDS 100
|
||||
#define SYSTICK_TICKS_PERIOD 10
|
||||
|
|
|
@ -8,34 +8,48 @@
|
|||
#ifndef STATION_CONFIG_H_
|
||||
#define STATION_CONFIG_H_
|
||||
|
||||
// Only for debugging
|
||||
//#define _DBG_TRACE
|
||||
/* ------------------ */
|
||||
/* MODES OF OPERATION */
|
||||
|
||||
#define _METEO // Enable meteo station
|
||||
#define _DIGI // Enable WIDE1-1 digipeater
|
||||
//#define _DIGI_ONLY_789 // Limit digipeater to handle only -7, -8 and -9 SSIDs
|
||||
//#define _VICTRON // Enable support for Victron VE.Direct protocol
|
||||
|
||||
#define _METEO // Uncomment to enable all meteo functionality. TX20 anemometer, dallas termometer, MS5611 pressure sens
|
||||
//#define _DALLAS_AS_TELEM // Uncomment this to enable temperture measuremenets as a fifth telem channel if _METEO is disabled
|
||||
//#define _DALLAS_SPLIT_PIN // Uncomment this to change One Wire bus driver to work on separate pins for transmit and receive
|
||||
// this is useful if the ground separation circuitry is used
|
||||
/* MODES OF OPERATION */
|
||||
/* ------------------ */
|
||||
|
||||
#define PARATNC_HWREV_A
|
||||
//#define PARATNC_HWREV_B
|
||||
|
||||
#define _DIGI // Comment this do disable WIDE1-1 digipeating
|
||||
//#define _DIGI_ONLY_789 // Uncomment this to limit the digipeater only to SSIDs 7, 8 and 9 which corresponds
|
||||
// mostly to mobile stations. This may be used to limit power consuption or tx activity
|
||||
/* ---------------------------- */
|
||||
/* WEATHER/METEO CONFIGURATION */
|
||||
|
||||
//#define _VICTRON // Uncomment this to enable VE.Direct protocol
|
||||
//#define _DALLAS_AS_TELEM // Use Dallas one-wire thermometer as a 5th telemetry channel
|
||||
// May be used even if _METEO is not enabled
|
||||
#define _DALLAS_SPLIT_PIN
|
||||
#define _ANEMOMETER_TX20
|
||||
//#define _ANEMOMETER_ANALOGUE
|
||||
#define _ANEMOMETER_PULSES_IN_10SEC_PER_ONE_MS_OF_WINDSPEED 10
|
||||
#define _ANEMOMETER_DIRECTION_ASCENDING_WITH_VOLTAGE
|
||||
#define _ANEMOMETER_VOLTAGE_FOR_1DEG_DIRECTION
|
||||
#define _ANEMOMETER_VOLTAGE_FOR_359DEG_DIRECTION
|
||||
|
||||
/* WEATHER/METEO CONFIGURATION */
|
||||
/* ---------------------------- */
|
||||
|
||||
//#define _MUTE_RF // TODO: Not yet implemented - This will make station RXonly and disable all data transmission
|
||||
//#define _MUTE_OWN // TODO: Not yet implemented - This will disable all self-generated packets (wx, telemetry, beacon)
|
||||
// and switch device to "pure" kiss TNC operation. Packets from PC will be transmitted normally.
|
||||
|
||||
// Coordines should be in APRS decimal format DDDMM.SS for Longitude and DDMM.SS for latitude
|
||||
#define _CALL "NOCALL"
|
||||
#define _SSID 0
|
||||
#define _LAT 4900.00
|
||||
#define _CALL "N9CALL"
|
||||
#define _SSID 1
|
||||
#define _LAT 4950.00
|
||||
#define _LATNS 'N'
|
||||
#define _LON 01900.00
|
||||
#define _LONWE 'E'
|
||||
#define _COMMENT "Modify this file to fit Your needs and rename it to station_config.h"
|
||||
#define _COMMENT "please set a configuration!"
|
||||
|
||||
// You can use only one of these below defines to choose symbol. Meteo data are are always transmitted with blue WX symbol
|
||||
//#define _SYMBOL_DIGI // uncomment if you want digi symbol(green star with D inside)
|
||||
|
@ -56,14 +70,14 @@
|
|||
// Comment this to disable beacon auto sending during startup (this can be risky if RF feedback occur)
|
||||
//#define _BCN_ON_STARTUP
|
||||
|
||||
#define _WX_INTERVAL 4 // WX packet interval in minutes
|
||||
#define _BCN_INTERVAL 15 // Own beacon interval in minutes
|
||||
#define _WX_INTERVAL 6 // WX packet interval in minutes
|
||||
#define _BCN_INTERVAL 5 // Own beacon interval in minutes
|
||||
|
||||
#define _PTT_PUSHPULL // Uncomment this if you want PTT line to work as Push-pull instead of Open Drain
|
||||
#define _SERIAL_BAUDRATE 9600
|
||||
|
||||
// Transmitting delay
|
||||
#define _DELAY_BASE 20 // * 50ms. For example setting 10 gives 500msec delay. Maximum value is 20
|
||||
#define _DELAY_BASE 2 // * 50ms. For example setting 10 gives 500msec delay. Maximum value is 20
|
||||
//#define _RANDOM_DELAY // adds random delay TO fixed time set by _DELAY_BASE. This additional time can be
|
||||
// from 100ms up to 1 sec in 100ms steps. Values are drawn from samples going from ADC
|
||||
// so it is better to use Unsquelched output in radio to provide much more randomness
|
||||
|
@ -116,6 +130,20 @@
|
|||
#define _DIGI
|
||||
#endif
|
||||
|
||||
#if defined(PARATNC_HWREV_A) && (defined (_METEO) || defined (_DALLAS_AS_TELEM)) && !defined(_DALLAS_SPLIT_PIN)
|
||||
#define _DALLAS_SPLIT_PIN
|
||||
#endif
|
||||
|
||||
#if defined(PARATNC_HWREV_B) && (defined (_METEO) || defined (_DALLAS_AS_TELEM)) && !defined(_DALLAS_SPLIT_PIN)
|
||||
#define _DALLAS_SPLIT_PIN
|
||||
#endif
|
||||
|
||||
#if defined(_ANEMOMETER_TX20) && defined(_ANEMOMETER_ANALOGUE)
|
||||
#error "You cannot use two anemometers at once!!!"
|
||||
#endif
|
||||
|
||||
#if !defined(_ANEMOMETER_TX20) && !defined(_ANEMOMETER_ANALOGUE) && defined(_METEO)
|
||||
#define _ANEMOMETER_TX20
|
||||
#endif
|
||||
|
||||
#endif /* STATION_CONFIG_H_ */
|
||||
|
|
BIN
skalowania.ods
BIN
skalowania.ods
Plik binarny nie jest wyświetlany.
|
@ -50,18 +50,5 @@ void TimerConfig(void) {
|
|||
TIM7->CR1 |= TIM_CR1_CEN;
|
||||
TIM7->DIER |= 1;
|
||||
NVIC_EnableIRQ( TIM7_IRQn );
|
||||
/*
|
||||
///////////////////////////////////////////
|
||||
/// konfiguracja TIM3 -- wysylanie wlasnej pozycji i danych WX ///
|
||||
///////////////////////////////////////////
|
||||
NVIC_SetPriority(TIM3_IRQn, 4);
|
||||
TIM3->PSC = 65534;
|
||||
TIM3->ARR = 21960;
|
||||
TIM3->CR1 |= TIM_CR1_DIR;
|
||||
TIM3->CR1 &= (0xFFFFFFFF ^ TIM_CR1_DIR);
|
||||
TIM3->CR1 |= TIM_CR1_CEN;
|
||||
TIM3->DIER |= 1;
|
||||
NVIC_EnableIRQ( TIM3_IRQn );
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "drivers/_dht22.h"
|
||||
#include "drivers/serial.h"
|
||||
#include "drivers/i2c.h"
|
||||
#include "drivers/analog_anemometer.h"
|
||||
#include "aprs/wx.h"
|
||||
#include "aprs/telemetry.h"
|
||||
#include "aprs/beacon.h"
|
||||
|
@ -43,20 +44,20 @@
|
|||
// TIM1 w TX20
|
||||
|
||||
/* Zmienne używane do oversamplingu */
|
||||
char adc_sample_count = 0, adc_sample_c2 = 0; // Zmienna odliczająca próbki
|
||||
int adc_sample_count = 0, adc_sample_c2 = 0; // Zmienna odliczająca próbki
|
||||
unsigned short int AdcBuffer[4]; // Bufor przechowujący kolejne wartości rejestru DR
|
||||
short int AdcValue;
|
||||
|
||||
// this function will set all iterrupt priorities except systick
|
||||
void it_handlers_set_priorities(void) {
|
||||
NVIC_SetPriority(TIM2_IRQn, 1);
|
||||
NVIC_SetPriority(TIM2_IRQn, 1); // one-wire delay
|
||||
NVIC_SetPriority(I2C1_EV_IRQn, 2);
|
||||
NVIC_SetPriority(TIM4_IRQn, 3);
|
||||
NVIC_SetPriority(TIM7_IRQn, 4);
|
||||
NVIC_SetPriority(TIM4_IRQn, 3); // DAC
|
||||
NVIC_SetPriority(TIM7_IRQn, 4); // ADC
|
||||
// systick
|
||||
NVIC_SetPriority(TIM1_UP_TIM16_IRQn, 6);
|
||||
NVIC_SetPriority(EXTI9_5_IRQn, 7);
|
||||
NVIC_SetPriority(EXTI4_IRQn, 8);
|
||||
NVIC_SetPriority(TIM1_UP_TIM16_IRQn, 6); // TX20 anemometer
|
||||
NVIC_SetPriority(EXTI9_5_IRQn, 7); // TX20 anemometer
|
||||
NVIC_SetPriority(EXTI4_IRQn, 8); // DHT22 humidity sensor
|
||||
NVIC_SetPriority(USART1_IRQn, 9);
|
||||
NVIC_SetPriority(I2C1_ER_IRQn, 10);
|
||||
|
||||
|
@ -111,17 +112,25 @@ void TIM2_IRQHandler( void ) {
|
|||
|
||||
}
|
||||
|
||||
void TIM1_TRG_COM_TIM17_IRQHandler(void) {
|
||||
NVIC_ClearPendingIRQ(TIM1_TRG_COM_TIM17_IRQn);
|
||||
TIM17->SR &= ~(1<<0);
|
||||
|
||||
analog_anemometer_timer_irq();
|
||||
}
|
||||
|
||||
void DMA1_Channel7_IRQHandler() {
|
||||
NVIC_ClearPendingIRQ(DMA1_Channel7_IRQn);
|
||||
|
||||
analog_anemometer_dma_irq();
|
||||
|
||||
}
|
||||
|
||||
void TIM4_IRQHandler( void ) {
|
||||
// obsluga przerwania cyfra-analog
|
||||
TIM4->SR &= ~(1<<0);
|
||||
// if (timm == 0) {
|
||||
DAC->DHR8R1 = AFSK_DAC_ISR(&main_afsk);
|
||||
DAC->SWTRIGR |= 1;
|
||||
// }
|
||||
// else {
|
||||
// if (delay_5us > 0)
|
||||
// delay_5us--;
|
||||
// }
|
||||
DAC->DHR8R1 = AFSK_DAC_ISR(&main_afsk);
|
||||
DAC->SWTRIGR |= 1;
|
||||
|
||||
if (main_afsk.sending) {
|
||||
GPIO_SetBits(GPIOC, GPIO_Pin_9);
|
||||
|
|
10
src/main.c
10
src/main.c
|
@ -41,6 +41,7 @@
|
|||
#include "drivers/ms5611.h"
|
||||
#include "drivers/i2c.h"
|
||||
#include "drivers/tx20.h"
|
||||
#include "drivers/analog_anemometer.h"
|
||||
#include "aprs/wx.h"
|
||||
#endif
|
||||
|
||||
|
@ -203,7 +204,14 @@ main(int argc, char* argv[])
|
|||
#else
|
||||
dallas_init(GPIOC, GPIO_Pin_11, GPIO_PinSource11, &rte_wx_dallas_average);
|
||||
#endif
|
||||
TX20Init();
|
||||
|
||||
#ifdef _ANEMOMETER_TX20
|
||||
TX20Init();
|
||||
#endif
|
||||
#ifdef _ANEMOMETER_ANALOGUE
|
||||
analog_anemometer_init(0, 0, 0, 0);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#ifdef _DALLAS_AS_TELEM
|
||||
#ifndef _DALLAS_SPLIT_PIN
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* analog_anemometer.h
|
||||
*
|
||||
* Created on: 25.12.2019
|
||||
* Author: mateusz
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_DRIVERS_ANALOG_ANEMOMETER_H_
|
||||
#define INCLUDE_DRIVERS_ANALOG_ANEMOMETER_H_
|
||||
|
||||
#define ANALOG_ANEMOMETER_SPEED_PULSES_N 10
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void analog_anemometer_init( uint16_t pulses_per_ms,
|
||||
uint16_t mvolts_for_1deg,
|
||||
uint16_t mvolts_for_359deg,
|
||||
uint8_t reversed);
|
||||
|
||||
void analog_anemometer_timer_irq(void);
|
||||
|
||||
#endif /* INCLUDE_DRIVERS_ANALOG_ANEMOMETER_H_ */
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* analog_anemometer.c
|
||||
*
|
||||
* Created on: 25.12.2019
|
||||
* Author: mateusz
|
||||
*/
|
||||
|
||||
#include "drivers/analog_anemometer.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stm32f10x_tim.h>
|
||||
#include <stm32f10x_dma.h>
|
||||
#include "drivers/gpio_conf.h"
|
||||
|
||||
uint16_t analog_anemometer_windspeed_pulses_time[ANALOG_ANEMOMETER_SPEED_PULSES_N];
|
||||
|
||||
void analog_anemometer_init(uint16_t pulses_per_ms, uint16_t mvolts_for_1deg,
|
||||
uint16_t mvolts_for_359deg, uint8_t reversed) {
|
||||
|
||||
TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStruct;
|
||||
DMA_InitTypeDef DMA_InitStruct;
|
||||
|
||||
// enabling the clock for TIM17
|
||||
RCC->APB2ENR |= RCC_APB2ENR_TIM17EN;
|
||||
RCC->AHBENR |= RCC_AHBENR_DMA1EN;
|
||||
|
||||
// Configuring a pin where pulses from anemometer are connected
|
||||
Configure_GPIO(GPIOB,9,FLOATING_INPUT);
|
||||
|
||||
// resetting the timer to defaults
|
||||
TIM_DeInit(TIM17);
|
||||
|
||||
// initializing structure with default values
|
||||
TIM_TimeBaseStructInit(&TIM_TimeBaseInitStruct);
|
||||
|
||||
TIM_TimeBaseInitStruct.TIM_Prescaler = 23999; // PSC 23999
|
||||
TIM_TimeBaseInitStruct.TIM_Period = 60000; // ARR
|
||||
TIM_TimeBaseInitStruct.TIM_CounterMode = TIM_CounterMode_Up;
|
||||
TIM_TimeBaseInitStruct.TIM_ClockDivision = TIM_CKD_DIV1;
|
||||
|
||||
// Configuring basics of thr timer
|
||||
TIM_TimeBaseInit(TIM17, &TIM_TimeBaseInitStruct);
|
||||
|
||||
// Enabling capture input
|
||||
TIM_TIxExternalClockConfig(TIM17, TIM_TIxExternalCLK1Source_TI1, TIM_ICPolarity_Rising, 0);
|
||||
|
||||
// Starting timer
|
||||
TIM_Cmd(TIM17, ENABLE);
|
||||
|
||||
// Enabling a DMA request signal from first capture-compare channel
|
||||
TIM_DMACmd(TIM17, TIM_DMA_CC1, ENABLE);
|
||||
|
||||
// Enabling an interrupt
|
||||
TIM_ITConfig(TIM17, TIM_IT_Update, ENABLE);
|
||||
NVIC_EnableIRQ( TIM1_TRG_COM_TIM17_IRQn );
|
||||
|
||||
// Initializing the struct with DMA configuration
|
||||
DMA_StructInit(&DMA_InitStruct);
|
||||
|
||||
// De initializing DMA1
|
||||
DMA_DeInit(DMA1_Channel7);
|
||||
|
||||
DMA_InitStruct.DMA_BufferSize = ANALOG_ANEMOMETER_SPEED_PULSES_N;
|
||||
DMA_InitStruct.DMA_DIR = DMA_DIR_PeripheralSRC;
|
||||
DMA_InitStruct.DMA_M2M = DMA_M2M_Disable;
|
||||
DMA_InitStruct.DMA_MemoryBaseAddr = analog_anemometer_windspeed_pulses_time;
|
||||
DMA_InitStruct.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
|
||||
DMA_InitStruct.DMA_MemoryInc = DMA_MemoryInc_Enable;
|
||||
DMA_InitStruct.DMA_PeripheralBaseAddr = &TIM17->CCR1;
|
||||
DMA_InitStruct.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
|
||||
DMA_InitStruct.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
|
||||
|
||||
DMA_Init(DMA1_Channel7, &DMA_InitStruct);
|
||||
DMA1_Channel7->CCR |= DMA_CCR7_EN;
|
||||
DMA1_Channel7->CCR |= DMA_CCR7_TCIE;
|
||||
|
||||
NVIC_EnableIRQ( DMA1_Channel7_IRQn );
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void analog_anemometer_timer_irq(void) {
|
||||
|
||||
}
|
||||
|
||||
void analog_anemometer_dma_irq(void) {
|
||||
DMA_ClearITPendingBit(DMA1_IT_GL7);
|
||||
}
|
|
@ -195,7 +195,8 @@ char __attribute__((optimize("O0"))) dallas_receive_byte(void) {
|
|||
float __attribute__((optimize("O0"))) dallas_query(DallasQF *qf) {
|
||||
unsigned char data[9];
|
||||
int crc;
|
||||
char temp1, temp2, sign, i;
|
||||
int i;
|
||||
char temp1, temp2, sign;
|
||||
unsigned temp3;
|
||||
float temperature = 0.0f;
|
||||
|
||||
|
|
|
@ -11,15 +11,6 @@
|
|||
|
||||
#include "station_config.h"
|
||||
|
||||
//#include <stm32f10x_md_vl.h>
|
||||
|
||||
///* only for debug */
|
||||
//#define __SERIAL
|
||||
//#include "drivers/serial.h"
|
||||
//char logging_buff[40];
|
||||
//#include <stdlib.h>
|
||||
//#include <stdio.h>
|
||||
|
||||
#define BS VNAME.BitSampler
|
||||
#define BQ VNAME.BitQueue
|
||||
#define QL VNAME.QueueLenght
|
||||
|
@ -195,6 +186,7 @@ void TX20DataParse(void) {
|
|||
wx_last_good_wind_time = master_time;
|
||||
}
|
||||
|
||||
#ifdef _ANEMOMETER_TX20
|
||||
// Przerwania EXTI do synchronizacji
|
||||
|
||||
#if TX == 0
|
||||
|
@ -302,3 +294,5 @@ void TIM4_IRQHandler( void ) {
|
|||
#else
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue