2015-07-17 13:55:54 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
|
|
|
*
|
|
|
|
* 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-01-31 02:37:08 -05:00
|
|
|
//BUG: No audio in about when shown second time
|
|
|
|
//BUG: Description doesn't show up first time going to system>module info (UI drawn on top)
|
2016-01-29 18:28:05 -05:00
|
|
|
//TODO: Morse coder
|
2016-01-07 08:17:39 -05:00
|
|
|
//TODO: Playdead amnesia and login
|
|
|
|
//TODO: Touch screen calibration
|
|
|
|
//TODO: Display module info (name, desc) somewhere
|
|
|
|
//TODO: Show MD5 mismatches for modules not found, etc...
|
2016-01-05 05:47:46 -05:00
|
|
|
//TODO: More gfx, cute icons :)
|
2016-01-29 18:28:05 -05:00
|
|
|
//TODO: Check jammer bandwidths
|
2016-01-03 01:24:30 -05:00
|
|
|
//TODO: GSM channel detector
|
|
|
|
//TODO: AFSK receiver
|
|
|
|
//TODO: SIGFOX RX/TX
|
2015-11-20 01:59:09 -05:00
|
|
|
//TODO: Reset baseband if module not found (instead of lockup in RAM loop)
|
2016-01-03 01:24:30 -05:00
|
|
|
//TODO: Module name/filename in modules.hpp to indicate requirement in case it's not found ui_loadmodule
|
2015-11-20 01:59:09 -05:00
|
|
|
//TODO: LCD backlight PWM
|
2016-01-05 05:47:46 -05:00
|
|
|
//TODO: BUG: Crash after TX stop (unregister message !)
|
2015-11-20 01:59:09 -05:00
|
|
|
//TODO: Check bw setting in LCR TX
|
|
|
|
//TODO: BUG: Crash after PSN entry in RDS TX
|
2015-09-10 14:36:39 -04:00
|
|
|
//TODO: Bodet :)
|
|
|
|
//TODO: Whistler
|
|
|
|
//TODO: Setup: Play dead by default ? Enable/disable ?
|
|
|
|
//TODO: Hide statusview when playing dead
|
|
|
|
//TODO: Persistent playdead !
|
|
|
|
//TODO: LCR EC=A,J,N
|
|
|
|
//TODO: LCR full message former (see norm)
|
|
|
|
//TODO: LCR address scan
|
|
|
|
//TODO: AFSK NRZI
|
|
|
|
//TODO: TX power
|
|
|
|
|
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 "cpld_update.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>
|
|
|
|
|
|
|
|
int main(void) {
|
2015-08-01 16:42:27 -04:00
|
|
|
portapack::init();
|
2015-07-17 13:55:54 -04:00
|
|
|
|
|
|
|
if( !cpld_update_if_necessary() ) {
|
|
|
|
chSysHalt();
|
|
|
|
}
|
|
|
|
|
|
|
|
portapack::io.init();
|
2015-08-01 17:31:51 -04:00
|
|
|
portapack::display.init();
|
2015-07-17 13:55:54 -04:00
|
|
|
|
|
|
|
sdcStart(&SDCD1, nullptr);
|
|
|
|
|
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
|
|
|
};
|
2015-08-01 17:31:51 -04:00
|
|
|
ui::Painter painter;
|
2015-07-17 13:55:54 -04:00
|
|
|
EventDispatcher event_dispatcher { &system_view, painter, context };
|
|
|
|
|
2016-01-31 03:34:24 -05:00
|
|
|
EventDispatcher::message_map().register_handler(Message::ID::Shutdown,
|
2015-08-20 21:03:49 -04:00
|
|
|
[&event_dispatcher](const Message* const) {
|
|
|
|
event_dispatcher.request_stop();
|
|
|
|
}
|
|
|
|
);
|
2016-01-31 03:34:24 -05:00
|
|
|
EventDispatcher::message_map().register_handler(Message::ID::DisplaySleep,
|
|
|
|
[&event_dispatcher](const Message* const) {
|
|
|
|
event_dispatcher.set_display_sleep(true);
|
|
|
|
}
|
|
|
|
);
|
2015-09-04 14:37:27 -04:00
|
|
|
|
2015-08-20 20:11:08 -04:00
|
|
|
m4_init(portapack::spi_flash::baseband, portapack::memory::map::m4_code);
|
2015-09-04 14:37:27 -04:00
|
|
|
|
2015-08-15 01:28:28 -04:00
|
|
|
controls_init();
|
|
|
|
lcd_frame_sync_configure();
|
|
|
|
rtc_interrupt_enable();
|
2015-07-30 12:41:33 -04:00
|
|
|
|
2015-08-15 01:01:20 -04:00
|
|
|
event_dispatcher.run();
|
2015-07-17 13:55:54 -04:00
|
|
|
|
2015-11-13 13:55:52 -05:00
|
|
|
sdcDisconnect(&SDCD1);
|
2015-11-13 13:55:08 -05:00
|
|
|
sdcStop(&SDCD1);
|
|
|
|
|
2015-08-20 21:03:49 -04:00
|
|
|
portapack::shutdown();
|
2015-08-20 23:26:36 -04:00
|
|
|
m4_init(portapack::spi_flash::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;
|
|
|
|
}
|