Commit Graph

579 Commits

Author SHA1 Message Date
Jared Boone
0d8971cd7d Use size of provided buffer for stream write. 2016-04-11 10:20:19 -07:00
Jared Boone
56e448d355 Track StreamInput bytes written 2016-04-11 10:20:19 -07:00
Jared Boone
f94938db8e De-template FIFO. 2016-04-11 10:20:19 -07:00
Jared Boone
59f1a32566 Semi-naive audio recording to SD card. 2016-04-11 10:20:19 -07:00
Jared Boone
c01f2d82e1 Move TPMS taps to dsp_fir_taps.hpp.
Will soon use in proc_record.cpp.
2016-04-11 10:18:31 -07:00
Jared Boone
4ac2c540c9 Disable SDC "nice waiting" for performance.
Quick test indicates 4.5% better average write performance. No change in reads.
2016-04-10 17:24:28 -07:00
Jared Boone
b35a8c4501 Add TPMS signal_type. 2016-04-06 17:04:40 -07:00
Jared Boone
bf348cf30a Move message handling loops to MessageQueue. 2016-02-27 21:07:11 -08:00
Jared Boone
6101ca36cd Use unique_ptr for baseband_buffer. 2016-02-23 20:21:32 -08:00
Jared Boone
3493b7d1b7 Hide BasebandThread::baseband_processor. 2016-02-23 19:56:55 -08:00
Jared Boone
a1b9f4aa1b Simplify, generalize, share int16_t taps copy function.
Also prevents compiler loop unrolling in non-critical code, for code size improvement.
2016-02-23 15:04:20 -08:00
Jared Boone
9c11fdf80c Explicit std::function nullptr checks.
Eliminates std::function check which tries to "_ZSt25__throw_bad_function_callv", along with 816 bytes of extra code, including some locale/wlocale/moneypunct nonsense.
2016-02-23 13:30:41 -08:00
Jared Boone
0c29308eb9 Fix FM squelch.
Forgot to recalibrate when adjusting normalization of float/audio signal path.
2016-02-16 11:32:38 -08:00
Jared Boone
ef86848139 Change baseband floats to normalize at +/-1.0. 2016-02-14 12:38:50 -08:00
Jared Boone
a5ed3b20b4 Audio compressor makeup gain value was inverted. Oops. 2016-02-14 12:17:04 -08:00
Jared Boone
1cdeb1ca4e Use audio compressor in AM/SSB receiver mode. 2016-02-13 11:19:32 -08:00
Jared Boone
9f4c8929ac Audio compressor implementation. 2016-02-13 11:19:07 -08:00
Jared Boone
b0e76191d7 Simplify some silly math. 2016-02-10 11:23:41 -08:00
Jared Boone
d125a5c662 Remove "K" parameter from FIFO template. 2016-02-10 10:41:06 -08:00
Jared Boone
096e961c67 Remove ChibiOS registry, thread names.
Only useful for debugging, but even then not very visible or useful. Gained 256 bytes of code RAM.
2016-02-09 11:36:38 -08:00
Jared Boone
ae93d8ee58 Simplify RSSI/BB DMA, extract to ThreadWait class.
Also saved 688 bytes of code.
2016-02-09 10:41:19 -08:00
Jared Boone
aae1a953fc Init matched filter output variable. 2016-02-06 16:24:14 -08:00
Jared Boone
ac2320f0c5 Limit scope of some function variables. 2016-02-06 16:23:55 -08:00
furrtek
ba94ce55ef Loadmodule emergency fix 2016-02-06 23:19:28 +01:00
Jared Boone
9430c94dec Move I2S management to application side. 2016-02-05 15:25:08 -08:00
Jared Boone
cefab197da Add virtual destructor for ThreadBase.
Oops!
2016-02-05 10:44:27 -08:00
furrtek
c81ba5be8e "At least it builds, now" 2016-02-05 17:40:14 +01:00
furrtek
8009a9b543 Merge remote-tracking branch 'upstream/master'
Conflicts:
	firmware/application/Makefile
	firmware/application/analog_audio_app.cpp
	firmware/application/analog_audio_app.hpp
	firmware/application/event.cpp
	firmware/application/irq_ipc.hpp
	firmware/application/portapack.hpp
	firmware/application/receiver_model.cpp
	firmware/application/receiver_model.hpp
	firmware/application/recent_entries.cpp
	firmware/application/string_format.hpp
	firmware/application/ui_debug.cpp
	firmware/application/ui_debug.hpp
	firmware/application/ui_menu.cpp
	firmware/application/ui_navigation.cpp
	firmware/application/ui_navigation.hpp
	firmware/application/ui_receiver.cpp
	firmware/application/ui_receiver.hpp
	firmware/application/ui_sd_card_status_view.cpp
	firmware/application/ui_sd_card_status_view.hpp
	firmware/application/ui_setup.cpp
	firmware/application/ui_setup.hpp
	firmware/application/ui_spectrum.hpp
	firmware/baseband-tx/dsp_fir_taps.cpp
	firmware/baseband-tx/dsp_fir_taps.hpp
	firmware/baseband-tx/irq_ipc_m4.cpp
	firmware/baseband-tx/irq_ipc_m4.hpp
	firmware/baseband-tx/proc_audiotx.cpp
	firmware/baseband/Makefile
	firmware/baseband/audio_output.cpp
	firmware/baseband/audio_output.hpp
	firmware/baseband/block_decimator.hpp
	firmware/baseband/dsp_decimate.cpp
	firmware/baseband/dsp_decimate.hpp
	firmware/baseband/dsp_demodulate.cpp
	firmware/baseband/dsp_demodulate.hpp
	firmware/baseband/dsp_fir_taps.cpp
	firmware/baseband/irq_ipc_m4.cpp
	firmware/baseband/irq_ipc_m4.hpp
	firmware/baseband/proc_am_audio.cpp
	firmware/baseband/proc_am_audio.hpp
	firmware/baseband/proc_nfm_audio.cpp
	firmware/baseband/proc_nfm_audio.hpp
	firmware/baseband/proc_wfm_audio.cpp
	firmware/baseband/proc_wfm_audio.hpp
	firmware/baseband/spectrum_collector.hpp
	firmware/common/dsp_fir_taps.cpp
	firmware/common/dsp_fir_taps.hpp
	firmware/common/event.hpp
	firmware/common/message.hpp
	firmware/common/ui_painter.cpp
	firmware/common/ui_painter.hpp
