kopia lustrzana https://github.com/SP8EBC/ParaTNC
sketch of kiss diagnostics communication
rodzic
ba12a656fa
commit
5537f5d246
|
@ -4,7 +4,6 @@
|
|||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
C_SRCS += \
|
||||
../src/KissCommunication.c \
|
||||
../src/LedConfig.c \
|
||||
../src/PathConfig.c \
|
||||
../src/TimerConfig.c \
|
||||
|
@ -20,6 +19,7 @@ C_SRCS += \
|
|||
../src/float_to_string.c \
|
||||
../src/io.c \
|
||||
../src/it_handlers.c \
|
||||
../src/kiss_communication.c \
|
||||
../src/main.c \
|
||||
../src/packet_tx_handler.c \
|
||||
../src/pwr_save.c \
|
||||
|
@ -35,7 +35,6 @@ C_SRCS += \
|
|||
../src/wx_pwr_switch.c
|
||||
|
||||
OBJS += \
|
||||
./src/KissCommunication.o \
|
||||
./src/LedConfig.o \
|
||||
./src/PathConfig.o \
|
||||
./src/TimerConfig.o \
|
||||
|
@ -51,6 +50,7 @@ OBJS += \
|
|||
./src/float_to_string.o \
|
||||
./src/io.o \
|
||||
./src/it_handlers.o \
|
||||
./src/kiss_communication.o \
|
||||
./src/main.o \
|
||||
./src/packet_tx_handler.o \
|
||||
./src/pwr_save.o \
|
||||
|
@ -66,7 +66,6 @@ OBJS += \
|
|||
./src/wx_pwr_switch.o
|
||||
|
||||
C_DEPS += \
|
||||
./src/KissCommunication.d \
|
||||
./src/LedConfig.d \
|
||||
./src/PathConfig.d \
|
||||
./src/TimerConfig.d \
|
||||
|
@ -82,6 +81,7 @@ C_DEPS += \
|
|||
./src/float_to_string.d \
|
||||
./src/io.d \
|
||||
./src/it_handlers.d \
|
||||
./src/kiss_communication.d \
|
||||
./src/main.d \
|
||||
./src/packet_tx_handler.d \
|
||||
./src/pwr_save.d \
|
||||
|
|
|
@ -5,6 +5,13 @@
|
|||
* Author: mateusz
|
||||
*/
|
||||
|
||||
/**
|
||||
* Important warning for ParaMETEO target!! Starting from EA15 software the configuration is kept in separate NvMem area,
|
||||
* outside application software area. It isn't erased or reprogrammed during loading HEX file generated with this build.
|
||||
* After NvMem is initialized, changing only this configuration won't affect ParaMETEO. To force update flash mass erase
|
||||
* shall be performed.
|
||||
*/
|
||||
|
||||
#ifndef STATION_CONFIG_H_
|
||||
#define STATION_CONFIG_H_
|
||||
|
||||
|
@ -26,9 +33,6 @@
|
|||
/* MODES OF OPERATION */
|
||||
/* ------------------ */
|
||||
|
||||
//#define PARATNC_HWREV_C
|
||||
#define PARAMETEO
|
||||
|
||||
/* ---------------------------- */
|
||||
/* WEATHER/METEO CONFIGURATION */
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef KISSCALLBACK_H_
|
||||
#define KISSCALLBACK_H_
|
||||
|
||||
#include "kiss_communication.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void kiss_callback_get_running_config();
|
||||
int16_t kiss_pool_callback_get_running_config(uint8_t * output_buffer, uint16_t buffer_size, uint8_t current_segment );
|
||||
|
||||
#endif
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "stdint.h"
|
||||
|
||||
#define KISS_BUFFER_LN 256
|
||||
//#define KISS_BUFFER_LN 256
|
||||
|
||||
#define KISS_TOO_LONG_FRM -1
|
||||
|
||||
|
@ -23,12 +23,22 @@
|
|||
#define TFEND (uint8_t)0xDC
|
||||
#define TFESC (uint8_t)0xDD
|
||||
|
||||
#define KISS_DATA (uint8_t) 0x00
|
||||
#define KISS_GET_RUNNING_CONFIG (uint8_t) 0x20
|
||||
#define KISS_RUNNING_CONFIG (uint8_t) 0x70
|
||||
|
||||
#define KISS_GET_VERSION (uint8_t) 0x15
|
||||
|
||||
#define KISS_RETURN_IDLE 1
|
||||
|
||||
/* C++ detection */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int32_t SendKISSToHost(uint8_t* input_frame, uint16_t input_frame_len, uint8_t* output, uint16_t output_len);
|
||||
uint8_t kiss_async_pooler(uint8_t* output, uint16_t output_len );
|
||||
|
||||
int32_t kiss_send_ax25_to_host(uint8_t* input_frame, uint16_t input_frame_len, uint8_t* output, uint16_t output_len);
|
||||
int32_t kiss_parse_received(uint8_t* input_frame_from_host, uint16_t input_len, AX25Ctx* ax25, Afsk* a);
|
||||
|
||||
void kiss_reset_buffer(uint8_t* output, uint16_t output_len, uint16_t* current_len);
|
||||
|
@ -37,9 +47,6 @@
|
|||
void kiss_put_call(const AX25Call *addr, uint8_t is_last, uint8_t* output, uint16_t output_len, uint16_t* current_len, uint16_t* crc);
|
||||
void kiss_finalize_buffer(uint8_t* output, uint16_t output_len, uint16_t* current_len);
|
||||
|
||||
|
||||
uint8_t* kiss_get_buff_ptr(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#define PWR_SWITCH_BOTH
|
||||
|
||||
#define OWN_APRS_MSG_LN 160
|
||||
#define OWN_APRS_MSG_LN 256
|
||||
|
||||
// backup registers (ParaMETEO)
|
||||
// 0 -> powersave status
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* Author: mateusz
|
||||
*/
|
||||
|
||||
#include "KissCommunication.h"
|
||||
#include <kiss_communication.h>
|
||||
#include "kiss_callback.h"
|
||||
|
||||
|
||||
#include "main.h"
|
||||
|
@ -22,13 +23,43 @@
|
|||
|
||||
extern unsigned short tx10m;
|
||||
|
||||
#define KISS_DATA (uint8_t) 0x00
|
||||
#define KISS_GET_RUNNING_CONFIG (uint8_t) 0x20
|
||||
#define KISS_RUNNING_CONFIG (uint8_t) 0x70
|
||||
/**
|
||||
* ID of asynchronous message which is currently transmitteed asynchronously do host PC.
|
||||
* If it is set to 0xFF then no async message is transmitted
|
||||
*/
|
||||
uint8_t kiss_current_async_message = 0xFF;
|
||||
|
||||
uint8_t kiss_buffer[KISS_BUFFER_LN];
|
||||
/**
|
||||
* This an id of segment of multiframe message, like running config
|
||||
*/
|
||||
uint8_t kiss_current_message_frame_segment = 0;
|
||||
|
||||
int32_t SendKISSToHost(uint8_t* input_frame, uint16_t input_frame_len, uint8_t* output, uint16_t output_len) {
|
||||
uint8_t kiss_async_pooler(uint8_t* output, uint16_t output_len ) {
|
||||
|
||||
int16_t pooling_result = 0;
|
||||
|
||||
uint8_t out = 0;
|
||||
|
||||
if (kiss_current_async_message == 0xFF) {
|
||||
return KISS_RETURN_IDLE;
|
||||
}
|
||||
|
||||
switch(kiss_current_async_message) {
|
||||
case KISS_RUNNING_CONFIG:
|
||||
pooling_result = kiss_pool_callback_get_running_config(output, output_len, kiss_current_message_frame_segment);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// positive return value
|
||||
if (pooling_result > 0) {
|
||||
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
int32_t kiss_send_ax25_to_host(uint8_t* input_frame, uint16_t input_frame_len, uint8_t* output, uint16_t output_len) {
|
||||
#define FEND (uint8_t)0xC0
|
||||
#define FESC (uint8_t)0xDB
|
||||
#define TFEND (uint8_t)0xDC
|
||||
|
@ -72,18 +103,17 @@ int32_t SendKISSToHost(uint8_t* input_frame, uint16_t input_frame_len, uint8_t*
|
|||
int32_t kiss_parse_received(uint8_t* input_frame_from_host, uint16_t input_len, AX25Ctx* ax25, Afsk* a) {
|
||||
int i/* zmienna do poruszania sie po buforze odbiorczym usart */;
|
||||
int j/* zmienna do poruszania sie po lokalnej tablicy do przepisywania*/;
|
||||
// uint8_t FrameBuff[100];
|
||||
|
||||
if (input_frame_from_host == 0x00 || ax25 == 0x00 || a == 0x00) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
uint8_t *FrameBuff = kiss_buffer;
|
||||
uint8_t *FrameBuff = (uint8_t *)main_own_aprs_msg;
|
||||
|
||||
uint8_t frame_type = *(input_frame_from_host+1);
|
||||
|
||||
// check if frame from host is not too long
|
||||
if (input_len >= KISS_BUFFER_LN)
|
||||
if (input_len >= OWN_APRS_MSG_LN)
|
||||
return 1;
|
||||
|
||||
if (*(input_frame_from_host) != FEND) {
|
||||
|
@ -91,9 +121,11 @@ int32_t kiss_parse_received(uint8_t* input_frame_from_host, uint16_t input_len,
|
|||
}
|
||||
|
||||
// check input frame type
|
||||
switch (frame_type != 0x00) {
|
||||
switch (frame_type) {
|
||||
|
||||
case KISS_DATA: {
|
||||
memset(FrameBuff, 0x00, OWN_APRS_MSG_LN);
|
||||
|
||||
// if this is data frame
|
||||
for (i=2, j=0; (i<input_len && *(input_frame_from_host+i) != FEND); i++, j++) {
|
||||
if (*(input_frame_from_host+i) == FESC) {
|
||||
|
@ -121,7 +153,7 @@ int32_t kiss_parse_received(uint8_t* input_frame_from_host, uint16_t input_len,
|
|||
afsk_txStart(a);
|
||||
} break;
|
||||
|
||||
case KISS_RUNNING_CONFIG: {
|
||||
case KISS_GET_RUNNING_CONFIG: {
|
||||
|
||||
} break;
|
||||
|
||||
|
@ -250,8 +282,5 @@ void kiss_finalize_buffer(uint8_t* output, uint16_t output_len, uint16_t* curren
|
|||
*current_len = ln;
|
||||
}
|
||||
|
||||
uint8_t* kiss_get_buff_ptr(void) {
|
||||
return kiss_buffer;
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
|
||||
#include "drivers/dallas.h"
|
||||
|
||||
#include "KissCommunication.h"
|
||||
#include <kiss_communication.h>
|
||||
|
||||
#define SOH 0x01
|
||||
|
||||
|
@ -1017,7 +1017,7 @@ int main(int argc, char* argv[]){
|
|||
|
||||
if (main_kiss_enabled == 1) {
|
||||
// convert message to kiss format and send it to host
|
||||
srl_start_tx(main_kiss_srl_ctx_ptr, SendKISSToHost(ax25_rxed_frame.raw_data, (ax25_rxed_frame.raw_msg_len - 2), main_kiss_srl_ctx.srl_tx_buf_pointer, main_kiss_srl_ctx.srl_tx_buf_ln));
|
||||
srl_start_tx(main_kiss_srl_ctx_ptr, kiss_send_ax25_to_host(ax25_rxed_frame.raw_data, (ax25_rxed_frame.raw_msg_len - 2), main_kiss_srl_ctx.srl_tx_buf_pointer, main_kiss_srl_ctx.srl_tx_buf_ln));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
#include <afsk.h>
|
||||
#include <cfifo.h>
|
||||
#include <crc.h>
|
||||
#include <kiss_communication.h>
|
||||
|
||||
#include "station_config.h"
|
||||
|
||||
#include "KissCommunication.h"
|
||||
|
||||
AX25Msg ax25_rxed_frame;
|
||||
char ax25_new_msg_rx_flag;
|
||||
|
|
Ładowanie…
Reference in New Issue