Commit Graph

276 Commits

Author SHA1 Message Date
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
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
Jared Boone
85e984ed3b Clean up complex<int8_t> -> complex<float> casting. 2015-11-19 12:42:35 -08:00