Commit Graph

283 Commits

Author SHA1 Message Date
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
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
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
778e2d2381 A little code consolidation -- M0APP IRQ. 2016-01-04 10:12:18 -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
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
0497dbf62f NBFM configuration message.
Allows changing NBFM filter configurations from M0.
2016-01-03 12:46:21 -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
ff05833b02 Use new decimation filters in AIS processor. 2016-01-01 13:20:02 -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
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
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
b65cd72a68 Remove some pointless GCC-isms. 2015-12-17 10:12:03 -08:00
Jared Boone
750506b33e Move more code from .hpp to .cpp. 2015-12-16 22:35:26 -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
24d60a11e3 Add WM8731.read() for cached values. 2015-12-14 12:09:01 -08:00
Jared Boone
9170c66bc0 Remove unused function declaration. 2015-12-12 11:37:59 -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
088f60f2bc Extract spectrum collector from BasebandProcessor.
Code size improvement, and less confused classes. :-)
2015-12-11 12:26:45 -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
83bf2a9a36 Tweak BasebandConfiguration constructors to avoid surprise type conversions. 2015-12-10 14:40:48 -08:00
Jared Boone
3ed77af0c1 BasebandProcessor: Streamline construction of some messages. 2015-12-10 12:25:11 -08:00
Jared Boone
4d52f73f6a Move Manchester to common/. 2015-12-10 11:28:18 -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
7de187e267 Move ERT, AIS packet code to common/. 2015-12-08 16:08:20 -08:00
Jared Boone
d0d97e92cb Rename ::Packet to baseband::Packet. Remove IPC packet types. 2015-12-08 15:15:51 -08:00
Jared Boone
90a7327cd5 Clean up FieldReader and BitRemap types. 2015-12-08 14:15:15 -08:00
Jared Boone
7cded79b59 Clean up CRC class/interface, make more like boost::crc_basic. 2015-12-08 10:35:54 -08:00
Jared Boone
a2df8ea599 Simplify excessively idiomatic C-ism. 2015-12-07 15:29:43 -08:00
Jared Boone
bd33e652ea Abstract packet type/implementation details. 2015-12-07 12:35:05 -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
42d13e6713 ui::OptionsField match option value by ==, not >=.
I think I used >= to match baseband filter bandwidth, but then the options would all have to be in increasing order to do the right thing, which is not what another developer would expect!
2015-12-03 20:53:14 -08:00
Jared Boone
76845c4335 Extract to_string_* functions from ui_widget. 2015-12-02 13:38:17 -08:00
Jared Boone
4baf2a06f2 Move ais_baseband code to app_ais. 2015-12-02 09:31:14 -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
c70d95dcbe Remove SDCardStatusMessage, replace with Signal, extract to separate files. 2015-12-01 10:38:35 -08:00
Jared Boone
42104d217a Broaden SD card status detail in message. 2015-11-29 15:50:58 -08:00
Jared Boone
5928086fd9 Simplify SD card mount status code. 2015-11-29 15:37:24 -08:00
Jared Boone
435824e9b5 Clean up buffer_t constructors. 2015-11-20 11:21:31 -08:00
Jared Boone
d96379dc9c Remove extra semicolons. 2015-11-20 11:11:14 -08:00
Jared Boone
600a983d5c Clean up complex<int16_t> -> complex<float> casting. 2015-11-20 11:01:41 -08:00
Jared Boone
9900c29283 Deepen BitPattern and BitHistory to 64 bits. 2015-11-16 10:33:08 -08:00
Jared Boone
4d6877ab15 Extract FieldReader to separate header so it can be reused. 2015-11-16 10:31:36 -08:00
Jared Boone
4f82524e77 Another default constructor. 2015-11-11 10:30:35 -08:00
Jared Boone
2c64454172 More constructor style clean-up. 2015-11-11 09:35:28 -08:00
Jared Boone
ebf103363c Constructor style clean-up. 2015-11-11 09:16:20 -08:00
Jared Boone
987ea3555d SD card detection and filesystem mounting. 2015-11-10 15:24:42 -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
e6351ca066 Improve comment accuracy. 2015-11-10 15:11:19 -08:00
Jared Boone
791b2a9762 Remove now-unused FSKConfiguration message. 2015-11-10 15:07:20 -08:00
Jared Boone
981c2fbfbd Complete FSKProcessor's trip to being AISProcessor. 2015-11-10 15:04:38 -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
0b522abbc1 Rename AIS packet handler variables for consistency with spec. 2015-11-09 14:35:06 -08:00
Jared Boone
850c847bbf Trap attempts to register more than one message handler at a time. 2015-11-09 11:57:38 -08:00
Jared Boone
47a3ffb15a Insulate ui::Context a bit from its clients.
Add accessor methods.
2015-11-09 11:56:40 -08:00
Jared Boone
85383e488b std::fma not necessary with proper compiler options.
std::fma isn't available on Ubuntu 15.04 arm-gcc, apparently. Hence my reviewing this code...
2015-11-08 16:33:32 -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
9e694ce836 AIS decoding and really bad UI.
The decoder needs a serious refactoring/decoupling.
The UI just dumps bits of the received packets into a console window, whcih scrolls too quickly in an AIS-dense area with a good antenna.
2015-11-06 13:53:04 -08:00
Jared Boone
a366b3ac4f CRC class.
Has some more efficient code, commented out because I was having trouble getting it to work. However, it may have been due to the particular data I was trying to decode and CRC-validate.
2015-11-06 13:49:59 -08:00
Jared Boone
5236a858d0 Change Field.read to const. 2015-11-06 09:40:04 -08:00
Jared Boone
a33aa26bf5 Change header guard name. 2015-11-06 09:40:04 -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
015e5516d5 Update/consolidate AIS RRC matched filter taps. 2015-11-06 09:40:04 -08:00
Jared Boone
dc30911e0f Check for widget != nullptr before add/remove child. 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
0a7ac153a7 AIS RRC taps updated, more precision, corrected frequency shift. 2015-11-06 09:40:03 -08:00
Jared Boone
338983e7ae Remove unused negative-shifted RRC filters. 2015-11-06 09:40:03 -08:00
Jared Boone
3e9f0971e1 Assert that FSKConfiguration size is the same between application and baseband binaries. 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
37b1d7cf2f Remove payload_length from PacketBuilder, etc. 2015-11-06 09:40:01 -08:00
Jared Boone
142617ad94 Silence Clang warning. 2015-11-06 09:40:01 -08:00
Jared Boone
36689f5c45 Refactor bit pattern matching.
Remove AccessCodeCorrelator, Unstuff classes.
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
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
b41ff962f4 Replace std::sin() with interpolated LUT. 2015-10-14 11:10:24 -07:00
Jared Boone
882fbbef31 Add more fft_swap bit reversal functions. 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
Jared Boone
f1ca3fe5bb Switch RFFC5072, MAX2837 back to 40MHz reference.
Turns out the MAX2837 can't tune the necessary range when given a 50MHz reference. Oops.
2015-09-02 17:45:19 -07:00
Jared Boone
293337b647 Init radio in RX mode, not TX mode. 2015-09-02 17:30:16 -07:00
Jared Boone
75d9aa9c73 Remove extra CPLD code internal signals. 2015-08-27 16:54:38 -07:00
Jared Boone
19764ce693 Swap function of P2_8, P2_4 in schematic, firmware, CPLD.
gpio_unused: P2_4 -> P2_8
gpio_lcd_rd: P2_8 -> P2_4
P2_8 is a very long line, shared with DFU button.
Revise schematic to match CPLD signal names.
2015-08-27 16:54:38 -07:00
Jared Boone
b13081696d Simplify MessageQueue pop() usage. 2015-08-27 14:35:17 -07:00
Jared Boone
035ec84f04 Wrap MessageQueue.push() with mutex.
This addresses issue #61, occasional FIFO/data corruption. With the mutex, any thread on one core can write to the FIFO. But still, only one thread on one core should read from the FIFO.
2015-08-26 14:18:03 -07:00
Jared Boone
7937ea7327 Enable DMB instruction at end of FIFO data copy.
Can't hurt to make sure FIFO and buffer state are flushed before returning to caller...
2015-08-26 14:13:51 -07:00
Jared Boone
4fe145b61d Remove application kludge to strip DFU of header.
Strip the header in in the Python SPI image generator, instead.
2015-08-25 15:11:22 -07:00
Jared Boone
690c3c98db Add Shutdown message, plumbing to send and handle. 2015-08-20 18:03:49 -07:00
Jared Boone
bd791a8512 Remove code replaced by memory_map.hpp. 2015-08-20 17:50:20 -07:00
Jared Boone
4b7780f5c6 Move _KiB and _MiB user-defined literals to utility.hpp.
Where I put all the stuff I don't know where to put.
2015-08-20 17:15:51 -07:00
Jared Boone
1c3e45917c Rework to make use of declared memory map regions. 2015-08-20 17:11:08 -07:00
Jared Boone
05690b20ed Created memory_map header.
Knowledge of memory map will be consolidated here.
2015-08-20 17:09:11 -07:00
Jared Boone
52e8093618 Generalize FIFO to specify FIFO size as 2^K.
Configure baseband queue to be larger (4K) than application queue (2K).
2015-08-20 15:59:25 -07:00
Jared Boone
4126f1ab1f Change IPC to exchange data, not pointers. 2015-08-20 13:13:12 -07:00
Jared Boone
b1a4418f06 Push more widget painting code into ui::Painter
Hide knowledge of damage tracking strategy.
2015-08-14 21:36:51 -07:00
Jared Boone
872c998ff1 Move widget tree painting to ui::Painter.
Still doesn't seem like the right place, but better than the event dispatcher!
2015-08-14 21:27:46 -07:00
Jared Boone
a9bb7c96e5 Move UI dirty tracking out of application main.cpp. 2015-08-14 21:17:23 -07:00
Jared Boone
a7226820d0 Hide implementation of MessageHandlerMap. 2015-08-14 17:31:23 -07:00
Jared Boone
76df4f0369 Extract magnitude_squared to utility. 2015-08-04 14:08:15 -07:00
Jared Boone
efaf13d2d1 Extract complex16_mag_squared_to_dbv_norm to utility. 2015-08-04 12:03:10 -07:00
Jared Boone
d855336985 Persist tuned frequency.
w00t!
2015-08-04 10:31:03 -07:00
Jared Boone
4870f0015b Extract PPB reset value to a constant.
Group with related constants.
2015-08-04 10:29:54 -07:00
Jared Boone
52ba9af1c7 Make persistent memory data_t types explicit.
I want the storage types to be reliable, separate from the interface types.
2015-08-04 10:29:10 -07:00
Jared Boone
11c786c4fb Change set_correction_ppb argument to const. 2015-08-04 10:28:23 -07:00
Jared Boone
45d26abf10 Use correct memory region for persistent storage.
Turns out 0x10088000 - 0x10089fff is not the right place. It's 0x40041000, and is only 256 bytes!
Move PPM to correct place, change representation to PPB for finer control.
Reset PPB value to initial value if read value out of bounds.
Clip PPB value on write to permitted bounds.
Contributes to resolution of issue #11.
2015-08-04 10:03:18 -07:00
Jared Boone
98a1eb5c1c Add LCD shutdown method.
Resets LCD controller, turns off backlight.
2015-08-01 14:36:27 -07:00
Jared Boone
65d5f68bfb Move LCD display object to portapack namespace.
Globals are bad... Except in embedded development!
2015-08-01 14:31:51 -07:00
Jared Boone
8af8941687 Use from-RAM DFU image, proper HackRF firmware padding. 2015-07-30 10:02:05 -07:00
Jared Boone
b32f5e2239 Generalize method for executing SPI flash image in M4 RAM. 2015-07-30 09:41:33 -07:00
Clayton Smith
3874c82d57 Store PPM in shared memory for now. 2015-07-29 14:26:40 -07:00
Jared Boone
0ed607b6dd Short-term focus navigation fix
Addresses argilo's immediate problem navigating between fields in a row, issue #32.
2015-07-29 14:00:59 -07:00
Jared Boone
4aa1c8fb65 String functions now default to length = 0, no padding. 2015-07-20 21:53:12 -07:00
Jared Boone
6f2cbd1ac5 Partial refactor of channel filter frequency code.
Move channel filter frequency determination to baseband side, where the filtering is determined and performed.
Add useful accessor methods to BlockDecimator.
2015-07-18 16:49:40 -07:00
Jared Boone
ffc50785b7 specan: cleared up terminology, accounted for decimation.
Channel spectrum decimation now accounted for when computing filter frequencies.
Renamed a bunch of variables relating to channel spectrum bandwidth and filter frequencies.
2015-07-18 16:48:19 -07:00
Jared Boone
e571ca7f1c Change reference initializations errors in GCC 4.8
Resolves issue #12.
2015-07-17 12:07:38 -07:00
Jared Boone
7c9fc62f5e Move halt indication code to common place. 2015-07-08 16:28:57 -07:00
Jared Boone
dc6fee8370 Initial firmware commit. 2015-07-08 08:39:24 -07:00