2016-02-04 11:35:55 +01:00
furrtek
6e496e2b26 Merge fixing, commit to catch up on recent files 2016-02-04 10:27:53 +01:00
Jared Boone
20137db8d0 Move code into .cpp for tiny code size improvement. 2016-02-03 22:47:44 -08:00
Jared Boone
af8c9609a8 Little code size tweak using std::move in constructors. 2016-02-03 22:47:22 -08:00
Jared Boone
cff314cbc8 Convince compiler to not inline member constructors. 2016-02-03 19:59:41 -08:00
Jared Boone
ceef8d32d3 Use more accurate arctan for NBFM demodulation. 2016-02-02 16:15:14 -08:00
Jared Boone
ab2c5b256f Reinstate and slightly tweak NBFM squelch. 2016-02-02 16:08:18 -08:00
furrtek
44638e504b SYNC 2016-01-31 09:34:24 +01:00
Jared Boone
faf0fd6b91 Remove some spurious comments. 2016-01-30 21:11:59 -08:00
Jared Boone
e778be6472 Selection of AM/SSB from application side. 2016-01-30 18:02:28 -08:00
Jared Boone
f2dff16820 Use complex channel filter taps for AM/SSB. 2016-01-30 17:30:54 -08:00
Jared Boone
ad4d7a2e8a Add SSB demodulator, switch between AM and SSB. 2016-01-30 17:30:03 -08:00
Jared Boone
1915ff980f Add AM processor decim_2. 2016-01-30 17:28:11 -08:00
Jared Boone
b029bacd8c Remove channel decimation from AMConfigureMessage. 2016-01-30 17:21:48 -08:00
Jared Boone
220b7b0a6a Add SSB demodulator. 2016-01-29 22:27:18 -08:00
Jared Boone
a558565886 Further template BlockDecimator by element type, use for audio buffer.
Appropriating for use as a buffer accumulator that will save up enough audio samples to put into an audio DMA buffer.
2016-01-29 19:25:08 -08:00
Jared Boone
aead1d8798 Change NBFM audio fs->24k, AM ->12k.
Send channel decimation factor from application to baseband.
2016-01-29 19:23:30 -08:00
Jared Boone
28e5b7e4af Remove some filter constructors, reset Z on configure(). 2016-01-29 17:06:22 -08:00
Jared Boone
d984532190 Converging AM, NBFM processors for eventual merging. 2016-01-29 16:18:03 -08:00
Jared Boone
7c65a2d650 Clean up baseband processor statics. 2016-01-29 16:11:00 -08:00
Jared Boone
96898f82b2 Pass IIR configs from application to baseband. 2016-01-29 15:57:20 -08:00
Jared Boone
01e14ecbcf Move IIR struct and configs to common/. 2016-01-29 15:43:39 -08:00
Jared Boone
db642cac8d Change audio sampling rates on NBFM, AM modes. 2016-01-29 15:33:01 -08:00
Jared Boone
0e436ded14 Add IIR configs for lower audio sampling rates. 2016-01-29 15:32:32 -08:00
Jared Boone
a2a169352c Rename existing IIR configs to reflect fs=48k design. 2016-01-29 15:24:31 -08:00
Jared Boone
1aa391bac8 Whoops. Revert to baseband -O3 compiler flag.
Was running out of CPU in ERT mode.
2016-01-17 14:08:49 -08:00
Jared Boone
8d2a86a499 Change baseband optimization from -O3 to -O2
Significant size benefit with negligable performance effect.
2016-01-16 14:10:22 -08:00
Jared Boone
58e6d26910 Move AudioOutput back to inside audio processor classes.
Was wasting precious RAM making it static. I lose 400 bytes of .text, not sure why, but I think the trade is worth it.
2016-01-16 13:56:23 -08:00
Jared Boone
1d0de2240d Protect/private some ThreadBase implementation details. 2016-01-15 20:25:29 -08:00
Jared Boone
f06d5989db Move EventDispatcher code out of .hpp. 2016-01-12 22:20:13 -08:00
Jared Boone
731cea1b96 Move event.* code into event_m[04].*.
Slightly more duplication of code now. Need a base class...
2016-01-12 22:00:42 -08:00
Jared Boone
e73a9f98a1 Move EventDispatcher code into event_*.hpp.
More code redistribution coming shortly...
2016-01-12 21:49:29 -08:00
Jared Boone
b993e3d73e Consolidate spectrum collector message handling. 2016-01-12 10:32:00 -08:00
Jared Boone
a577bc9664 Refactor naughty static variable hiding in WidebandSpectrum. 2016-01-11 17:18:24 -08:00
Jared Boone
1f3c182b7f Add missing message handler for wideband spectrum.
Spectrum processing was not enabled, and hence wideband spectrum was not being displayed.
2016-01-11 16:31:49 -08:00
Jared Boone
55e3a70fde Change baseband audio processing pipeline to all floats. 2016-01-11 16:15:42 -08:00
Jared Boone
5e917ebb2c Cache IIR filter state because compiler *sometimes* doesn't want to. 2016-01-11 15:44:42 -08:00
Jared Boone
e169a46367 Un-static squelch history. 2016-01-11 11:38:33 -08:00
Jared Boone
64966d4539 Fix NaNs coming out of angle_approx_0deg27().
Used in FM demodulator, was causing downstream problems when using the floating point values directly.
2016-01-11 11:17:54 -08:00
Jared Boone
5a532f34a7 Remove extra buffer structs/copies. 2016-01-11 09:35:58 -08:00
Jared Boone
877a66ca78 Create AudioOutput singleton, from extracted BasebandProcessor code. 2016-01-10 20:25:24 -08:00
Jared Boone
364217a2b5 Rename IIR filter config variables. 2016-01-10 20:20:07 -08:00
Jared Boone
13d260f936 Add IIR passthrough filter config. 2016-01-10 20:18:12 -08:00
Jared Boone
5dac0bbe49 Squelch special case when threshold == 0, do not squelch. 2016-01-10 20:16:21 -08:00
Jared Boone
01df79641c Rename squelch algorithm variable for clarity.
Helps to understand meaning of threshold.
2016-01-10 20:14:26 -08:00
Jared Boone
6f00687d88 Add configure() for IIR filter. 2016-01-10 20:11:27 -08:00
Jared Boone
497adda390 IIR default constructor passes no audio.
Debugging mechanism -- filter must be configured to pass audio.
2016-01-10 20:11:05 -08:00
Jared Boone
172a6da36c Unconst IIR configuration and filter. 2016-01-10 20:06:58 -08:00
Jared Boone
eb5b2d7d30 Fix broken audio stats when audio is muted. 2016-01-10 11:34:06 -08:00
Jared Boone
4ea84301c6 For non-audio modes, don't bother muting audio.
It's assumed base class will start with audio muted.
2016-01-10 11:33:44 -08:00
Jared Boone
d6f797540d Remove baseband message from queue after it is processed.
Application code can now wait on queue empty and know the baseband's state.
2016-01-10 11:15:37 -08:00
Jared Boone
136ba895ef Clear spectrum FIFO when streaming is stopped. 2016-01-10 11:00:09 -08:00
Jared Boone
62e5ec1dbb Postpone clearing channel_spectrum_request_update until finished with data in array.
There was potential for new samples to be copied into array as the FFT and post-processing were occuring.
2016-01-10 10:45:22 -08:00
Jared Boone
d821afc60d Spectrum streaming control, spectrum attributes back in each frame.
TODO: This feels kinda complex, and there's some repeated Processor code that needs to be refactored into a base class.
2016-01-10 10:42:20 -08:00
Jared Boone
0647f26707 Move SGPIO configuration and control to baseband firmware.
Addresses long-standing and annoying bug where SGPIO DMA channel would not disable -- and not configure cleanly next time it was needed. My theory is that the DMA channel couldn't disable until it got a request from the peripheral, and sometimes the peripheral was disabled before that last request.

