Commit Graph

628 Commits

Author SHA1 Message Date
Jared Boone
a29b76ac38 Pull AIS record types out of AISView. 2016-01-13 11:52:39 -08:00
Jared Boone
4b2157a938 Push AIS list item draw style into render method. 2016-01-13 11:43:21 -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
b9f124850b Add buffer_t<float> type alias. 2016-01-11 16:10:48 -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
146caaab6f Consolidate baseband disable code. 2016-01-10 11:10:13 -08:00
Jared Boone
d9bfaaf805 Stop baseband streaming when switching radio configuration.
Probably unnecessary, but feeling paranoid about changing sample rates while there's a processor actively handling samples, and potentially maxing out the M4 core.
2016-01-10 11:01:54 -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
8fde4972b4 Methods to peek and skip messages in queue.
Allows receiver to not consume a message until after it's handled. And that enables the transmitter to block until the queue is empty, knowing that when unblocked, all messages in queue have been handled.
2016-01-10 10:15:25 -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
43d6098c48 Move baseband_sgpio.* to common/.
It'll soon be used by M4 code, not M0. SGPIO baseband streaming needs to be tightly controlled by... the baseband!
2016-01-09 17:57:37 -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
c3167ac27c Missing #includes. 2016-01-09 12:17:17 -08:00
Jared Boone
8fba47b7d8 FIFO in and out indices should be volatile.
Later code revealed that the receiving core never notices (reads anew) the _in member variable when waiting for the FIFO to be empty (_in == _out).
2016-01-07 10:53:27 -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
ba33cc737d Transmit DisplayFrameSync message, handle in WaterfallSpectrum.
More kludginess, especially around initialization and timing. But it addresses the flickering lines of pixels at the bottom of the waterfall scroll area!
2016-01-06 11:36:57 -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
Jared Boone
2cd28fcc0c Make FIFO::in() more consistent with other functions. 2016-01-06 11:04:25 -08:00
Jared Boone
4059e9cebe Reintroduce FIFO in/out for templated FIFO element type. 2016-01-06 11:01:02 -08:00
Jared Boone
b05923eab6 Change FIFO is_full() to make more sense. 2016-01-06 10:58:42 -08: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
0fe5409357 Move M4TXEVENT interrupt control into event handler run(). 2016-01-04 12:15:35 -08:00
Jared Boone
69b258cc2b Consolidate event handler code, including IRQ. 2016-01-04 12:15:10 -08:00
Jared Boone
b058c0fe00 Consolidate M0-specific code. 2016-01-04 12:07:30 -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
5547782f5a Improve FFT twiddle factor precisions using Python SymPy.
Python math, numpy, scipy produce values with significant rounding errors.
2016-01-03 21:02:44 -08:00
Jared Boone
963b6e257a FFT twiddles can be used for all K <= table length.
Change assert to allow FFTs < 8.
2016-01-03 20:25:31 -08:00
Jared Boone
54e59cc224 Hard-code K=8 FFT twiddle constants for now.
So low on baseband RAM! This eliminates the sin_f32() function and table, which is only used in the FFT, for the moment.
2016-01-03 20:08:26 -08:00
Jared Boone
65dd385c94 Little FFT loop indexing tweak. 2016-01-03 17:47:08 -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
62ee26e763 OK... Nuke list initializations. 2016-01-03 16:28:09 -08:00
Jared Boone
422f6c6960 Don't pass by reference in message constructors. 2016-01-03 16:21:17 -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
7496c2aced Send NBFM configuration message from M0 to M4. 2016-01-03 12:47:22 -08:00
Jared Boone
0497dbf62f NBFM configuration message.
Allows changing NBFM filter configurations from M0.
2016-01-03 12:46:21 -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
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
3db0820b54 Remove LOCATE_IN_RAM from DMA IRQ handler
Not needed for M4, was causing code to be located in data RAM, and veneers to jump between code and data RAM. Reclaimed a few hundred bytes of code RAM.
2015-12-29 11:24:23 -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
df593c2f0f Run codec at 1 x baseband sample rate. Do not use CPLD decimator.
Codec performance appears to be unaffected by <8MHz sample rate. Saves a bit of power, eliminates dependency on CPLD decimation feature.
2015-12-29 10:55:55 -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
87c9772128 More M4 instruction wrappers, with vector typed arguments. 2015-12-28 16:52:10 -08:00
Jared Boone
f74e6690cb Utilize class types for member variables -- slightly more generic. 2015-12-28 16:51:34 -08:00
Jared Boone
9505d367c3 Add SMMULR "intrinsic". 2015-12-28 16:50:01 -08:00
Jared Boone
90cd2a6794 Improve argument and retval types for my M4 SIMD intrinsics. 2015-12-28 16:49:31 -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
ccc3402869 Add complex32_t type. 2015-12-28 10:14:35 -08:00
Jared Boone
dc86db5b87 Reminder to my future self to not over-optimize complex conjugate multiply. 2015-12-28 10:12:40 -08:00
Jared Boone
b8726b6ecf Un-bitfield PinConfig, GCC 5 didn't like it.
And GCC 4.9 was very touchy about it. Attempts to fix by other means broke MAX2837 register readback (but not writing?). It suggests there might be a deeper issue -- setup/hold timing?
2015-12-24 10:36:26 -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
b38338efc0 Keep MAX2837 in standby so temperature can be read.
I think this won't significantly impact power consumption.
2015-12-17 20:59:21 -08:00
Jared Boone
1146d1fa06 Clean up temperature sensor rendering. 2015-12-17 20:36:58 -08:00
Jared Boone
188f692195 Center temperature graph in view. 2015-12-17 12:18:25 -08:00
Jared Boone
c3116eac63 Use reference to temperature logger, more concise. 2015-12-17 12:16:26 -08:00
Jared Boone
c92138f4b3 Extract calculation of temperature from raw sensor value. 2015-12-17 12:14:28 -08:00
Jared Boone
146a06b0d1 Method to read TemperatureLogger record capacity. 2015-12-17 12:12:22 -08:00
Jared Boone
17d405ccec Weird syntax burp on my part. 2015-12-17 10:30:40 -08:00
Jared Boone
b65cd72a68 Remove some pointless GCC-isms. 2015-12-17 10:12:03 -08:00
Jared Boone
3151100e50 Correct aesthetic typo in MAX2837 register defaults. 2015-12-16 22:37:55 -08:00
Jared Boone
86edf01def Quick and dirty temperature logger, debug view of temp vs. time. 2015-12-16 22:36:51 -08:00
Jared Boone
750506b33e Move more code from .hpp to .cpp. 2015-12-16 22:35:26 -08:00
Jared Boone
d34499d920 Remove ui::BasebandBandwidthField. 2015-12-16 22:29:29 -08:00
Jared Boone
5408eb1042 Nuke duplicate peripheral pointer constants for C++
Turns out the reinterpret_cast idiom is no longer kosher in the standard.
2015-12-16 21:21:45 -08:00
Jared Boone
7a4604e24e Move code out of ui_spectrum.hpp. 2015-12-16 19:33:30 -08:00
Jared Boone
f204a58d24 WM8731 header clean-up. 2015-12-14 14:03:17 -08:00
Jared Boone
552bba47ea Move a lot of WM8731 functions to .cpp. 2015-12-14 13:57:45 -08:00
Jared Boone
fa3eaf0820 Disable audio codec wait-for-zero-crossing volume change mode.
This may explain (now unreproduceable) issue where UI volume changes weren't always changing the gain on the audio codec.
2015-12-14 12:26:41 -08:00
Jared Boone
4ce27f51d4 Add WM8731 registers view. 2015-12-14 12:09:31 -08:00
Jared Boone
24d60a11e3 Add WM8731.read() for cached values. 2015-12-14 12:09:01 -08:00
Jared Boone
ee3a77f32c Center RegistersWidget painting. 2015-12-14 11:47:43 -08:00
Jared Boone
56c3167156 Move RegistersWidget/Views methods to .cpp. 2015-12-14 11:30:24 -08:00
Jared Boone
2ee072aa7b Invert register number column colors in RegistersWidget. 2015-12-14 11:24:48 -08:00
Jared Boone
a340cbb74b Make NavigationView an implicit first argument to any instance pushed onto nav stack. 2015-12-14 11:18:59 -08:00
Jared Boone
0828c66b8a Move default constructor to .hpp. 2015-12-14 11:12:12 -08:00
Jared Boone
969d9bd070 Use std::unique_ptr inside NavigationView. 2015-12-14 11:11:49 -08:00