kopia lustrzana https://github.com/Qyon/STM32_RTTY
some cleanups
rodzic
faf8d3118a
commit
b0c3512dc9
|
@ -5,21 +5,22 @@ SET(CMAKE_SYSTEM_VERSION 1)
|
||||||
|
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
set(TOOLCHAIN_DIR /opt/gcc-arm-none-eabi-5_4-2016q3/bin/)
|
set(TOOLCHAIN_DIR "/opt/gcc-arm-none-eabi-5_4-2016q3/bin/")
|
||||||
CMAKE_FORCE_C_COMPILER(${TOOLCHAIN_DIR}/arm-none-eabi-gcc GNU)
|
CMAKE_FORCE_C_COMPILER(${TOOLCHAIN_DIR}/arm-none-eabi-gcc GNU)
|
||||||
CMAKE_FORCE_CXX_COMPILER(${TOOLCHAIN_DIR}/arm-none-eabi-g++ GNU)
|
CMAKE_FORCE_CXX_COMPILER(${TOOLCHAIN_DIR}/arm-none-eabi-g++ GNU)
|
||||||
else()
|
else()
|
||||||
set(TOOLCHAIN_DIR D:/Programy/arm_gcc/bin/)
|
set(TOOLCHAIN_DIR "D:/Programy/arm_gcc/bin/")
|
||||||
CMAKE_FORCE_C_COMPILER(${TOOLCHAIN_DIR}/arm-none-eabi-gcc.exe GNU)
|
CMAKE_FORCE_C_COMPILER(${TOOLCHAIN_DIR}/arm-none-eabi-gcc.exe GNU)
|
||||||
CMAKE_FORCE_CXX_COMPILER(${TOOLCHAIN_DIR}/arm-none-eabi-g++.exe GNU)
|
CMAKE_FORCE_CXX_COMPILER(${TOOLCHAIN_DIR}/arm-none-eabi-g++.exe GNU)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
project(STM32_RTTY C ASM CXX)
|
project(STM32_RTTY C CXX ASM)
|
||||||
|
|
||||||
|
|
||||||
add_definitions(-DSTM32F100C8)
|
add_definitions(-DSTM32F100C8)
|
||||||
add_definitions(-DSTM32F10X_MD_VL)
|
add_definitions(-DSTM32F10X_MD_VL)
|
||||||
add_definitions(-DUSE_STDPERIPH_DRIVER)
|
add_definitions(-DUSE_STDPERIPH_DRIVER)
|
||||||
|
add_definitions(-DSUPPORT_CPLUSPLUS)
|
||||||
add_definitions(-D__ASSEMBLY__)
|
add_definitions(-D__ASSEMBLY__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +29,7 @@ SET(LINKER_SCRIPT ${PROJECT_SOURCE_DIR}/arm-gcc-link.ld)
|
||||||
SET(COMMON_FLAGS " -mcpu=cortex-m3 -mthumb -Wall -ffunction-sections -g -O3 -g -nostartfiles ")
|
SET(COMMON_FLAGS " -mcpu=cortex-m3 -mthumb -Wall -ffunction-sections -g -O3 -g -nostartfiles ")
|
||||||
SET(CMAKE_CXX_FLAGS "${COMMON_FLAGS} -std=c++11")
|
SET(CMAKE_CXX_FLAGS "${COMMON_FLAGS} -std=c++11")
|
||||||
SET(CMAKE_C_FLAGS "${COMMON_FLAGS} -std=gnu99")
|
SET(CMAKE_C_FLAGS "${COMMON_FLAGS} -std=gnu99")
|
||||||
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,-Map=${CMAKE_BINARY_DIR}/${PROJECT_NAME}.map -O3 -Wl,--gc-sections -T ${LINKER_SCRIPT}")
|
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,-Map=${CMAKE_BINARY_DIR}/${PROJECT_NAME}.map -lstdc++ -O3 -Wl,--gc-sections --specs=nano.specs -T ${LINKER_SCRIPT}")
|
||||||
|
|
||||||
file(GLOB_RECURSE USER_SOURCES "*.c")
|
file(GLOB_RECURSE USER_SOURCES "*.c")
|
||||||
file(GLOB_RECURSE USER_SOURCES_CXX "*.cpp")
|
file(GLOB_RECURSE USER_SOURCES_CXX "*.cpp")
|
||||||
|
@ -53,7 +54,9 @@ set(BIN_FILE ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.bin)
|
||||||
add_custom_command(TARGET ${PROJECT_NAME}.elf POST_BUILD
|
add_custom_command(TARGET ${PROJECT_NAME}.elf POST_BUILD
|
||||||
COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${PROJECT_NAME}.elf> ${HEX_FILE}
|
COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${PROJECT_NAME}.elf> ${HEX_FILE}
|
||||||
COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${PROJECT_NAME}.elf> ${BIN_FILE}
|
COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${PROJECT_NAME}.elf> ${BIN_FILE}
|
||||||
COMMENT "Building ${HEX_FILE} \nBuilding ${BIN_FILE}")
|
COMMENT "Building ${HEX_FILE} \nBuilding ${BIN_FILE}"
|
||||||
|
COMMAND ${TOOLCHAIN_DIR}/arm-none-eabi-size ${PROJECT_NAME}.elf)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
|
||||||
add_custom_target(program
|
add_custom_target(program
|
||||||
|
|
5
aprs.cpp
5
aprs.cpp
|
@ -61,7 +61,7 @@ void aprs_send_position(GPSEntry gpsData, int8_t temperature, uint16_t voltage)
|
||||||
aprs_packet_counter ++;
|
aprs_packet_counter ++;
|
||||||
|
|
||||||
sprintf(packet_buffer,
|
sprintf(packet_buffer,
|
||||||
("!%02d%02d.%02u%c/%03d%02u.%02u%cO/A=%06ld/P%dS%dT%dV%d Hello from the sky!"),
|
("!%02d%02d.%02u%c/%03d%02u.%02u%cO/A=%06ld/P%dS%dT%dV%d%s"),
|
||||||
abs(la_degrees), la_minutes, la_h_minutes,
|
abs(la_degrees), la_minutes, la_h_minutes,
|
||||||
la_degrees > 0 ? 'N' : 'S',
|
la_degrees > 0 ? 'N' : 'S',
|
||||||
abs(lo_degrees), lo_minutes, lo_h_minutes,
|
abs(lo_degrees), lo_minutes, lo_h_minutes,
|
||||||
|
@ -70,7 +70,8 @@ void aprs_send_position(GPSEntry gpsData, int8_t temperature, uint16_t voltage)
|
||||||
aprs_packet_counter,
|
aprs_packet_counter,
|
||||||
gpsData.sats_raw,
|
gpsData.sats_raw,
|
||||||
temperature,
|
temperature,
|
||||||
voltage
|
voltage,
|
||||||
|
APRS_COMMENT
|
||||||
);
|
);
|
||||||
qaprs.sendData(packet_buffer);
|
qaprs.sendData(packet_buffer);
|
||||||
}
|
}
|
||||||
|
|
2
config.h
2
config.h
|
@ -12,8 +12,8 @@
|
||||||
//**************config**************
|
//**************config**************
|
||||||
#define CALLSIGN "DF8OE" // put your callsign here
|
#define CALLSIGN "DF8OE" // put your callsign here
|
||||||
#define APRS_CALLSIGN "DF8OE-10"
|
#define APRS_CALLSIGN "DF8OE-10"
|
||||||
#define RTTY_GREETING "$$$$$$RS41 modified for amateur radio use by DF8OE, enjoy and see you on the HUB... \n\r"
|
|
||||||
#define APRS_SSID 'B'
|
#define APRS_SSID 'B'
|
||||||
|
#define APRS_COMMENT "Hello from the sky!"
|
||||||
#define RTTY_TO_APRS_RATIO 5
|
#define RTTY_TO_APRS_RATIO 5
|
||||||
|
|
||||||
//*************frequency********************
|
//*************frequency********************
|
||||||
|
|
7
main.c
7
main.c
|
@ -36,11 +36,8 @@ int napiecie;
|
||||||
volatile char flaga = 0;//((((tx_delay / 1000) & 0x0f) << 3) | Smoc);
|
volatile char flaga = 0;//((((tx_delay / 1000) & 0x0f) << 3) | Smoc);
|
||||||
uint16_t CRC_rtty = 0x12ab; //checksum
|
uint16_t CRC_rtty = 0x12ab; //checksum
|
||||||
char buf_rtty[200];
|
char buf_rtty[200];
|
||||||
char menu[] = RTTY_GREETING;
|
|
||||||
char init_trx[] = "\n\rPowering up TX\n\r";
|
|
||||||
volatile unsigned char pun = 0;
|
volatile unsigned char pun = 0;
|
||||||
volatile unsigned int cun = 10;
|
volatile unsigned int cun = 10;
|
||||||
unsigned char dev = 0;
|
|
||||||
volatile unsigned char tx_on = 0;
|
volatile unsigned char tx_on = 0;
|
||||||
volatile unsigned int tx_on_delay;
|
volatile unsigned int tx_on_delay;
|
||||||
volatile unsigned char tx_enable = 0;
|
volatile unsigned char tx_enable = 0;
|
||||||
|
@ -48,7 +45,6 @@ rttyStates send_rtty_status = rttyZero;
|
||||||
volatile char *rtty_buf;
|
volatile char *rtty_buf;
|
||||||
volatile uint16_t button_pressed = 0;
|
volatile uint16_t button_pressed = 0;
|
||||||
volatile uint8_t disable_armed = 0;
|
volatile uint8_t disable_armed = 0;
|
||||||
unsigned char cun_off = 0;
|
|
||||||
|
|
||||||
void send_rtty_packet();
|
void send_rtty_packet();
|
||||||
|
|
||||||
|
@ -172,8 +168,6 @@ int main(void) {
|
||||||
radio_enable_tx();
|
radio_enable_tx();
|
||||||
|
|
||||||
uint8_t rtty_before_aprs_left = RTTY_TO_APRS_RATIO;
|
uint8_t rtty_before_aprs_left = RTTY_TO_APRS_RATIO;
|
||||||
//#pragma clang diagnostic push
|
|
||||||
//#pragma clang diagnostic ignored "-Wmissing-noreturn"
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (tx_on == 0 && tx_enable) {
|
if (tx_on == 0 && tx_enable) {
|
||||||
if (rtty_before_aprs_left){
|
if (rtty_before_aprs_left){
|
||||||
|
@ -197,7 +191,6 @@ int main(void) {
|
||||||
__WFI();
|
__WFI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//#pragma clang diagnostic pop
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_rtty_packet() {
|
void send_rtty_packet() {
|
||||||
|
|
Ładowanie…
Reference in New Issue