2015-07-17 13:55:54 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
2016-07-27 23:25:33 -04:00
|
|
|
* Copyright (C) 2016 Furrtek
|
2015-07-17 13:55:54 -04:00
|
|
|
*
|
|
|
|
* This file is part of PortaPack.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2016-12-24 10:54:44 -05:00
|
|
|
// Color bitmaps generated with:
|
2016-08-01 14:06:17 -04:00
|
|
|
// Gimp image > indexed colors (16), then "xxd -i *.bmp"
|
2016-05-27 00:48:04 -04:00
|
|
|
|
2018-05-15 18:35:30 -04:00
|
|
|
// Note about available RAM:
|
|
|
|
// Check what ends up in the BSS section by looking at the map files !
|
|
|
|
// Use constexpr where possible or make sure const are in .cpp files, not headers !
|
|
|
|
|
2018-05-21 13:46:48 -04:00
|
|
|
// Note about messages:
|
|
|
|
// There can only be one message handler for one kind of message at once
|
2018-06-12 02:55:12 -04:00
|
|
|
// If an attempt is made to register a second handler, there's a chDbgPanic "MsgDblReg"
|
|
|
|
|
|
|
|
// Note about matched filters: see proc_sonde.hpp
|
2018-05-21 13:46:48 -04:00
|
|
|
|
2018-05-16 04:45:13 -04:00
|
|
|
//TEST: Goertzel tone detect
|
2017-06-23 03:40:22 -04:00
|
|
|
//TEST: Menuview refresh, seems to blink a lot
|
|
|
|
//TEST: Check AFSK transmit end, skips last bits ?
|
|
|
|
//TEST: Imperial in whipcalc
|
|
|
|
|
2018-06-12 02:55:12 -04:00
|
|
|
//BUG: Console lock-up if first string to be printed starts with escape character ?
|
2017-12-06 19:58:25 -05:00
|
|
|
//BUG: (Workaround ok) CPLD-related rx ok, tx bad, see portapack.cpp lines 214+ to disable CPLD overlay
|
2017-05-25 16:08:33 -04:00
|
|
|
//BUG: SCANNER Lock on frequency, if frequency jump, still locked on first one
|
|
|
|
//BUG: SCANNER Multiple slices
|
2018-05-15 18:35:30 -04:00
|
|
|
//GLITCH: The about view scroller sometimes misses lines because of a race condition between the display scrolling and drawing the line
|
2018-05-21 13:46:48 -04:00
|
|
|
//GLITCH: Start of tx using ReplayThread plays a small bit of previous transmission (content of 1 buffer ?)
|
|
|
|
// See fifo.reset_in() ?
|
2017-05-25 16:08:33 -04:00
|
|
|
|
2019-02-06 12:34:53 -05:00
|
|
|
//FIXED: Update button in signal gen doesn't work for shape change
|
|
|
|
//BUG: Signal gen noise shape doesn't work
|
2018-06-12 02:55:12 -04:00
|
|
|
//TODO: Continue acars receiver. See matched filter, probably doesn't shift the spectrum correctly
|
2018-06-10 05:15:43 -04:00
|
|
|
//TODO: Add larger description text field in frequency load, under menuview
|
|
|
|
//TODO: Allow apps to select a preferred FREQMAN file
|
2018-05-16 04:45:13 -04:00
|
|
|
//TODO: Make play button larger in Replay
|
|
|
|
//TODO: Add default headphones volume setting in Audio settings
|
2018-06-10 05:15:43 -04:00
|
|
|
//TODO: Put LNA and VGA controls in Soundboard
|
|
|
|
//TODO: Make CTCSS display only when squelch is opened
|
|
|
|
//TODO: DCS decoder
|
|
|
|
//TODO: Increase resolution of audio FFT view ? Currently 48k/(256/2) (375Hz) because of the use of real values (half of FFT output)
|
2018-03-27 07:52:07 -04:00
|
|
|
//TODO: Move Touchtunes remote to Custom remote
|
|
|
|
//TODO: Use escapes \x1B to set colors in text, it works !
|
2018-01-09 16:12:19 -05:00
|
|
|
//TODO: Open files in File Manager
|
|
|
|
//TODO: Ask for filename after record
|
2017-12-08 13:58:46 -05:00
|
|
|
//TODO: Super simple text file viewer
|
2017-12-06 19:58:25 -05:00
|
|
|
//TODO: Clean up ReplayThread
|
2017-10-15 10:53:40 -04:00
|
|
|
//TODO: Cap Wav viewer position
|
|
|
|
//TODO: Adapt wav viewer position step
|
2017-11-02 13:11:26 -04:00
|
|
|
//TODO: Use unit_auto_scale
|
2017-10-15 10:53:40 -04:00
|
|
|
//TODO: Remove make_bistream from encoders.cpp, too complex, stinks. bitstream_append should be enough.
|
|
|
|
//TODO: Continue work on proc_afskrx_corr, see python script (it works !)
|
|
|
|
//TODO: De bruijn sequence scanner for encoders
|
|
|
|
//TODO: FILEMAN Move files
|
|
|
|
//TODO: Use separate thread for scanning in EPAR TX
|
2017-06-23 03:40:22 -04:00
|
|
|
//TODO: Make freqman refresh simpler (use previous black rectangle method)
|
2017-05-25 16:08:33 -04:00
|
|
|
//TODO: Merge AFSK and TONES procs ?
|
2017-06-23 03:40:22 -04:00
|
|
|
//TODO: NFM RX mode: nav.pop on squelch
|
2017-05-25 16:08:33 -04:00
|
|
|
//TODO: MORSE use prosigns
|
|
|
|
//TODO: MORSE live keying mode
|
|
|
|
//TODO: Use to_string_short_freq wherever possible
|
|
|
|
//TODO: SCANNER Waveform widget as FFT view ?
|
2017-03-14 04:20:13 -04:00
|
|
|
//TODO: Optimize (and group ?) CTCSS tone gen code
|
2017-02-14 22:05:38 -05:00
|
|
|
/*
|
|
|
|
Continuous (Fox-oring)
|
|
|
|
12s transmit, 48s space (Sprint 1/5th)
|
|
|
|
60s transmit, 240s space (Classic 1/5 min)
|
|
|
|
60s transmit, 360s space (Classic 1/7 min)
|
|
|
|
*/
|
2017-06-23 03:40:22 -04:00
|
|
|
//TODO: FreqMan: Remove and rename categories
|
2016-12-09 12:21:47 -05:00
|
|
|
//TODO: Mousejack ?
|
|
|
|
//TODO: Move frequencykeypad from ui_receiver to ui_widget (used everywhere)
|
|
|
|
//TODO: ADS-B draw trajectory + GPS coordinates + scale, and playback
|
|
|
|
//TODO: RDS multiple groups (sequence)
|
|
|
|
//TODO: Use ModalMessageView confirmation for TX ?
|
2016-08-02 06:44:31 -04:00
|
|
|
//TODO: Use msgpack for settings, lists... on sd card
|
2016-07-29 23:27:28 -04:00
|
|
|
|
2017-05-18 06:06:11 -04:00
|
|
|
// Multimon-style stuff:
|
2016-11-30 01:41:55 -05:00
|
|
|
//TODO: DMR detector
|
2016-01-03 01:24:30 -05:00
|
|
|
//TODO: GSM channel detector
|
2016-07-29 23:27:28 -04:00
|
|
|
//TODO: Playdead amnesia and login
|
2015-09-10 14:36:39 -04:00
|
|
|
//TODO: Setup: Play dead by default ? Enable/disable ?
|
2017-05-18 06:06:11 -04:00
|
|
|
|
|
|
|
// Old or low-priority stuff:
|
|
|
|
//TODO: Bodet :)
|
|
|
|
//TODO: Analog TV tx with camcorder font character generator
|
|
|
|
//TODO: Scan for OOK TX
|
|
|
|
//TODO: Check more OOK encoders
|
2016-12-09 12:21:47 -05:00
|
|
|
//BUG (fixed ?): No audio in about when shown second time
|
2016-07-29 23:27:28 -04:00
|
|
|
//TODO: Show MD5 mismatches for modules not found, etc...
|
|
|
|
//TODO: Module name/filename in modules.hpp to indicate requirement in case it's not found ui_loadmodule
|
2016-08-02 06:44:31 -04:00
|
|
|
//BUG: Description doesn't show up first time going to system>module info (UI drawn on top)
|
2016-07-25 10:21:27 -04:00
|
|
|
//TODO: Two players tic-tac-toe
|
2016-12-09 12:21:47 -05:00
|
|
|
//TODO: Analog TV pong game
|
2015-09-10 14:36:39 -04:00
|
|
|
|
2015-07-17 13:55:54 -04:00
|
|
|
#include "ch.h"
|
|
|
|
|
2015-08-01 16:42:27 -04:00
|
|
|
#include "portapack.hpp"
|
2015-07-17 13:55:54 -04:00
|
|
|
#include "portapack_shared_memory.hpp"
|
|
|
|
|
|
|
|
#include "message_queue.hpp"
|
|
|
|
|
|
|
|
#include "ui.hpp"
|
|
|
|
#include "ui_widget.hpp"
|
|
|
|
#include "ui_painter.hpp"
|
|
|
|
#include "ui_navigation.hpp"
|
|
|
|
|
|
|
|
#include "irq_lcd_frame.hpp"
|
|
|
|
#include "irq_controls.hpp"
|
2015-08-14 23:57:40 -04:00
|
|
|
#include "irq_rtc.hpp"
|
2015-07-17 13:55:54 -04:00
|
|
|
|
2016-01-31 03:34:24 -05:00
|
|
|
#include "event_m0.hpp"
|
2015-07-17 13:55:54 -04:00
|
|
|
|
2016-02-16 14:09:00 -05:00
|
|
|
#include "core_control.hpp"
|
2015-07-30 12:41:33 -04:00
|
|
|
#include "spi_image.hpp"
|
2015-07-17 13:55:54 -04:00
|
|
|
|
|
|
|
#include "debug.hpp"
|
|
|
|
#include "led.hpp"
|
|
|
|
|
|
|
|
#include "gcc.hpp"
|
|
|
|
|
2015-11-10 18:24:42 -05:00
|
|
|
#include "sd_card.hpp"
|
2015-07-17 13:55:54 -04:00
|
|
|
|
|
|
|
#include <string.h>
|
2021-09-25 10:37:30 -04:00
|
|
|
|
|
|
|
#include "rffc507x.hpp" /* c/m, avoiding initial short ON Ant_DC_Bias pulse, from cold reset */
|
|
|
|
rffc507x::RFFC507x first_if;
|
2015-07-17 13:55:54 -04:00
|
|
|
|
2016-05-12 01:53:09 -04:00
|
|
|
static void event_loop() {
|
2015-08-14 18:52:11 -04:00
|
|
|
ui::Context context;
|
2015-07-17 13:55:54 -04:00
|
|
|
ui::SystemView system_view {
|
|
|
|
context,
|
2015-08-14 18:52:11 -04:00
|
|
|
portapack::display.screen_rect()
|
2015-07-17 13:55:54 -04:00
|
|
|
};
|
|
|
|
|
2016-05-12 18:52:18 -04:00
|
|
|
EventDispatcher event_dispatcher { &system_view, context };
|
2016-05-12 01:53:09 -04:00
|
|
|
MessageHandlerRegistration message_handler_display_sleep {
|
|
|
|
Message::ID::DisplaySleep,
|
2016-01-31 03:34:24 -05:00
|
|
|
[&event_dispatcher](const Message* const) {
|
|
|
|
event_dispatcher.set_display_sleep(true);
|
|
|
|
}
|
2016-05-12 01:53:09 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
event_dispatcher.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(void) {
|
2021-09-25 10:37:30 -04:00
|
|
|
first_if.init(); /* To avoid initial short Ant_DC_Bias pulse ,we need quick set up GP01_RFF507X =1 */
|
2017-06-14 01:16:00 -04:00
|
|
|
if( portapack::init() ) {
|
|
|
|
portapack::display.init();
|
2016-05-12 01:53:09 -04:00
|
|
|
|
2022-04-11 05:42:56 -04:00
|
|
|
// sdcStart(&SDCD1, nullptr); // Commented out as now happens in portapack.cpp
|
2015-09-04 14:37:27 -04:00
|
|
|
|
2022-04-05 16:16:57 -04:00
|
|
|
// controls_init(); // Commented out as now happens in portapack.cpp
|
2017-06-14 01:16:00 -04:00
|
|
|
lcd_frame_sync_configure();
|
|
|
|
rtc_interrupt_enable();
|
2015-09-04 14:37:27 -04:00
|
|
|
|
2017-06-14 01:16:00 -04:00
|
|
|
event_loop();
|
2015-07-30 12:41:33 -04:00
|
|
|
|
2022-04-11 05:42:56 -04:00
|
|
|
|
2017-06-14 01:16:00 -04:00
|
|
|
sdcDisconnect(&SDCD1);
|
|
|
|
sdcStop(&SDCD1);
|
2015-07-17 13:55:54 -04:00
|
|
|
|
2017-06-14 01:16:00 -04:00
|
|
|
portapack::shutdown();
|
|
|
|
}
|
2015-11-13 13:55:08 -05:00
|
|
|
|
2016-07-01 13:37:22 -04:00
|
|
|
m4_init(portapack::spi_flash::image_tag_hackrf, portapack::memory::map::m4_code_hackrf);
|
2016-02-16 14:04:35 -05:00
|
|
|
m0_halt();
|
2015-07-17 13:55:54 -04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|