kopia lustrzana https://github.com/SP8EBC/ParaTNC
changed configuration of UART pin. Added hardware errata
rodzic
f6401a57af
commit
ba4e3b841a
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 926 KiB |
|
@ -4,7 +4,7 @@
|
||||||
#include "aprs/ax25.h"
|
#include "aprs/ax25.h"
|
||||||
|
|
||||||
#define SW_VER "DE07"
|
#define SW_VER "DE07"
|
||||||
#define SW_DATE "27032020"
|
#define SW_DATE "04042020"
|
||||||
|
|
||||||
#define SYSTICK_TICKS_PER_SECONDS 100
|
#define SYSTICK_TICKS_PER_SECONDS 100
|
||||||
#define SYSTICK_TICKS_PERIOD 10
|
#define SYSTICK_TICKS_PERIOD 10
|
||||||
|
@ -30,9 +30,6 @@ extern char after_tx_lock;
|
||||||
extern unsigned short rx10m, tx10m, digi10m, kiss10m;
|
extern unsigned short rx10m, tx10m, digi10m, kiss10m;
|
||||||
|
|
||||||
uint16_t main_get_adc_sample(void);
|
uint16_t main_get_adc_sample(void);
|
||||||
//void main_wx_decremenet_counter(void);
|
|
||||||
//void main_packets_tx_decremenet_counter(void);
|
|
||||||
//void main_two_second_pool_decrement_counter(void);
|
|
||||||
|
|
||||||
inline void main_wait_for_tx_complete(void) {
|
inline void main_wait_for_tx_complete(void) {
|
||||||
while(main_afsk.sending == 1);
|
while(main_afsk.sending == 1);
|
||||||
|
|
|
@ -18,6 +18,10 @@
|
||||||
|
|
||||||
#define PRESSURE_AVERAGE_LN 4
|
#define PRESSURE_AVERAGE_LN 4
|
||||||
|
|
||||||
|
#define RTE_WX_MEASUREMENT_WIND 460
|
||||||
|
#define RTE_WX_MEASUREMENT_TEMPERATURE 100
|
||||||
|
#define RTE_WX_MEASUREMENT_PRESSUERE 300
|
||||||
|
|
||||||
extern float rte_wx_temperature_dallas, rte_wx_temperature_dallas_valid;
|
extern float rte_wx_temperature_dallas, rte_wx_temperature_dallas_valid;
|
||||||
extern float rte_wx_temperature_dalls_slew_rate;
|
extern float rte_wx_temperature_dalls_slew_rate;
|
||||||
extern float rte_wx_temperature_average_dallas_valid;
|
extern float rte_wx_temperature_average_dallas_valid;
|
||||||
|
@ -60,6 +64,7 @@ extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void rte_wx_init(void);
|
void rte_wx_init(void);
|
||||||
|
void rte_wx_update_last_measuremenet_timers(uint16_t measurement_type);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "drivers/tx20.h"
|
#include "drivers/tx20.h"
|
||||||
#include "drivers/analog_anemometer.h"
|
#include "drivers/analog_anemometer.h"
|
||||||
#include "aprs/wx.h"
|
#include "aprs/wx.h"
|
||||||
|
#include "drivers/gpio_conf.h"
|
||||||
|
|
||||||
#ifdef _UMB_MASTER
|
#ifdef _UMB_MASTER
|
||||||
#include "umb_master/umb_master.h"
|
#include "umb_master/umb_master.h"
|
||||||
|
@ -200,7 +201,6 @@ main(int argc, char* argv[])
|
||||||
main_own_path_ln = ConfigPath(main_own_path);
|
main_own_path_ln = ConfigPath(main_own_path);
|
||||||
|
|
||||||
#ifdef _METEO
|
#ifdef _METEO
|
||||||
|
|
||||||
// initialize i2c controller
|
// initialize i2c controller
|
||||||
i2cConfigure();
|
i2cConfigure();
|
||||||
#endif
|
#endif
|
||||||
|
@ -213,6 +213,9 @@ main(int argc, char* argv[])
|
||||||
ax25_init(&main_ax25, &main_afsk, 0, 0x00);
|
ax25_init(&main_ax25, &main_afsk, 0, 0x00);
|
||||||
DA_Init();
|
DA_Init();
|
||||||
|
|
||||||
|
// initialize Watchdog output
|
||||||
|
Configure_GPIO(GPIOA,12,GPPP_OUTPUT_50MHZ);
|
||||||
|
|
||||||
// initialize variables & arrays in rte_wx
|
// initialize variables & arrays in rte_wx
|
||||||
rte_wx_init();
|
rte_wx_init();
|
||||||
|
|
||||||
|
@ -512,6 +515,8 @@ main(int argc, char* argv[])
|
||||||
wx_pool_anemometer();
|
wx_pool_anemometer();
|
||||||
|
|
||||||
main_ten_second_pool_timer = 10000;
|
main_ten_second_pool_timer = 10000;
|
||||||
|
|
||||||
|
GPIOA->ODR = (GPIOA->ODR ^ GPIO_Pin_12);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _METEO
|
#ifdef _METEO
|
||||||
|
|
10
src/rte_wx.c
10
src/rte_wx.c
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
|
|
||||||
#include <rte_wx.h>
|
#include <rte_wx.h>
|
||||||
|
#include <wx_handler.h>
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
float rte_wx_temperature_dallas = 0.0f, rte_wx_temperature_dallas_valid = 0.0f;
|
float rte_wx_temperature_dallas = 0.0f, rte_wx_temperature_dallas_valid = 0.0f;
|
||||||
float rte_wx_temperature_dalls_slew_rate = 0.0f;
|
float rte_wx_temperature_dalls_slew_rate = 0.0f;
|
||||||
|
@ -56,3 +58,11 @@ void rte_wx_init(void) {
|
||||||
rte_wx_pressure_history[i] = 0.0f;
|
rte_wx_pressure_history[i] = 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rte_wx_update_last_measuremenet_timers(uint16_t parameter_type) {
|
||||||
|
if (parameter_type == RTE_WX_MEASUREMENT_WIND)
|
||||||
|
wx_last_good_wind_time = master_time;
|
||||||
|
else if (parameter_type == RTE_WX_MEASUREMENT_TEMPERATURE)
|
||||||
|
wx_last_good_temperature_time = master_time;
|
||||||
|
else;
|
||||||
|
}
|
||||||
|
|
|
@ -32,7 +32,9 @@ typedef struct umb_context_t {
|
||||||
|
|
||||||
uint16_t channel_numbers[UMB_CHANNELS_STORAGE_CAPAC];
|
uint16_t channel_numbers[UMB_CHANNELS_STORAGE_CAPAC];
|
||||||
|
|
||||||
uint8_t current_channel;
|
uint8_t channel_number_it;
|
||||||
|
|
||||||
|
uint16_t current_channel;
|
||||||
|
|
||||||
} umb_context_t;
|
} umb_context_t;
|
||||||
|
|
||||||
|
|
|
@ -71,9 +71,9 @@ void srl_init(void) {
|
||||||
srl_tx_buf_ln = TX_BUFFER_LN;
|
srl_tx_buf_ln = TX_BUFFER_LN;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Configure_GPIO(GPIOA,11,AFPP_OUTPUT_2MHZ); // CTS
|
//Configure_GPIO(GPIOA,11,AFPP_OUTPUT_2MHZ); // CTS
|
||||||
Configure_GPIO(GPIOA,12,AFPP_OUTPUT_2MHZ); // RTS
|
//Configure_GPIO(GPIOA,12,GPPP_OUTPUT_2MHZ); // RTS
|
||||||
Configure_GPIO(GPIOA,8,AFPP_OUTPUT_2MHZ); // CLK
|
//Configure_GPIO(GPIOA,8,AFPP_OUTPUT_2MHZ); // CLK
|
||||||
Configure_GPIO(GPIOA,10,PUD_INPUT); // RX
|
Configure_GPIO(GPIOA,10,PUD_INPUT); // RX
|
||||||
Configure_GPIO(GPIOA,9,AFPP_OUTPUT_2MHZ); // TX
|
Configure_GPIO(GPIOA,9,AFPP_OUTPUT_2MHZ); // TX
|
||||||
|
|
||||||
|
|
|
@ -10,16 +10,17 @@
|
||||||
|
|
||||||
void umb_channel_pool(umb_frame_t *frame, umb_context_t *ctx) {
|
void umb_channel_pool(umb_frame_t *frame, umb_context_t *ctx) {
|
||||||
#if defined(_UMB_MASTER)
|
#if defined(_UMB_MASTER)
|
||||||
if (ctx->current_channel > UMB_CHANNELS_STORAGE_CAPAC)
|
if (ctx->channel_number_it > UMB_CHANNELS_STORAGE_CAPAC)
|
||||||
ctx->current_channel = 0;
|
ctx->channel_number_it = 0;
|
||||||
|
|
||||||
uint16_t curr_chn = ctx->channel_numbers[ctx->current_channel];
|
uint16_t curr_chn = ctx->channel_numbers[ctx->channel_number_it];
|
||||||
|
ctx->current_channel = curr_chn;
|
||||||
|
|
||||||
if (curr_chn != 0xFFFFu) {
|
if (curr_chn != 0xFFFFu) {
|
||||||
umb_0x23_offline_data_request(frame, ctx, curr_chn);
|
umb_0x23_offline_data_request(frame, ctx, curr_chn);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->current_channel++;
|
ctx->channel_number_it++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,6 +280,8 @@ umb_retval_t umb_pooling_handler(umb_context_t* ctx, umb_call_reason_t r, uint32
|
||||||
*/
|
*/
|
||||||
umb_retval_t umb_master_callback(umb_frame_t* frame, umb_context_t* ctx) {
|
umb_retval_t umb_master_callback(umb_frame_t* frame, umb_context_t* ctx) {
|
||||||
|
|
||||||
|
umb_retval_t ret_fron_callback = UMB_UNINITIALIZED;
|
||||||
|
|
||||||
// check if this is a response to routine which was queried recently
|
// check if this is a response to routine which was queried recently
|
||||||
if (frame->command_id != ctx->current_routine) {
|
if (frame->command_id != ctx->current_routine) {
|
||||||
ctx->state = UMB_STATUS_ERROR_WRONG_RID_IN_RESPONSE;
|
ctx->state = UMB_STATUS_ERROR_WRONG_RID_IN_RESPONSE;
|
||||||
|
@ -290,11 +292,16 @@ umb_retval_t umb_master_callback(umb_frame_t* frame, umb_context_t* ctx) {
|
||||||
// looking for a callback to this response
|
// looking for a callback to this response
|
||||||
switch (frame->command_id) {
|
switch (frame->command_id) {
|
||||||
case 0x23: {
|
case 0x23: {
|
||||||
umb_0x23_offline_data_callback(frame, ctx);
|
ret_fron_callback = umb_0x23_offline_data_callback(frame, ctx);
|
||||||
|
|
||||||
|
if (ret_fron_callback == UMB_OK) {
|
||||||
|
rte_wx_update_last_measuremenet_timers(ctx->current_channel);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x26: {
|
case 0x26: {
|
||||||
umb_0x26_status_callback(frame, ctx);
|
ret_fron_callback = umb_0x26_status_callback(frame, ctx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue