Commit Graph

313 Commits

Author SHA1 Message Date
Jared Boone
77eb0c5d24 ILI9341 read_pixels().
Improves on / abstracts prior interface, which just handed back uint16_ts from the LCD's parallel interface.
2016-02-19 15:31:56 -08:00
Jared Boone
bdaa13c103 CRC, Adler32 interfaces accept void* blocks.
...despite my better judgement.
2016-02-19 15:30:35 -08:00
Jared Boone
6d0995e165 Function to read bytes from 16-bit LCD interface.
...begin careful not to overread from the LCD, or overwrite to the buffer.
2016-02-19 15:29:00 -08:00
Jared Boone
1f79c72bf0 Remove irrelevant comment from portapack::io. 2016-02-19 15:28:15 -08:00
Jared Boone
322a15587a Add ColorRGB888 type for data from LCD frame buffer. 2016-02-19 15:27:50 -08:00
Jared Boone
5ed76d6985 Adler32 implementation (for PNG writer). 2016-02-19 14:13:15 -08:00
Jared Boone
daeb542086 Remove constexpr use of std::log2, std::log10.
GCC 4.9 doesn't care for it.
2016-02-19 10:30:26 -08:00
Jared Boone
d6d1f6b8af Missing #include. 2016-02-19 08:57:07 -08:00
Jared Boone
1e0d34c98b CRC internal type more suitable for ARM. 2016-02-18 21:31:51 -08:00
Jared Boone
00fb25f143 CRC class now supports reverse of input/output. 2016-02-18 20:36:32 -08:00
Jared Boone
0681f9c5df Init message queues in M0 event dispatcher. 2016-02-16 11:23:02 -08:00
Jared Boone
ef86848139 Change baseband floats to normalize at +/-1.0. 2016-02-14 12:38:50 -08:00
Jared Boone
64e4cde7f5 fast_pow2() implemented. 2016-02-13 11:18:34 -08:00
Jared Boone
d2531016e5 Expose fast_log2(). 2016-02-13 11:18:15 -08:00
Jared Boone
4321deee1e ChibiOS memory helper functions. 2016-02-12 13:52:22 -08:00
Jared Boone
d125a5c662 Remove "K" parameter from FIFO template. 2016-02-10 10:41:06 -08:00
Jared Boone
dfbcf5bc75 Extract some constexpr math utilities to utility.hpp
...my dumping ground for so many random bits.
2016-02-10 10:15:42 -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
5cd423bb20 Fast log2 implementation.
Big improvement in code size (2034 bytes!). Baseband FFT (idle) thread CPU cut in half.
2016-02-08 12:55:06 -08:00
Jared Boone
cdd15fcf79 Rework complex16_mag_squared_to_dbv_norm() to use log2.
Small code size reduction and improvement in CPU effort.
2016-02-08 12:35:20 -08:00
Jared Boone
3aabd804d3 Remove commented code. 2016-02-07 21:52:36 -08:00
Jared Boone
5a66c68861 Return Widget::children() by reference. 2016-02-07 11:24:25 -08:00
Jared Boone
2b6bc03408 Remove unfinished Widget last child focus code. 2016-02-07 11:06:16 -08:00
Jared Boone
31499fea5d Rewrite Widget::screen_pos() in terms of screen_rect(). 2016-02-07 10:55:55 -08:00
Jared Boone
a420f018c7 Remove unused View::dirty_screen_rect member. 2016-02-07 10:53:40 -08:00
Jared Boone
41d4fd0044 Remove unused View::initial_focus(). 2016-02-07 10:42:41 -08:00
Jared Boone
3a709c51c4 Hide more Widget member variables. 2016-02-07 10:40:06 -08:00
Jared Boone
7cb3bbc9f8 Make Widget flags private, expose via methods. 2016-02-07 10:32:38 -08:00
Jared Boone
a9451c17b4 Move PPB clock adjustment out of ReceiverModel. 2016-02-05 16:52:34 -08:00
Jared Boone
fd3f962e40 Define and utilize memory region backup_ram. 2016-02-05 16:45:23 -08:00
Jared Boone
0294165481 Extract LOTS of stuff into an audio API.
Prevent all manner of type and implementation leakage.
2016-02-05 16:25:43 -08:00
Jared Boone
9430c94dec Move I2S management to application side. 2016-02-05 15:25:08 -08:00
Jared Boone
80511ac93f Improve repaint scope when widgets removed from parent.
Addresses flickering (again!) when switching between options views in receiver app.
2016-02-05 10:44:09 -08:00
Jared Boone
1d2dd4e19d Old GCC on Travis-CI was cheesed off by my new syntax. 2016-02-03 17:59:46 -08:00
Jared Boone
84824a504f Add UI Image and ImageButton classes. 2016-02-03 15:48:50 -08:00
Jared Boone
76013a656c Add Painter.draw_bitmap for Bitmap types. 2016-02-03 13:23:46 -08:00
Jared Boone
deade67fd8 Add ui::Bitmap for two-color images. 2016-02-03 13:23:23 -08:00
Jared Boone
5d0b5d427a Extract draw_bitmap from draw_glyph. 2016-02-03 10:33:54 -08:00
Jared Boone
be8c1307e2 Add OptionsField event for on_focus.
TODO: So poorly named! Should be on_focus, but requires sweeping changes. Ugh.
2016-02-02 13:41:11 -08:00
Jared Boone
ccafc1e82c Fix DSB channel filter taps, don't saturate max tap value. 2016-01-30 20:45:16 -08:00
Jared Boone
a79aa3e580 Correct DSB decim_2 FIR taps comment. 2016-01-30 19:03:50 -08:00
Jared Boone
a97cd642ac Multiple AM modes selection in application API. 2016-01-30 19:03:32 -08:00
Jared Boone
a1e1677b8b Rename AM modulation mode "DSB". 2016-01-30 18:17:29 -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
1915ff980f Add AM processor decim_2. 2016-01-30 17:28:11 -08:00
Jared Boone
279e5c775d Add LSB filter taps. 2016-01-30 17:23:04 -08:00
Jared Boone
69deaafd1c Clean up formatting of USB FIR filter taps. 2016-01-30 17:22:38 -08:00
Jared Boone
b029bacd8c Remove channel decimation from AMConfigureMessage. 2016-01-30 17:21:48 -08:00
Jared Boone
f82a22dd2c USB channel filter. 2016-01-29 22:29:52 -08:00
Jared Boone
b9c2ba4053 Add fir_taps_complex structure. 2016-01-29 22:29:23 -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
65d224be14 Add IIR configs for fs=24kHz NBFM and fs=12kHz AM. 2016-01-29 18:31:03 -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
275b644edd Fix flickering freq/gain options views.
Was caused by invalidating ALL of the parent view, when only the overlapping views would need to be repainted.
2016-01-27 21:47:10 -08:00
Jared Boone
b801366e4e Recover from display sleep, use LCD sleep function. 2016-01-27 21:05:28 -08:00
Jared Boone
894d4b955c Unclever first attempt at display sleep. 2016-01-27 20:33:54 -08:00
Jared Boone
7519b83379 Make better use of range_t methods. 2016-01-27 14:46:45 -08:00
Jared Boone
018b54c711 Extract range_t to utility header. 2016-01-27 12:09:36 -08:00
Jared Boone
0efe2ea0ae Add virtual title() to View class. 2016-01-26 13:01:16 -08:00
Jared Boone
a13e19a907 Paint background of Text object before string. 2016-01-26 13:00:36 -08:00
Jared Boone
798b5eb972 Extract Temperature, Pressure into units header. 2016-01-23 21:37:22 -08:00
Jared Boone
45ae222ab5 Extract Optional to own header. 2016-01-23 21:26:06 -08:00
Jared Boone
14f18d5cf7 Reduce use of unsigned integers when signed will do fine. 2016-01-23 17:53:16 -08:00
Jared Boone
ce481c0b5a Clean up UI type static_casts.
So disgusting, but not entirely gone yet...
2016-01-23 17:02:16 -08:00
Jared Boone
8fd8815e95 Remove irrelevant comments. 2016-01-15 16:00:21 -08:00
Jared Boone
f3989050e8 Clean up AIS lat/lon types and formatting. 2016-01-15 15:25:32 -08:00
Jared Boone
1e92d416c7 More AIS position report detail. 2016-01-15 15:21:45 -08:00
Jared Boone
9cab3c9978 Remove message_map from Context.
It doesn't belong in a display/rendering context object, it has much broader significance, mostly distributing messages via the M4->M0 IPC mechanism.
2016-01-13 15:46:04 -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
b9f124850b Add buffer_t<float> type alias. 2016-01-11 16:10:48 -08:00
Jared Boone
136ba895ef Clear spectrum FIFO when streaming is stopped. 2016-01-10 11:00:09 -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
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
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
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