mirror of
https://github.com/RfidResearchGroup/mayhem-firmware.git
synced 2026-05-12 11:27:21 -07:00
Merge 'upstream/master' - At least it builds...
This commit is contained in:
+2
-2
@@ -14,9 +14,9 @@ notifications:
|
||||
- "Firmware download : https://portapack-h1-builds.s3.amazonaws.com/%{repository_slug}/%{build_number}/%{build_number}.1/build/firmware/portapack-h1-firmware-%{commit}.tar.bz2"
|
||||
|
||||
before_script:
|
||||
- wget https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q2-update/+download/gcc-arm-none-eabi-5_4-2016q2-20160622-linux.tar.bz2 -O /tmp/gcc-arm.tar.bz2
|
||||
- wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2016q4/gcc-arm-none-eabi-6_2-2016q4-20161216-linux.tar.bz2 -O /tmp/gcc-arm.tar.bz2
|
||||
- tar -xf /tmp/gcc-arm.tar.bz2
|
||||
- export PATH=$PWD/gcc-arm-none-eabi-5_4-2016q2/bin:$PATH
|
||||
- export PATH=$PWD/gcc-arm-none-eabi-6_2-2016q4/bin:$PATH
|
||||
- export CC="arm-none-eabi-gcc"
|
||||
- export CXX="arm-none-eabi-g++"
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
project(firmware)
|
||||
|
||||
set(BASEBAND ${PROJECT_SOURCE_DIR}/baseband)
|
||||
set(COMMON ${PROJECT_SOURCE_DIR}/common)
|
||||
set(CHIBIOS ${PROJECT_SOURCE_DIR}/chibios)
|
||||
set(CHIBIOS_PORTAPACK ${PROJECT_SOURCE_DIR}/chibios-portapack)
|
||||
@@ -27,7 +28,7 @@ set(CHIBIOS_PORTAPACK ${PROJECT_SOURCE_DIR}/chibios-portapack)
|
||||
set(HACKRF_FIRMWARE_FILENAME hackrf_one_usb_ram.dfu)
|
||||
set(HACKRF_FIRMWARE_IMAGE ${PROJECT_SOURCE_DIR}/${HACKRF_FIRMWARE_FILENAME})
|
||||
|
||||
set(HACKRF_CPLD_SVF_FILENAME hackrf_cpld_default.svf)
|
||||
set(HACKRF_CPLD_SVF_FILENAME hackrf_cpld_portapack.svf)
|
||||
set(HACKRF_CPLD_SVF_PATH ${PROJECT_SOURCE_DIR}/${HACKRF_CPLD_SVF_FILENAME})
|
||||
|
||||
set(EXTRACT_CPLD_DATA ${PROJECT_SOURCE_DIR}/tools/extract_cpld_data.py)
|
||||
@@ -59,7 +60,7 @@ add_custom_target(
|
||||
|
||||
add_custom_target(
|
||||
program
|
||||
COMMAND dfu-util --device 1fc9:000c --download ${HACKRF_FIRMWARE_IMAGE} --reset
|
||||
COMMAND dfu-util --device 1fc9:000c --download ${HACKRF_FIRMWARE_IMAGE}
|
||||
COMMAND sleep 1s
|
||||
COMMAND hackrf_spiflash -w ${FIRMWARE_FILENAME}
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FIRMWARE_FILENAME}
|
||||
|
||||
@@ -36,7 +36,7 @@ set(USE_OPT "-Os -g --specs=nano.specs")
|
||||
set(USE_COPT "-std=gnu99")
|
||||
|
||||
# C++ specific options here (added to USE_OPT).
|
||||
set(USE_CPPOPT "-Wl,-Map,foo.map -std=c++11 -fno-rtti -fno-exceptions")
|
||||
set(USE_CPPOPT "-std=c++14 -fno-rtti -fno-exceptions -Weffc++ -Wuninitialized")
|
||||
|
||||
# Enable this if you want the linker to remove unused code and data
|
||||
set(USE_LINK_GC yes)
|
||||
@@ -131,6 +131,7 @@ set(CPPSRC
|
||||
rffc507x_spi.cpp
|
||||
max2837.cpp
|
||||
max5864.cpp
|
||||
${COMMON}/buffer.cpp
|
||||
debounce.cpp
|
||||
touch.cpp
|
||||
touch_adc.cpp
|
||||
@@ -201,14 +202,15 @@ set(CPPSRC
|
||||
capture_app.cpp
|
||||
replay_app.cpp
|
||||
sd_card.cpp
|
||||
time.cpp
|
||||
rtc_time.cpp
|
||||
file.cpp
|
||||
filewriter.cpp
|
||||
wavfile.cpp
|
||||
log_file.cpp
|
||||
${COMMON}/png_writer.cpp
|
||||
${COMMON}/buffer_exchange.cpp
|
||||
capture_thread.cpp
|
||||
replay_thread.cpp
|
||||
io_file.cpp
|
||||
io_wave.cpp
|
||||
${COMMON}/manchester.cpp
|
||||
string_format.cpp
|
||||
temperature_logger.cpp
|
||||
@@ -357,6 +359,7 @@ add_definitions(${DEFS})
|
||||
include_directories(. ${INCDIR})
|
||||
link_directories(${LLIBDIR})
|
||||
target_link_libraries(${PROJECT_NAME}.elf ${LIBS})
|
||||
target_link_libraries(${PROJECT_NAME}.elf -Wl,-Map=${PROJECT_NAME}.map)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${PROJECT_NAME}.bin
|
||||
|
||||
+180
-90
@@ -194,6 +194,33 @@ __/chibios-portapack/ext/fatfs/src/ff.c.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/__/chibios-portapack/ext/fatfs/src/ff.c.s
|
||||
.PHONY : __/chibios-portapack/ext/fatfs/src/ff.c.s
|
||||
|
||||
__/chibios-portapack/ext/fatfs/src/option/unicode.obj: __/chibios-portapack/ext/fatfs/src/option/unicode.c.obj
|
||||
|
||||
.PHONY : __/chibios-portapack/ext/fatfs/src/option/unicode.obj
|
||||
|
||||
# target to build an object file
|
||||
__/chibios-portapack/ext/fatfs/src/option/unicode.c.obj:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/__/chibios-portapack/ext/fatfs/src/option/unicode.c.obj
|
||||
.PHONY : __/chibios-portapack/ext/fatfs/src/option/unicode.c.obj
|
||||
|
||||
__/chibios-portapack/ext/fatfs/src/option/unicode.i: __/chibios-portapack/ext/fatfs/src/option/unicode.c.i
|
||||
|
||||
.PHONY : __/chibios-portapack/ext/fatfs/src/option/unicode.i
|
||||
|
||||
# target to preprocess a source file
|
||||
__/chibios-portapack/ext/fatfs/src/option/unicode.c.i:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/__/chibios-portapack/ext/fatfs/src/option/unicode.c.i
|
||||
.PHONY : __/chibios-portapack/ext/fatfs/src/option/unicode.c.i
|
||||
|
||||
__/chibios-portapack/ext/fatfs/src/option/unicode.s: __/chibios-portapack/ext/fatfs/src/option/unicode.c.s
|
||||
|
||||
.PHONY : __/chibios-portapack/ext/fatfs/src/option/unicode.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
__/chibios-portapack/ext/fatfs/src/option/unicode.c.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/__/chibios-portapack/ext/fatfs/src/option/unicode.c.s
|
||||
.PHONY : __/chibios-portapack/ext/fatfs/src/option/unicode.c.s
|
||||
|
||||
__/chibios-portapack/os/hal/platforms/LPC43xx/gpt_lld.obj: __/chibios-portapack/os/hal/platforms/LPC43xx/gpt_lld.c.obj
|
||||
|
||||
.PHONY : __/chibios-portapack/os/hal/platforms/LPC43xx/gpt_lld.obj
|
||||
@@ -2003,6 +2030,60 @@ __/common/ais_packet.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/__/common/ais_packet.cpp.s
|
||||
.PHONY : __/common/ais_packet.cpp.s
|
||||
|
||||
__/common/buffer.obj: __/common/buffer.cpp.obj
|
||||
|
||||
.PHONY : __/common/buffer.obj
|
||||
|
||||
# target to build an object file
|
||||
__/common/buffer.cpp.obj:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/__/common/buffer.cpp.obj
|
||||
.PHONY : __/common/buffer.cpp.obj
|
||||
|
||||
__/common/buffer.i: __/common/buffer.cpp.i
|
||||
|
||||
.PHONY : __/common/buffer.i
|
||||
|
||||
# target to preprocess a source file
|
||||
__/common/buffer.cpp.i:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/__/common/buffer.cpp.i
|
||||
.PHONY : __/common/buffer.cpp.i
|
||||
|
||||
__/common/buffer.s: __/common/buffer.cpp.s
|
||||
|
||||
.PHONY : __/common/buffer.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
__/common/buffer.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/__/common/buffer.cpp.s
|
||||
.PHONY : __/common/buffer.cpp.s
|
||||
|
||||
__/common/buffer_exchange.obj: __/common/buffer_exchange.cpp.obj
|
||||
|
||||
.PHONY : __/common/buffer_exchange.obj
|
||||
|
||||
# target to build an object file
|
||||
__/common/buffer_exchange.cpp.obj:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/__/common/buffer_exchange.cpp.obj
|
||||
.PHONY : __/common/buffer_exchange.cpp.obj
|
||||
|
||||
__/common/buffer_exchange.i: __/common/buffer_exchange.cpp.i
|
||||
|
||||
.PHONY : __/common/buffer_exchange.i
|
||||
|
||||
# target to preprocess a source file
|
||||
__/common/buffer_exchange.cpp.i:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/__/common/buffer_exchange.cpp.i
|
||||
.PHONY : __/common/buffer_exchange.cpp.i
|
||||
|
||||
__/common/buffer_exchange.s: __/common/buffer_exchange.cpp.s
|
||||
|
||||
.PHONY : __/common/buffer_exchange.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
__/common/buffer_exchange.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/__/common/buffer_exchange.cpp.s
|
||||
.PHONY : __/common/buffer_exchange.cpp.s
|
||||
|
||||
__/common/chibios_cpp.obj: __/common/chibios_cpp.cpp.obj
|
||||
|
||||
.PHONY : __/common/chibios_cpp.obj
|
||||
@@ -3272,33 +3353,6 @@ file.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/file.cpp.s
|
||||
.PHONY : file.cpp.s
|
||||
|
||||
filewriter.obj: filewriter.cpp.obj
|
||||
|
||||
.PHONY : filewriter.obj
|
||||
|
||||
# target to build an object file
|
||||
filewriter.cpp.obj:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/filewriter.cpp.obj
|
||||
.PHONY : filewriter.cpp.obj
|
||||
|
||||
filewriter.i: filewriter.cpp.i
|
||||
|
||||
.PHONY : filewriter.i
|
||||
|
||||
# target to preprocess a source file
|
||||
filewriter.cpp.i:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/filewriter.cpp.i
|
||||
.PHONY : filewriter.cpp.i
|
||||
|
||||
filewriter.s: filewriter.cpp.s
|
||||
|
||||
.PHONY : filewriter.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
filewriter.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/filewriter.cpp.s
|
||||
.PHONY : filewriter.cpp.s
|
||||
|
||||
freqman.obj: freqman.cpp.obj
|
||||
|
||||
.PHONY : freqman.obj
|
||||
@@ -3353,6 +3407,60 @@ hackrf_cpld_data.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/hackrf_cpld_data.cpp.s
|
||||
.PHONY : hackrf_cpld_data.cpp.s
|
||||
|
||||
io_file.obj: io_file.cpp.obj
|
||||
|
||||
.PHONY : io_file.obj
|
||||
|
||||
# target to build an object file
|
||||
io_file.cpp.obj:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/io_file.cpp.obj
|
||||
.PHONY : io_file.cpp.obj
|
||||
|
||||
io_file.i: io_file.cpp.i
|
||||
|
||||
.PHONY : io_file.i
|
||||
|
||||
# target to preprocess a source file
|
||||
io_file.cpp.i:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/io_file.cpp.i
|
||||
.PHONY : io_file.cpp.i
|
||||
|
||||
io_file.s: io_file.cpp.s
|
||||
|
||||
.PHONY : io_file.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
io_file.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/io_file.cpp.s
|
||||
.PHONY : io_file.cpp.s
|
||||
|
||||
io_wave.obj: io_wave.cpp.obj
|
||||
|
||||
.PHONY : io_wave.obj
|
||||
|
||||
# target to build an object file
|
||||
io_wave.cpp.obj:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/io_wave.cpp.obj
|
||||
.PHONY : io_wave.cpp.obj
|
||||
|
||||
io_wave.i: io_wave.cpp.i
|
||||
|
||||
.PHONY : io_wave.i
|
||||
|
||||
# target to preprocess a source file
|
||||
io_wave.cpp.i:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/io_wave.cpp.i
|
||||
.PHONY : io_wave.cpp.i
|
||||
|
||||
io_wave.s: io_wave.cpp.s
|
||||
|
||||
.PHONY : io_wave.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
io_wave.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/io_wave.cpp.s
|
||||
.PHONY : io_wave.cpp.s
|
||||
|
||||
irq_controls.obj: irq_controls.cpp.obj
|
||||
|
||||
.PHONY : irq_controls.obj
|
||||
@@ -3866,6 +3974,33 @@ rffc507x_spi.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/rffc507x_spi.cpp.s
|
||||
.PHONY : rffc507x_spi.cpp.s
|
||||
|
||||
rtc_time.obj: rtc_time.cpp.obj
|
||||
|
||||
.PHONY : rtc_time.obj
|
||||
|
||||
# target to build an object file
|
||||
rtc_time.cpp.obj:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/rtc_time.cpp.obj
|
||||
.PHONY : rtc_time.cpp.obj
|
||||
|
||||
rtc_time.i: rtc_time.cpp.i
|
||||
|
||||
.PHONY : rtc_time.i
|
||||
|
||||
# target to preprocess a source file
|
||||
rtc_time.cpp.i:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/rtc_time.cpp.i
|
||||
.PHONY : rtc_time.cpp.i
|
||||
|
||||
rtc_time.s: rtc_time.cpp.s
|
||||
|
||||
.PHONY : rtc_time.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
rtc_time.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/rtc_time.cpp.s
|
||||
.PHONY : rtc_time.cpp.s
|
||||
|
||||
sd_card.obj: sd_card.cpp.obj
|
||||
|
||||
.PHONY : sd_card.obj
|
||||
@@ -4028,33 +4163,6 @@ temperature_logger.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/temperature_logger.cpp.s
|
||||
.PHONY : temperature_logger.cpp.s
|
||||
|
||||
time.obj: time.cpp.obj
|
||||
|
||||
.PHONY : time.obj
|
||||
|
||||
# target to build an object file
|
||||
time.cpp.obj:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/time.cpp.obj
|
||||
.PHONY : time.cpp.obj
|
||||
|
||||
time.i: time.cpp.i
|
||||
|
||||
.PHONY : time.i
|
||||
|
||||
# target to preprocess a source file
|
||||
time.cpp.i:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/time.cpp.i
|
||||
.PHONY : time.cpp.i
|
||||
|
||||
time.s: time.cpp.s
|
||||
|
||||
.PHONY : time.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
time.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/time.cpp.s
|
||||
.PHONY : time.cpp.s
|
||||
|
||||
touch.obj: touch.cpp.obj
|
||||
|
||||
.PHONY : touch.obj
|
||||
@@ -5108,33 +5216,6 @@ ui_whistle.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_whistle.cpp.s
|
||||
.PHONY : ui_whistle.cpp.s
|
||||
|
||||
wavfile.obj: wavfile.cpp.obj
|
||||
|
||||
.PHONY : wavfile.obj
|
||||
|
||||
# target to build an object file
|
||||
wavfile.cpp.obj:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/wavfile.cpp.obj
|
||||
.PHONY : wavfile.cpp.obj
|
||||
|
||||
wavfile.i: wavfile.cpp.i
|
||||
|
||||
.PHONY : wavfile.i
|
||||
|
||||
# target to preprocess a source file
|
||||
wavfile.cpp.i:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/wavfile.cpp.i
|
||||
.PHONY : wavfile.cpp.i
|
||||
|
||||
wavfile.s: wavfile.cpp.s
|
||||
|
||||
.PHONY : wavfile.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
wavfile.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/wavfile.cpp.s
|
||||
.PHONY : wavfile.cpp.s
|
||||
|
||||
# Help Target
|
||||
help:
|
||||
@echo "The following are some of the valid targets for this Makefile:"
|
||||
@@ -5151,6 +5232,9 @@ help:
|
||||
@echo "... __/chibios-portapack/ext/fatfs/src/ff.obj"
|
||||
@echo "... __/chibios-portapack/ext/fatfs/src/ff.i"
|
||||
@echo "... __/chibios-portapack/ext/fatfs/src/ff.s"
|
||||
@echo "... __/chibios-portapack/ext/fatfs/src/option/unicode.obj"
|
||||
@echo "... __/chibios-portapack/ext/fatfs/src/option/unicode.i"
|
||||
@echo "... __/chibios-portapack/ext/fatfs/src/option/unicode.s"
|
||||
@echo "... __/chibios-portapack/os/hal/platforms/LPC43xx/gpt_lld.obj"
|
||||
@echo "... __/chibios-portapack/os/hal/platforms/LPC43xx/gpt_lld.i"
|
||||
@echo "... __/chibios-portapack/os/hal/platforms/LPC43xx/gpt_lld.s"
|
||||
@@ -5352,6 +5436,12 @@ help:
|
||||
@echo "... __/common/ais_packet.obj"
|
||||
@echo "... __/common/ais_packet.i"
|
||||
@echo "... __/common/ais_packet.s"
|
||||
@echo "... __/common/buffer.obj"
|
||||
@echo "... __/common/buffer.i"
|
||||
@echo "... __/common/buffer.s"
|
||||
@echo "... __/common/buffer_exchange.obj"
|
||||
@echo "... __/common/buffer_exchange.i"
|
||||
@echo "... __/common/buffer_exchange.s"
|
||||
@echo "... __/common/chibios_cpp.obj"
|
||||
@echo "... __/common/chibios_cpp.i"
|
||||
@echo "... __/common/chibios_cpp.s"
|
||||
@@ -5493,15 +5583,18 @@ help:
|
||||
@echo "... file.obj"
|
||||
@echo "... file.i"
|
||||
@echo "... file.s"
|
||||
@echo "... filewriter.obj"
|
||||
@echo "... filewriter.i"
|
||||
@echo "... filewriter.s"
|
||||
@echo "... freqman.obj"
|
||||
@echo "... freqman.i"
|
||||
@echo "... freqman.s"
|
||||
@echo "... hackrf_cpld_data.obj"
|
||||
@echo "... hackrf_cpld_data.i"
|
||||
@echo "... hackrf_cpld_data.s"
|
||||
@echo "... io_file.obj"
|
||||
@echo "... io_file.i"
|
||||
@echo "... io_file.s"
|
||||
@echo "... io_wave.obj"
|
||||
@echo "... io_wave.i"
|
||||
@echo "... io_wave.s"
|
||||
@echo "... irq_controls.obj"
|
||||
@echo "... irq_controls.i"
|
||||
@echo "... irq_controls.s"
|
||||
@@ -5559,6 +5652,9 @@ help:
|
||||
@echo "... rffc507x_spi.obj"
|
||||
@echo "... rffc507x_spi.i"
|
||||
@echo "... rffc507x_spi.s"
|
||||
@echo "... rtc_time.obj"
|
||||
@echo "... rtc_time.i"
|
||||
@echo "... rtc_time.s"
|
||||
@echo "... sd_card.obj"
|
||||
@echo "... sd_card.i"
|
||||
@echo "... sd_card.s"
|
||||
@@ -5577,9 +5673,6 @@ help:
|
||||
@echo "... temperature_logger.obj"
|
||||
@echo "... temperature_logger.i"
|
||||
@echo "... temperature_logger.s"
|
||||
@echo "... time.obj"
|
||||
@echo "... time.i"
|
||||
@echo "... time.s"
|
||||
@echo "... touch.obj"
|
||||
@echo "... touch.i"
|
||||
@echo "... touch.s"
|
||||
@@ -5697,9 +5790,6 @@ help:
|
||||
@echo "... ui_whistle.obj"
|
||||
@echo "... ui_whistle.i"
|
||||
@echo "... ui_whistle.s"
|
||||
@echo "... wavfile.obj"
|
||||
@echo "... wavfile.i"
|
||||
@echo "... wavfile.s"
|
||||
.PHONY : help
|
||||
|
||||
|
||||
|
||||
@@ -185,40 +185,13 @@ void AISRecentEntry::update(const ais::Packet& packet) {
|
||||
|
||||
namespace ui {
|
||||
|
||||
static const std::array<std::pair<std::string, size_t>, 2> ais_columns { {
|
||||
{ "MMSI", 9 },
|
||||
{ "Name/Call", 20 },
|
||||
} };
|
||||
|
||||
template<>
|
||||
void RecentEntriesView<AISRecentEntries>::draw_header(
|
||||
void RecentEntriesTable<AISRecentEntries>::draw(
|
||||
const Entry& entry,
|
||||
const Rect& target_rect,
|
||||
Painter& painter,
|
||||
const Style& style
|
||||
) {
|
||||
auto x = 0;
|
||||
for(const auto& column : ais_columns) {
|
||||
const auto width = column.second;
|
||||
auto text = column.first;
|
||||
if( width > text.length() ) {
|
||||
text.append(width - text.length(), ' ');
|
||||
}
|
||||
|
||||
painter.draw_string({ x, target_rect.pos.y }, style, text);
|
||||
x += (width * 8) + 8;
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
void RecentEntriesView<AISRecentEntries>::draw(
|
||||
const Entry& entry,
|
||||
const Rect& target_rect,
|
||||
Painter& painter,
|
||||
const Style& style,
|
||||
const bool is_selected
|
||||
) {
|
||||
const auto& draw_style = is_selected ? style.invert() : style;
|
||||
|
||||
std::string line = ais::format::mmsi(entry.mmsi) + " ";
|
||||
if( !entry.name.empty() ) {
|
||||
line += entry.name;
|
||||
@@ -227,13 +200,13 @@ void RecentEntriesView<AISRecentEntries>::draw(
|
||||
}
|
||||
|
||||
line.resize(target_rect.width() / 8, ' ');
|
||||
painter.draw_string(target_rect.pos, draw_style, line);
|
||||
painter.draw_string(target_rect.location(), style, line);
|
||||
}
|
||||
|
||||
AISRecentEntryDetailView::AISRecentEntryDetailView() {
|
||||
add_children({ {
|
||||
add_children({
|
||||
&button_done,
|
||||
} });
|
||||
});
|
||||
|
||||
button_done.on_select = [this](const ui::Button&) {
|
||||
if( this->on_close ) {
|
||||
@@ -291,7 +264,7 @@ void AISRecentEntryDetailView::set_entry(const AISRecentEntry& entry) {
|
||||
AISAppView::AISAppView(NavigationView&) {
|
||||
baseband::run_image(portapack::spi_flash::image_tag_ais);
|
||||
|
||||
add_children({ {
|
||||
add_children({
|
||||
&label_channel,
|
||||
&options_channel,
|
||||
&field_rf_amp,
|
||||
@@ -301,7 +274,7 @@ AISAppView::AISAppView(NavigationView&) {
|
||||
&channel,
|
||||
&recent_entries_view,
|
||||
&recent_entry_detail_view,
|
||||
} });
|
||||
});
|
||||
|
||||
recent_entry_detail_view.hidden(true);
|
||||
|
||||
@@ -315,7 +288,6 @@ AISAppView::AISAppView(NavigationView&) {
|
||||
receiver_model.rf_amp(),
|
||||
static_cast<int8_t>(receiver_model.lna()),
|
||||
static_cast<int8_t>(receiver_model.vga()),
|
||||
1,
|
||||
});
|
||||
|
||||
options_channel.on_change = [this](size_t, OptionsField::value_t v) {
|
||||
@@ -332,7 +304,7 @@ AISAppView::AISAppView(NavigationView&) {
|
||||
|
||||
logger = std::make_unique<AISLogger>();
|
||||
if( logger ) {
|
||||
logger->append("ais.txt");
|
||||
logger->append(u"ais.txt");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,12 +330,13 @@ void AISAppView::on_packet(const ais::Packet& packet) {
|
||||
logger->on_packet(packet);
|
||||
}
|
||||
|
||||
const auto updated_entry = recent.on_packet(packet.source_id(), packet);
|
||||
auto& entry = ::on_packet(recent, packet.source_id());
|
||||
entry.update(packet);
|
||||
recent_entries_view.set_dirty();
|
||||
|
||||
// TODO: Crude hack, should be a more formal listener arrangement...
|
||||
if( updated_entry.key() == recent_entry_detail_view.entry().key() ) {
|
||||
recent_entry_detail_view.set_entry(updated_entry);
|
||||
if( entry.key() == recent_entry_detail_view.entry().key() ) {
|
||||
recent_entry_detail_view.set_entry(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ using namespace lpc43xx;
|
||||
|
||||
struct AISPosition {
|
||||
rtc::RTC timestamp { };
|
||||
ais::Latitude latitude;
|
||||
ais::Longitude longitude;
|
||||
ais::Latitude latitude { };
|
||||
ais::Longitude longitude { };
|
||||
ais::RateOfTurn rate_of_turn { -128 };
|
||||
ais::SpeedOverGround speed_over_ground { 1023 };
|
||||
ais::CourseOverGround course_over_ground { 3600 };
|
||||
@@ -78,6 +78,9 @@ struct AISRecentEntry {
|
||||
AISRecentEntry(
|
||||
const ais::MMSI& mmsi
|
||||
) : mmsi { mmsi },
|
||||
name { },
|
||||
call_sign { },
|
||||
destination { },
|
||||
last_position { },
|
||||
received_count { 0 },
|
||||
navigational_status { -1 }
|
||||
@@ -91,18 +94,18 @@ struct AISRecentEntry {
|
||||
void update(const ais::Packet& packet);
|
||||
};
|
||||
|
||||
using AISRecentEntries = RecentEntries<ais::Packet, AISRecentEntry>;
|
||||
using AISRecentEntries = RecentEntries<AISRecentEntry>;
|
||||
|
||||
class AISLogger {
|
||||
public:
|
||||
Optional<File::Error> append(const std::string& filename) {
|
||||
Optional<File::Error> append(const std::filesystem::path& filename) {
|
||||
return log_file.append(filename);
|
||||
}
|
||||
|
||||
void on_packet(const ais::Packet& packet);
|
||||
|
||||
private:
|
||||
LogFile log_file;
|
||||
LogFile log_file { };
|
||||
};
|
||||
|
||||
namespace ui {
|
||||
@@ -111,7 +114,7 @@ using AISRecentEntriesView = RecentEntriesView<AISRecentEntries>;
|
||||
|
||||
class AISRecentEntryDetailView : public View {
|
||||
public:
|
||||
std::function<void(void)> on_close;
|
||||
std::function<void(void)> on_close { };
|
||||
|
||||
AISRecentEntryDetailView();
|
||||
|
||||
@@ -122,7 +125,7 @@ public:
|
||||
void paint(Painter&) override;
|
||||
|
||||
private:
|
||||
AISRecentEntry entry_;
|
||||
AISRecentEntry entry_ { };
|
||||
|
||||
Button button_done {
|
||||
{ 72, 216, 96, 24 },
|
||||
@@ -158,11 +161,15 @@ private:
|
||||
static constexpr uint32_t sampling_rate = 2457600;
|
||||
static constexpr uint32_t baseband_bandwidth = 1750000;
|
||||
|
||||
AISRecentEntries recent;
|
||||
std::unique_ptr<AISLogger> logger;
|
||||
AISRecentEntries recent { };
|
||||
std::unique_ptr<AISLogger> logger { };
|
||||
|
||||
AISRecentEntriesView recent_entries_view { recent };
|
||||
AISRecentEntryDetailView recent_entry_detail_view;
|
||||
const RecentEntriesColumns columns { {
|
||||
{ "MMSI", 9 },
|
||||
{ "Name/Call", 20 },
|
||||
} };
|
||||
AISRecentEntriesView recent_entries_view { columns, recent };
|
||||
AISRecentEntryDetailView recent_entry_detail_view { };
|
||||
|
||||
static constexpr auto header_height = 1 * 16;
|
||||
|
||||
|
||||
@@ -44,10 +44,10 @@ AMOptionsView::AMOptionsView(
|
||||
{
|
||||
set_style(style);
|
||||
|
||||
add_children({ {
|
||||
add_children({
|
||||
&label_config,
|
||||
&options_config,
|
||||
} });
|
||||
});
|
||||
|
||||
options_config.set_selected_index(receiver_model.am_configuration());
|
||||
options_config.on_change = [this](size_t n, OptionsField::value_t) {
|
||||
@@ -63,10 +63,10 @@ NBFMOptionsView::NBFMOptionsView(
|
||||
{
|
||||
set_style(style);
|
||||
|
||||
add_children({ {
|
||||
add_children({
|
||||
&label_config,
|
||||
&options_config,
|
||||
} });
|
||||
});
|
||||
|
||||
options_config.set_selected_index(receiver_model.nbfm_configuration());
|
||||
options_config.on_change = [this](size_t n, OptionsField::value_t) {
|
||||
@@ -79,7 +79,7 @@ NBFMOptionsView::NBFMOptionsView(
|
||||
AnalogAudioView::AnalogAudioView(
|
||||
NavigationView& nav
|
||||
) {
|
||||
add_children({ {
|
||||
add_children({
|
||||
&rssi,
|
||||
&channel,
|
||||
&audio,
|
||||
@@ -90,7 +90,7 @@ AnalogAudioView::AnalogAudioView(
|
||||
&field_volume,
|
||||
&record_view,
|
||||
&waterfall,
|
||||
} });
|
||||
});
|
||||
|
||||
field_frequency.set_value(receiver_model.tuning_frequency());
|
||||
field_frequency.set_step(receiver_model.frequency_step());
|
||||
@@ -161,7 +161,7 @@ void AnalogAudioView::on_hide() {
|
||||
void AnalogAudioView::set_parent_rect(const Rect new_parent_rect) {
|
||||
View::set_parent_rect(new_parent_rect);
|
||||
|
||||
const ui::Rect waterfall_rect { 0, header_height, new_parent_rect.width(), static_cast<ui::Dim>(new_parent_rect.height() - header_height) };
|
||||
const ui::Rect waterfall_rect { 0, header_height, new_parent_rect.width(), new_parent_rect.height() - header_height };
|
||||
waterfall.set_parent_rect(waterfall_rect);
|
||||
}
|
||||
|
||||
|
||||
@@ -139,14 +139,14 @@ private:
|
||||
' ',
|
||||
};
|
||||
|
||||
std::unique_ptr<Widget> options_widget;
|
||||
std::unique_ptr<Widget> options_widget { };
|
||||
|
||||
RecordView record_view {
|
||||
{ 0 * 8, 2 * 16, 30 * 8, 1 * 16 },
|
||||
"AUD_????", RecordView::FileType::WAV, 4096, 4
|
||||
u"AUD_????", RecordView::FileType::WAV, 4096, 4
|
||||
};
|
||||
|
||||
spectrum::WaterfallWidget waterfall;
|
||||
spectrum::WaterfallWidget waterfall { };
|
||||
|
||||
void on_tuning_frequency_changed(rf::Frequency f);
|
||||
void on_baseband_bandwidth_changed(uint32_t bandwidth_hz);
|
||||
|
||||
@@ -225,4 +225,14 @@ void capture_stop() {
|
||||
send_message(&message);
|
||||
}
|
||||
|
||||
void replay_start(CaptureConfig* const config) {
|
||||
CaptureConfigMessage message { config };
|
||||
send_message(&message);
|
||||
}
|
||||
|
||||
void replay_stop() {
|
||||
CaptureConfigMessage message { nullptr };
|
||||
send_message(&message);
|
||||
}
|
||||
|
||||
} /* namespace baseband */
|
||||
|
||||
@@ -75,6 +75,8 @@ void spectrum_streaming_stop();
|
||||
|
||||
void capture_start(CaptureConfig* const config);
|
||||
void capture_stop();
|
||||
void replay_start(CaptureConfig* const config);
|
||||
void replay_stop();
|
||||
|
||||
} /* namespace baseband */
|
||||
|
||||
|
||||
@@ -27,25 +27,12 @@ using namespace hackrf::one;
|
||||
namespace baseband {
|
||||
|
||||
void CPLD::init() {
|
||||
set_decimation_by(1);
|
||||
gpios_baseband_decimation[0].output();
|
||||
gpios_baseband_decimation[1].output();
|
||||
gpios_baseband_decimation[2].output();
|
||||
|
||||
set_q_invert(false);
|
||||
gpio_baseband_q_invert.output();
|
||||
set_invert(false);
|
||||
gpio_baseband_invert.output();
|
||||
}
|
||||
|
||||
void CPLD::set_decimation_by(const uint8_t n) {
|
||||
const uint8_t skip_n = n - 1;
|
||||
const uint8_t value = skip_n ^ 7;
|
||||
gpios_baseband_decimation[0].write(value & 1);
|
||||
gpios_baseband_decimation[1].write(value & 2);
|
||||
gpios_baseband_decimation[2].write(value & 4);
|
||||
}
|
||||
|
||||
void CPLD::set_q_invert(const bool invert) {
|
||||
gpio_baseband_q_invert.write(invert);
|
||||
void CPLD::set_invert(const bool invert) {
|
||||
gpio_baseband_invert.write(invert);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,8 +30,7 @@ class CPLD {
|
||||
public:
|
||||
void init();
|
||||
|
||||
void set_decimation_by(const uint8_t n);
|
||||
void set_q_invert(const bool invert);
|
||||
void set_invert(const bool invert);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace ui {
|
||||
CaptureAppView::CaptureAppView(NavigationView& nav) {
|
||||
baseband::run_image(portapack::spi_flash::image_tag_capture);
|
||||
|
||||
add_children({ {
|
||||
add_children({
|
||||
&rssi,
|
||||
&channel,
|
||||
&field_frequency,
|
||||
@@ -44,7 +44,7 @@ CaptureAppView::CaptureAppView(NavigationView& nav) {
|
||||
&field_vga,
|
||||
&record_view,
|
||||
&waterfall,
|
||||
} });
|
||||
});
|
||||
|
||||
field_frequency.set_value(target_frequency());
|
||||
field_frequency.set_step(receiver_model.frequency_step());
|
||||
@@ -74,7 +74,6 @@ CaptureAppView::CaptureAppView(NavigationView& nav) {
|
||||
receiver_model.rf_amp(),
|
||||
static_cast<int8_t>(receiver_model.lna()),
|
||||
static_cast<int8_t>(receiver_model.vga()),
|
||||
1,
|
||||
});
|
||||
|
||||
record_view.set_sampling_rate(sampling_rate / 8);
|
||||
@@ -99,7 +98,7 @@ void CaptureAppView::on_hide() {
|
||||
void CaptureAppView::set_parent_rect(const Rect new_parent_rect) {
|
||||
View::set_parent_rect(new_parent_rect);
|
||||
|
||||
const ui::Rect waterfall_rect { 0, header_height, new_parent_rect.width(), static_cast<ui::Dim>(new_parent_rect.height() - header_height) };
|
||||
const ui::Rect waterfall_rect { 0, header_height, new_parent_rect.width(), new_parent_rect.height() - header_height };
|
||||
waterfall.set_parent_rect(waterfall_rect);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,10 +89,10 @@ private:
|
||||
|
||||
RecordView record_view {
|
||||
{ 0 * 8, 1 * 16, 30 * 8, 1 * 16 },
|
||||
"BBD_????", RecordView::FileType::RawS16, 16384, 3
|
||||
u"BBD_????", RecordView::FileType::RawS16, 16384, 3
|
||||
};
|
||||
|
||||
spectrum::WaterfallWidget waterfall;
|
||||
spectrum::WaterfallWidget waterfall { };
|
||||
};
|
||||
|
||||
} /* namespace ui */
|
||||
|
||||
@@ -22,60 +22,22 @@
|
||||
#include "capture_thread.hpp"
|
||||
|
||||
#include "baseband_api.hpp"
|
||||
#include "buffer_exchange.hpp"
|
||||
|
||||
// StreamOutput ///////////////////////////////////////////////////////////
|
||||
|
||||
class StreamOutput {
|
||||
public:
|
||||
StreamOutput(CaptureConfig* const config);
|
||||
~StreamOutput();
|
||||
|
||||
size_t available() {
|
||||
return fifo_buffers_full->len();
|
||||
struct BasebandCapture {
|
||||
BasebandCapture(CaptureConfig* const config) {
|
||||
baseband::capture_start(config);
|
||||
}
|
||||
|
||||
StreamBuffer* get_buffer() {
|
||||
StreamBuffer* p { nullptr };
|
||||
fifo_buffers_full->out(p);
|
||||
return p;
|
||||
~BasebandCapture() {
|
||||
baseband::capture_stop();
|
||||
}
|
||||
|
||||
bool release_buffer(StreamBuffer* const p) {
|
||||
p->empty();
|
||||
return fifo_buffers_empty->in(p);
|
||||
}
|
||||
|
||||
static FIFO<StreamBuffer*>* fifo_buffers_empty;
|
||||
static FIFO<StreamBuffer*>* fifo_buffers_full;
|
||||
|
||||
private:
|
||||
CaptureConfig* const config;
|
||||
};
|
||||
|
||||
FIFO<StreamBuffer*>* StreamOutput::fifo_buffers_empty = nullptr;
|
||||
FIFO<StreamBuffer*>* StreamOutput::fifo_buffers_full = nullptr;
|
||||
|
||||
StreamOutput::StreamOutput(
|
||||
CaptureConfig* const config
|
||||
) : config { config }
|
||||
{
|
||||
baseband::capture_start(config);
|
||||
fifo_buffers_empty = config->fifo_buffers_empty;
|
||||
fifo_buffers_full = config->fifo_buffers_full;
|
||||
}
|
||||
|
||||
StreamOutput::~StreamOutput() {
|
||||
fifo_buffers_full = nullptr;
|
||||
fifo_buffers_empty = nullptr;
|
||||
baseband::capture_stop();
|
||||
}
|
||||
|
||||
// CaptureThread //////////////////////////////////////////////////////////
|
||||
|
||||
Thread* CaptureThread::thread = nullptr;
|
||||
|
||||
CaptureThread::CaptureThread(
|
||||
std::unique_ptr<Writer> writer,
|
||||
std::unique_ptr<stream::Writer> writer,
|
||||
size_t write_size,
|
||||
size_t buffer_count,
|
||||
std::function<void()> success_callback,
|
||||
@@ -92,23 +54,11 @@ CaptureThread::CaptureThread(
|
||||
CaptureThread::~CaptureThread() {
|
||||
if( thread ) {
|
||||
chThdTerminate(thread);
|
||||
chEvtSignal(thread, event_mask_loop_wake);
|
||||
chThdWait(thread);
|
||||
thread = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureThread::check_fifo_isr() {
|
||||
// TODO: Prevent over-signalling by transmitting a set of
|
||||
// flags from the baseband core.
|
||||
const auto fifo = StreamOutput::fifo_buffers_full;
|
||||
if( fifo ) {
|
||||
if( !fifo->is_empty() ) {
|
||||
chEvtSignalI(thread, event_mask_loop_wake);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
msg_t CaptureThread::static_fn(void* arg) {
|
||||
auto obj = static_cast<CaptureThread*>(arg);
|
||||
const auto error = obj->run();
|
||||
@@ -123,19 +73,17 @@ msg_t CaptureThread::static_fn(void* arg) {
|
||||
}
|
||||
|
||||
Optional<File::Error> CaptureThread::run() {
|
||||
StreamOutput stream { &config };
|
||||
BasebandCapture capture { &config };
|
||||
BufferExchange buffers { &config };
|
||||
|
||||
while( !chThdShouldTerminate() ) {
|
||||
if( stream.available() ) {
|
||||
auto buffer = stream.get_buffer();
|
||||
auto write_result = writer->write(buffer->data(), buffer->size());
|
||||
if( write_result.is_error() ) {
|
||||
return write_result.error();
|
||||
}
|
||||
stream.release_buffer(buffer);
|
||||
} else {
|
||||
chEvtWaitAny(event_mask_loop_wake);
|
||||
auto buffer = buffers.get();
|
||||
auto write_result = writer->write(buffer->data(), buffer->size());
|
||||
if( write_result.is_error() ) {
|
||||
return write_result.error();
|
||||
}
|
||||
buffer->empty();
|
||||
buffers.put(buffer);
|
||||
}
|
||||
|
||||
return { };
|
||||
|
||||
@@ -26,23 +26,17 @@
|
||||
|
||||
#include "event_m0.hpp"
|
||||
|
||||
#include "file.hpp"
|
||||
#include "io.hpp"
|
||||
#include "optional.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
||||
class Writer {
|
||||
public:
|
||||
virtual File::Result<size_t> write(const void* const buffer, const size_t bytes) = 0;
|
||||
virtual ~Writer() = default;
|
||||
};
|
||||
|
||||
class CaptureThread {
|
||||
public:
|
||||
CaptureThread(
|
||||
std::unique_ptr<Writer> writer,
|
||||
std::unique_ptr<stream::Writer> writer,
|
||||
size_t write_size,
|
||||
size_t buffer_count,
|
||||
std::function<void()> success_callback,
|
||||
@@ -50,20 +44,21 @@ public:
|
||||
);
|
||||
~CaptureThread();
|
||||
|
||||
CaptureThread(const CaptureThread&) = delete;
|
||||
CaptureThread(CaptureThread&&) = delete;
|
||||
CaptureThread& operator=(const CaptureThread&) = delete;
|
||||
CaptureThread& operator=(CaptureThread&&) = delete;
|
||||
|
||||
const CaptureConfig& state() const {
|
||||
return config;
|
||||
}
|
||||
|
||||
static void check_fifo_isr();
|
||||
|
||||
private:
|
||||
static constexpr auto event_mask_loop_wake = EVENT_MASK(0);
|
||||
|
||||
CaptureConfig config;
|
||||
std::unique_ptr<Writer> writer;
|
||||
std::unique_ptr<stream::Writer> writer;
|
||||
std::function<void()> success_callback;
|
||||
std::function<void(File::Error)> error_callback;
|
||||
static Thread* thread;
|
||||
Thread* thread { nullptr };
|
||||
|
||||
static msg_t static_fn(void* arg);
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ constexpr ClockControl::Type si5351_clock_control_ms_src_clkin = ClockControl::M
|
||||
|
||||
constexpr ClockControls si5351_clock_control_common {
|
||||
ClockControl::CLK_IDRV_6mA | ClockControl::CLK_SRC_MS_Self | ClockControl::CLK_INV_Normal | ClockControl::MS_INT_Fractional | ClockControl::CLK_PDN_Power_Off,
|
||||
ClockControl::CLK_IDRV_6mA | ClockControl::CLK_SRC_MS_Group | ClockControl::CLK_INV_Normal | ClockControl::MS_INT_Integer | ClockControl::CLK_PDN_Power_Off,
|
||||
ClockControl::CLK_IDRV_6mA | ClockControl::CLK_SRC_MS_Group | ClockControl::CLK_INV_Invert | ClockControl::MS_INT_Integer | ClockControl::CLK_PDN_Power_Off,
|
||||
ClockControl::CLK_IDRV_6mA | ClockControl::CLK_SRC_MS_Group | ClockControl::CLK_INV_Normal | ClockControl::MS_INT_Integer | ClockControl::CLK_PDN_Power_Off,
|
||||
ClockControl::CLK_IDRV_8mA | ClockControl::CLK_SRC_MS_Self | ClockControl::CLK_INV_Normal | ClockControl::MS_INT_Integer | ClockControl::CLK_PDN_Power_Off,
|
||||
ClockControl::CLK_IDRV_8mA | ClockControl::CLK_SRC_MS_Self | ClockControl::CLK_INV_Normal | ClockControl::MS_INT_Integer | ClockControl::CLK_PDN_Power_Off,
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
mask_t mask;
|
||||
mask_t mask { };
|
||||
};
|
||||
|
||||
#endif/*__DIRTY_REGISTERS_H__*/
|
||||
|
||||
@@ -75,42 +75,13 @@ void ERTRecentEntry::update(const ert::Packet& packet) {
|
||||
|
||||
namespace ui {
|
||||
|
||||
static const std::array<std::pair<std::string, size_t>, 4> ert_columns { {
|
||||
{ "ID", 10 },
|
||||
{ "Tp", 2 },
|
||||
{ "Consumpt", 10 },
|
||||
{ "Cnt", 3 },
|
||||
} };
|
||||
|
||||
template<>
|
||||
void RecentEntriesView<ERTRecentEntries>::draw_header(
|
||||
void RecentEntriesTable<ERTRecentEntries>::draw(
|
||||
const Entry& entry,
|
||||
const Rect& target_rect,
|
||||
Painter& painter,
|
||||
const Style& style
|
||||
) {
|
||||
auto x = 0;
|
||||
for(const auto& column : ert_columns) {
|
||||
const auto width = column.second;
|
||||
auto text = column.first;
|
||||
if( width > text.length() ) {
|
||||
text.append(width - text.length(), ' ');
|
||||
}
|
||||
|
||||
painter.draw_string({ x, target_rect.pos.y }, style, text);
|
||||
x += (width * 8) + 8;
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
void RecentEntriesView<ERTRecentEntries>::draw(
|
||||
const Entry& entry,
|
||||
const Rect& target_rect,
|
||||
Painter& painter,
|
||||
const Style& style,
|
||||
const bool is_selected
|
||||
) {
|
||||
const auto& draw_style = is_selected ? style.invert() : style;
|
||||
|
||||
std::string line = ert::format::id(entry.id) + " " + ert::format::commodity_type(entry.commodity_type) + " " + ert::format::consumption(entry.last_consumption);
|
||||
|
||||
if( entry.received_count > 999 ) {
|
||||
@@ -120,19 +91,19 @@ void RecentEntriesView<ERTRecentEntries>::draw(
|
||||
}
|
||||
|
||||
line.resize(target_rect.width() / 8, ' ');
|
||||
painter.draw_string(target_rect.pos, draw_style, line);
|
||||
painter.draw_string(target_rect.location(), style, line);
|
||||
}
|
||||
|
||||
ERTAppView::ERTAppView(NavigationView&) {
|
||||
baseband::run_image(portapack::spi_flash::image_tag_ert);
|
||||
|
||||
add_children({ {
|
||||
add_children({
|
||||
&field_rf_amp,
|
||||
&field_lna,
|
||||
&field_vga,
|
||||
&rssi,
|
||||
&recent_entries_view,
|
||||
} });
|
||||
});
|
||||
|
||||
radio::enable({
|
||||
initial_target_frequency,
|
||||
@@ -142,12 +113,11 @@ ERTAppView::ERTAppView(NavigationView&) {
|
||||
receiver_model.rf_amp(),
|
||||
static_cast<int8_t>(receiver_model.lna()),
|
||||
static_cast<int8_t>(receiver_model.vga()),
|
||||
1,
|
||||
});
|
||||
|
||||
logger = std::make_unique<ERTLogger>();
|
||||
if( logger ) {
|
||||
logger->append("ert.txt");
|
||||
logger->append(u"ert.txt");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +142,8 @@ void ERTAppView::on_packet(const ert::Packet& packet) {
|
||||
}
|
||||
|
||||
if( packet.crc_ok() ) {
|
||||
recent.on_packet({ packet.id(), packet.commodity_type() }, packet);
|
||||
auto& entry = ::on_packet(recent, ERTRecentEntry::Key { packet.id(), packet.commodity_type() });
|
||||
entry.update(packet);
|
||||
recent_entries_view.set_dirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ struct ERTRecentEntry {
|
||||
|
||||
size_t received_count { 0 };
|
||||
|
||||
ert::Consumption last_consumption;
|
||||
ert::Consumption last_consumption { };
|
||||
|
||||
ERTRecentEntry(
|
||||
const Key& key
|
||||
@@ -90,17 +90,17 @@ struct ERTRecentEntry {
|
||||
|
||||
class ERTLogger {
|
||||
public:
|
||||
Optional<File::Error> append(const std::string& filename) {
|
||||
Optional<File::Error> append(const std::filesystem::path& filename) {
|
||||
return log_file.append(filename);
|
||||
}
|
||||
|
||||
void on_packet(const ert::Packet& packet);
|
||||
|
||||
private:
|
||||
LogFile log_file;
|
||||
LogFile log_file { };
|
||||
};
|
||||
|
||||
using ERTRecentEntries = RecentEntries<ert::Packet, ERTRecentEntry>;
|
||||
using ERTRecentEntries = RecentEntries<ERTRecentEntry>;
|
||||
|
||||
namespace ui {
|
||||
|
||||
@@ -126,10 +126,16 @@ public:
|
||||
std::string title() const override { return "ERT"; };
|
||||
|
||||
private:
|
||||
ERTRecentEntries recent;
|
||||
std::unique_ptr<ERTLogger> logger;
|
||||
ERTRecentEntries recent { };
|
||||
std::unique_ptr<ERTLogger> logger { };
|
||||
|
||||
ERTRecentEntriesView recent_entries_view { recent };
|
||||
const RecentEntriesColumns columns { {
|
||||
{ "ID", 10 },
|
||||
{ "Tp", 2 },
|
||||
{ "Consumpt", 10 },
|
||||
{ "Cnt", 3 },
|
||||
} };
|
||||
ERTRecentEntriesView recent_entries_view { columns, recent };
|
||||
|
||||
static constexpr auto header_height = 1 * 16;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user