├── lib ├── miosix-kernel │ ├── miosix │ │ ├── util │ │ │ ├── utf8test │ │ │ ├── crc16.h │ │ │ ├── crc16.cpp │ │ │ ├── lcd44780.h │ │ │ └── lcd44780.cpp │ │ ├── arch │ │ │ ├── cortexM0 │ │ │ │ └── arch_registers_impl.h │ │ │ ├── cortexM3 │ │ │ │ └── arch_registers_impl.h │ │ │ └── common │ │ │ │ ├── core │ │ │ │ ├── memory_protection.h │ │ │ │ └── interrupts.h │ │ │ │ └── drivers │ │ │ │ └── serial.h │ │ ├── miosix.h │ │ ├── filesystem │ │ │ ├── fat32 │ │ │ │ └── integer.h │ │ │ └── ioctl.h │ │ └── kernel │ │ │ ├── SystemMap.h │ │ │ └── SystemMap.cpp │ ├── README.md │ └── meson.build ├── qdec │ ├── readme │ └── license.txt └── minmea │ └── COPYING ├── .github ├── FUNDING.yml └── workflows │ └── regenerate_symbols.yml ├── requirements.txt ├── subprojects ├── packagefiles │ ├── XPowersLib │ │ └── meson.build │ ├── radio_tool │ │ └── meson.build │ ├── codec2 │ │ ├── codec2 │ │ │ └── version.h │ │ └── meson.build │ └── tinyusb │ │ └── meson.build ├── tinyusb.wrap ├── XPowersLib.wrap ├── radio_tool.wrap └── codec2.wrap ├── voiceprompts.vpc ├── scripts ├── bin2sgl.exe ├── bin2sgl.Darwin ├── bin2sgl.Linux.bin ├── openocd │ ├── mod17.cfg │ └── stm32f4.cfg ├── bin2sgl.Linux ├── plot_m17_demod_csv2.py ├── plot_m17_demod_csv.py ├── clang_format.sh ├── add_dc_offset.cpp └── dfu_suffix.py ├── .devcontainer ├── devcontainer.json └── Dockerfile ├── meta ├── sat_menu_dev.txt ├── ptt_test.txt ├── select_menu.txt ├── menu_test.txt ├── readme └── leak_check.txt ├── tests ├── unit │ ├── assets │ │ ├── M17_test_baseband.raw │ │ └── M17_test_baseband_dc.raw │ ├── dummy.c │ ├── convert_minmea_coord.c │ ├── ui_check_standby.c │ ├── voice_prompts.c │ └── M17_rrc.cpp └── platform │ ├── boot_test.c │ └── tonegen.c ├── platform ├── mcu │ ├── CMSIS │ │ ├── Device │ │ │ └── ST │ │ │ │ └── STM32F4xx │ │ │ │ └── Include │ │ │ │ └── stm32f4xx.h │ │ └── Include │ │ │ └── arm_common_tables.h │ ├── MK22FN512xxx12 │ │ ├── boot │ │ │ ├── arch_registers_impl.h │ │ │ └── bsp.cpp │ │ └── drivers │ │ │ ├── usb │ │ │ ├── usb_device_cdc_acm.c │ │ │ ├── usb_osa_bm.c │ │ │ └── usb_osa_bm.h │ │ │ ├── rng.c │ │ │ └── usb_vcom.h │ ├── STM32H7xx │ │ └── boot │ │ │ ├── arch_registers_impl.h │ │ │ └── libc_integration.cpp │ ├── STM32F4xx │ │ ├── boot │ │ │ └── arch_registers_impl.h │ │ └── drivers │ │ │ ├── usb │ │ │ └── usbd_usr.c │ │ │ └── flash.h │ ├── ESP32S3 │ │ ├── zephyr.conf │ │ └── drivers │ │ │ └── delays.c │ └── x86_64 │ │ └── drivers │ │ ├── rng.cpp │ │ └── delays.c ├── targets │ ├── ttwrplus │ │ ├── Kconfig.sysbuild │ │ ├── support │ │ │ └── openocd.cfg │ │ ├── Kconfig.board │ │ ├── ttwrplus.yaml │ │ ├── board.cmake │ │ ├── Kconfig.defconfig │ │ ├── ttwrplus_defconfig │ │ ├── CMakeLists.txt │ │ └── hwconfig.h │ ├── linux │ │ ├── hwconfig.h │ │ └── emulator │ │ │ ├── emulator.h │ │ │ └── sdl_engine.h │ ├── GDx │ │ ├── hwconfig.c │ │ └── hwconfig.h │ └── MD-9600 │ │ └── hwconfig.c └── drivers │ ├── display │ └── SH110x_Mod17.h │ ├── audio │ ├── MAX9814.h │ ├── MAX9814_Mod17.cpp │ ├── file_source.h │ └── Cx000_dac.h │ ├── GPIO │ └── gpio-native.h │ ├── stubs │ ├── keyboard_stub.c │ ├── display_stub.c │ ├── nvmem_stub.c │ ├── inputStream_stub.c │ ├── radio_stub.c │ └── outputStream_stub.c │ ├── USB │ └── usb.h │ ├── keyboard │ ├── keyboard_linux.c │ └── cap1206.h │ ├── ADC │ └── ADC0_GDx.h │ ├── baseband │ ├── HR_C5000.h │ ├── radio_MD9600.cpp │ ├── MCP4551.c │ └── SKY72310.h │ ├── backlight │ └── backlight.h │ ├── chSelector │ └── chSelector.h │ ├── SPI │ └── spi_custom.c │ └── CPS │ └── cps_io_native_Mod17.c ├── openrtx ├── include │ ├── fonts │ │ ├── symbols │ │ │ ├── sources │ │ │ │ ├── call-made.svg │ │ │ │ ├── call-received.svg │ │ │ │ ├── wifi-strength-4.svg │ │ │ │ ├── alpha-m-box-outline.svg │ │ │ │ ├── network.svg │ │ │ │ ├── lock.svg │ │ │ │ ├── crosshairs.svg │ │ │ │ ├── wifi-strength-3.svg │ │ │ │ ├── wifi-strength-1.svg │ │ │ │ ├── wifi-strength-2.svg │ │ │ │ ├── crosshairs-gps.svg │ │ │ │ ├── transmission-tower.svg │ │ │ │ ├── access-point.svg │ │ │ │ ├── cog.svg │ │ │ │ └── LICENSE │ │ │ ├── symbols.h │ │ │ └── Symbols5pt7b.h │ │ └── adafruit │ │ │ └── gfxfont.h │ ├── core │ │ ├── battery.h │ │ ├── crc.h │ │ ├── beeps.h │ │ ├── backup.h │ │ ├── openrtx.h │ │ ├── threads.h │ │ ├── queue.h │ │ ├── datatypes.h │ │ ├── data_conversion.h │ │ └── event.h │ ├── peripherals │ │ └── rng.h │ ├── calibration │ │ ├── calibInfo_CS7000.h │ │ └── calibInfo_Mod17.h │ └── protocols │ │ └── M17 │ │ └── M17Constants.hpp └── src │ ├── core │ ├── voicePromptData.S │ └── crc.c │ ├── protocols │ └── M17 │ │ └── M17DSP.cpp │ └── ui │ └── default │ └── ui_strings.c ├── meson_options.txt ├── 99-openrtx.rules ├── osx.txt ├── west.yml ├── .clang-format ├── .gitignore ├── cross_cm7.txt └── cross_arm.txt /lib/miosix-kernel/miosix/util/utf8test: -------------------------------------------------------------------------------- 1 | This is a test è ώ 𝄞 -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # Sponsor OpenRTX 2 | 3 | liberapay: OpenRTX 4 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pyusb 2 | meson 3 | ffmpeg 4 | cairosvg==2.7.1 5 | numpy==1.25.2 -------------------------------------------------------------------------------- /subprojects/packagefiles/XPowersLib/meson.build: -------------------------------------------------------------------------------- 1 | project('XPowersLib', 'cpp') 2 | -------------------------------------------------------------------------------- /voiceprompts.vpc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tunas1337/OpenRTX/HEAD/voiceprompts.vpc -------------------------------------------------------------------------------- /scripts/bin2sgl.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tunas1337/OpenRTX/HEAD/scripts/bin2sgl.exe -------------------------------------------------------------------------------- /scripts/bin2sgl.Darwin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tunas1337/OpenRTX/HEAD/scripts/bin2sgl.Darwin -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": { 3 | "dockerfile": "Dockerfile" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /scripts/bin2sgl.Linux.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tunas1337/OpenRTX/HEAD/scripts/bin2sgl.Linux.bin -------------------------------------------------------------------------------- /meta/sat_menu_dev.txt: -------------------------------------------------------------------------------- 1 | key enter down down down down down enter 2 | sleep 5000 3 | screenshot SAT.bmp 4 | -------------------------------------------------------------------------------- /meta/ptt_test.txt: -------------------------------------------------------------------------------- 1 | sleep 3000 2 | screenshot noptt.bmp 3 | key 1 2 3 4 | ptt 5 | sleep 1000 6 | screenshot ptt.bmp 7 | -------------------------------------------------------------------------------- /tests/unit/assets/M17_test_baseband.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tunas1337/OpenRTX/HEAD/tests/unit/assets/M17_test_baseband.raw -------------------------------------------------------------------------------- /tests/unit/assets/M17_test_baseband_dc.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tunas1337/OpenRTX/HEAD/tests/unit/assets/M17_test_baseband_dc.raw -------------------------------------------------------------------------------- /scripts/openocd/mod17.cfg: -------------------------------------------------------------------------------- 1 | gdb_port 3333 2 | 3 | source [find interface/jlink.cfg] 4 | 5 | transport select swd 6 | 7 | source [find target/stm32f4x.cfg] 8 | -------------------------------------------------------------------------------- /platform/mcu/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tunas1337/OpenRTX/HEAD/platform/mcu/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h -------------------------------------------------------------------------------- /lib/qdec/readme: -------------------------------------------------------------------------------- 1 | This is a plain C header library lightly adapted from the SimpleHacks QDEC library. 2 | Find the original source here: https://github.com/SimpleHacks/QDEC 3 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/sources/call-made.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/sources/call-received.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /subprojects/tinyusb.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/hathach/tinyusb.git 3 | revision = 4bfab30c02279a0530e1a56f4a7c539f2d35a293 4 | patch_directory = tinyusb 5 | -------------------------------------------------------------------------------- /subprojects/XPowersLib.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/lewisxhe/XPowersLib.git 3 | revision = b0ed896c17d49a1b823ba0a6323cafd89b3a7d91 4 | patch_directory = XPowersLib 5 | -------------------------------------------------------------------------------- /subprojects/radio_tool.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/v0l/radio_tool 3 | revision = head 4 | patch_directory = radio_tool 5 | 6 | [provide] 7 | program_names = radio_tool 8 | -------------------------------------------------------------------------------- /meta/select_menu.txt: -------------------------------------------------------------------------------- 1 | key enter down down down down down enter 2 | sleep 1000 3 | key down enter 4 | sleep 5000 5 | nop sleep 1000 6 | nop key enter 7 | nop sleep 1000 8 | nop screenshot delta.bmp 9 | 10 | -------------------------------------------------------------------------------- /subprojects/codec2.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/drowe67/codec2-dev 3 | revision = a298f3789d7ef9e829049ebe14da8845d97ba8c1 4 | patch_directory = codec2 5 | 6 | [provide] 7 | dependency_names = codec2 8 | -------------------------------------------------------------------------------- /meta/menu_test.txt: -------------------------------------------------------------------------------- 1 | sleep 4000 2 | nop SAT menu 3 | key enter DOWN down down down down enter 4 | ready 5 | screenshot sat.bmp 6 | nop GPS menu 7 | key esc DOWN down down down enter 8 | ready 9 | screenshot gps.bmp 10 | -------------------------------------------------------------------------------- /tests/unit/dummy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | if (1) { 5 | printf("PASS!\n"); 6 | return 0; 7 | } else { 8 | printf("FAIL!\n"); 9 | return -1; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/sources/wifi-strength-4.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /platform/targets/ttwrplus/Kconfig.sysbuild: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: Apache-2.0 2 | 3 | choice BOOTLOADER 4 | default BOOTLOADER_MCUBOOT 5 | endchoice 6 | 7 | choice BOOT_SIGNATURE_TYPE 8 | default BOOT_SIGNATURE_TYPE_NONE 9 | endchoice 10 | -------------------------------------------------------------------------------- /platform/targets/ttwrplus/support/openocd.cfg: -------------------------------------------------------------------------------- 1 | set ESP_RTOS none 2 | set ESP32_ONLYCPU 1 3 | 4 | # Source the JTAG interface configuration file 5 | source [find interface/esp_usb_jtag.cfg] 6 | # Source the ESP32-S3 configuration file 7 | source [find target/esp32s3.cfg] 8 | -------------------------------------------------------------------------------- /openrtx/src/core/voicePromptData.S: -------------------------------------------------------------------------------- 1 | #ifndef VP_USE_FILESYSTEM 2 | .section .note.GNU-stack,"" 3 | .section .rodata 4 | 5 | .global _vpdata_start 6 | .global _vpdata_end 7 | 8 | _vpdata_start: 9 | .incbin "../voiceprompts.vpc" 10 | 11 | .set _vpdata_end, . 12 | #endif 13 | -------------------------------------------------------------------------------- /scripts/bin2sgl.Linux: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" 4 | 5 | if [ `uname -m` = "aarch64" ]; then 6 | qemu-x86_64 $SCRIPTPATH/bin2sgl.Linux.bin "$@" 7 | else 8 | $SCRIPTPATH/bin2sgl.Linux.bin "$@" 9 | fi 10 | 11 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/sources/alpha-m-box-outline.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/sources/network.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /platform/targets/ttwrplus/Kconfig.board: -------------------------------------------------------------------------------- 1 | # LilyGo T-TWR Plus board configuration 2 | 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | config BOARD_TTWRPLUS 6 | bool "LilyGo T-TWR Plus Board" 7 | depends on SOC_SERIES_ESP32S3 8 | 9 | choice SOC_PART_NUMBER 10 | default SOC_ESP32S3_WROOM_N16R8 11 | endchoice 12 | -------------------------------------------------------------------------------- /platform/mcu/MK22FN512xxx12/boot/arch_registers_impl.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ARCH_REGISTERS_IMPL_H 3 | #define ARCH_REGISTERS_IMPL_H 4 | 5 | #include "MK22F51212.h" 6 | #include "core_cm4.h" 7 | #include "system_MK22F51212.h" 8 | 9 | #define RCC_SYNC() //Workaround for a bug in stm32f42x 10 | 11 | #endif //ARCH_REGISTERS_IMPL_H 12 | -------------------------------------------------------------------------------- /lib/miosix-kernel/README.md: -------------------------------------------------------------------------------- 1 | 2 | This repository contains an adapted version of the miosix kernel, tailored for the usage with the OpenRTX targets equipped with an ARM cortex M4 microcontroller. 3 | 4 | The original repository can be found here: [https://github.com/fedetft/miosix-kernel](https://github.com/fedetft/miosix-kernel) 5 | 6 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/sources/lock.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | option('asan', type : 'boolean', value : false, description : 'Compile the software with AddressSanitizer') 2 | option('ubsan', type : 'boolean', value : false, description : 'Compile the software with Undefined Behaviour Sanitizer') 3 | option('test', type: 'string', description: 'Replace the main OpenRTX source file with a specialized test') 4 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/sources/crosshairs.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/sources/wifi-strength-3.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /platform/targets/ttwrplus/ttwrplus.yaml: -------------------------------------------------------------------------------- 1 | identifier: ttwrplus 2 | name: LilyGO T-TWR Plus 3 | type: mcu 4 | arch: xtensa 5 | toolchain: 6 | - zephyr 7 | supported: 8 | - gpio 9 | - uart 10 | - i2c 11 | - spi 12 | - counter 13 | - watchdog 14 | - entropy 15 | - pwm 16 | - dma 17 | testing: 18 | ignore_tags: 19 | - net 20 | - bluetooth 21 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/sources/wifi-strength-1.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/sources/wifi-strength-2.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /platform/mcu/STM32H7xx/boot/arch_registers_impl.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ARCH_REGISTERS_IMPL_H 3 | #define ARCH_REGISTERS_IMPL_H 4 | 5 | //Always include stm32h7xx.h before core_cm4.h, there's some nasty dependency 6 | #include "stm32h7xx.h" 7 | #include "core_cm7.h" 8 | #include "system_stm32h7xx.h" 9 | 10 | #define RCC_SYNC() __DSB() 11 | 12 | #endif //ARCH_REGISTERS_IMPL_H 13 | -------------------------------------------------------------------------------- /platform/mcu/STM32F4xx/boot/arch_registers_impl.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ARCH_REGISTERS_IMPL_H 3 | #define ARCH_REGISTERS_IMPL_H 4 | 5 | //Always include stm32f4xx.h before core_cm4.h, there's some nasty dependency 6 | #include "stm32f4xx.h" 7 | #include "core_cm4.h" 8 | #include "system_stm32f4xx.h" 9 | 10 | #define RCC_SYNC() //Workaround for a bug in stm32f42x 11 | 12 | #endif //ARCH_REGISTERS_IMPL_H 13 | -------------------------------------------------------------------------------- /lib/miosix-kernel/miosix/util/crc16.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CRC16_H 3 | #define CRC16_H 4 | 5 | namespace miosix { 6 | 7 | /** 8 | * Calculate the ccitt crc16 on a string of bytes 9 | * \param message string of bytes 10 | * \param length message length 11 | * \return the crc16 12 | */ 13 | unsigned short crc16(const void *message, unsigned int length); 14 | 15 | } //namespace miosix 16 | 17 | #endif //CRC16_H 18 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/sources/crosshairs-gps.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /platform/targets/ttwrplus/board.cmake: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: Apache-2.0 2 | 3 | if(NOT "${OPENOCD}" MATCHES "^${ESPRESSIF_TOOLCHAIN_PATH}/.*") 4 | set(OPENOCD OPENOCD-NOTFOUND) 5 | endif() 6 | find_program(OPENOCD openocd PATHS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin NO_DEFAULT_PATH) 7 | 8 | include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake) 9 | include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) 10 | -------------------------------------------------------------------------------- /platform/targets/ttwrplus/Kconfig.defconfig: -------------------------------------------------------------------------------- 1 | # LilyGo T-TWR Plus board configuration 2 | 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | config BOARD 6 | default "ttwrplus" 7 | depends on BOARD_TTWRPLUS 8 | 9 | config ENTROPY_GENERATOR 10 | default y 11 | 12 | config HEAP_MEM_POOL_SIZE 13 | default 98304 if WIFI 14 | default 40960 if BT 15 | default 4096 16 | 17 | choice BT_HCI_BUS_TYPE 18 | default BT_ESP32 if BT 19 | endchoice 20 | -------------------------------------------------------------------------------- /meta/readme: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | uidev: 5 | meson compile -C build_linux openrtx_linux 6 | cat sat_menu_dev.txt | build_linux/openrtx_linux 7 | convert SAT.bmp -resize 600% SAT.jpg 8 | 9 | 10 | valgrind: 11 | meson compile -C build_linux openrtx_linux 12 | cat leak_check.txt | valgrind --leak-check=full --log-file=valgrind.log build_linux/openrtx_linux 13 | record: 14 | meson compile -C build_linux openrtx_linux 15 | cat record_demo.txt | build_linux/openrtx_linux 16 | 17 | -------------------------------------------------------------------------------- /lib/miosix-kernel/miosix/arch/cortexM0/arch_registers_impl.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ARCH_REGISTERS_IMPL_H 3 | #define ARCH_REGISTERS_IMPL_H 4 | 5 | //Always include stm32f0xx.h before core_cm0.h, there's some nasty dependency 6 | #include "CMSIS/Device/ST/STM32F0xx/Include/stm32f0xx.h" 7 | #include "CMSIS/Include/core_cm0.h" 8 | #include "CMSIS/Device/ST/STM32F0xx/Include/system_stm32f0xx.h" 9 | 10 | #define RCC_SYNC() //Workaround for a bug in stm32f42x 11 | 12 | #endif //ARCH_REGISTERS_IMPL_H 13 | -------------------------------------------------------------------------------- /lib/miosix-kernel/miosix/arch/cortexM3/arch_registers_impl.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ARCH_REGISTERS_IMPL_H 3 | #define ARCH_REGISTERS_IMPL_H 4 | 5 | //Always include stm32f10x.h before core_cm3.h, there's some nasty dependency 6 | #include "CMSIS/Device/ST/STM32F10x/Include/stm32f10x.h" 7 | #include "CMSIS/Include/core_cm3.h" 8 | #include "CMSIS/Device/ST/STM32F10x/Include/system_stm32f10x.h" 9 | 10 | #define RCC_SYNC() //Workaround for a bug in stm32f42x 11 | 12 | #endif //ARCH_REGISTERS_IMPL_H 13 | -------------------------------------------------------------------------------- /lib/miosix-kernel/miosix/miosix.h: -------------------------------------------------------------------------------- 1 | 2 | //Common #include are grouped here for ease of use 3 | 4 | #ifndef MIOSIX_H 5 | #define MIOSIX_H 6 | 7 | /* Hardware */ 8 | #include "interfaces/arch_registers.h" 9 | #include "interfaces/bsp.h" 10 | /* Miosix kernel */ 11 | #include "kernel/kernel.h" 12 | #include "kernel/sync.h" 13 | #include "kernel/queue.h" 14 | /* Utilities */ 15 | #include "util/util.h" 16 | /* Settings */ 17 | #include "config/miosix_settings.h" 18 | 19 | #endif //MIOSIX_H 20 | -------------------------------------------------------------------------------- /scripts/plot_m17_demod_csv2.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | import pandas as pd 4 | from matplotlib import pyplot as plt 5 | from sys import argv 6 | 7 | plt.rcParams["figure.autolayout"] = True 8 | df = pd.read_csv(argv[1]) 9 | #df = df.head(n=10000) 10 | print("Contents in csv file:\n", df) 11 | plt.plot(df.index, df.RRCSignal) 12 | plt.plot(df.index, df.SyncDetect) 13 | plt.plot(df.index, df.QntMax) 14 | plt.plot(df.index, df.QntMin) 15 | plt.plot(df.index, df.Symbol) 16 | plt.show() 17 | -------------------------------------------------------------------------------- /scripts/openocd/stm32f4.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # OpenOCD configuration file for in-circuit debugging the stm32f4discovery 3 | # To start debugging issue those commands: 4 | # arm-miosix-eabi-gdb main.elf 5 | # target remote :3333 6 | # monitor reset halt 7 | # load 8 | # break main 9 | # continue 10 | # 11 | 12 | # Daemon configuration 13 | telnet_port 4444 14 | gdb_port 3333 15 | 16 | # Board support is available in newer oocd 17 | source [find board/stm32f4discovery.cfg] 18 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/sources/transmission-tower.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/miosix-kernel/miosix/arch/common/core/memory_protection.h: -------------------------------------------------------------------------------- 1 | 2 | //MPU code is common for all the cortex M cores, so it has been put here 3 | 4 | #ifndef MEMORY_PROTECTION_H 5 | #define MEMORY_PROTECTION_H 6 | 7 | #if defined(_ARCH_CORTEXM3_STM32F2) || defined(_ARCH_CORTEXM4_STM32F4) \ 8 | || defined(_ARCH_CORTEXM7_STM32F7) || defined(_ARCH_CORTEXM7_STM32H7) \ 9 | || defined(_ARCH_CORTEXM3_EFM32GG) || defined(_ARCH_CORTEXM4_STM32L4) 10 | #include "mpu_cortexMx.h" 11 | #endif 12 | 13 | #endif //MEMORY_PROTECTION_H 14 | -------------------------------------------------------------------------------- /99-openrtx.rules: -------------------------------------------------------------------------------- 1 | # udev rules for DFU mode on radios supported by OpenRTX 2 | # Place this in /etc/udev/rules.d/ to let non-root users talk to the radios. 3 | 4 | # GDx family (example: Radioddity GD77) 5 | SUBSYSTEM=="usb", ATTRS{idVendor}=="15a2", ATTRS{idProduct}=="0073", MODE="0666" 6 | # MDx family (example: Tytera MD380) 7 | SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0666" 8 | # Module17 (GigaDevice GD32 support) 9 | SUBSYSTEM=="usb", ATTRS{idVendor}=="28e9", ATTRS{idProduct}=="0189", MODE="0666" 10 | -------------------------------------------------------------------------------- /lib/minmea/COPYING: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2004 Sam Hocevar 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | -------------------------------------------------------------------------------- /osx.txt: -------------------------------------------------------------------------------- 1 | # deps: brew install gcc@9 codec2 binutils 2 | [binaries] 3 | c = 'gcc-9' 4 | cpp = 'g++-9' 5 | #ld = 'ld' 6 | ar = 'gcc-ar-9' 7 | #as = 'as' 8 | size = '/usr/local/opt/binutils/bin/gsize' 9 | objdump = '/usr/local/opt/binutils/bin/objdump' 10 | objcopy = '/usr/local/opt/binutils/bin/objcopy' 11 | #strip = 'arm-miosix-eabi-strip' 12 | #gdb = 'arm-miosix-eabi-gdb' 13 | #terminal= 'x-terminal-emulator' 14 | #openocd = '/usr/local/bin/openocd' 15 | 16 | [properties] 17 | c_args = ['-I/usr/local/include'] 18 | cpp_args = ['-I/usr/local/include'] 19 | -------------------------------------------------------------------------------- /platform/mcu/ESP32S3/zephyr.conf: -------------------------------------------------------------------------------- 1 | CONFIG_POSIX_CLOCK=y 2 | CONFIG_PTHREAD_IPC=y 3 | CONFIG_CPP=y 4 | CONFIG_REQUIRES_FULL_LIBCPP=y 5 | CONFIG_STD_CPP14=y 6 | CONFIG_PRINTK=y 7 | CONFIG_PRINTK_SYNC=y 8 | CONFIG_LOG=y 9 | CONFIG_LOG_PRINTK=y 10 | CONFIG_LOG_MODE_IMMEDIATE=y 11 | CONFIG_XTENSA_RESET_VECTOR=n 12 | CONFIG_SOC_ESP32S3=y 13 | CONFIG_MAIN_STACK_SIZE=2048 14 | CONFIG_XTENSA_USE_CORE_CRT1=n 15 | CONFIG_CONSOLE=y 16 | CONFIG_SERIAL=y 17 | CONFIG_UART_CONSOLE=y 18 | CONFIG_GPIO=y 19 | CONFIG_GEN_ISR_TABLES=y 20 | CONFIG_GEN_IRQ_VECTOR_TABLE=n 21 | CONFIG_CLOCK_CONTROL=y 22 | CONFIG_I2C=y 23 | CONFIG_NEWLIB_LIBC=y 24 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/symbols.h: -------------------------------------------------------------------------------- 1 | // This is a generated file, please do not edit it! Use generate_symbols.py 2 | typedef enum { 3 | SYMBOL_SPACE = 32, 4 | SYMBOL_ACCESS_POINT = 33, 5 | SYMBOL_ALPHA_M_BOX_OUTLINE = 34, 6 | SYMBOL_CALL_MADE = 35, 7 | SYMBOL_CALL_RECEIVED = 36, 8 | SYMBOL_COG = 37, 9 | SYMBOL_CROSSHAIRS_GPS = 38, 10 | SYMBOL_CROSSHAIRS = 39, 11 | SYMBOL_LOCK = 40, 12 | SYMBOL_NETWORK = 41, 13 | SYMBOL_TRANSMISSION_TOWER = 42, 14 | SYMBOL_WIFI_STRENGTH_1 = 43, 15 | SYMBOL_WIFI_STRENGTH_2 = 44, 16 | SYMBOL_WIFI_STRENGTH_3 = 45, 17 | SYMBOL_WIFI_STRENGTH_4 = 46, 18 | } symbol_t; 19 | -------------------------------------------------------------------------------- /lib/miosix-kernel/miosix/arch/common/core/interrupts.h: -------------------------------------------------------------------------------- 1 | 2 | //Interrupt code is common for all the cortex M cores, so it has been put here 3 | 4 | #ifdef _ARCH_ARM7_LPC2000 5 | #include "interrupts_arm7.h" 6 | #elif defined(_ARCH_CORTEXM0) || defined(_ARCH_CORTEXM3) \ 7 | || defined(_ARCH_CORTEXM4) || defined(_ARCH_CORTEXM7) 8 | #include "interrupts_cortexMx.h" 9 | #else 10 | #error "Unknown arch" 11 | #endif 12 | 13 | // Cortex M0 and M0+ does not have some SCB registers, in order to avoid 14 | // compilation issues a flag is defined to disable code that accesses to 15 | // registers not present in these families 16 | 17 | #if defined(_ARCH_CORTEXM0_STM32) 18 | #define _ARCH_CORTEXM0 19 | #endif 20 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/sources/access-point.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /platform/targets/ttwrplus/ttwrplus_defconfig: -------------------------------------------------------------------------------- 1 | CONFIG_SOC_SERIES_ESP32S3=y 2 | CONFIG_DISPLAY=y 3 | CONFIG_SSD1306=y 4 | CONFIG_THREAD_STACK_INFO=y 5 | CONFIG_DYNAMIC_THREAD=y 6 | CONFIG_DYNAMIC_THREAD_STACK_SIZE=4096 7 | CONFIG_DYNAMIC_THREAD_PREFER_POOL=y 8 | CONFIG_DYNAMIC_THREAD_POOL_SIZE=4 9 | CONFIG_COMMON_LIBC_MALLOC=y 10 | CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=131072 11 | CONFIG_INPUT=y 12 | CONFIG_INPUT_GPIO_KEYS=y 13 | CONFIG_SENSOR=y 14 | CONFIG_SERIAL=y 15 | CONFIG_UART_INTERRUPT_DRIVEN=y 16 | CONFIG_UART_USE_RUNTIME_CONFIGURE=y 17 | CONFIG_ASSERT=y 18 | CONFIG_SPI=y 19 | CONFIG_LED_STRIP=y 20 | CONFIG_WS2812_STRIP=y 21 | CONFIG_WS2812_STRIP_SPI=y 22 | CONFIG_POSIX_API=y 23 | CONFIG_FLASH=y 24 | CONFIG_FLASH_MAP=y 25 | CONFIG_SOC_FLASH_ESP32=y 26 | -------------------------------------------------------------------------------- /west.yml: -------------------------------------------------------------------------------- 1 | manifest: 2 | self: 3 | path: OpenRTX 4 | 5 | defaults: 6 | remote: zephyr 7 | 8 | remotes: 9 | - name: zephyr 10 | url-base: https://github.com/zephyrproject-rtos 11 | 12 | projects: 13 | - name: zephyr 14 | revision: a4de2eb3d1756c445d2e2ecb72e6d562674c118b 15 | path: zephyr 16 | west-commands: scripts/west-commands.yml 17 | import: submanifests 18 | 19 | - name: mcuboot 20 | revision: 9bf7ce8c5fe8152836a6e00bd4444153bd950342 21 | path: bootloader/mcuboot 22 | 23 | - name: hal_espressif 24 | revision: 80d910ca89eab9bce03f59a4ade33f1fc30ce0ad 25 | path: modules/hal/espressif 26 | west-commands: west/west-commands.yml 27 | groups: 28 | - hal 29 | -------------------------------------------------------------------------------- /lib/miosix-kernel/miosix/arch/common/drivers/serial.h: -------------------------------------------------------------------------------- 1 | 2 | //Serial code is common for all the cortex M cores, so it has been put here 3 | 4 | #ifdef _ARCH_ARM7_LPC2000 5 | #include "serial_lpc2000.h" 6 | #elif defined(_ARCH_CORTEXM0_STM32) || defined(_ARCH_CORTEXM3_STM32) \ 7 | || defined(_ARCH_CORTEXM4_STM32F4) || defined(_ARCH_CORTEXM3_STM32F2) \ 8 | || defined(_ARCH_CORTEXM3_STM32L1) || defined(_ARCH_CORTEXM7_STM32F7) \ 9 | || defined(_ARCH_CORTEXM7_STM32H7) || defined(_ARCH_CORTEXM4_STM32F3) \ 10 | || defined(_ARCH_CORTEXM4_STM32L4) 11 | #include "serial_stm32.h" 12 | #elif defined(_ARCH_CORTEXM3_EFM32GG) 13 | #include "serial_efm32.h" 14 | #elif defined(_ARCH_CORTEXM4_ATSAM4L) 15 | #include "serial_atsam4l.h" 16 | #else 17 | #error "Unknown arch" 18 | #endif 19 | -------------------------------------------------------------------------------- /lib/miosix-kernel/miosix/filesystem/fat32/integer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------*/ 2 | /* Integer type definitions for FatFs module */ 3 | /*-------------------------------------------*/ 4 | 5 | #ifndef _FF_INTEGER 6 | #define _FF_INTEGER 7 | 8 | #ifdef _WIN32 /* FatFs development platform */ 9 | 10 | #include 11 | #include 12 | 13 | #else /* Embedded platform */ 14 | 15 | /* This type MUST be 8 bit */ 16 | typedef unsigned char BYTE; 17 | 18 | /* These types MUST be 16 bit */ 19 | typedef short SHORT; 20 | typedef unsigned short WORD; 21 | typedef unsigned short WCHAR; 22 | 23 | /* These types MUST be 16 bit or 32 bit */ 24 | typedef int INT; 25 | typedef unsigned int UINT; 26 | 27 | /* These types MUST be 32 bit */ 28 | typedef long LONG; 29 | typedef unsigned long DWORD; 30 | 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /scripts/plot_m17_demod_csv.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | import pandas as pd 4 | from matplotlib import pyplot as plt 5 | from sys import argv 6 | 7 | plt.rcParams["figure.autolayout"] = True 8 | df = pd.read_csv(argv[1]) 9 | print("Contents in csv file:\n", df) 10 | plt.plot(df.index, df.Sample, label="Sample") 11 | plt.plot(df.index, df.Convolution / 10, label="Conv") 12 | plt.plot(df.index, df.Threshold / 10, label="Conv. Th+") 13 | plt.plot(df.index, df.Threshold * -1 / 10, label="Conv. Th-") 14 | plt.plot(df.index, df.Index, label="Index") 15 | plt.plot(df.index, df.Max, label="Qnt. avg. +") 16 | plt.plot(df.index, df.Min, label="Qnt. avg. -") 17 | plt.plot(df.index, df.Symbol * 10, label="Symbol") 18 | plt.plot(df.index, df.I, label="I") 19 | plt.plot(df.index, df.Flags * 100, label="Flags") 20 | plt.grid(True) 21 | plt.legend(loc="upper left") 22 | plt.suptitle(argv[1]) 23 | plt.show() 24 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/sources/cog.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/miosix-kernel/miosix/kernel/SystemMap.h: -------------------------------------------------------------------------------- 1 | #ifndef SYSTEMMAP_H 2 | #define SYSTEMMAP_H 3 | 4 | #include "kernel/sync.h" 5 | #include "config/miosix_settings.h" 6 | 7 | #include 8 | #include 9 | 10 | #ifdef WITH_PROCESSES 11 | 12 | namespace miosix { 13 | 14 | class SystemMap 15 | { 16 | public: 17 | static SystemMap &instance(); 18 | 19 | void addElfProgram(const char *name, const unsigned int *elf, unsigned int size); 20 | void removeElfProgram(const char *name); 21 | std::pair getElfProgram(const char *name) const; 22 | 23 | unsigned int getElfCount() const; 24 | 25 | private: 26 | SystemMap() {} 27 | SystemMap(const SystemMap&); 28 | SystemMap& operator= (const SystemMap&); 29 | 30 | typedef std::map > ProgramsMap; 31 | ProgramsMap mPrograms; 32 | }; 33 | 34 | } //namespace miosix 35 | 36 | #endif //WITH_PROCESSES 37 | 38 | #endif /* SYSTEMMAP_H */ 39 | -------------------------------------------------------------------------------- /.github/workflows/regenerate_symbols.yml: -------------------------------------------------------------------------------- 1 | name: "Check if symbols need to be regenerated" 2 | on: 3 | workflow_dispatch: 4 | push: 5 | paths: 6 | - 'openrtx/include/fonts/symbols/**/*' 7 | pull_request: 8 | paths: 9 | - 'openrtx/include/fonts/symbols/**/*' 10 | 11 | 12 | jobs: 13 | check-symbol-generation: 14 | runs-on: ubuntu-22.04 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v4 18 | with: 19 | submodules: recursive 20 | - name: install-deps 21 | run: | 22 | sudo apt update 23 | sudo apt install python3 python3-pip 24 | - name: Setup symbols script dependencies 25 | run: | 26 | cd ${{github.workspace}} 27 | pip3 install -r requirements.txt 28 | - name: Run symbols script 29 | run: ./scripts/generate_symbols.py 30 | - name: Fail the build if there are changes generated 31 | run: | 32 | git --no-pager diff 33 | git diff-index --quiet HEAD 34 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: Google 3 | AlignConsecutiveBitFields: AcrossEmptyLinesAndComments 4 | AlignTrailingComments: 'true' 5 | AlignConsecutiveAssignments: Consecutive 6 | AllowShortFunctionsOnASingleLine: 'false' 7 | ColumnLimit: '80' 8 | DerivePointerAlignment: 'false' 9 | IndentExternBlock: NoIndent 10 | IndentWidth: '4' 11 | NamespaceIndentation: Inner 12 | 13 | BinPackParameters: 'false' 14 | BreakBeforeBraces: Custom 15 | BraceWrapping: 16 | AfterCaseLabel: 'true' 17 | AfterClass: 'true' 18 | AfterControlStatement: Always 19 | AfterEnum: 'true' 20 | AfterFunction: 'true' 21 | AfterNamespace: 'true' 22 | AfterObjCDeclaration: 'true' 23 | AfterStruct: 'true' 24 | AfterUnion: 'true' 25 | AfterExternBlock: 'false' 26 | BeforeCatch: 'true' 27 | BeforeElse: 'true' 28 | BeforeLambdaBody: 'true' 29 | BeforeWhile: 'false' 30 | IndentBraces: 'false' 31 | SplitEmptyFunction: 'true' 32 | SplitEmptyRecord: 'true' 33 | SplitEmptyNamespace: 'true' 34 | 35 | ... 36 | -------------------------------------------------------------------------------- /tests/unit/convert_minmea_coord.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | static void assert_conversion(struct minmea_float *f, int32_t expected) 7 | { 8 | int32_t result = minmea_tofixedpoint(f); 9 | if (result != expected) 10 | { 11 | printf("FAILED! result value %d - expected %d\n", 12 | result, expected); 13 | exit(1); 14 | } 15 | } 16 | 17 | int main() { 18 | printf("minmea coordinate conversion test\n"); 19 | struct minmea_float test = {5333735, 1000}; 20 | assert_conversion(&test, 53562250); 21 | test.scale = 1; 22 | test.value = 0; 23 | assert_conversion(&test, 0); 24 | test.scale = 1000; 25 | test.value = -5333735; 26 | assert_conversion(&test, -53562250); 27 | test.scale = 1000; 28 | test.value = -330; 29 | assert_conversion(&test, -5500); 30 | test.scale = 1000; 31 | test.value = -3296; 32 | assert_conversion(&test, -54933); 33 | printf("PASS\n"); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /platform/drivers/display/SH110x_Mod17.h: -------------------------------------------------------------------------------- 1 | #ifndef SH110X_MOD17_H 2 | #define SH110X_MOD17_H 3 | 4 | #include 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | /** 12 | * Initialize the SH110x display driver. 13 | */ 14 | void SH110x_init(); 15 | 16 | /** 17 | * Shut down the SH110x display driver. 18 | */ 19 | void SH110x_terminate(); 20 | 21 | /** 22 | * Do a partial framebuffer render. 23 | * 24 | * @param startRow: first row of the partial render. 25 | * @param endRow: last row of the partial render. 26 | * @param fb: pointer to framebuffer. 27 | */ 28 | void SH110x_renderRows(uint8_t startRow, uint8_t endRow, void *fb); 29 | 30 | /** 31 | * Render the framebuffer on the screen. 32 | * 33 | * @param fb: pointer to framebuffer. 34 | */ 35 | void SH110x_render(void *fb); 36 | 37 | /** 38 | * Set display contrast. 39 | * 40 | * @param contrast: display contrast level, 0 to 63. 41 | */ 42 | void SH110x_setContrast(uint8_t contrast); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif /* SH110X_MOD17_H */ 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #Build dirs 2 | build* 3 | 4 | # Prerequisites 5 | *.d 6 | 7 | # Compiled Object files 8 | *.slo 9 | *.lo 10 | *.o 11 | *.obj 12 | 13 | # Precompiled Headers 14 | *.gch 15 | *.pch 16 | 17 | # Compiled Dynamic libraries 18 | *.so 19 | *.dylib 20 | *.dll 21 | 22 | # Fortran module files 23 | *.mod 24 | *.smod 25 | 26 | # Compiled Static libraries 27 | *.lai 28 | *.la 29 | *.a 30 | *.lib 31 | 32 | # Executables 33 | *.exe 34 | *.out 35 | *.app 36 | 37 | # Binaries 38 | *.bin 39 | *.elf 40 | *.hex 41 | *.map 42 | 43 | # Python byte-compiled 44 | */__pycache__ 45 | 46 | # Kdevelop files 47 | *.kdev4 48 | .kdev4/ 49 | 50 | # gutentags 51 | tags 52 | 53 | 54 | # subprojects 55 | subprojects/radio_tool 56 | subprojects/codec2 57 | subprojects/tinyusb 58 | subprojects/XPowersLib 59 | 60 | # ignore log files 61 | *.log 62 | 63 | # ignore linux openrtx emulator history file 64 | .emulatorsh_history 65 | 66 | # ignore bin2sgl 67 | !scripts/bin2sgl.Linux.bin 68 | !scripts/bin2sgl.exe 69 | 70 | # Compiled script 71 | scripts/get_demod_log 72 | 73 | # OpenRTX Codeplugs 74 | *.rtxc 75 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/sources/LICENSE: -------------------------------------------------------------------------------- 1 | ## Pictogrammers Free License 2 | 3 | Last Updated: February 1st, 2023 4 | 5 | This package is released as free, open-source, and GPL friendly by 6 | the [Pictogrammers](https://pictogrammers.com/). You may use it 7 | for commercial projects, open-source projects, or anything really. 8 | 9 | # Icons: Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) 10 | 11 | Some of the icons are redistributed under the Apache 2.0 license. All other 12 | icons are either redistributed under their respective licenses or are 13 | distributed under the Apache 2.0 license. 14 | 15 | # Fonts: Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) 16 | 17 | All web and desktop fonts are distributed under the Apache 2.0 license. Web 18 | and desktop fonts contain some icons that are redistributed under the Apache 19 | 2.0 license. All other icons are either redistributed under their respective 20 | licenses or are distributed under the Apache 2.0 license. 21 | 22 | # Code: MIT (https://opensource.org/licenses/MIT) 23 | 24 | The MIT license applies to all non-font and non-icon files. 25 | -------------------------------------------------------------------------------- /lib/qdec/license.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 SimpleHacks ("Simple hacks for a simple life") 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /subprojects/packagefiles/radio_tool/meson.build: -------------------------------------------------------------------------------- 1 | project('radio_tool', 'cpp') 2 | 3 | # Building radio_tool natively in meson will be possible when native 4 | # subproject building will be implemented. 5 | 6 | #usb = dependency('libusb-1.0', version : '>=1.0.0') 7 | # 8 | #conf_data = configuration_data() 9 | #conf_data.set('GIT_SHA1', '58ff5701466a6dc651e0d04778c4abec780f4643') 10 | #conf_data.set('GIT_SHA1_SHORT', '58ff570') 11 | #conf_data.set('PROJECT_VERSION', '0.1.0') 12 | #conf_data.set('PROJECT_NAME', 'radio_tool') 13 | #version_file = configure_file(input : 'src/version.cpp.in', 14 | # output : 'version.cpp', 15 | # configuration : conf_data) 16 | # 17 | #src = ['src/radio_tool.cpp', 18 | # 'src/dfu.cpp', 19 | # 'src/radio_factory.cpp', 20 | # 'src/tyt_radio.cpp', 21 | # 'src/tyt_dfu.cpp', 22 | # 'src/tyt_fw.cpp', 23 | # 'src/cs_fw.cpp', 24 | # 'src/rdt.cpp', 25 | # version_file] 26 | # 27 | #inc = include_directories('include') 28 | 29 | run_command('mkdir', 'build') 30 | run_command('cmake', '.') 31 | run_command('make', '-j4') 32 | 33 | radio_tool = find_program('./radio_tool') 34 | 35 | meson.override_find_program('radio_tool', radio_tool) 36 | -------------------------------------------------------------------------------- /lib/miosix-kernel/miosix/kernel/SystemMap.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "SystemMap.h" 3 | 4 | using namespace std; 5 | 6 | #ifdef WITH_PROCESSES 7 | 8 | namespace miosix { 9 | 10 | SystemMap& SystemMap::instance() 11 | { 12 | static SystemMap singleton; 13 | return singleton; 14 | } 15 | 16 | void SystemMap::addElfProgram(const char* name, const unsigned int *elf, unsigned int size) 17 | { 18 | string sName(name); 19 | if(mPrograms.find(sName) == mPrograms.end()) 20 | mPrograms.insert(make_pair(sName, make_pair(elf, size))); 21 | } 22 | 23 | void SystemMap::removeElfProgram(const char* name) 24 | { 25 | string sName(name); 26 | ProgramsMap::iterator it = mPrograms.find(sName); 27 | 28 | if(it != mPrograms.end()) 29 | mPrograms.erase(it); 30 | } 31 | 32 | pair SystemMap::getElfProgram(const char* name) const 33 | { 34 | ProgramsMap::const_iterator it = mPrograms.find(string(name)); 35 | 36 | if(it == mPrograms.end()) 37 | return make_pair(0, 0); 38 | 39 | return it->second; 40 | } 41 | 42 | unsigned int SystemMap::getElfCount() const 43 | { 44 | return mPrograms.size(); 45 | } 46 | 47 | } //namespace miosix 48 | 49 | #endif //WITH_PROCESSES 50 | -------------------------------------------------------------------------------- /lib/miosix-kernel/miosix/util/crc16.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "crc16.h" 3 | 4 | namespace miosix { 5 | 6 | /** 7 | * 16 bit ccitt crc calculation 8 | * \param crc the firs time the function is called, pass 0xffff, all the other 9 | * times, pass the previous value. The value returned after the last call is 10 | * the desired crc 11 | * \param data a byte of the message 12 | */ 13 | static inline void crc16Update(unsigned short& crc, unsigned char data) 14 | { 15 | unsigned short x=((crc>>8) ^ data) & 0xff; 16 | x^=x>>4; 17 | crc=(crc<<8) ^ (x<<12) ^ (x<<5) ^ x; 18 | } 19 | 20 | unsigned short crc16(const void *message, unsigned int length) 21 | { 22 | const unsigned char *m=reinterpret_cast(message); 23 | unsigned short result=0xffff; 24 | for(unsigned int i=0;i 32 | #include 33 | 34 | using namespace std; 35 | 36 | int main() 37 | { 38 | unsigned char test[]="Some test string"; 39 | cout<<"0x"<bitmap 13 | uint8_t width; ///< Bitmap dimensions in pixels 14 | uint8_t height; ///< Bitmap dimensions in pixels 15 | uint8_t xAdvance; ///< Distance to advance cursor (x axis) 16 | int8_t xOffset; ///< X dist from cursor pos to UL corner 17 | int8_t yOffset; ///< Y dist from cursor pos to UL corner 18 | } GFXglyph; 19 | 20 | /// Data stored for FONT AS A WHOLE 21 | typedef struct { 22 | uint8_t *bitmap; ///< Glyph bitmaps, concatenated 23 | GFXglyph *glyph; ///< Glyph array 24 | uint16_t first; ///< ASCII extents (first char) 25 | uint16_t last; ///< ASCII extents (last char) 26 | uint8_t yAdvance; ///< Newline distance (y axis) 27 | } GFXfont; 28 | 29 | // Define PROGMEM macro, since it is not used in our platforms 30 | #define PROGMEM 31 | 32 | #endif // _GFXFONT_H_ 33 | -------------------------------------------------------------------------------- /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:24.04 AS build 2 | 3 | # dependencies for miosix compiler 4 | RUN apt-get update -y && apt-get install -y \ 5 | git \ 6 | wget \ 7 | sudo \ 8 | build-essential \ 9 | libncurses5-dev \ 10 | byacc \ 11 | flex \ 12 | texinfo \ 13 | patch \ 14 | tar \ 15 | unzip \ 16 | lzip \ 17 | libelf-dev \ 18 | perl \ 19 | libexpat1-dev \ 20 | && rm -rf /var/lib/apt/lists/* 21 | 22 | # compile miosix compiler 23 | RUN git clone --depth 1 https://github.com/fedetft/miosix-kernel.git \ 24 | && cd miosix-kernel/miosix/_tools/compiler/gcc-9.2.0-mp3.2 \ 25 | && sh download.sh \ 26 | && bash install-script.sh -j`nproc` 27 | 28 | 29 | # 2th stage build 30 | FROM ubuntu:24.04 31 | 32 | # copy arm-miosix-eabi compiler from build stage 33 | COPY --from=build /opt /opt 34 | 35 | # create symbolic links to compiler 36 | RUN ln -s /opt/arm-miosix-eabi/bin/* /bin/ 37 | 38 | # dependencies for the project 39 | RUN apt-get update -y && apt-get install -y \ 40 | git \ 41 | pkg-config \ 42 | build-essential \ 43 | meson \ 44 | libsdl2-dev \ 45 | libreadline-dev \ 46 | dfu-util \ 47 | cmake \ 48 | libusb-1.0-0 \ 49 | libusb-1.0-0-dev \ 50 | codec2 \ 51 | libcodec2-dev \ 52 | && rm -rf /var/lib/apt/lists/* 53 | 54 | # fix error from git with different users 55 | RUN git config --system --add safe.directory '*' 56 | -------------------------------------------------------------------------------- /subprojects/packagefiles/codec2/codec2/version.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | 3 | FILE........: version.h 4 | AUTHOR......: Tomas Härdin 5 | DATE CREATED: 03 November 2017 6 | 7 | Codec 2 VERSION #defines 8 | 9 | \*---------------------------------------------------------------------------*/ 10 | 11 | /* 12 | Copyright (C) 2017 Tomas Härdin 13 | 14 | All rights reserved. 15 | 16 | This program is free software; you can redistribute it and/or modify 17 | it under the terms of the GNU Lesser General Public License version 2.1, as 18 | published by the Free Software Foundation. This program is 19 | distributed in the hope that it will be useful, but WITHOUT ANY 20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or 21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 22 | License for more details. 23 | 24 | You should have received a copy of the GNU Lesser General Public License 25 | along with this program; if not, see . 26 | */ 27 | 28 | //this functions both as an include guard and your typical HAVE macro 29 | #ifndef CODEC2_HAVE_VERSION 30 | #define CODEC2_HAVE_VERSION 31 | 32 | #define CODEC2_VERSION_MAJOR 1 33 | #define CODEC2_VERSION_MINOR 0 34 | /* #undef CODEC2_VERSION_PATCH */ 35 | #define CODEC2_VERSION "1.0" 36 | 37 | #endif //CODEC2_HAVE_VERSION 38 | -------------------------------------------------------------------------------- /subprojects/packagefiles/codec2/meson.build: -------------------------------------------------------------------------------- 1 | project('codec2', 'c') 2 | 3 | cmake = import('cmake') 4 | 5 | codec2_inc = include_directories('.', 'src') 6 | codec2_src = ['src/dump.c', 7 | 'src/lpc.c', 8 | 'src/nlp.c', 9 | 'src/phase.c', 10 | 'src/quantise.c', 11 | 'src/postfilter.c', 12 | 'src/codec2.c', 13 | 'src/codec2_fft.c', 14 | 'src/lsp.c', 15 | 'src/sine.c', 16 | 'src/interp.c', 17 | 'src/kiss_fft.c', 18 | 'src/kiss_fftr.c', 19 | 'src/newamp1.c', 20 | 'src/codebook.c', 21 | 'src/codebookd.c', 22 | 'src/pack.c', 23 | 'src/codebooknewamp1.c', 24 | 'src/codebooknewamp1_energy.c'] 25 | 26 | add_project_arguments('-DCODEC2_MODE_EN_DEFAULT=0', language : 'c') 27 | add_project_arguments('-DCODEC2_MODE_3200_EN=1' , language : 'c') 28 | add_project_arguments('-DCODEC2_MODE_1600_EN=1' , language : 'c') 29 | add_project_arguments('-DFREEDV_MODE_EN_DEFAULT=0', language : 'c') 30 | add_project_arguments('-w' , language : 'c') 31 | 32 | codec2 = static_library('codec2', 33 | codec2_src, 34 | include_directories : codec2_inc, 35 | install : false) 36 | 37 | codec2_dep = declare_dependency(include_directories : codec2_inc, 38 | link_with : codec2) 39 | -------------------------------------------------------------------------------- /platform/targets/ttwrplus/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-or-later 2 | 3 | # 4 | # CMake configuration file for the T-TWR Plus OpenRTX target 5 | # 6 | cmake_minimum_required(VERSION 3.20.0) 7 | 8 | target_sources(app 9 | PRIVATE 10 | ${OPENRTX_ROOT}/platform/mcu/ESP32S3/drivers/delays.c 11 | 12 | ${OPENRTX_ROOT}/platform/targets/ttwrplus/platform.c 13 | ${OPENRTX_ROOT}/platform/targets/ttwrplus/pmu.cpp 14 | 15 | ${OPENRTX_ROOT}/platform/drivers/display/SH1106_ttwrplus.c 16 | ${OPENRTX_ROOT}/platform/drivers/keyboard/keyboard_ttwrplus.c 17 | ${OPENRTX_ROOT}/platform/drivers/baseband/radio_ttwrplus.cpp 18 | ${OPENRTX_ROOT}/platform/drivers/baseband/AT1846S_SA8x8.cpp 19 | ${OPENRTX_ROOT}/platform/drivers/baseband/SA8x8.c 20 | ${OPENRTX_ROOT}/platform/drivers/GPS/gps_zephyr.c 21 | ${OPENRTX_ROOT}/platform/drivers/GPS/nmea_rbuf.c 22 | ${OPENRTX_ROOT}/platform/drivers/audio/audio_ttwrplus.c 23 | ${OPENRTX_ROOT}/platform/drivers/NVM/flash_zephyr.c 24 | ${OPENRTX_ROOT}/platform/drivers/NVM/nvmem_ttwrplus.c 25 | 26 | ${OPENRTX_ROOT}/platform/drivers/stubs/cps_io_stub.c 27 | 28 | ${OPENRTX_ROOT}/subprojects/XPowersLib/src/XPowersLibInterface.cpp 29 | ) 30 | 31 | target_include_directories(app 32 | PRIVATE 33 | ${OPENRTX_ROOT}/platform/targets/ttwrplus 34 | 35 | ${OPENRTX_ROOT}/subprojects/XPowersLib/src 36 | ${OPENRTX_ROOT}/subprojects/XPowersLib/src/REG 37 | ) 38 | 39 | target_compile_definitions(app PRIVATE PLATFORM_TTWRPLUS CONFIG_SCREEN_BRIGHTNESS CONFIG_UI_NO_KEYBOARD) 40 | -------------------------------------------------------------------------------- /platform/drivers/audio/MAX9814.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2022 - 2025 by Mathis Schmieder DB9MAT * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, see * 16 | ***************************************************************************/ 17 | 18 | #ifndef MAX9814_H 19 | #define MAX9814_H 20 | 21 | #include 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | void max9814_setGain(uint8_t gain); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /* MAX9814_H */ 35 | -------------------------------------------------------------------------------- /subprojects/packagefiles/tinyusb/meson.build: -------------------------------------------------------------------------------- 1 | project('tinyusb', 'c') 2 | 3 | # 4 | # HACK 5 | # This is a workaround for meson not propagating the include directories of the 6 | # main project to the subprojects. To avoid double-inclusion we force the 7 | # include paths needed to compile tinyusb and already present in the main 8 | # program via GCC compile arguments. 9 | # 10 | add_project_arguments('-I../platform/mcu/CMSIS/Device/ST/STM32F4xx/Include', 11 | language : 'c') 12 | add_project_arguments('-I../platform/mcu/CMSIS/Include', language : 'c') 13 | add_project_arguments('-w', language : 'c') 14 | 15 | tinyusb_inc = include_directories('openrtx', 'src', 'hw') 16 | 17 | tinyusb_src = ['src/tusb.c', 18 | 'src/device/usbd.c', 19 | 'src/common/tusb_fifo.c', 20 | 'src/device/usbd_control.c', 21 | 'src/class/cdc/cdc_device.c', 22 | 'src/portable/st/synopsys/dcd_synopsys.c', 23 | 'src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c'] 24 | 25 | # Define CPU type and clock speed via GCC command line arguments 26 | add_project_arguments('-DSTM32F405xx', language : 'c') 27 | add_project_arguments('-DHSE_VALUE=8000000', language : 'c') 28 | 29 | 30 | 31 | tinyusb = static_library('tinyusb', 32 | tinyusb_src, 33 | include_directories : tinyusb_inc, 34 | install : false) 35 | 36 | tinyusb_dep = declare_dependency(include_directories : tinyusb_inc, 37 | link_with : tinyusb) 38 | -------------------------------------------------------------------------------- /platform/drivers/GPIO/gpio-native.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2024 - 2025 by Silvano Seva IU2KWO * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, see * 16 | ***************************************************************************/ 17 | 18 | #ifndef GPIO_NATIVE_H 19 | #define GPIO_NATIVE_H 20 | 21 | #if defined(STM32F405xx) 22 | #include 23 | #include 24 | #elif defined(STM32H743xx) 25 | #include 26 | #include 27 | #elif defined(MK22FN512xx) 28 | #include 29 | #endif 30 | 31 | #endif /* GPIO_NATIVE_H */ 32 | -------------------------------------------------------------------------------- /scripts/clang_format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Copyright (C) 2021 by Alain Carlucci. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, see 17 | 18 | function show_help { 19 | echo "OpenRTX clang-format tool." 20 | echo "" 21 | echo "Usage: $0 [--check] [--help]" 22 | echo "" 23 | echo "To apply clang-format style to the whole codebase, run without arguments" 24 | echo "To check if the codebase is compliant, run with --check" 25 | } 26 | 27 | if [ $# -gt 1 ]; then 28 | show_help 29 | exit 1 30 | fi 31 | 32 | if [ $# -eq 1 ]; then 33 | if [ "$1" == "--help" ]; then 34 | show_help 35 | exit 0 36 | fi 37 | 38 | if [ "$1" != "--check" ]; then 39 | echo "Invalid argument $1" 40 | show_help 41 | exit 1 42 | fi 43 | fi 44 | 45 | FILE_LIST=$(git ls-files | egrep '\.(c|cpp|h)$' | egrep -v 'lib/|subprojects/|platform/mcu') 46 | 47 | CHECK_ARGS="" 48 | if [ "$1" == "--check" ]; then 49 | CHECK_ARGS="--dry-run -Werror" 50 | fi 51 | 52 | clang-format $CHECK_ARGS -i $FILE_LIST 53 | -------------------------------------------------------------------------------- /platform/drivers/stubs/keyboard_stub.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2023 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #include 22 | 23 | void kbd_init() 24 | { 25 | 26 | } 27 | 28 | void kbd_terminate() 29 | { 30 | 31 | } 32 | 33 | keyboard_t kbd_getKeys() 34 | { 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /openrtx/include/core/battery.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN, * 4 | * Silvano Seva IU2KWO * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 3 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, see * 18 | ***************************************************************************/ 19 | 20 | #ifndef BATTERY_H 21 | #define BATTERY_H 22 | 23 | #include 24 | 25 | /** 26 | * This function computes the battery's state of charge given its current voltage. 27 | * @param vbat: battery voltage in millivolt. 28 | * @return state of charge percentage, from 0% to 100%. 29 | */ 30 | uint8_t battery_getCharge(uint16_t vbat); 31 | 32 | #endif /* BATTERY_H */ 33 | -------------------------------------------------------------------------------- /openrtx/src/protocols/M17/M17DSP.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2021 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #include 22 | #include 23 | 24 | #ifdef CONFIG_M17 25 | Fir< std::tuple_size< decltype(M17::rrc_taps_48k) >::value > M17::rrc_48k(M17::rrc_taps_48k); 26 | Fir< std::tuple_size< decltype(M17::rrc_taps_24k) >::value > M17::rrc_24k(M17::rrc_taps_24k); 27 | #endif 28 | -------------------------------------------------------------------------------- /platform/drivers/USB/usb.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2022 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Silvano Seva IU2KWO * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 3 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, see * 18 | ***************************************************************************/ 19 | 20 | #ifndef USB_H 21 | #define USB_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /** 32 | * Initialise the USB driver. 33 | */ 34 | void usb_init(); 35 | 36 | /** 37 | * Shut down the USB driver. 38 | */ 39 | void usb_terminate(); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif /* USB_H */ 46 | -------------------------------------------------------------------------------- /tests/unit/ui_check_standby.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | extern bool _ui_checkStandby(long long); 8 | extern state_t state; 9 | 10 | void assert_display_timer(display_timer_t conf, 11 | long long time_sec, 12 | bool expected) 13 | { 14 | state.settings.brightness_timer = conf; 15 | 16 | long long ticks = time_sec * 1000; 17 | 18 | if (_ui_checkStandby(ticks) != expected) 19 | { 20 | printf("FAILED! enum value %d - time %lld sec - expected %d\n", 21 | conf, time_sec, expected); 22 | exit(1); 23 | } 24 | } 25 | 26 | void test_timer_threshold(display_timer_t conf, long long time_sec) 27 | { 28 | assert_display_timer(conf, time_sec -1, false); 29 | assert_display_timer(conf, time_sec, true); 30 | } 31 | 32 | int main() { 33 | printf("Backlight timer test\n"); 34 | 35 | test_timer_threshold(TIMER_5S, 5); 36 | test_timer_threshold(TIMER_10S, 10); 37 | test_timer_threshold(TIMER_15S, 15); 38 | test_timer_threshold(TIMER_20S, 20); 39 | test_timer_threshold(TIMER_25S, 25); 40 | test_timer_threshold(TIMER_30S, 30); 41 | 42 | test_timer_threshold(TIMER_1M, 1 * 60); 43 | test_timer_threshold(TIMER_2M, 2 * 60); 44 | test_timer_threshold(TIMER_3M, 3 * 60); 45 | test_timer_threshold(TIMER_4M, 4 * 60); 46 | test_timer_threshold(TIMER_5M, 5 * 60); 47 | 48 | 49 | test_timer_threshold(TIMER_15M, 15 * 60); 50 | test_timer_threshold(TIMER_30M, 30 * 60); 51 | test_timer_threshold(TIMER_45M, 45 * 60); 52 | 53 | test_timer_threshold(TIMER_1H, 60 * 60); 54 | 55 | assert_display_timer(TIMER_OFF, 0, false); 56 | assert_display_timer(TIMER_OFF, 60 * 60 * 24, false); 57 | 58 | printf("PASS\n"); 59 | 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /tests/platform/boot_test.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | int main() 26 | { 27 | platform_init(); 28 | 29 | while(1) 30 | { 31 | platform_ledOn(GREEN); 32 | delayMs(1000); 33 | platform_ledOff(GREEN); 34 | delayMs(1000); 35 | } 36 | 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /platform/drivers/audio/MAX9814_Mod17.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2021 - 2025 by Mathis Schmieder DB9MAT * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, see * 16 | ***************************************************************************/ 17 | 18 | #include 19 | #include 20 | #include "MAX9814.h" 21 | 22 | /* 23 | * Implementation of MAX9814 gain setting 24 | */ 25 | 26 | void max9814_setGain(uint8_t gain) 27 | { 28 | if (gain == 0) 29 | { 30 | gpio_setMode(MIC_GAIN, OUTPUT); 31 | gpio_setPin(MIC_GAIN); // 40 dB gain 32 | } 33 | else if (gain == 1) 34 | { 35 | gpio_setMode(MIC_GAIN, OUTPUT); 36 | gpio_clearPin(MIC_GAIN); // 50 dB gain 37 | } 38 | else 39 | { 40 | gpio_setMode(MIC_GAIN, INPUT); // High impedance, 60 dB gain 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /platform/mcu/MK22FN512xxx12/drivers/usb/usb_device_cdc_acm.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. 3 | * Copyright 2016 NXP 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * o Redistributions of source code must retain the above copyright notice, this list 9 | * of conditions and the following disclaimer. 10 | * 11 | * o Redistributions in binary form must reproduce the above copyright notice, this 12 | * list of conditions and the following disclaimer in the documentation and/or 13 | * other materials provided with the distribution. 14 | * 15 | * o Neither the name of the copyright holder nor the names of its 16 | * contributors may be used to endorse or promote products derived from this 17 | * software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include "usb_device_config.h" 32 | #include "usb.h" 33 | #include "usb_device.h" 34 | 35 | #if USB_DEVICE_CONFIG_CDC_ACM 36 | #include "usb_device_cdc_acm.h" 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /meta/leak_check.txt: -------------------------------------------------------------------------------- 1 | p 2 | p 3 | p 4 | p 5 | r 12 6 | key 1 2 3 4 5 6 enter 7 | key esc 8 | key 1 2 3 4 5 6 enter 9 | key 4 5 1 8 enter 10 | key 4 5 1 8 enter 11 | key 4 6 9 enter 12 | key esc 13 | key enter 14 | key down down down 15 | key down 16 | key enter 17 | key esc 18 | key down down down down down 19 | key enter 20 | key esc 21 | p 22 | p 23 | key enter 24 | key esc 25 | key 4 5 1 8 enter 26 | key 1 4 6 5 2 enter 27 | p 28 | p 29 | key enter down down down down down enter 30 | key esc 31 | key down down down down 32 | key enter 33 | key esc 34 | key esc 35 | key enter up up enter 36 | key up 37 | key esc 38 | key esc 39 | r 12 40 | r 15 41 | s 42 | vb 7.6 43 | key enter 44 | key esc 45 | s 46 | channel 1 47 | channel 2 48 | ch 3 49 | ch 5 50 | ch 15 51 | key esc 52 | ch 2 53 | key esc 54 | key esc 55 | key esc 56 | key enter 57 | key esc 58 | key esc 59 | key enter 60 | key down down down 61 | key enter 62 | key enter 63 | key down 64 | key enter 65 | key up 66 | key up 67 | key up 68 | key up 69 | key up 70 | key up 71 | key down 72 | key down 73 | key esc 74 | 75 | p 76 | p 77 | key esc 78 | key esc 79 | key esc 80 | key up 81 | key esc 82 | key up 83 | key up 84 | key 4 5 1 8 enter enter 85 | p 86 | p 87 | key 1 4 6 5 2 enter 4 5 1 8 enter 88 | p 89 | p 90 | p 91 | p 92 | key enter up up enter 93 | key up 94 | key esc 95 | key down down down down enter 96 | key esc 97 | key down down down down down enter 98 | key esc 99 | key esc 100 | 101 | key esc 102 | key esc 103 | key esc 104 | key up 105 | key esc 106 | key up 107 | key up 108 | key 4 5 1 8 enter enter 109 | p 110 | p 111 | key 1 4 6 5 2 enter 4 5 1 8 enter 112 | ready 113 | p 114 | p 115 | p 116 | p 117 | key enter up up enter 118 | key up 119 | key esc 120 | key down down down down enter 121 | key esc 122 | key down down down down down enter 123 | key esc 124 | key esc 125 | -------------------------------------------------------------------------------- /platform/targets/linux/hwconfig.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Frederik Saraci IU2NRO * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, see * 16 | ***************************************************************************/ 17 | 18 | #ifndef HWCONFIG_H 19 | #define HWCONFIG_H 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* Module17 hardware info flags, required by Module17 UI emulator target */ 26 | enum Mod17Flags 27 | { 28 | MOD17_FLAGS_HMI_PRESENT = 1, 29 | MOD17_FLAGS_SOFTPOT = 2 30 | }; 31 | 32 | /* Screen has adjustable brightness */ 33 | #define CONFIG_SCREEN_BRIGHTNESS 34 | 35 | /* Battery type */ 36 | #define CONFIG_BAT_LIPO 37 | #define CONFIG_BAT_NCELLS 2 38 | 39 | /* Device supports M17 mode */ 40 | #define CONFIG_M17 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif /* HWCONFIG_H */ 47 | -------------------------------------------------------------------------------- /openrtx/src/core/crc.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2022 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #include 22 | 23 | uint16_t crc_ccitt(const void *data, const size_t len) 24 | { 25 | uint16_t x = 0; 26 | uint16_t crc = 0; 27 | const uint8_t *buf = ((const uint8_t *) data); 28 | 29 | for(size_t i = 0; i < len; i++) 30 | { 31 | x = (crc >> 8) ^ buf[i]; 32 | x ^= x >> 4; 33 | crc = (crc << 8) ^ (x << 12) ^ (x << 5) ^ x; 34 | } 35 | 36 | return crc; 37 | } 38 | -------------------------------------------------------------------------------- /platform/mcu/MK22FN512xxx12/drivers/rng.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2023 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #include 22 | #include 23 | 24 | void rng_init() 25 | { 26 | SIM->SCGC6 |= SIM_SCGC6_RNGA(1); 27 | RNG->CR |= RNG_CR_GO(1); 28 | } 29 | 30 | void rng_terminate() 31 | { 32 | SIM->SCGC6 &= ~SIM_SCGC6_RNGA(1); 33 | } 34 | 35 | uint32_t rng_get() 36 | { 37 | // Wait until there is some data 38 | while((RNG->SR & RNG_SR_OREG_LVL_MASK) == 0) ; 39 | 40 | return RNG->OR; 41 | } 42 | -------------------------------------------------------------------------------- /platform/drivers/keyboard/keyboard_linux.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | void kbd_init() 28 | { 29 | } 30 | 31 | keyboard_t kbd_getKeys() 32 | { 33 | keyboard_t keys = 0; 34 | 35 | //this pulls in emulated keypresses from the command shell 36 | keys |= emulator_getKeys(); 37 | keys |= sdlEngine_getKeys(); 38 | 39 | return keys; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /platform/mcu/x86_64/drivers/rng.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2023 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | static std::mt19937 rng; 26 | 27 | void rng_init() 28 | { 29 | std::random_device seed; 30 | rng.seed(seed()); 31 | } 32 | 33 | void rng_terminate() 34 | { 35 | 36 | } 37 | 38 | uint32_t rng_get() 39 | { 40 | std::uniform_int_distribution< uint32_t > 41 | distribution(0, std::numeric_limits::max()); 42 | 43 | return distribution(rng); 44 | } 45 | -------------------------------------------------------------------------------- /openrtx/include/core/crc.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2022 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #ifndef CRC_H 22 | #define CRC_H 23 | 24 | #include 25 | #include 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /** 32 | * Compute the CCITT 16-bit CRC over a given block of data. 33 | * 34 | * @param data: input data. 35 | * @param len: data length, in bytes. 36 | * @return CCITT CRC. 37 | */ 38 | uint16_t crc_ccitt(const void *data, const size_t len); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif /* CRC_H */ 45 | -------------------------------------------------------------------------------- /platform/targets/GDx/hwconfig.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2024 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | static const struct spiConfig spiFlashCfg = 27 | { 28 | .clk = { FLASH_CLK }, 29 | .mosi = { FLASH_SDO }, 30 | .miso = { FLASH_SDI }, 31 | .clkPeriod = SCK_PERIOD_FROM_FREQ(1000000), 32 | .flags = 0 33 | }; 34 | 35 | SPI_BITBANG_DEVICE_DEFINE(nvm_spi, spiFlashCfg, NULL) 36 | SPI_MK22_DEVICE_DEFINE(c6000_spi, SPI0, NULL) 37 | -------------------------------------------------------------------------------- /platform/targets/ttwrplus/hwconfig.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2023 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Silvano Seva IU2KWO * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 3 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, see * 18 | ***************************************************************************/ 19 | 20 | #ifndef HWCONFIG_H 21 | #define HWCONFIG_H 22 | 23 | #include 24 | 25 | /* 26 | * Display properties are encoded in the devicetree 27 | */ 28 | #define DISPLAY DT_CHOSEN(zephyr_display) 29 | #define CONFIG_SCREEN_WIDTH DT_PROP(DISPLAY, width) 30 | #define CONFIG_SCREEN_HEIGHT DT_PROP(DISPLAY, height) 31 | #define CONFIG_PIX_FMT_BW 32 | 33 | #define CONFIG_GPS 34 | #define CONFIG_NMEA_RBUF_SIZE 128 35 | 36 | #define CONFIG_BAT_LIPO 37 | #define CONFIG_BAT_NCELLS 1 38 | 39 | #define CONFIG_M17 40 | 41 | #endif /* HWCONFIG_H */ 42 | -------------------------------------------------------------------------------- /openrtx/include/core/beeps.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * Joseph Stephen VK7JS * 7 | * * 8 | * This program is free software; you can redistribute it and/or modify * 9 | * it under the terms of the GNU General Public License as published by * 10 | * the Free Software Foundation; either version 3 of the License, or * 11 | * (at your option) any later version. * 12 | * * 13 | * This program is distributed in the hope that it will be useful, * 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 16 | * GNU General Public License for more details. * 17 | * * 18 | * You should have received a copy of the GNU General Public License * 19 | * along with this program; if not, see * 20 | ***************************************************************************/ 21 | #ifndef BEEPS_H_INCLUDED 22 | #define BEEPS_H_INCLUDED 23 | // Duration in tenths of a second. 24 | #define SHORT_BEEP 3 25 | #define LONG_BEEP 7 26 | 27 | // Beep frequencies 28 | #define BEEP_MENU_FIRST_ITEM 500 29 | #define BEEP_MENU_ITEM 1000 30 | #define BEEP_FUNCTION_LATCH_ON 800 31 | #define BEEP_FUNCTION_LATCH_OFF 400 32 | #define BEEP_KEY_GENERIC 750 33 | extern const uint16_t BOOT_MELODY[]; 34 | 35 | #endif // BEEPS_H_INCLUDED 36 | -------------------------------------------------------------------------------- /scripts/add_dc_offset.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * * 3 | * Convert a baseband from m17-cpp-mod to Module17/MD3x0 ADC input equivalent * 4 | * * 5 | ******************************************************************************/ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) { 12 | FILE *baseband_in = fopen(argv[1], "rb"); 13 | if (!baseband_in) 14 | { 15 | perror("Error in reading test baseband"); 16 | return -1; 17 | } 18 | 19 | // Get file size 20 | fseek(baseband_in, 0L, SEEK_END); 21 | long baseband_size = ftell(baseband_in); 22 | unsigned baseband_samples = baseband_size / 2; 23 | fseek(baseband_in, 0L, SEEK_SET); 24 | printf("Baseband is %ld bytes!\n", baseband_size); 25 | 26 | // Read data from input file 27 | int16_t *baseband_buffer = (int16_t *) malloc(baseband_size); 28 | if (!baseband_buffer) 29 | { 30 | perror("Error in memory allocation"); 31 | return -1; 32 | } 33 | size_t read_items = fread(baseband_buffer, 2, baseband_samples, baseband_in); 34 | if (read_items != baseband_samples) 35 | { 36 | perror("Error in reading input file"); 37 | return -1; 38 | } 39 | fclose(baseband_in); 40 | 41 | // Add DC bias 42 | int16_t *filtered_buffer = (int16_t *) malloc(baseband_size); 43 | for(size_t i = 0; i < baseband_samples; i++) 44 | { 45 | float elem = static_cast< float >(baseband_buffer[i]); 46 | filtered_buffer[i] = static_cast< int16_t >((elem + 32768) / 16); 47 | printf("%d\n", filtered_buffer[i]); 48 | } 49 | 50 | // Write back 51 | FILE *baseband_out = fopen(argv[2], "wb"); 52 | fwrite(filtered_buffer, baseband_samples, 2, baseband_out); 53 | fclose(baseband_out); 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /lib/miosix-kernel/meson.build: -------------------------------------------------------------------------------- 1 | 2 | miosix_inc = ['lib/miosix-kernel/miosix', 3 | 'lib/miosix-kernel/miosix/config', 4 | 'lib/miosix-kernel/miosix/arch/common', 5 | 'lib/miosix-kernel/miosix/util'] 6 | 7 | miosix_src = ['lib/miosix-kernel/miosix/kernel/scheduler/priority/priority_scheduler.cpp', 8 | 'lib/miosix-kernel/miosix/kernel/error.cpp', 9 | 'lib/miosix-kernel/miosix/kernel/kernel.cpp', 10 | 'lib/miosix-kernel/miosix/kernel/pthread.cpp', 11 | 'lib/miosix-kernel/miosix/kernel/stage_2_boot.cpp', 12 | 'lib/miosix-kernel/miosix/kernel/sync.cpp', 13 | 'lib/miosix-kernel/miosix/kernel/timeconversion.cpp', 14 | 'lib/miosix-kernel/miosix/util/util.cpp', 15 | 'lib/miosix-kernel/miosix/stdlib_integration/libc_integration.cpp', 16 | 'lib/miosix-kernel/miosix/stdlib_integration/libstdcpp_integration.cpp'] 17 | 18 | miosix_def = {'DONT_USE_CMSIS_INIT' : '', 19 | 'COMPILING_MIOSIX' : '', 20 | '_POSIX_PRIORITY_SCHEDULING': ''} 21 | 22 | ## 23 | ## ARM Cortex M4 24 | ## 25 | miosix_cm4f_inc = miosix_inc + ['lib/miosix-kernel/miosix/arch/cortexM4F'] 26 | miosix_cm4f_src = miosix_src + ['lib/miosix-kernel/miosix/arch/cortexM4F/portability.cpp', 27 | 'lib/miosix-kernel/miosix/arch/common/core/interrupts_cortexMx.cpp'] 28 | miosix_cm4f_def = miosix_def + {'_ARCH_CORTEXM4' : ''} 29 | 30 | 31 | ## 32 | ## ARM Cortex M7 33 | ## 34 | miosix_cm7_inc = miosix_inc + ['lib/miosix-kernel/miosix/arch/cortexM7'] 35 | miosix_cm7_src = miosix_src + ['lib/miosix-kernel/miosix/arch/cortexM7/portability.cpp', 36 | 'lib/miosix-kernel/miosix/arch/common/core/cache_cortexMx.cpp', 37 | 'lib/miosix-kernel/miosix/arch/common/core/mpu_cortexMx.cpp', 38 | 'lib/miosix-kernel/miosix/arch/common/core/interrupts_cortexMx.cpp'] 39 | miosix_cm7_def = miosix_def + {'_ARCH_CORTEXM7' : ''} 40 | -------------------------------------------------------------------------------- /platform/drivers/audio/file_source.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2023 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #ifndef FILE_SOURCE_H 22 | #define FILE_SOURCE_H 23 | 24 | #include 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /** 31 | * Driver providing an audio input stream from a file. File format should be 32 | * raw, 16 bit, little endian. The configuration parameter is the file name with 33 | * the full path. 34 | */ 35 | 36 | extern const struct audioDriver file_source_audio_driver; 37 | 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif /* STM32_DAC_H */ 44 | -------------------------------------------------------------------------------- /openrtx/include/core/backup.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2022 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #ifndef BACKUP_H 22 | #define BACKUP_H 23 | 24 | #include 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /** 31 | * Start a dump of the external flash memory content via xmodem transfer, 32 | * blocking function. 33 | */ 34 | void eflash_dump(); 35 | 36 | /** 37 | * Start a restore of the external flash memory content via xmodem transfer, 38 | * blocking function. 39 | */ 40 | void eflash_restore(); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | 47 | #endif /* BACKUP_H */ 48 | -------------------------------------------------------------------------------- /openrtx/include/core/openrtx.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2022 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #ifndef OPENRTX_H 22 | #define OPENRTX_H 23 | 24 | #include 25 | 26 | /** 27 | * Initialisation of all the OpenRTX components, to be called before the main 28 | * entrypoint. 29 | */ 30 | void openrtx_init(); 31 | 32 | /** 33 | * Entrypoint of the OpenRTX firmware. 34 | * This function returns only on linux emulator, when the main program terminates. 35 | * Return type is void* to make this function be used as a pthread thread body. 36 | */ 37 | void *openrtx_run(void *arg); 38 | 39 | #endif /* OPENRTX_H */ 40 | -------------------------------------------------------------------------------- /platform/drivers/ADC/ADC0_GDx.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Silvano Seva IU2KWO * 3 | * and Niccolò Izzo IU2KIN * 4 | * * 5 | * This program is free software; you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation; either version 3 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program; if not, see * 17 | ***************************************************************************/ 18 | 19 | #ifndef ADC0_H 20 | #define ADC0_H 21 | 22 | #include 23 | 24 | /** 25 | * Initialise and start ADC0. 26 | */ 27 | void adc0_init(); 28 | 29 | /** 30 | * Turn off ADC0. 31 | */ 32 | void adc0_terminate(); 33 | 34 | /** 35 | * Get current measurement of a given channel returning the raw ADC value. 36 | * @param ch: channel number. 37 | * @return current value of the specified channel, in ADC counts. 38 | */ 39 | uint16_t adc0_getRawSample(uint8_t ch); 40 | 41 | /** 42 | * Get current measurement of a given channel. 43 | * @param ch: channel number. 44 | * @return current value of the specified channel in mV. 45 | */ 46 | uint16_t adc0_getMeasurement(uint8_t ch); 47 | 48 | #endif /* ADC0_H */ 49 | -------------------------------------------------------------------------------- /platform/mcu/ESP32S3/drivers/delays.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2023 - 2025 by Silvano Seva IU2KWO * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, see * 16 | ***************************************************************************/ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | 23 | void delayUs(unsigned int useconds) 24 | { 25 | k_usleep(useconds); 26 | } 27 | 28 | void delayMs(unsigned int mseconds) 29 | { 30 | k_msleep(mseconds); 31 | } 32 | 33 | void sleepFor(unsigned int seconds, unsigned int mseconds) 34 | { 35 | uint64_t duration = (seconds * 1000) + mseconds; 36 | k_sleep(K_MSEC(duration)); 37 | } 38 | 39 | void sleepUntil(long long timestamp) 40 | { 41 | if(timestamp <= k_uptime_get()) 42 | return; 43 | 44 | k_sleep(K_TIMEOUT_ABS_MS(timestamp)); 45 | } 46 | 47 | long long getTick() 48 | { 49 | // k_uptime_get() returns the elapsed time since the system booted, 50 | // in milliseconds. 51 | return k_uptime_get(); 52 | } 53 | -------------------------------------------------------------------------------- /openrtx/include/peripherals/rng.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2023 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #ifndef RNG_H 22 | #define RNG_H 23 | 24 | #include 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /** 31 | * Driver for Random Number Generator. 32 | */ 33 | 34 | /** 35 | * Initialise the RNG driver. 36 | */ 37 | void rng_init(); 38 | 39 | /** 40 | * Shut down the RNG module. 41 | */ 42 | void rng_terminate(); 43 | 44 | /** 45 | * Generate a 32 bit random number. 46 | * 47 | * @return random number. 48 | */ 49 | uint32_t rng_get(); 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif /* INTERFACES_GPS_H */ 56 | -------------------------------------------------------------------------------- /tests/platform/tonegen.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Federico Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Silvano Seva IU2KWO * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 3 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, see * 18 | ***************************************************************************/ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "toneGenerator_MDx.h" 25 | #include "hwconfig.h" 26 | 27 | int main() 28 | { 29 | gpio_setMode(SPK_MUTE, OUTPUT); // Turn on speaker 30 | gpio_clearPin(SPK_MUTE); 31 | 32 | gpio_setMode(AMP_EN, OUTPUT); // Turn on audio amplifier 33 | gpio_setPin(AMP_EN); 34 | 35 | toneGen_init(); 36 | toneGen_setBeepFreq(440.0f); 37 | 38 | while(1) 39 | { 40 | toneGen_beepOn(); 41 | delayMs(500); 42 | toneGen_beepOff(); 43 | delayMs(500); 44 | } 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /tests/unit/voice_prompts.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2021 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * * 8 | * This program is free software; you can redistribute it and/or modify * 9 | * it under the terms of the GNU General Public License as published by * 10 | * the Free Software Foundation; either version 3 of the License, or * 11 | * (at your option) any later version. * 12 | * * 13 | * This program is distributed in the hope that it will be useful, * 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 16 | * GNU General Public License for more details. * 17 | * * 18 | * You should have received a copy of the GNU General Public License * 19 | * along with this program; if not, see * 20 | ***************************************************************************/ 21 | 22 | // Test private methods 23 | #define private public 24 | 25 | #include 26 | #include 27 | 28 | /** 29 | * Test voice prompts playback 30 | */ 31 | 32 | int main() 33 | { 34 | state.settings.vpLevel = 3; 35 | vpQueueFlags_t flags = vp_getVoiceLevelQueueFlags(); 36 | 37 | vp_init(); 38 | vp_flush(); 39 | vp_queueStringTableEntry(¤tLanguage->allChannels); 40 | vp_play(); 41 | while(true) 42 | { 43 | vp_tick(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /platform/drivers/baseband/HR_C5000.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2021 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #ifndef HRC5000_H 22 | #define HRC5000_H 23 | 24 | #include "HR_Cx000.h" 25 | 26 | enum class C5000_SpiOpModes : uint8_t 27 | { 28 | CONFIG = 0, ///< Main configuration registers. 29 | AUX = 1, ///< Auxiliary configuration registers. 30 | DATA = 2, ///< Data register. 31 | SOUND = 3, ///< Voice prompt sample register. 32 | CMX638 = 4, ///< CMX638 configuration register. 33 | AMBE3K = 5 ///< AMBE3000 configuration register. 34 | }; 35 | 36 | using HR_C5000 = HR_Cx000 < C5000_SpiOpModes >; 37 | 38 | #endif // HRC5000_H 39 | -------------------------------------------------------------------------------- /platform/mcu/MK22FN512xxx12/drivers/usb/usb_osa_bm.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. 3 | * Copyright 2016 NXP 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * o Redistributions of source code must retain the above copyright notice, this list 9 | * of conditions and the following disclaimer. 10 | * 11 | * o Redistributions in binary form must reproduce the above copyright notice, this 12 | * list of conditions and the following disclaimer in the documentation and/or 13 | * other materials provided with the distribution. 14 | * 15 | * o Neither the name of the copyright holder nor the names of its 16 | * contributors may be used to endorse or promote products derived from this 17 | * software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #include "stdint.h" 31 | #include "usb.h" 32 | #include "usb_osa.h" 33 | #include "stdlib.h" 34 | #include "MK22F51212.h" 35 | #include "fsl_common.h" 36 | 37 | void USB_OsaEnterCritical(uint32_t *sr) 38 | { 39 | *sr = __get_PRIMASK(); 40 | __disable_irq(); 41 | __ASM("CPSID I"); 42 | } 43 | 44 | void USB_OsaExitCritical(uint32_t sr) 45 | { 46 | __set_PRIMASK(sr); 47 | } 48 | -------------------------------------------------------------------------------- /platform/drivers/keyboard/cap1206.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2024 - 2025 by Morgan Diepart ON4MOD * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, see * 16 | ***************************************************************************/ 17 | 18 | #ifndef CAP1206_H 19 | #define CAP1206_H 20 | 21 | #include 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /** 29 | * Initialize the CAP1206 device. 30 | * 31 | * @param i2c: driver managing the I2C bus the chip is connected to. 32 | * @return zero on success, a negative error code otherwise. 33 | */ 34 | int cap1206_init(const struct i2cDevice *i2c); 35 | 36 | /** 37 | * Read the status of the touch keys connected to the CAP1206 device. 38 | * 39 | * @param i2c: driver managing the I2C bus the chip is connected to. 40 | * @return a bitmap representing the status of the keys or a negative error code. 41 | */ 42 | int cap1206_readkeys(const struct i2cDevice *i2c); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif /* CAP1206_H */ 49 | 50 | -------------------------------------------------------------------------------- /lib/miosix-kernel/miosix/util/lcd44780.h: -------------------------------------------------------------------------------- 1 | 2 | #include "interfaces/gpio.h" 3 | 4 | #ifndef LCD44780_H 5 | #define LCD44780_H 6 | 7 | namespace miosix { 8 | 9 | /** 10 | * Class to control an HD44780 compatible LCD 11 | * 12 | */ 13 | class Lcd44780 14 | { 15 | public: 16 | /** 17 | * Constructor, initializes the display 18 | * \param rs a Gpio class specifying the GPIO connected to the rs signal 19 | * \param e a Gpio class specifying the GPIO connected to the e signal 20 | * \param d4 a Gpio class specifying the GPIO connected to the d4 signal 21 | * \param d5 a Gpio class specifying the GPIO connected to the d5 signal 22 | * \param d6 a Gpio class specifying the GPIO connected to the d6 signal 23 | * \param d7 a Gpio class specifying the GPIO connected to the d7 signal 24 | * \param row number of rows of the display 25 | * \param col number of columns of the display 26 | */ 27 | Lcd44780(GpioPin rs, GpioPin e, GpioPin d4, GpioPin d5, GpioPin d6, 28 | GpioPin d7, int row, int col); 29 | 30 | /** 31 | * Set the display cursor 32 | * \param x a value from 0 to col-1 33 | * \param y a value from 0 to row-1 34 | */ 35 | void go(int x, int y); 36 | 37 | /** 38 | * Print to the display 39 | */ 40 | int printf(const char *fmt, ...); 41 | 42 | /** 43 | * Clear the screen 44 | */ 45 | void clear(); 46 | 47 | /** 48 | * \return the number of rows of the display 49 | */ 50 | int getRow() const { return row; } 51 | 52 | /** 53 | * \return the number of columns of the display 54 | */ 55 | int getCol() const { return col; } 56 | 57 | private: 58 | 59 | void init(); 60 | 61 | void half(unsigned char byte); 62 | 63 | void data(unsigned char byte); 64 | 65 | void comd(unsigned char byte); 66 | 67 | GpioPin rs; 68 | GpioPin e; 69 | GpioPin d4; 70 | GpioPin d5; 71 | GpioPin d6; 72 | GpioPin d7; 73 | const int row; 74 | const int col; 75 | }; 76 | 77 | } //namespace miosix 78 | 79 | #endif //LCD44780_H 80 | -------------------------------------------------------------------------------- /platform/drivers/stubs/display_stub.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2023 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | 26 | void display_init() 27 | { 28 | 29 | } 30 | 31 | void display_terminate() 32 | { 33 | 34 | } 35 | 36 | void display_renderRows(uint8_t startRow, uint8_t endRow, void *fb) 37 | { 38 | (void) startRow; 39 | (void) endRow; 40 | (void) fb; 41 | } 42 | 43 | void display_render(void *fb) 44 | { 45 | (void) fb; 46 | } 47 | 48 | void display_setContrast(uint8_t contrast) 49 | { 50 | (void) contrast; 51 | } 52 | 53 | void display_setBacklightLevel(uint8_t level) 54 | { 55 | (void) level; 56 | } 57 | -------------------------------------------------------------------------------- /platform/mcu/STM32H7xx/boot/libc_integration.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Silvano Seva IU2KWO * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, see * 16 | ***************************************************************************/ 17 | 18 | #include 19 | #include 20 | #include "filesystem/file_access.h" 21 | 22 | using namespace std; 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /** 29 | * \internal 30 | * _write_r, write to a file 31 | */ 32 | int _write_r(struct _reent *ptr, int fd, const void *buf, size_t cnt) 33 | { 34 | (void) ptr; 35 | (void) fd; 36 | (void) buf; 37 | (void) cnt; 38 | 39 | /* If fd is not stdout or stderr */ 40 | ptr->_errno = EBADF; 41 | return -1; 42 | } 43 | 44 | /** 45 | * \internal 46 | * _read_r, read from a file. 47 | */ 48 | int _read_r(struct _reent *ptr, int fd, void *buf, size_t cnt) 49 | { 50 | (void) ptr; 51 | (void) fd; 52 | (void) buf; 53 | (void) cnt; 54 | 55 | /* If fd is not stdin */ 56 | ptr->_errno = EBADF; 57 | return -1; 58 | } 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | -------------------------------------------------------------------------------- /platform/drivers/backlight/backlight.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2021 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #ifndef BACKLIGHT_H 22 | #define BACKLIGHT_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /** 29 | * Low-level driver for backlight dimming control. 30 | * This header file only provides the API for driver initialisation and shutdown, 31 | * while effective setting of backlight level is provided by target-specific 32 | * sources by implementating display_setBacklightLevel(). 33 | */ 34 | 35 | /** 36 | * Initialise backlight driver. 37 | */ 38 | void backlight_init(); 39 | 40 | /** 41 | * Terminate backlight driver. 42 | */ 43 | void backlight_terminate(); 44 | 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif /* BACKLIGHT_H */ 51 | -------------------------------------------------------------------------------- /platform/mcu/STM32F4xx/drivers/usb/usbd_usr.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_usr.c 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief This file includes the user application layer 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "usbd_usr.h" 30 | #include "usbd_ioreq.h" 31 | 32 | #include 33 | 34 | USBD_Usr_cb_TypeDef USR_cb = 35 | { 36 | USBD_USR_Init, 37 | USBD_USR_DeviceReset, 38 | USBD_USR_DeviceConfigured, 39 | USBD_USR_DeviceSuspended, 40 | USBD_USR_DeviceResumed, 41 | USBD_USR_DeviceConnected, 42 | USBD_USR_DeviceDisconnected, 43 | }; 44 | 45 | 46 | 47 | void USBD_USR_Init(void) { } 48 | 49 | void USBD_USR_DeviceReset(uint8_t speed ) 50 | { 51 | (void) speed; 52 | } 53 | 54 | void USBD_USR_DeviceConfigured (void) { } 55 | 56 | void USBD_USR_DeviceSuspended(void) { } 57 | 58 | void USBD_USR_DeviceResumed(void) { } 59 | 60 | void USBD_USR_DeviceConnected (void) { } 61 | 62 | void USBD_USR_DeviceDisconnected (void) { } 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 73 | -------------------------------------------------------------------------------- /openrtx/include/core/threads.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #ifndef THREADS_H 22 | #define THREADS_H 23 | 24 | #include 25 | 26 | /** 27 | * Threads' stack sizes 28 | */ 29 | #define UI_THREAD_STKSIZE 2048 30 | #define RTX_THREAD_STKSIZE 512 31 | #define CODEC2_THREAD_STKSIZE 16384 32 | #define AUDIO_THREAD_STKSIZE 512 33 | 34 | /** 35 | * Thread priority levels, UNIX-like: lower level, higher thread priority 36 | */ 37 | #ifdef _MIOSIX 38 | #define THREAD_PRIO_RT 0 39 | #define THREAD_PRIO_HIGH 1 40 | #define THREAD_PRIO_NORMAL 2 41 | #define THREAD_PRIO_LOW 3 42 | #endif 43 | 44 | /** 45 | * Spawn all the threads for the various functionalities. 46 | */ 47 | void create_threads(); 48 | 49 | #endif /* THREADS_H */ 50 | -------------------------------------------------------------------------------- /openrtx/include/fonts/symbols/Symbols5pt7b.h: -------------------------------------------------------------------------------- 1 | // This is a generated file, please do not edit it! Use generate_symbols.py 2 | static const uint8_t Symbols5pt7bBitmaps[] PROGMEM = { 3 | 0x00, //space 4 | 0x00, 0x00, 0x42, 0x24, 0x24, 0x42, 0x00, 0x00, //access-point.svg 5 | 0x00, 0x7e, 0x5a, 0x66, 0x66, 0x42, 0x7e, 0x00, //alpha-m-box-outline.svg 6 | 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, //call-made.svg 7 | 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, //call-received.svg 8 | 0x00, 0x18, 0x7e, 0x66, 0x66, 0x7e, 0x18, 0x00, //cog.svg 9 | 0x00, 0x3c, 0x42, 0x5a, 0x5a, 0x42, 0x3c, 0x00, //crosshairs-gps.svg 10 | 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, //crosshairs.svg 11 | 0x18, 0x24, 0x24, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, //lock.svg 12 | 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x18, 0x18, //network.svg 13 | 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x24, 0x00, //transmission-tower.svg 14 | 0x00, 0x3c, 0x81, 0x42, 0x3c, 0x18, 0x18, 0x00, //wifi-strength-1.svg 15 | 0x00, 0x3c, 0x81, 0x5a, 0x3c, 0x18, 0x18, 0x00, //wifi-strength-2.svg 16 | 0x00, 0x3c, 0x81, 0x7e, 0x3c, 0x18, 0x18, 0x00, //wifi-strength-3.svg 17 | 0x00, 0x3c, 0xff, 0x7e, 0x3c, 0x18, 0x18, 0x00, //wifi-strength-4.svg 18 | }; 19 | 20 | static const GFXglyph Symbols5pt7bGlyphs[] PROGMEM = { 21 | //Index, W, H,xAdv,dX, dY 22 | { 0, 1, 1, 5, 0, -7}, // " " space 23 | { 1, 8, 8, 5, 0, -7}, // "!" access-point.svg 24 | { 9, 8, 8, 5, 0, -7}, // """ alpha-m-box-outline.svg 25 | { 17, 8, 8, 5, 0, -7}, // "#" call-made.svg 26 | { 25, 8, 8, 5, 0, -7}, // "$" call-received.svg 27 | { 33, 8, 8, 5, 0, -7}, // "%" cog.svg 28 | { 41, 8, 8, 5, 0, -7}, // "&" crosshairs-gps.svg 29 | { 49, 8, 8, 5, 0, -7}, // "'" crosshairs.svg 30 | { 57, 8, 8, 5, 0, -7}, // "(" lock.svg 31 | { 65, 8, 8, 5, 0, -7}, // ")" network.svg 32 | { 73, 8, 8, 5, 0, -7}, // "*" transmission-tower.svg 33 | { 81, 8, 8, 5, 0, -7}, // "+" wifi-strength-1.svg 34 | { 89, 8, 8, 5, 0, -7}, // "," wifi-strength-2.svg 35 | { 97, 8, 8, 5, 0, -7}, // "-" wifi-strength-3.svg 36 | { 105, 8, 8, 5, 0, -7}, // "." wifi-strength-4.svg 37 | }; 38 | static const GFXfont Symbols5pt7b PROGMEM = { 39 | (uint8_t *)Symbols5pt7bBitmaps, 40 | (GFXglyph *)Symbols5pt7bGlyphs, 41 | //ASCII start, ASCII stop,y Advance 42 | 32, 46, 19 }; 43 | -------------------------------------------------------------------------------- /platform/drivers/chSelector/chSelector.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2021 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Caleb Jamison * 5 | * Frederik Saraci IU2NRO * 6 | * Silvano Seva IU2KWO * 7 | * * 8 | * This program is free software; you can redistribute it and/or modify * 9 | * it under the terms of the GNU General Public License as published by * 10 | * the Free Software Foundation; either version 3 of the License, or * 11 | * (at your option) any later version. * 12 | * * 13 | * This program is distributed in the hope that it will be useful, * 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 16 | * GNU General Public License for more details. * 17 | * * 18 | * You should have received a copy of the GNU General Public License * 19 | * along with this program; if not, see * 20 | ***************************************************************************/ 21 | 22 | #ifndef CH_SELECTOR_H 23 | #define CH_SELECTOR_H 24 | 25 | /** 26 | * Low-level driver for correct handling of channel selector knobs connected to 27 | * a quadrature encoder. 28 | * This header file only provides the API for driver initialisation and shutdown, 29 | * while the readout of current encoder position is provided by target-specific 30 | * sources by implementating platform_getChSelector(). 31 | */ 32 | 33 | /** 34 | * Initialise channel selector driver. 35 | */ 36 | void chSelector_init(); 37 | 38 | /** 39 | * Terminate channel selector driver. 40 | */ 41 | void chSelector_terminate(); 42 | 43 | #endif /* CH_SELECTOR_H */ 44 | -------------------------------------------------------------------------------- /openrtx/include/calibration/calibInfo_CS7000.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2024 - 2025 by Silvano Seva IU2KWO * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, see * 16 | ***************************************************************************/ 17 | 18 | #ifndef CALIBINFO_CS7000_H 19 | #define CALIBINFO_CS7000_H 20 | 21 | #include 22 | #include 23 | 24 | 25 | /** 26 | * \brief Calibration data for Connect Systems CS7000. 27 | */ 28 | struct CS7000Calib 29 | { 30 | uint32_t txCalFreq[8]; // 0x000 31 | uint32_t rxCalFreq[8]; // 0x024 32 | uint8_t rxSensitivity[8]; // 0x044 33 | uint8_t txHighPwr[8]; // 0x06C 34 | uint8_t txMiddlePwr[8]; // 0x074 35 | uint8_t mskFreqOffset[8]; // 0x0B4 36 | uint8_t txDigitalPathI[8]; // 0x0BC 37 | uint8_t txDigitalPathQ[8]; // 0x0C4 38 | uint8_t txAnalogPathI[8]; // 0x0CC 39 | uint8_t txAnalogPathQ[8]; // 0x0D4 40 | uint8_t errorRate[8]; // 0x0DC 41 | }; 42 | 43 | /** 44 | * \brief RSSI calibration data. 45 | */ 46 | struct rssiParams 47 | { 48 | float slope; 49 | float offset; 50 | uint32_t rxFreq; 51 | }; 52 | 53 | #endif /* CALIBINFO_CS7000_H */ 54 | -------------------------------------------------------------------------------- /openrtx/include/core/queue.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #ifndef QUEUE_H 22 | #define QUEUE_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | // Ring buffer size (MAX = 255) 31 | #define MSG_QTY 10 32 | 33 | typedef struct queue_t 34 | { 35 | pthread_mutex_t mutex; 36 | pthread_cond_t not_empty; 37 | uint8_t read_pos; 38 | uint8_t write_pos; 39 | uint8_t msg_num; 40 | uint32_t buffer[MSG_QTY]; 41 | } 42 | queue_t; 43 | 44 | /** 45 | * 46 | */ 47 | void queue_init(queue_t *q); 48 | 49 | /** 50 | * 51 | */ 52 | void queue_terminate(queue_t *q); 53 | 54 | /** 55 | * 56 | */ 57 | bool queue_pend(queue_t *q, uint32_t *msg, bool blocking); 58 | 59 | /** 60 | * 61 | */ 62 | bool queue_post(queue_t *q, uint32_t msg); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /openrtx/include/core/datatypes.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN, * 4 | * Silvano Seva IU2KWO * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 3 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, see * 18 | ***************************************************************************/ 19 | 20 | #ifndef DATATYPES_H 21 | #define DATATYPES_H 22 | 23 | #include 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /** 30 | * \brief CTCSS and DCS type definition. 31 | * 32 | * Continuous Tone Controlled Squelch System (CTCSS) 33 | * sub-audible tone frequency are expressed in \em tenth of Hz. 34 | * For example, the subaudible tone of 88.5 Hz is represented within Hamlib by 35 | * 885. 36 | * 37 | * Digitally-Coded Squelch codes are simple direct integers. 38 | */ 39 | typedef unsigned int tone_t; 40 | 41 | /** 42 | * \brief Frequency type. 43 | * 44 | * Frequency type unit in Hz, able to hold SHF frequencies. 45 | */ 46 | typedef uint32_t freq_t; 47 | 48 | /** 49 | * \brief RSSI type. 50 | * 51 | * Data type for RSSI, in dBm. 52 | */ 53 | typedef int32_t rssi_t; 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif /* DATATYPES_H */ 60 | -------------------------------------------------------------------------------- /platform/mcu/x86_64/drivers/delays.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Frederik Saraci IU2NRO * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, see * 16 | ***************************************************************************/ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | /** 24 | * Implementation of the delay functions for x86_64. 25 | */ 26 | 27 | void delayUs(unsigned int useconds) 28 | { 29 | usleep(useconds); 30 | } 31 | 32 | void delayMs(unsigned int mseconds) 33 | { 34 | usleep(mseconds*1000); 35 | } 36 | 37 | void sleepFor(unsigned int seconds, unsigned int mseconds) 38 | { 39 | unsigned int time = (seconds * 1000) + mseconds; 40 | delayMs(time); 41 | } 42 | 43 | void sleepUntil(long long timestamp) 44 | { 45 | long long delta = timestamp - getTick(); 46 | if(delta <= 0) return; 47 | delayMs(delta); 48 | } 49 | 50 | long long getTick() 51 | { 52 | /* 53 | * Return current time in milliseconds, consistently with the miosix kernel 54 | * having a tick rate of 1kHz. 55 | */ 56 | 57 | struct timeval te; 58 | gettimeofday(&te, NULL); 59 | long long milliseconds = te.tv_sec*1000LL + te.tv_usec/1000; 60 | return milliseconds; 61 | } 62 | -------------------------------------------------------------------------------- /platform/drivers/stubs/nvmem_stub.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2023 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #include 22 | 23 | 24 | void nvm_init() 25 | { 26 | 27 | } 28 | 29 | void nvm_terminate() 30 | { 31 | 32 | } 33 | 34 | void nvm_readCalibData(void *buf) 35 | { 36 | (void) buf; 37 | } 38 | 39 | void nvm_readHwInfo(hwInfo_t *info) 40 | { 41 | (void) info; 42 | } 43 | 44 | int nvm_readVfoChannelData(channel_t *channel) 45 | { 46 | (void) channel; 47 | 48 | return -1; 49 | } 50 | 51 | int nvm_readSettings(settings_t *settings) 52 | { 53 | (void) settings; 54 | 55 | return -1; 56 | } 57 | 58 | int nvm_writeSettings(const settings_t *settings) 59 | { 60 | (void) settings; 61 | 62 | return -1; 63 | } 64 | 65 | int nvm_writeSettingsAndVfo(const settings_t *settings, const channel_t *vfo) 66 | { 67 | (void) settings; 68 | (void) vfo; 69 | 70 | return -1; 71 | } 72 | -------------------------------------------------------------------------------- /openrtx/include/core/data_conversion.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2022 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #ifndef DATA_CONVERSION_H 22 | #define DATA_CONVERSION_H 23 | 24 | #include 25 | #include 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /** 32 | * In-place conversion of data elements from int16_t to unsigned 16 bit values 33 | * ranging from 0 to 4095. 34 | * 35 | * @param buffer: data buffer. 36 | * @param length: buffer length, in elements. 37 | */ 38 | void S16toU12(int16_t *buffer, const size_t length); 39 | 40 | /** 41 | * In-place conversion of data elements from int16_t to unsigned 8 bit values 42 | * ranging from 0 to 255. 43 | * 44 | * @param buffer: data buffer. 45 | * @param length: buffer length, in elements. 46 | */ 47 | void S16toU8(int16_t *buffer, const size_t length); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* DATA_CONVERSION_H */ 54 | -------------------------------------------------------------------------------- /platform/targets/MD-9600/hwconfig.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2024 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | static void gpsEnable(void *priv) 30 | { 31 | gpio_setPin(GPS_EN); 32 | gpsStm32_enable(priv); 33 | } 34 | 35 | static void gpsDisable(void *priv) 36 | { 37 | gpio_clearPin(GPS_EN); 38 | gpsStm32_disable(priv); 39 | } 40 | 41 | static pthread_mutex_t spi2Mutex; 42 | static pthread_mutex_t adcMutex; 43 | 44 | SPI_STM32_DEVICE_DEFINE(spi2, SPI2, &spi2Mutex) 45 | ADC_STM32_DEVICE_DEFINE(adc1, ADC1, &adcMutex, ADC_COUNTS_TO_UV(3300000, 12)) 46 | 47 | const struct gpsDevice gps = 48 | { 49 | .priv = NULL, 50 | .enable = gpsEnable, 51 | .disable = gpsDisable, 52 | .getSentence = gpsStm32_getNmeaSentence 53 | }; 54 | -------------------------------------------------------------------------------- /platform/drivers/baseband/radio_MD9600.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2021 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #include 22 | 23 | void radio_init(const rtxStatus_t *rtxState) 24 | { 25 | (void) rtxState; 26 | } 27 | 28 | void radio_terminate() 29 | { 30 | 31 | } 32 | 33 | void radio_setOpmode(const enum opmode mode) 34 | { 35 | (void) mode; 36 | } 37 | 38 | bool radio_checkRxDigitalSquelch() 39 | { 40 | return false; 41 | } 42 | 43 | void radio_enableAfOutput() 44 | { 45 | 46 | } 47 | 48 | void radio_disableAfOutput() 49 | { 50 | 51 | } 52 | 53 | void radio_enableRx() 54 | { 55 | 56 | } 57 | 58 | void radio_enableTx() 59 | { 60 | 61 | } 62 | 63 | void radio_disableRtx() 64 | { 65 | 66 | } 67 | 68 | void radio_updateConfiguration() 69 | { 70 | 71 | } 72 | 73 | rssi_t radio_getRssi() 74 | { 75 | return -154.0f; 76 | } 77 | 78 | enum opstatus radio_getStatus() 79 | { 80 | return OFF; 81 | } 82 | -------------------------------------------------------------------------------- /openrtx/include/core/event.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN, * 4 | * Silvano Seva IU2KWO * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 3 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, see * 18 | ***************************************************************************/ 19 | 20 | #ifndef EVENT_H 21 | #define EVENT_H 22 | 23 | /** 24 | * This enum describes the event message type: 25 | * - EVENT_KBD is used to send a keypress 26 | * - EVENT_STATUS is used to send a status change notification 27 | */ 28 | enum eventType_t 29 | { 30 | EVENT_KBD = 0, 31 | EVENT_STATUS = 1 32 | }; 33 | 34 | /** 35 | * The event message is constrained to 32 bits size 36 | * This is necessary to send event messages in uC OS/III Queues 37 | * That accept a void * type message, which is 32-bits wide on 38 | * ARM cortex-M MCUs 39 | * uC OS/III Queues are meant to send pointer to allocated data 40 | * But if we keep the size under 32 bits, we can sent the 41 | * entire message, casting it to a void * pointer. 42 | */ 43 | typedef union 44 | { 45 | struct 46 | { 47 | uint32_t type : 2, 48 | payload : 30; 49 | }; 50 | 51 | uint32_t value; 52 | }event_t; 53 | 54 | #endif /* EVENT_H */ 55 | -------------------------------------------------------------------------------- /openrtx/include/calibration/calibInfo_Mod17.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2022 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * Mathis Schmieder DB9MAT * 7 | * * 8 | * This program is free software; you can redistribute it and/or modify * 9 | * it under the terms of the GNU General Public License as published by * 10 | * the Free Software Foundation; either version 3 of the License, or * 11 | * (at your option) any later version. * 12 | * * 13 | * This program is distributed in the hope that it will be useful, * 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 16 | * GNU General Public License for more details. * 17 | * * 18 | * You should have received a copy of the GNU General Public License * 19 | * along with this program; if not, see * 20 | ***************************************************************************/ 21 | 22 | #ifndef CALIBINFO_MOD17_H 23 | #define CALIBINFO_MOD17_H 24 | 25 | #include 26 | #include 27 | 28 | /** 29 | * \brief Calibration data for Module17. 30 | */ 31 | typedef struct 32 | { 33 | uint16_t tx_wiper; ///< Baseband TX potentiometer 34 | uint16_t rx_wiper; ///< Baseband RX potentiometer 35 | uint8_t mic_gain; ///< Microphone gain 36 | uint8_t bb_tx_invert : 1, ///< Invert TX baseband 37 | bb_rx_invert : 1, ///< Invert RX baseband 38 | ptt_in_level : 1, ///< PTT in acive level 39 | ptt_out_level : 1, ///< PTT out active level 40 | _padding : 4; 41 | } 42 | mod17Calib_t; 43 | 44 | #endif /* CALIBINFO_MOD17_H */ 45 | -------------------------------------------------------------------------------- /platform/drivers/stubs/inputStream_stub.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2023 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #include 22 | 23 | streamId inputStream_start(const enum AudioSource source, 24 | const enum AudioPriority prio, 25 | stream_sample_t * const buf, 26 | const size_t bufLength, 27 | const enum BufMode mode, 28 | const uint32_t sampleRate) 29 | { 30 | (void) source; 31 | (void) prio; 32 | (void) buf; 33 | (void) bufLength; 34 | (void) mode; 35 | (void) sampleRate; 36 | 37 | return -1; 38 | } 39 | 40 | dataBlock_t inputStream_getData(streamId id) 41 | { 42 | (void) id; 43 | 44 | dataBlock_t block; 45 | block.data = NULL; 46 | block.len = 0; 47 | 48 | return block; 49 | } 50 | 51 | void inputStream_stop(streamId id) 52 | { 53 | (void) id; 54 | } 55 | -------------------------------------------------------------------------------- /platform/drivers/stubs/radio_stub.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2023 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #include 22 | 23 | 24 | void radio_init(const rtxStatus_t *rtxState) 25 | { 26 | (void) rtxState; 27 | } 28 | 29 | void radio_terminate() 30 | { 31 | 32 | } 33 | 34 | void radio_setOpmode(const enum opmode mode) 35 | { 36 | (void) mode; 37 | } 38 | 39 | bool radio_checkRxDigitalSquelch() 40 | { 41 | return false; 42 | } 43 | 44 | void radio_enableAfOutput() 45 | { 46 | 47 | } 48 | 49 | void radio_disableAfOutput() 50 | { 51 | 52 | } 53 | 54 | void radio_enableRx() 55 | { 56 | 57 | } 58 | 59 | void radio_enableTx() 60 | { 61 | 62 | } 63 | 64 | void radio_disableRtx() 65 | { 66 | 67 | } 68 | 69 | void radio_updateConfiguration() 70 | { 71 | 72 | } 73 | 74 | rssi_t radio_getRssi() 75 | { 76 | return -121.0f; // S1 level: -121dBm 77 | } 78 | 79 | enum opstatus radio_getStatus() 80 | { 81 | return OFF; 82 | } 83 | -------------------------------------------------------------------------------- /openrtx/src/ui/default/ui_strings.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2022 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * Joseph Stephen VK7JS * 7 | * * 8 | * This program is free software; you can redistribute it and/or modify * 9 | * it under the terms of the GNU General Public License as published by * 10 | * the Free Software Foundation; either version 3 of the License, or * 11 | * (at your option) any later version. * 12 | * * 13 | * This program is distributed in the hope that it will be useful, * 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 16 | * GNU General Public License for more details. * 17 | * * 18 | * You should have received a copy of the GNU General Public License * 19 | * along with this program; if not, see * 20 | ***************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | const stringsTable_t languages[NUM_LANGUAGES] = {englishStrings,spanishStrings}; 29 | const stringsTable_t* currentLanguage = &languages[0]; 30 | 31 | int GetEnglishStringTableOffset(const char* text) 32 | { 33 | if ((text == NULL) || (*text == '\0')) 34 | return -1; 35 | 36 | uint8_t stringCount = sizeof(stringsTable_t) / sizeof(char *); 37 | 38 | for (uint8_t i = 0; i < stringCount; ++i) 39 | { 40 | const char* strPtr = ((const char **)&englishStrings)[i]; 41 | 42 | if (strcmp(text, strPtr) == 0) 43 | { 44 | return i; 45 | } 46 | } 47 | 48 | return -1; 49 | } 50 | -------------------------------------------------------------------------------- /platform/mcu/MK22FN512xxx12/drivers/usb_vcom.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Silvano Seva IU2KWO * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, see * 16 | ***************************************************************************/ 17 | 18 | #ifndef USB_VCOM_H 19 | #define USB_VCOM_H 20 | 21 | #include 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /** 29 | * Initialise USB virtual com port. Parameters: 115200 baud, 8N1. 30 | * @return zero on success, negative value on failure. 31 | */ 32 | void vcom_init(); 33 | 34 | /** 35 | * Write a block of data. This function blocks until all data have been sent. 36 | * \param buffer buffer where take data to write. 37 | * \param size buffer size 38 | * \return number of bytes written or a negative number on failure. 39 | */ 40 | ssize_t vcom_writeBlock(const void *buf, size_t len); 41 | 42 | /** 43 | * Read a block of data, nonblocking function. 44 | * \param buffer buffer where read data will be stored. 45 | * \param size buffer size. 46 | * \return number of bytes read or a negative number on failure. Note that 47 | * it is normal for this function to return less character than the amount 48 | * asked. 49 | */ 50 | ssize_t vcom_readBlock(void *buf, size_t len); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif /* USB_VCOM_H */ 57 | -------------------------------------------------------------------------------- /platform/mcu/STM32F4xx/drivers/flash.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2021 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccol� Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #ifndef FLASH_H 22 | #define FLASH_H 23 | 24 | #include 25 | #include 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /** 32 | * Driver for MCU's internal flash management, allowing for sector erase and data 33 | * writing. 34 | */ 35 | 36 | /** 37 | * Erase one sector of the MCU flash memory. 38 | * 39 | * @param secNum: sector number. 40 | * @return true for successful erase, false otherwise. 41 | */ 42 | bool flash_eraseSector(const uint8_t secNum); 43 | 44 | /** 45 | * Write data to the MCU flash memory. 46 | * 47 | * @param address: starting address for the write operation. 48 | * @param data: data to be written. 49 | * @param len: data length. 50 | */ 51 | void flash_write(const uint32_t address, const void *data, const size_t len); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif /* FLASH_H */ 58 | -------------------------------------------------------------------------------- /lib/miosix-kernel/miosix/filesystem/ioctl.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2013 by Terraneo Federico * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 2 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * As a special exception, if other files instantiate templates or use * 15 | * macros or inline functions from this file, or you compile this file * 16 | * and link it with other works to produce a work based on this file, * 17 | * this file does not by itself cause the resulting work to be covered * 18 | * by the GNU General Public License. However the source code for this * 19 | * file must still be made available in accordance with the GNU General * 20 | * Public License. This exception does not invalidate any other reasons * 21 | * why a work based on this file might be covered by the GNU General * 22 | * Public License. * 23 | * * 24 | * You should have received a copy of the GNU General Public License * 25 | * along with this program; if not, see * 26 | ***************************************************************************/ 27 | 28 | #ifndef IOCTL_H 29 | #define IOCTL_H 30 | 31 | namespace miosix { 32 | 33 | enum Ioctl 34 | { 35 | IOCTL_SYNC=100, 36 | IOCTL_TCGETATTR=101, 37 | IOCTL_TCSETATTR_NOW=102, 38 | IOCTL_TCSETATTR_FLUSH=103, 39 | IOCTL_TCSETATTR_DRAIN=104, 40 | IOCTL_FLUSH=105 41 | }; 42 | 43 | } 44 | 45 | #endif //IOCTL_H 46 | -------------------------------------------------------------------------------- /platform/targets/GDx/hwconfig.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #ifndef HWCONFIG_H 22 | #define HWCONFIG_H 23 | 24 | #include 25 | 26 | #ifdef PLATFORM_GD77 27 | #include "pinmap_GD77.h" 28 | #else 29 | #include "pinmap_DM1801.h" 30 | #endif 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | extern const struct spiCustomDevice nvm_spi; 37 | extern const struct spiDevice c6000_spi; 38 | 39 | /* Screen dimensions */ 40 | #define CONFIG_SCREEN_WIDTH 128 41 | #define CONFIG_SCREEN_HEIGHT 64 42 | 43 | /* Screen pixel format */ 44 | #define CONFIG_PIX_FMT_BW 45 | 46 | /* Screen has adjustable contrast */ 47 | #define CONFIG_SCREEN_CONTRAST 48 | #define CONFIG_DEFAULT_CONTRAST 71 49 | 50 | /* Screen has adjustable brightness */ 51 | #define CONFIG_SCREEN_BRIGHTNESS 52 | 53 | /* Battery type */ 54 | #define CONFIG_BAT_LIION 55 | #define CONFIG_BAT_NCELLS 2 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif /* HWCONFIG_H */ 62 | -------------------------------------------------------------------------------- /platform/targets/linux/emulator/emulator.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | #ifndef EMULATOR_H 21 | #define EMULATOR_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #ifndef CONFIG_SCREEN_WIDTH 29 | #define CONFIG_SCREEN_WIDTH 160 30 | #endif 31 | 32 | #ifndef CONFIG_SCREEN_HEIGHT 33 | #define CONFIG_SCREEN_HEIGHT 128 34 | #endif 35 | 36 | enum choices 37 | { 38 | VAL_RSSI=1, 39 | VAL_BAT, 40 | VAL_MIC, 41 | VAL_VOL, 42 | VAL_CH, 43 | VAL_PTT, 44 | PRINT_STATE, 45 | EXIT 46 | }; 47 | 48 | typedef struct 49 | { 50 | float RSSI; 51 | float vbat; 52 | float micLevel; 53 | float volumeLevel; 54 | float chSelector; 55 | bool PTTstatus; 56 | bool powerOff; 57 | } 58 | emulator_state_t; 59 | 60 | extern emulator_state_t emulator_state; 61 | 62 | void emulator_start(); 63 | 64 | keyboard_t emulator_getKeys(); 65 | 66 | #endif /* EMULATOR_H */ 67 | -------------------------------------------------------------------------------- /cross_cm7.txt: -------------------------------------------------------------------------------- 1 | [binaries] 2 | c = 'arm-miosix-eabi-gcc' 3 | cpp = 'arm-miosix-eabi-g++' 4 | ld = 'arm-miosix-eabi-ld' 5 | ar = 'arm-miosix-eabi-ar' 6 | as = 'arm-miosix-eabi-as' 7 | size = 'arm-miosix-eabi-size' 8 | objdump = 'arm-miosix-eabi-objdump' 9 | objcopy = 'arm-miosix-eabi-objcopy' 10 | strip = 'arm-miosix-eabi-strip' 11 | gdb = 'arm-miosix-eabi-gdb' 12 | terminal= 'x-terminal-emulator' 13 | openocd = '/usr/local/bin/openocd' 14 | 15 | [built-in options] 16 | c_args = [ 17 | '-D_DEFAULT_SOURCE=1', 18 | '-ffunction-sections', 19 | '-fdata-sections', 20 | '-Wall', 21 | '-Werror=return-type', 22 | '-g', 23 | '-mcpu=cortex-m7', # Cortex-M4 CPU 24 | '-mthumb', # ARM Thumb2 ISA 25 | '-mfloat-abi=hard', # Hard floating point support 26 | '-mfpu=fpv5-d16', 27 | '-Os' 28 | ] 29 | 30 | cpp_args = [ 31 | '-D_DEFAULT_SOURCE=1', 32 | '-ffunction-sections', 33 | '-fdata-sections', 34 | '-Wall', 35 | '-Werror=return-type', 36 | '-g', 37 | '-fno-exceptions', 38 | '-fno-rtti', 39 | '-D__NO_EXCEPTIONS', 40 | '-std=c++14', 41 | '-mcpu=cortex-m7', # Cortex-M4 CPU 42 | '-mthumb', # ARM Thumb2 ISA 43 | '-mfloat-abi=hard', # Hard floating point support 44 | '-mfpu=fpv5-d16', 45 | '-Os' 46 | ] 47 | 48 | c_link_args = [ 49 | '-mcpu=cortex-m7', 50 | '-mthumb', 51 | '-mfloat-abi=hard', 52 | '-mfpu=fpv5-d16', 53 | '-ffunction-sections', 54 | '-fdata-sections', 55 | '-fno-exceptions', 56 | '-fno-rtti', 57 | '-Wl,-L../lib/miosix-kernel', 58 | '-Wl,--gc-sections', 59 | '-Wl,-Map,main.map', 60 | '-Wl,--warn-common', 61 | '-nostdlib', 62 | '-lstdc++', 63 | '-lc', 64 | '-lm', 65 | '-lgcc', 66 | '-latomic' 67 | ] 68 | 69 | cpp_link_args = c_link_args 70 | 71 | [host_machine] 72 | system = 'none' 73 | cpu_family = 'arm' 74 | cpu = 'cortex-m4' 75 | endian = 'little' 76 | -------------------------------------------------------------------------------- /platform/drivers/audio/Cx000_dac.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2024 - 2025 by Silvano Seva IU2KWO * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, see * 16 | ***************************************************************************/ 17 | 18 | #ifndef Cx000_DAC_H 19 | #define Cx000_DAC_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /** 30 | * Driver to use the HR_Cx000 internal DAC as audio output stream device. 31 | * Input data format is signed 16-bit and only a single instance of this driver 32 | * is allowed. 33 | */ 34 | 35 | extern const struct audioDriver Cx000_dac_audio_driver; 36 | 37 | /** 38 | * Start generation of a "beep" tone from DAC output. 39 | * 40 | * @param freq: tone frequency in Hz. 41 | * @return zero on success, a negative error code otherwise. 42 | */ 43 | int Cx000dac_startBeep(const uint16_t freq); 44 | 45 | /** 46 | * Stop an ongoing "beep" tone. 47 | */ 48 | void Cx000dac_stopBeep(); 49 | 50 | #ifdef __cplusplus 51 | } // extern "C" 52 | 53 | /** 54 | * Initialize the driver. 55 | */ 56 | void Cx000dac_init(HR_C6000 *device); 57 | 58 | /** 59 | * Shutdown the driver. 60 | */ 61 | void Cx000dac_terminate(); 62 | 63 | /** 64 | * Driver task function, to be called at least once every 4ms to ensure a 65 | * proper operation. 66 | */ 67 | void Cx000dac_task(); 68 | 69 | #endif 70 | 71 | #endif /* Cx000_DAC_H */ 72 | -------------------------------------------------------------------------------- /openrtx/include/protocols/M17/M17Constants.hpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2022 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #ifndef M17_CONSTANTS_H 22 | #define M17_CONSTANTS_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #ifndef __cplusplus 29 | #error This header is C++ only! 30 | #endif 31 | 32 | namespace M17 33 | { 34 | 35 | static constexpr size_t M17_SYMBOL_RATE = 4800; 36 | static constexpr size_t M17_FRAME_SYMBOLS = 192; 37 | static constexpr size_t M17_SYNCWORD_SYMBOLS = 8; 38 | static constexpr size_t M17_FRAME_BYTES = M17_FRAME_SYMBOLS / 4; 39 | 40 | static constexpr syncw_t LSF_SYNC_WORD = {0x55, 0xF7}; // LSF sync word 41 | static constexpr syncw_t BERT_SYNC_WORD = {0xDF, 0x55}; // BERT data sync word 42 | static constexpr syncw_t STREAM_SYNC_WORD = {0xFF, 0x5D}; // Stream data sync word 43 | static constexpr syncw_t PACKET_SYNC_WORD = {0x75, 0xFF}; // Packet data sync word 44 | static constexpr syncw_t EOT_SYNC_WORD = {0x55, 0x5D}; // End of transmission sync word 45 | 46 | } // namespace M17 47 | 48 | #endif // M17_CONSTANTS_H 49 | -------------------------------------------------------------------------------- /cross_arm.txt: -------------------------------------------------------------------------------- 1 | [binaries] 2 | c = 'arm-miosix-eabi-gcc' 3 | cpp = 'arm-miosix-eabi-g++' 4 | ld = 'arm-miosix-eabi-ld' 5 | ar = 'arm-miosix-eabi-ar' 6 | as = 'arm-miosix-eabi-as' 7 | size = 'arm-miosix-eabi-size' 8 | objdump = 'arm-miosix-eabi-objdump' 9 | objcopy = 'arm-miosix-eabi-objcopy' 10 | strip = 'arm-miosix-eabi-strip' 11 | gdb = 'arm-miosix-eabi-gdb' 12 | terminal= 'x-terminal-emulator' 13 | openocd = '/usr/local/bin/openocd' 14 | 15 | [built-in options] 16 | c_args = [ 17 | '-D_DEFAULT_SOURCE=1', 18 | '-ffunction-sections', 19 | '-fdata-sections', 20 | '-Wall', 21 | '-Werror=return-type', 22 | '-g', 23 | '-mcpu=cortex-m4', # Cortex-M4 CPU 24 | '-mthumb', # ARM Thumb2 ISA 25 | '-mfloat-abi=hard', # Hard floating point support 26 | '-mfpu=fpv4-sp-d16', 27 | '-Os' 28 | ] 29 | 30 | cpp_args = [ 31 | '-D_DEFAULT_SOURCE=1', 32 | '-ffunction-sections', 33 | '-fdata-sections', 34 | '-Wall', 35 | '-Werror=return-type', 36 | '-g', 37 | '-fno-exceptions', 38 | '-fno-rtti', 39 | '-D__NO_EXCEPTIONS', 40 | '-std=c++14', 41 | '-mcpu=cortex-m4', # Cortex-M4 CPU 42 | '-mthumb', # ARM Thumb2 ISA 43 | '-mfloat-abi=hard', # Hard floating point support 44 | '-mfpu=fpv4-sp-d16', 45 | '-Os' 46 | ] 47 | 48 | c_link_args = [ 49 | '-mcpu=cortex-m4', 50 | '-mthumb', 51 | '-mfloat-abi=hard', 52 | '-mfpu=fpv4-sp-d16', 53 | '-ffunction-sections', 54 | '-fdata-sections', 55 | '-fno-exceptions', 56 | '-fno-rtti', 57 | '-Wl,-L../lib/miosix-kernel', 58 | '-Wl,--gc-sections', 59 | '-Wl,-Map,main.map', 60 | '-Wl,--warn-common', 61 | '-Wl,--print-memory-usage', 62 | '-nostdlib', 63 | '-lstdc++', 64 | '-lc', 65 | '-lm', 66 | '-lgcc', 67 | '-latomic' 68 | ] 69 | 70 | cpp_link_args = c_link_args 71 | 72 | [host_machine] 73 | system = 'none' 74 | cpu_family = 'arm' 75 | cpu = 'cortex-m4' 76 | endian = 'little' 77 | -------------------------------------------------------------------------------- /lib/miosix-kernel/miosix/util/lcd44780.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include "miosix.h" 5 | #include "interfaces/delays.h" 6 | #include "lcd44780.h" 7 | 8 | namespace miosix { 9 | 10 | Lcd44780::Lcd44780(miosix::GpioPin rs, miosix::GpioPin e, miosix::GpioPin d4, 11 | miosix::GpioPin d5, miosix::GpioPin d6, miosix::GpioPin d7, 12 | int row, int col) : rs(rs), e(e), d4(d4), d5(d5), d6(d6), d7(d7), 13 | row(row), col(col) 14 | { 15 | rs.mode(Mode::OUTPUT); 16 | e.mode(Mode::OUTPUT); 17 | d4.mode(Mode::OUTPUT); 18 | d5.mode(Mode::OUTPUT); 19 | d6.mode(Mode::OUTPUT); 20 | d7.mode(Mode::OUTPUT); 21 | e.low(); 22 | Thread::sleep(50); //Powerup delay 23 | init(); 24 | clear(); 25 | } 26 | 27 | void Lcd44780::go(int x, int y) 28 | { 29 | if(x<0 || x>=col || y<0 || y>=row) return; 30 | 31 | // 4x20 is implemented as 2x40. 32 | // TODO Test 4x16 display. 33 | if(y>1) 34 | { 35 | x += col; 36 | } 37 | 38 | comd(0x80 | ((y & 1) ? 0x40 : 0) | x); //Move cursor 39 | } 40 | 41 | int Lcd44780::printf(const char* fmt, ...) 42 | { 43 | va_list arg; 44 | char line[40]; 45 | va_start(arg,fmt); 46 | int len=vsnprintf(line,sizeof(line),fmt,arg); 47 | va_end(arg); 48 | for(int i=0;i * 20 | ***************************************************************************/ 21 | 22 | #include "MCP4551.h" 23 | 24 | // Common WIPER values 25 | #define MCP4551_WIPER_MID 0x080 26 | #define MCP4551_WIPER_A 0x100 27 | #define MCP4551_WIPER_B 0x000 28 | 29 | // Command definitions (sent to WIPER register) 30 | #define MCP4551_CMD_WRITE 0x00 31 | #define MCP4551_CMD_INC 0x04 32 | #define MCP4551_CMD_DEC 0x08 33 | #define MCP4551_CMD_READ 0x0C 34 | 35 | 36 | int mcp4551_init(const struct i2cDevice *i2c, const uint8_t devAddr) 37 | { 38 | return mcp4551_setWiper(i2c, devAddr, MCP4551_WIPER_MID); 39 | } 40 | 41 | int mcp4551_setWiper(const struct i2cDevice *i2c, const uint8_t devAddr, 42 | const uint16_t value) 43 | { 44 | uint8_t data[2] = 45 | { 46 | (uint8_t)(value >> 8 & 0x01) | MCP4551_CMD_WRITE, 47 | (uint8_t) value 48 | }; 49 | 50 | i2c_acquire(i2c); 51 | int ret = i2c_write(i2c, devAddr, data, 2, true); 52 | i2c_release(i2c); 53 | 54 | return ret; 55 | } 56 | -------------------------------------------------------------------------------- /scripts/dfu_suffix.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | 4 | # 5 | # Copyright 2011 Dominic Spill 6 | # Copyright 2010 TheSeven 7 | # 8 | # This file was forked form Project Ubertooth. 9 | # 10 | 11 | from struct import pack, unpack 12 | 13 | crc_table = [] 14 | 15 | # From freemyipod.org 16 | for i in range(256): 17 | t = i 18 | for j in range(8): 19 | if t & 1: 20 | t = (t >> 1) ^ 0xedb88320 21 | else: 22 | t >>= 1 23 | crc_table.append(t) 24 | 25 | 26 | def crc32(data): 27 | crc = 0xffffffff 28 | for byte in data: 29 | crc = (crc >> 8) ^ crc_table[(crc ^ ord(byte)) & 0xff] 30 | return crc 31 | 32 | 33 | def check_suffix(firmware): 34 | """Check the dfu suffix""" 35 | print('Checking firmware signature') 36 | 37 | data = firmware[:-4] 38 | length = ord(firmware[-5]) 39 | suffix = firmware[-length:] 40 | 41 | # Will always have these fields 42 | dwCRC = unpack(' * 19 | ***************************************************************************/ 20 | 21 | #include 22 | 23 | streamId outputStream_start(const enum AudioSink destination, 24 | const enum AudioPriority prio, 25 | stream_sample_t * const buf, 26 | const size_t length, 27 | const enum BufMode mode, 28 | const uint32_t sampleRate) 29 | { 30 | (void) destination; 31 | (void) prio; 32 | (void) buf; 33 | (void) length; 34 | (void) mode; 35 | (void) sampleRate; 36 | 37 | return -1; 38 | } 39 | 40 | stream_sample_t *outputStream_getIdleBuffer(const streamId id) 41 | { 42 | (void) id; 43 | 44 | return NULL; 45 | } 46 | 47 | bool outputStream_sync(const streamId id, const bool bufChanged) 48 | { 49 | (void) id; 50 | (void) bufChanged; 51 | 52 | return false; 53 | } 54 | 55 | void outputStream_stop(const streamId id) 56 | { 57 | (void) id; 58 | } 59 | 60 | void outputStream_terminate(const streamId id) 61 | { 62 | (void) id; 63 | } 64 | -------------------------------------------------------------------------------- /platform/mcu/MK22FN512xxx12/boot/bsp.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2021 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO, * 6 | * Federico Terraneo * 7 | * * 8 | * This program is free software; you can redistribute it and/or modify * 9 | * it under the terms of the GNU General Public License as published by * 10 | * the Free Software Foundation; either version 3 of the License, or * 11 | * (at your option) any later version. * 12 | * * 13 | * This program is distributed in the hope that it will be useful, * 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 16 | * GNU General Public License for more details. * 17 | * * 18 | * You should have received a copy of the GNU General Public License * 19 | * along with this program; if not, see * 20 | ***************************************************************************/ 21 | 22 | /*********************************************************************** 23 | * bsp.cpp Part of the Miosix Embedded OS. 24 | * Board support package, this file initializes hardware. 25 | ************************************************************************/ 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | 34 | namespace miosix 35 | { 36 | 37 | // 38 | // Initialization 39 | // 40 | 41 | void IRQbspInit() 42 | { 43 | SIM->SCGC5 |= 0x3E00; // Enable GPIO clock 44 | 45 | // Configure SysTick 46 | SysTick->LOAD = SystemCoreClock / miosix::TICK_FREQ; 47 | } 48 | 49 | void bspInit2() 50 | { 51 | 52 | } 53 | 54 | // 55 | // Shutdown and reboot 56 | // 57 | 58 | void shutdown() 59 | { 60 | reboot(); 61 | } 62 | 63 | void reboot() 64 | { 65 | disableInterrupts(); 66 | miosix_private::IRQsystemReboot(); 67 | } 68 | 69 | } //namespace miosix 70 | -------------------------------------------------------------------------------- /platform/drivers/SPI/spi_custom.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2024 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #include 22 | #include "spi_custom.h" 23 | 24 | int spiCustom_transfer(const struct spiDevice *dev, const void *txBuf, 25 | void *rxBuf, const size_t size) 26 | { 27 | const struct spiCustomDevice *spiDev = (const struct spiCustomDevice *) dev; 28 | const uint8_t *txData = (const uint8_t *) txBuf; 29 | uint8_t *rxData = (uint8_t *) rxBuf; 30 | 31 | if(spiDev->spiFunc == NULL) 32 | return -EIO; 33 | 34 | // Send only 35 | if(rxBuf == NULL) 36 | { 37 | for(size_t i = 0; i < size; i++) 38 | spiDev->spiFunc(dev->priv, txData[i]); 39 | 40 | return 0; 41 | } 42 | 43 | // Receive only 44 | if(txBuf == NULL) 45 | { 46 | for(size_t i = 0; i < size; i++) 47 | rxData[i] = spiDev->spiFunc(dev->priv, 0x00); 48 | 49 | return 0; 50 | } 51 | 52 | // Transmit and receive, only symmetric transfer is supported 53 | for(size_t i = 0; i < size; i++) 54 | rxData[i] = spiDev->spiFunc(dev->priv, txData[i]); 55 | 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /platform/drivers/baseband/SKY72310.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2020 - 2025 by Silvano Seva IU2KWO * 3 | * and Niccolò Izzo IU2KIN * 4 | * * 5 | * This program is free software; you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation; either version 3 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program; if not, see * 17 | ***************************************************************************/ 18 | 19 | #ifndef SKY73210_H 20 | #define SKY73210_H 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /** 32 | * SKY73210 device data. 33 | */ 34 | struct sky73210 35 | { 36 | const struct spiDevice *spi; ///< SPI bus device driver 37 | const struct gpioPin cs; ///< Chip select gpio 38 | const uint32_t refClk; ///< Reference clock frequency, in Hz 39 | }; 40 | 41 | /** 42 | * Initialise the PLL. 43 | * 44 | * @param dev: pointer to device data. 45 | */ 46 | void SKY73210_init(const struct sky73210 *dev); 47 | 48 | /** 49 | * Terminate PLL driver. 50 | * 51 | * @param dev: pointer to device data. 52 | */ 53 | void SKY73210_terminate(const struct sky73210 *dev); 54 | 55 | /** 56 | * Change VCO frequency. 57 | * 58 | * @param dev: pointer to device data. 59 | * @param freq: new VCO frequency, in Hz. 60 | * @param clkDiv: reference clock division factor. 61 | */ 62 | void SKY73210_setFrequency(const struct sky73210 *dev, const uint32_t freq, 63 | uint8_t clkDiv); 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | #endif /* SKY73210_H */ 70 | -------------------------------------------------------------------------------- /platform/targets/linux/emulator/sdl_engine.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2021 - 2025 by Alessio Caiazza IU5BON * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, see * 16 | ***************************************************************************/ 17 | #ifndef SDL_ENGINE_H 18 | #define SDL_ENGINE_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | /* 26 | * Screen dimensions, adjust basing on the size of the screen you need to 27 | * emulate 28 | */ 29 | #ifndef CONFIG_SCREEN_WIDTH 30 | #define CONFIG_SCREEN_WIDTH 160 31 | #endif 32 | 33 | #ifndef CONFIG_SCREEN_HEIGHT 34 | #define CONFIG_SCREEN_HEIGHT 128 35 | #endif 36 | 37 | #ifdef CONFIG_PIX_FMT_RGB565 38 | #define PIXEL_FORMAT SDL_PIXELFORMAT_RGB565 39 | #define PIXEL_SIZE uint16_t 40 | #else 41 | #define PIXEL_FORMAT SDL_PIXELFORMAT_ARGB8888 42 | #define PIXEL_SIZE uint32_t 43 | #endif 44 | 45 | /** 46 | * Initialize the SDL engine. Must be called in the Main Thread. 47 | */ 48 | void sdlEngine_init(); 49 | 50 | /** 51 | * SDL main loop. Must be called in the Main Thread. 52 | */ 53 | void sdlEngine_run(); 54 | 55 | /** 56 | * Thread-safe check to verify if the application entered the SDL main loop. 57 | * 58 | * @return true after sdl_task() started. 59 | */ 60 | bool sdlEngine_ready(); 61 | 62 | /** 63 | * Thread-safe function returning the keys currently being pressed. 64 | * 65 | * @return a keyboard_t bit field with the keys currently being pressed. 66 | */ 67 | keyboard_t sdlEngine_getKeys(); 68 | 69 | #endif /* SDL_ENGINE_H */ 70 | -------------------------------------------------------------------------------- /platform/drivers/CPS/cps_io_native_Mod17.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2022 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * This program is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation; either version 3 of the License, or * 10 | * (at your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, see * 19 | ***************************************************************************/ 20 | 21 | #include 22 | 23 | 24 | /** 25 | * This function does not apply to address-based codeplugs 26 | */ 27 | int cps_open(char *cps_name) 28 | { 29 | (void) cps_name; 30 | return 0; 31 | } 32 | 33 | /** 34 | * This function does not apply to address-based codeplugs 35 | */ 36 | void cps_close() 37 | { 38 | } 39 | 40 | /** 41 | * This function does not apply to address-based codeplugs 42 | */ 43 | int cps_create(char *cps_name) 44 | { 45 | (void) cps_name; 46 | return 0; 47 | } 48 | 49 | int cps_readChannel(channel_t *channel, uint16_t pos) 50 | { 51 | (void) channel; 52 | (void) pos; 53 | return -1; 54 | } 55 | 56 | int cps_readBankHeader(bankHdr_t *b_header, uint16_t pos) 57 | { 58 | (void) b_header; 59 | (void) pos; 60 | return -1; 61 | } 62 | 63 | int cps_readBankData(uint16_t bank_pos, uint16_t ch_pos) 64 | { 65 | (void) bank_pos; 66 | (void) ch_pos; 67 | return -1; 68 | } 69 | 70 | int cps_readContact(contact_t *contact, uint16_t pos) 71 | { 72 | (void) contact; 73 | (void) pos; 74 | return -1; 75 | } 76 | -------------------------------------------------------------------------------- /platform/mcu/MK22FN512xxx12/drivers/usb/usb_osa_bm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. 3 | * Copyright 2016 NXP 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * o Redistributions of source code must retain the above copyright notice, this list 9 | * of conditions and the following disclaimer. 10 | * 11 | * o Redistributions in binary form must reproduce the above copyright notice, this 12 | * list of conditions and the following disclaimer in the documentation and/or 13 | * other materials provided with the distribution. 14 | * 15 | * o Neither the name of the copyright holder nor the names of its 16 | * contributors may be used to endorse or promote products derived from this 17 | * software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef __USB_OSA_BM_H__ 32 | #define __USB_OSA_BM_H__ 33 | 34 | /******************************************************************************* 35 | * Definitions 36 | ******************************************************************************/ 37 | 38 | #define USB_OSA_SR_ALLOC() uint32_t usbOsaCurrentSr; 39 | #define USB_OSA_ENTER_CRITICAL() USB_OsaEnterCritical(&usbOsaCurrentSr) 40 | #define USB_OSA_EXIT_CRITICAL() USB_OsaExitCritical(usbOsaCurrentSr) 41 | 42 | /******************************************************************************* 43 | * API 44 | ******************************************************************************/ 45 | 46 | #if defined(__cplusplus) 47 | extern "C" { 48 | #endif 49 | 50 | extern void USB_OsaEnterCritical(uint32_t *sr); 51 | extern void USB_OsaExitCritical(uint32_t sr); 52 | 53 | #if defined(__cplusplus) 54 | } 55 | #endif 56 | 57 | #endif /* __USB_OSA_BM_H__ */ 58 | -------------------------------------------------------------------------------- /tests/unit/M17_rrc.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2021 - 2025 by Federico Amedeo Izzo IU2NUO, * 3 | * Niccolò Izzo IU2KIN * 4 | * Frederik Saraci IU2NRO * 5 | * Silvano Seva IU2KWO * 6 | * * 7 | * * 8 | * This program is free software; you can redistribute it and/or modify * 9 | * it under the terms of the GNU General Public License as published by * 10 | * the Free Software Foundation; either version 3 of the License, or * 11 | * (at your option) any later version. * 12 | * * 13 | * This program is distributed in the hope that it will be useful, * 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 16 | * GNU General Public License for more details. * 17 | * * 18 | * You should have received a copy of the GNU General Public License * 19 | * along with this program; if not, see * 20 | ***************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | #include "M17/M17DSP.hpp" 26 | 27 | #define IMPULSE_SIZE 4096 28 | 29 | using namespace std; 30 | 31 | /** 32 | * Test the different demodulation steps 33 | */ 34 | 35 | int main() 36 | { 37 | // Open file 38 | FILE *baseband_out = fopen("M17_rrc_impulse_response.raw", "wb"); 39 | if (!baseband_out) 40 | { 41 | perror("Error in opening output file"); 42 | return -1; 43 | } 44 | 45 | // Allocate impulse signal 46 | int16_t impulse[IMPULSE_SIZE] = { 0 }; 47 | impulse[0] = SHRT_MAX; 48 | 49 | // Apply RRC on impulse signal 50 | int16_t filtered_impulse[IMPULSE_SIZE] = { 0 }; 51 | for(size_t i = 0; i < IMPULSE_SIZE; i++) 52 | { 53 | float elem = static_cast< float >(impulse[i]); 54 | filtered_impulse[i] = static_cast< int16_t >(M17::rrc_48k(0.10 * elem)); 55 | } 56 | fwrite(filtered_impulse, IMPULSE_SIZE, 1, baseband_out); 57 | fclose(baseband_out); 58 | return 0; 59 | } 60 | --------------------------------------------------------------------------------