Anyway, the baseband firmware should control the SGPIO, methinks, despite the impact on baseband code size.
2016-01-10 10:23:39 -08:00
Jared Boone
c75c167c25 Rename GPDMA channel disable_force() to disable().
There was nothing particularly forceful about the disable_force() code. Whether it's a "forced" operation depends on what happens before and after (HALT and ACTIVE flags are involved in a smooth disabling of the channel).
2016-01-10 10:11:16 -08:00
Jared Boone
365c2ef946 Handle baseband::dma::wait_for_rx_buffer() returning empty buffer.
Was technically OK before, because sample count was zero. But seems silly (and vaguely dangerous) to call all that code with a nullptr.
2016-01-09 12:20:57 -08:00
Jared Boone
7710b2d1fa ChannelSpectrumConfig message subsumes FIFONotify.
Separate channel spectrum config from spectrum data. This will permit sending config info only when necessary.
Use type information of ChannelSpectrum to statically define number of FFT bins elsewhere.
TODO: Posting configuration message way too often. Fixing that is the next step.
2016-01-06 12:10:30 -08:00
Jared Boone
aaa1bc3a09 Transmit ChannelSpectrum data through separate FIFO.
Allows handling of data during LCD "vertical retrace", independent of other baseband->application messages. A bit kludgy still...
2016-01-06 11:34:41 -08:00
furrtek
496c77fe3e Module loading should work again
Modules won't load if already loaded (dirty footprint hack)
2016-01-05 20:17:55 +01:00
furrtek
3477a2691a Added missing files, ENUMed modulation modes 2016-01-05 11:47:46 +01:00
Jared Boone
dcb2c46c57 Add wideband FM spectrum waterfall. 2016-01-04 17:27:18 -08:00
Jared Boone
36021689f9 Remove commented, dead code. 2016-01-04 15:42:19 -08:00
Jared Boone
73671ca5f6 Update sample rate and buffer size comments in execute() methods. 2016-01-04 15:41:49 -08:00
Jared Boone
c1e5577669 Eliminate duplicate code between event_m4.hpp, event.hpp.
event.* is common code, _m0 and _m4 contain specific event mask definitions.
2016-01-04 12:54:05 -08:00
Jared Boone
229c1e9a3c Move M4 MAPP IRQ handler to be with the event handler class.
event.[ch]pp and event_m4.[ch]pp are looking almost the same now...
2016-01-04 12:44:28 -08:00
Jared Boone
a27489eb21 Consolidating M4-specific saturation flag code. 2016-01-04 12:00:52 -08:00
Jared Boone
b42d3cc9d5 Move BasebandStatsCollector code into .cpp, as much as possible.
Still have template for callback, but hopefully will mitigate bloat when BasebandStatsCollector is used in multiple places.
2016-01-04 11:49:39 -08:00
Jared Boone
6d3cdb9bbf Separate template/callback code from method code.
...for more small reductions in code size.
2016-01-04 11:45:33 -08:00
Jared Boone
cd3a5afdb1 More templating elimination (MatchedFilter), some #include clean-up.
592 bytes!
2016-01-04 11:32:47 -08:00
Jared Boone
e6f69c90f2 Reduce inlining of FIR configuration due to templating.
80 bytes!
2016-01-04 11:20:28 -08:00
Jared Boone
359fb6f3c6 ...and more pass-by-reference.
Another 176 bytes!
2016-01-04 11:04:28 -08:00
Jared Boone
05a1c22426 More tweaks to pass buffers by reference.
144 bytes less code!
2016-01-04 11:00:17 -08:00
Jared Boone
778e2d2381 A little code consolidation -- M0APP IRQ. 2016-01-04 10:12:18 -08:00
Jared Boone
cd17f414b7 ChannelDecimator now unused, remove from Makefile, remove commented code. 2016-01-04 09:49:48 -08:00
Jared Boone
168bd02dea Move AudioStatsCollector code into .cpp. 2016-01-04 09:25:43 -08:00
Jared Boone
c5b234d9f6 Remove BasebandProcessor virtual method replaced by message. 2016-01-04 09:13:17 -08:00
Jared Boone
222b878629 Use BasebandProcessor::mute_audio(), remove I2S #include dependencies. 2016-01-04 09:07:07 -08:00
Jared Boone
ef6ae8ed94 Add mute_audio() function to baseband processor. 2016-01-04 09:06:17 -08:00
Jared Boone
8fb3ffaedc Reorder squelch code to group things a bit more logically. 2016-01-04 09:01:51 -08:00
Jared Boone
b0855b3c4d Pass buffers by reference to save significant text section code size.
752 bytes!
2016-01-03 23:09:06 -08:00
Jared Boone
b03da8d693 Fix calculation of work_audio_buffer item count. 2016-01-03 22:42:40 -08:00
Jared Boone
d9017530c6 Moved baseband temporary buffers back into class member variables.
Significant performance hit when declaring on stack. C++ wants to initialize std::array or even raw array with element constructors, was resulting in ~7% CPU utilization, for a buffer that was immediately written over anyway.
2016-01-03 22:31:44 -08:00
Jared Boone
78992c2f8d Adjust default FM squelch threshold. 2016-01-03 17:05:00 -08:00
Jared Boone
8adaddac5f Make FM squelch runtime-configurable. 2016-01-03 17:03:16 -08:00
Jared Boone
86cf967464 Simplify FM demodulator class. Remove duplicate code. 2016-01-03 16:58:36 -08:00
Jared Boone
10bce4b845 Clean up #includes. 2016-01-03 16:58:08 -08:00
Jared Boone
28be223ace Fix for merge-breakage. Argh. 2016-01-03 16:37:47 -08:00
Jared Boone
3f299c74c6 More old GCC fussiness fixes. 2016-01-03 16:32:45 -08:00
Jared Boone
b5aa2b205f Implement AMConfigureMessage from M0 to M4. 2016-01-03 14:31:39 -08:00
Jared Boone
f2f7032615 Wideband FM configuration messages from M0. 2016-01-03 13:38:55 -08:00
Jared Boone
317ec53638 Handle NBFM configuration message on M4 processor side. 2016-01-03 12:49:00 -08:00
Jared Boone
a5012427d8 Remove little bit of dead code. 2016-01-03 12:45:34 -08:00
Jared Boone
c179b9e1cd Move FIR filter configs to common/, so M0 can use it.
Planning to pass from M0 to M4 so M4 doesn't need to keep all these different filter configs in text section.
2016-01-03 12:45:15 -08:00
Jared Boone
39ca6fec62 Transform update spectrum event into message. 2016-01-03 12:05:47 -08:00
Jared Boone
c9f9d97d07 Move BasebandConfiguration message handling into baseband thread. 2016-01-03 11:49:01 -08:00
Jared Boone
fd612dc207 Baseband: Pass unhandled messages to baseband thread, processor. 2016-01-02 22:59:31 -08:00
Jared Boone
07cd99d85d Removing baseband MessageHandlerMap.
It's a bit heavy (362 bytes smaller with switch/case implementation), hard to access to add/remove handlers, doesn't bubble events like I'd like. (I'm going to bubble events to the baseband processor shortly.)
2016-01-02 22:54:09 -08:00
furrtek
802ac496e9 Xylos (CCIR tones) TX, jammer update, SD card mod load
Xylos TX (CCIR tones) ;)
Jammer update, still buggy and inefficient
SD card module loader update
2016-01-03 07:24:30 +01:00
Jared Boone
fea5dd536f Move baseband working buffers from member variables to stack.
It's temporary, after all...
2016-01-02 12:08:21 -08:00
Jared Boone
e7be7c5121 Comments about IFIR filter taps design parameters. 2016-01-02 10:49:37 -08:00
Jared Boone
410d4d7fc3 Use IFIR decimator for TPMS. 2016-01-02 10:42:40 -08:00
Jared Boone
e720bfb054 Use IFIR decimation for broadcast FM receiver. 2016-01-02 10:35:23 -08:00
Jared Boone
a02bfe55d0 Decimators for wider IFIR output bandwidth. 2016-01-02 10:34:17 -08:00
Jared Boone
096ebe47d8 Turn almost-zeros in TPMS matched filter to actual zeros. 2016-01-02 10:24:49 -08:00
Jared Boone
0e04939439 Broadcast FM de-emphasis using 75us time constant. 2016-01-01 20:56:30 -08:00
Jared Boone
2e90edbf39 Add 30Hz high-pass IIR filter for wideband FM. 2016-01-01 20:55:00 -08:00
Jared Boone
9a0fb2cab7 Rename IIR filter for 300Hz high-pass. 2016-01-01 20:53:11 -08:00
Jared Boone
ff05833b02 Use new decimation filters in AIS processor. 2016-01-01 13:20:02 -08:00
Jared Boone
316d5d433b Move IIR code into .cpp file.
A few hundred more text section bytes saved.
2015-12-31 10:52:28 -08:00
Jared Boone
9fb22dfd1f Reduce type size for int16_t squared values. 2015-12-31 10:09:42 -08:00
Jared Boone
ef37bbd851 Small FM squelch simplification. 2015-12-31 10:08:41 -08:00
Jared Boone
0962343190 Use decimation variable, not hard-coded value.
Break in form from NBFM code.
2015-12-30 12:20:25 -08:00
Jared Boone
7de80edcd3 Move baseband FIR filter defs to common file.
They will likely be shared with multiple decimators/demodulators.
Also added normalized filter pass/stop values to each set of taps.
2015-12-30 12:19:42 -08:00
Jared Boone
bbfcca8ec0 Rebake of AM, NFM demodulators -- more flexible filtering/configuration.
Also make SpectrumCollector dynamically configurable.
Add deemphasis filter to NFM.
2015-12-29 11:02:07 -08:00
Jared Boone
549e5b9ddc Unrolled FIR filters for more flexible baseband filtering (using IFIR technique). 2015-12-29 10:48:29 -08:00
Jared Boone
8453741252 Saturate IIR filter output to int16_t. 2015-12-28 16:33:26 -08:00
Jared Boone
7ec1a1f85b Move comment about FM squelch IIR filter. 2015-12-28 16:24:43 -08:00
Jared Boone
ef7aeaafa9 Tweak (and document!) audio HPF IIR. 2015-12-28 16:01:26 -08:00
Jared Boone
4ee0385530 Add FM class default constructor.
For classes that configure FM demodulation at runtime.
2015-12-28 15:51:20 -08:00
Jared Boone
4910bacfa2 Un-comment angle_precise(). Not used, but no reason to comment out. 2015-12-28 15:50:19 -08:00
Jared Boone
49215c3ae6 Remove garbage DSP filter code. 2015-12-28 15:49:47 -08:00
Jared Boone
5ace32a1ee Fix inaccurate comment. 2015-12-20 13:33:08 -08:00
Jared Boone
bddd26d557 Perform frequency-domain windowing of spectrum.
Reduces sidelobes a bit, improves apparent resolution. Avoids windowing (more RAM and CPU) in baseband.
2015-12-20 13:31:00 -08:00
Jared Boone
b058d609eb Move packet timestamping into baseband.
Now reads the RTC peripheral at the end of each received packet.
TODO: Improve resolution to milliseconds or better.
TODO: Work back from end of packet to compute timestamp for beginning of packet.
TODO: Reuse ChibiOS RTC code, which isn't used now because ChibiOS on M0 core is responsible for RTC configuration, and including ChibiOS RTC API on M4 will also try to initialize/manage the peripheral.
2015-12-12 11:37:30 -08:00
Jared Boone
c825a027b2 Comments regarding threading concerns, future refactoring. 2015-12-11 17:29:58 -08:00
Jared Boone
d1637db2fc Reorder methods in source file to indicate call order. 2015-12-11 17:17:12 -08:00
Jared Boone
088f60f2bc Extract spectrum collector from BasebandProcessor.
Code size improvement, and less confused classes. :-)
2015-12-11 12:26:45 -08:00
Jared Boone
75b1cc25ff Missing lambda capture. 2015-12-10 21:21:42 -08:00
Jared Boone
211d1d19ea Move Thread WORKING_AREAs out of classes.
Limited where and how you could instantiate the classes.
2015-12-10 21:01:44 -08:00
Jared Boone
a3bab9126d Remove commented, dead code. 2015-12-10 20:13:27 -08:00
Jared Boone
ca7e0f1e20 Remove #include of ChibiOS test.h.
Would be appropriate if writing a test case project. Someday...
2015-12-10 18:28:19 -08:00
Jared Boone
d895a54078 Almost finished moving around baseband init/shutdown code. 2015-12-10 17:33:44 -08:00
Jared Boone
f90e5bab6b Push more init/shutdown code out of main(). 2015-12-10 17:29:16 -08:00
Jared Boone
f3979a1d65 Move event initialization code into EventDispatcher. 2015-12-10 17:25:55 -08:00
Jared Boone
95fe57c9aa Consolidate EventDispatcher client code. 2015-12-10 17:20:10 -08:00
Jared Boone
4b3fa25cef Move sending of ShutdownMessage into shutdown().
Crazy, I know.
2015-12-10 17:19:18 -08:00
Jared Boone
6328efb70b Move more baseband main() code into EventDispatcher.
EventDispatcher might be ripe for a refactor or rename.
2015-12-10 17:10:28 -08:00
Jared Boone
818790e734 Move init/configure details into RSSI/BasebandThread classes. 2015-12-10 16:33:40 -08:00
Jared Boone
ed25f65e8b Move BasebandThread init into main(). 2015-12-10 16:29:50 -08:00
Jared Boone
13e4b41c1e Trivial clean-up. 2015-12-10 16:15:18 -08:00
Jared Boone
255c568f9e Make some Baseband/RSSIThread members private/const. 2015-12-10 16:14:30 -08:00
Jared Boone
ded33ebabd Extract RSSIThread to separate files. 2015-12-10 16:07:21 -08:00
Jared Boone
e998014e57 Extract BasebandThread, ThreadBase to separate files. 2015-12-10 15:53:54 -08:00
Jared Boone
2808efac4c Remove unused lambda captures. 2015-12-10 15:27:33 -08:00
Jared Boone
e8cf0b8de7 Clean up baseband/main.cpp #includes. 2015-12-10 15:22:20 -08:00
Jared Boone
a7afc58cf8 More consistent use of pass-by-ref, const in baseband code. 2015-12-10 15:18:02 -08:00
Jared Boone
82f367dfea Move code into BasebandThread. 2015-12-10 14:41:07 -08:00
Jared Boone
f369885062 Extract processor factory function.
A small code size reduction. I tried using std::unique_ptr, but code bloated between 150 and 400 bytes!
2015-12-10 13:21:27 -08:00
Jared Boone
ef315f0d92 Const/pass-by-reference a bunch more baseband stuff. 2015-12-10 12:36:12 -08:00
Jared Boone
3ed77af0c1 BasebandProcessor: Streamline construction of some messages. 2015-12-10 12:25:11 -08:00
Jared Boone
77aceaaf56 More BasebandProcessor pass by reference. 2015-12-10 12:17:40 -08:00
Jared Boone
14f24d8584 Move BasebandProcessor message.push() from dedicated methods to existing lambdas. 2015-12-10 12:04:43 -08:00
Jared Boone
98abc4bba8 Create baseband statistics messages on stack.
Code size shrank ~200 bytes with this change.
2015-12-10 11:57:57 -08:00
Jared Boone
3bed016128 BasebandProcessor interface change to pass references, not copies. 2015-12-10 11:56:16 -08:00
Jared Boone
eb1402764e Move ERT packet type to its rightful place.
No longer mixed up with Message types.
2015-12-08 16:19:27 -08:00
Jared Boone
d0d97e92cb Rename ::Packet to baseband::Packet. Remove IPC packet types. 2015-12-08 15:15:51 -08:00
Jared Boone
bd33e652ea Abstract packet type/implementation details. 2015-12-07 12:35:05 -08:00
Jared Boone
2d0052fb14 Generalize ERT offset tracking a little. 2015-12-07 09:58:08 -08:00
Jared Boone
b9643dc988 Clean up ERT packet type notation.
Still not great, but at least repeated code is reduced.
2015-12-06 15:47:04 -08:00
Jared Boone
4205793b54 Clean up narrowing conversion warning. 2015-12-03 20:58:17 -08:00
Jared Boone
82ff45860e Add basic ERT (OOK) utility meter reception.
Extracted the Manchester formatting function for use in ERT, now also returns an indication of bits in error.
2015-12-01 11:24:48 -08:00
Jared Boone
435824e9b5 Clean up buffer_t constructors. 2015-11-20 11:21:31 -08:00
Jared Boone
600a983d5c Clean up complex<int16_t> -> complex<float> casting. 2015-11-20 11:01:41 -08:00
furrtek
5f60b004f7 Dynamic baseband module loading from SD card 2015-11-20 07:59:09 +01:00
Jared Boone
85e984ed3b Clean up complex<int8_t> -> complex<float> casting. 2015-11-19 12:42:35 -08:00
Jared Boone
060da5d227 Add ChannelDecimator decimate by 2 and no-shift options. 2015-11-19 12:24:20 -08:00
Jared Boone
ccd64f3cd9 Add function for c8->c16 decimate by two without fs/4 shift. 2015-11-19 12:20:20 -08:00
furrtek
835d581e6c Merged remote-tracking branch 'upstream/master' 2015-11-18 22:01:48 +01:00
Jared Boone
8967f0eaa1 Move common matchers to PacketBuilder. 2015-11-16 10:33:50 -08:00
furrtek
bcbad4629f Jammer ramp mode
Jammer range splitting, hopping. Only 1MHz wide splits for now.
2015-11-14 03:44:49 +01:00
furrtek
66de53744e Jammer UI
Drew jammer UI
Added presets for French GSM operators and a few other funny frequencies
Added minimalist jamming baseband code
2015-11-13 01:19:05 +01:00
Jared Boone
1770dff522 Finish object-izing Baseband and RSSI threads. 2015-11-11 10:54:36 -08:00
Jared Boone
d9106b6f44 Start object-ization of RSSI thread. 2015-11-11 10:11:37 -08:00
Jared Boone
19c89def75 Start to object-ize the baseband thread function. 2015-11-11 10:02:06 -08:00
Jared Boone
2c64454172 More constructor style clean-up. 2015-11-11 09:35:28 -08:00
Jared Boone
d02698a6de Apparent bug where min/max aren't initialized from value inside the buffer bounds.
The fix is less than ideal, it assumes that an incoming buffer length is always >= 1.
2015-11-11 09:30:15 -08:00
Jared Boone
ebf103363c Constructor style clean-up. 2015-11-11 09:16:20 -08:00
Jared Boone
9f6c495fef Add TPMS initial demodulator implementation.
Right now, 2FSK, 19200 baud, +/-38400Hz deviation. No effort is made to check CRC/checksums or decode packets.
2015-11-10 15:19:56 -08:00
Jared Boone
6cdef7026d Remove spectrum window-presum due to lack of code RAM. 2015-11-10 15:16:27 -08:00
Jared Boone
99871dcb84 Move a few member variables to stack/constants. 2015-11-10 15:10:52 -08:00
Jared Boone
981c2fbfbd Complete FSKProcessor's trip to being AISProcessor. 2015-11-10 15:04:38 -08:00
Jared Boone
111a5f10c0 Add some baseband constructors.
Some of them I think I took out earlier...
2015-11-10 14:04:50 -08:00
Jared Boone
add6171410 Move BasebandStatistics from heap to stack. 2015-11-10 13:59:17 -08:00
Jared Boone
0789d50fdf Rework BitHistory, BitPattern, PacketBuilder.
Templatize PacketBuilder to optionally bit unstuff, and have flexible packet termination behavior.
2015-11-09 14:38:09 -08:00
Jared Boone
5dcca89172 FSKProcessor: remove separate channel filter.
RRC filter alone will do the trick!
2015-11-07 14:10:44 -08:00
Jared Boone
fc037c739a Comment about correct MatchedFilter usage.
Because the filter expects a combined translate/rotate and low-pass filter in the taps, the taps must be a multiple of the translate sinusoid period.
2015-11-07 11:27:31 -08:00
Jared Boone
ae225e8c3b Further MatchedFilter optimization using algebraic identities and stuff.
Can't stop premature optimization!!!
2015-11-06 09:40:05 -08:00
Jared Boone
100761481e Fix inaccurate comment. 2015-11-06 09:40:05 -08:00
Jared Boone
3d5c8056d9 Premature optimization of MatchedFilter::shift_by_decimation_factor(). 2015-11-06 09:40:05 -08:00
Jared Boone
4afcc83873 Mark MatchedFilter::is_new_decimation_cycle() as const. 2015-11-06 09:40:05 -08:00
Jared Boone
3c33e20156 Rename MatchedFilter::decimation_factor. 2015-11-06 09:40:05 -08:00
Jared Boone
7a59823211 Stop computing channel spectrum during FSK demod.
Data is unused, as screen is displaying decoded packets.
2015-11-06 09:40:05 -08:00
Jared Boone
ddd34793a6 Default constructors and configure methods for baseband classes. 2015-11-06 09:40:05 -08:00
Jared Boone
51df92a05a Rename baseband_ais -> ais_baseband.
So that ais_baseband and ais_application filenames can be sorted near each other.
2015-11-06 09:40:04 -08:00
Jared Boone
26c23dc8a0 Use new FIR decimation in FSK demodulator.
Reduces FIR calculation effort when output samples are skipped at FIR filter, not after.
2015-11-06 09:40:04 -08:00
Jared Boone
86b068be62 Early calculation to reduce pressure on registers. 2015-11-06 09:40:04 -08:00
Jared Boone
a074e7d8d8 Remove commented code. 2015-11-06 09:40:04 -08:00
Jared Boone
424c0eac3f FIRAndDecimateBy2Complex: expose decimation_factor, bring work function into class. 2015-11-06 09:40:04 -08:00
Jared Boone
cde15e4271 Generalize fir_and_decimate_by_2_complex_fast.
Permit decimation_factors other than 2.
Permit tap counts != 64 (but still must be multiple of 8).
Half the amount of tap memory required.
Performance is significantly degraded due to greater flexibility -- most likely due to separate sample buffer shift phase, instead of performing shift during output sample calculation.
2015-11-06 09:40:04 -08:00
Jared Boone
be78ed657f Remove taps_count template arg for FIRAndDecimateBy2Complex.
Use heap to allocate samples and taps buffers, so filters of different lengths can be supported.
2015-11-06 09:40:04 -08:00
Jared Boone
0f73d6061a Remove old decimating FIR code. 2015-11-06 09:40:04 -08:00
Jared Boone
015e5516d5 Update/consolidate AIS RRC matched filter taps. 2015-11-06 09:40:04 -08:00
Jared Boone
dab801e167 AIS RX tweak of clock recovery constant for better performance. 2015-11-06 09:40:03 -08:00
Jared Boone
58b97dea68 AIS RX performance improved with 32-tap RRC. 2015-11-06 09:40:03 -08:00
Jared Boone
f82fd1f8d7 Tease apart utility.hpp, other header dependencies.
Trying to get a host-testable FSK demodulator, and finding a lot of M4- and ChibiOS-specific code is getting included. Boo.
2015-11-06 09:40:03 -08:00
Jared Boone
e049097f49 Remove spurious commented code. 2015-11-06 09:40:03 -08:00
Jared Boone
4aae77f565 MatchedFilter improvements
Use single set of taps for positive and negative filters.
Reverse taps (since new samples are pushed into buffer from the high end).
Make complex multiply explicit to avoid fancy but irrelevant arithmetic checks.
Compute negative filter from conjugation of positive filter taps.
Move filter power and difference calculations into MatchedFilter.
2015-11-06 09:40:03 -08:00
Jared Boone
ab28639a3d Use std::move to move samples in buffer.
Yes, std::rotate works, but it's fancy and does unnecessary work.
2015-11-06 09:40:02 -08:00
Jared Boone
4141d6fe0f Untemplate MatchedFilter, a different way. 2015-11-06 09:40:02 -08:00
Jared Boone
fe94cfa45a De-std::vector MatchedFilter, was chewing up far too much memory. 2015-11-06 09:40:02 -08:00
Jared Boone
64ed539554 Change LinearResampler.advance to external use only. 2015-11-06 09:40:02 -08:00
Jared Boone
4ed385d15e Prioritize PacketBuilder found_end_flag() over packet_truncated(). 2015-11-06 09:40:02 -08:00
Jared Boone
c2e7f9a6f4 Shorten AIS training sequence match length. 2015-11-06 09:40:02 -08:00
Jared Boone
d92c962c0c Set MatchedFilter taps with separate method. 2015-11-06 09:40:02 -08:00
Jared Boone
8198db768d Move some MatchedFilter code to .cpp file. 2015-11-06 09:40:02 -08:00
Jared Boone
aff7865c61 Move (some) AIS bits to a separate file. 2015-11-06 09:40:02 -08:00
Jared Boone
7a5100baf1 Enlarge packet payload size 256 -> 1024 bits. 2015-11-06 09:40:01 -08:00
Jared Boone
68250b4d30 Expose weight() of FixedErrorFilter. 2015-11-06 09:40:01 -08:00
Jared Boone
474eaa8541 Template ClockRecovery for ErrorFilter type. 2015-11-06 09:40:01 -08:00
Jared Boone
9879af37d5 FixedErrorFilter constructor. 2015-11-06 09:40:01 -08:00
Jared Boone
727d4c8a1f Const the FixedErrorFilter operator(). 2015-11-06 09:40:01 -08:00
Jared Boone
93b9b9d9ef LinearErrorFilter constructor. 2015-11-06 09:40:01 -08:00
Jared Boone
37b1d7cf2f Remove payload_length from PacketBuilder, etc. 2015-11-06 09:40:01 -08:00
Jared Boone
cf3bff3b03 Decouple PacketBuilder PayloadHandler function from method type. 2015-11-06 09:40:01 -08:00
Jared Boone
1bdad62496 Simplify PacketBuilder pattern matching and symbol accumulation. 2015-11-06 09:40:00 -08:00
Jared Boone
36689f5c45 Refactor bit pattern matching.
Remove AccessCodeCorrelator, Unstuff classes.
2015-11-06 09:40:00 -08:00
Jared Boone
f918a774b7 Address implicit cast compiler warnings. 2015-11-06 09:40:00 -08:00
Jared Boone
0bc8f551de Use matched filter for AIS GMSK demodulation demo.
Less than optimal for plain FSK, but flexible enough to also support GFSK/GMSK. Not at all optimized for SIMD instructions, so may not perform adequately at Bluetooth/GSM rates.
2015-11-06 09:40:00 -08:00
Jared Boone
a9c190b6bb Matched filter implementation.
Essentially a complex FIR filter that's more flexible than the ones already in the code base. Refactor?!
2015-11-06 09:40:00 -08:00
Jared Boone
e9f28f9ef3 Provide configuration of symbol unstuffing. 2015-11-06 09:40:00 -08:00
Jared Boone
a00fcbaa8f Unstuffing pattern length of zero should never match. 2015-11-06 09:40:00 -08:00
Jared Boone
05badaddda Put symbol coding into PacketBuilder.
Removes stuffing symbols before placing them into packet buffer.
2015-11-06 09:40:00 -08:00
Jared Boone
c936e09702 Add bit unstuffing algorithm.
For use in AIS. Probably useful elsewhere, too...
2015-11-06 09:39:59 -08:00
Jared Boone
31ff13f1c0 Un-const Message in message handler interfaces.
I want to modify in place the messages that are received. Naughty, but oh well.
2015-11-06 09:39:59 -08:00
Jared Boone
5c31e803c8 Change interface to AccessCodeCorrelator, inline in header. 2015-11-06 09:39:59 -08:00
Jared Boone
a3cce5632e Complete rewrite of clock recovery, lots of refactoring. 2015-11-06 09:39:59 -08:00
Jared Boone
8b2e75a299 Add LinearResampler implementation for clock recovery. 2015-11-06 09:39:59 -08:00
Jared Boone
f13e2d32c0 Add symbol coding namespace, NRZI decoder. 2015-11-06 09:39:59 -08:00
Jared Boone
934936d3f6 Enhancements to clock recovery
Linearly interpolate input and delayed samples, based on phase of internal symbol clock.
2015-11-06 09:39:59 -08:00
Jared Boone
291de8f869 Change channel_spectrum type to std::complex<float>.
Move FFT bit-reversal to complex<int16_t> -> complex<float> copy.
Change window so that adjacent bins have constant(-ish) gain.
Change window to float.
Change time domain samples to accumulate at even intervals over the FFT interval.
2015-10-14 11:10:24 -07:00
Jared Boone
7f46f0d071 Add tick tracking for all baseband threads. 2015-10-14 10:44:20 -07:00
furrtek
ff96464efe Added AFSK BW and repeat parameters 2015-09-16 15:43:43 +02:00
furrtek
9a7657fb38 Play dead actually works, fixed 7bit AFSK, AFSK repeat, started whistle mode 2015-09-10 20:36:39 +02:00
furrtek
30531a20f2 Splash screen and Play Dead functionality 2015-09-04 20:37:27 +02:00
furrtek
ec26f587f1 Started adding AFSK modulator options, cleaning up LCR TX 2015-09-03 06:34:00 +02:00
Jared Boone
e2bb77d756 Change wideband FFT bin filter, clean up code a bit. 2015-09-02 11:29:38 -07:00
Jared Boone
c4de9c4423 Mute audio whenever baseband mode is changed. 2015-09-01 21:05:47 -07:00
Jared Boone
c52de7abe6 Clean up baseband/RSSI streaming control.
Address hang-up of baseband and RSSI when switching modulation modes really fast.
2015-09-01 21:05:32 -07:00
Jared Boone
5d8c636f40 Halt M4 right after sending M0 the shutdown message.
Addresses issue #55.
2015-09-01 13:49:09 -07:00
furrtek
0e0261f813 LCR in TEDI 1200/2400 AFSK transmit 2015-08-28 20:50:42 +02:00
Jared Boone
3fea68d777 Adjust wideband specan gain to match other modes. 2015-08-27 14:57:05 -07:00
Jared Boone
b13081696d Simplify MessageQueue pop() usage. 2015-08-27 14:35:17 -07:00
Jared Boone
d8b3b4cb6b Check queue empty only once when reading messages.
There was a second is_empty() call hidden in the pop() call, so the while(condition) was redundant.
2015-08-27 14:27:29 -07:00
Jared Boone
e751e10e45 Add wideband spectrum processor. 2015-08-27 13:57:31 -07:00
Jared Boone
23ac04ad56 Make channel spectrum members protected, not private. 2015-08-27 13:51:55 -07:00
Jared Boone
c7907e948c Extract FSKProcessor into separate files. 2015-08-27 13:31:39 -07:00
Jared Boone
ffe829cf67 Extract WidebandFMAudio into separate files. 2015-08-27 13:19:34 -07:00
Jared Boone
7c5db55f8f Extract NarrowbandFMAudio into separate files. 2015-08-27 13:14:45 -07:00
Jared Boone
e246ea2c39 Extract NarrowbandAMAudio class into separate files. 2015-08-27 13:07:07 -07:00
Jared Boone
6bf61cbe88 Extract BasebandProcessor into separate files. 2015-08-27 11:11:08 -07:00
Jared Boone
b0e9afe26c Add missing #includes. 2015-08-27 11:10:44 -07:00
Jared Boone
04d05368c7 Push static variables and spectrum calc into BasebandProcessor. 2015-08-27 10:48:29 -07:00
Jared Boone
de0777f476 Extract FMSquelch into separate files. 2015-08-27 09:59:03 -07:00
Jared Boone
b904971ef2 Extract IIR filter configurations into separate file. 2015-08-27 09:58:37 -07:00
Jared Boone
c92bf12fbd Extract ChannelDecimator into separate files. 2015-08-27 09:49:14 -07:00
Jared Boone
98773cb62a Make GIT_REVISION value available within code.
Addresses issue #59.
No idea what it'll do if the commit is also tagged as a release...
2015-08-25 16:33:52 -07:00
furrtek
8f815a3b39 Integerized the waveform table 2015-08-24 05:16:55 +02:00
furrtek
8e0210f944 Savestate ! RDS (only PSN) tx 2015-08-23 05:08:38 +02:00
Jared Boone
3a96c04aa7 Implement, use configuration for FM demod deviation. 2015-08-21 09:19:08 -07:00
Jared Boone
fa275156ed Move FSKPacketMessage to stack. 2015-08-21 09:18:21 -07:00
Jared Boone
589cb47cc6 Move M4 shutdown() next to init(). 2015-08-20 20:40:46 -07:00
Jared Boone
672284080b Extract M4 IPC IRQ code into separate file. 2015-08-20 20:39:08 -07:00