portapack-mayhem/firmware/application/main.cpp

153 lines
4.0 KiB
C++
Raw Normal View History

2015-07-17 17:55:54 +00:00
/*
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
2016-07-28 03:25:33 +00:00
* Copyright (C) 2016 Furrtek
2015-07-17 17:55:54 +00: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.
*/
// Color bitmaps generated with:
// Gimp image > indexed colors (16), then "xxd -i *.bmp"
//BUG: Set description in frequency save makes everything go crazy
2017-01-29 06:50:48 +00:00
//BUG: Distorted audio in WFM receiver
//BUG: (fixed ?) POCSAG: Bad console scroll init
//BUG: POCSAG misses alphanum messages, cuts them off sometimes
2017-01-29 06:50:48 +00:00
//BUG: Check AFSK transmit end, skips last bits ?
//BUG: RDS doesn't stop baseband when stopping tx ?
//TEST: Imperial in whipcalc
//TEST: Numbers
//TEST: Jammer
//TODO: Script engine ?
//TODO: Morse coder for foxhunts
//TODO: Finish EPAR tx
//TODO: IQ replay
//TODO: Wav visualizer
//TODO: File browser ?
//TODO: Mousejack ?
//TODO: Move frequencykeypad from ui_receiver to ui_widget (used everywhere)
//TODO: ADS-B draw trajectory + GPS coordinates + scale, and playback
//TODO: Analog TV tx with camcorder font character generator
//TODO: Make Morse coder and Whistle use proc_tones
//TODO: RDS multiple groups (sequence)
//TODO: Use ModalMessageView confirmation for TX ?
2016-11-30 06:41:55 +00:00
//TODO: Show address/data bit fields in OOK TX
//TODO: Scan for OOK TX
//TODO: Check more OOK encoders
//TODO: POCSAG 512 and 2400 (all 3 at the same time, or parameter ?)
2016-08-02 10:44:31 +00:00
//TODO: Use msgpack for settings, lists... on sd card
2016-07-30 03:27:28 +00:00
//Multimon-style stuff:
//TODO: AFSK receiver
2016-11-30 06:41:55 +00:00
//TODO: CTCSS detector
//TODO: DMR detector
2016-07-30 03:27:28 +00:00
//TODO: GSM channel detector
//TODO: SIGFOX RX/TX
//TODO: Bodet :)
2016-07-30 03:27:28 +00:00
//TODO: LCR full message former (see norm)
//TODO: AFSK NRZI
2016-07-30 03:27:28 +00:00
//TODO: TX power setting
//TODO: Playdead amnesia and login
//TODO: Setup: Play dead by default ? Enable/disable ?
//BUG (fixed ?): No audio in about when shown second time
2016-07-30 03:27:28 +00: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 10:44:31 +00:00
//BUG: Description doesn't show up first time going to system>module info (UI drawn on top)
2016-07-30 03:27:28 +00:00
//TODO: Draw on touchscreen and transmit as spectrum paint
//TODO: Two players tic-tac-toe
//TODO: Analog TV pong game
2015-07-17 17:55:54 +00:00
#include "ch.h"
2015-08-01 20:42:27 +00:00
#include "portapack.hpp"
2015-07-17 17:55:54 +00: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"
#include "irq_rtc.hpp"
2015-07-17 17:55:54 +00:00
2016-01-31 08:34:24 +00:00
#include "event_m0.hpp"
2015-07-17 17:55:54 +00:00
#include "core_control.hpp"
#include "spi_image.hpp"
2015-07-17 17:55:54 +00:00
#include "debug.hpp"
#include "led.hpp"
#include "gcc.hpp"
#include "sd_card.hpp"
2015-07-17 17:55:54 +00:00
#include <string.h>
static void event_loop() {
ui::Context context;
2015-07-17 17:55:54 +00:00
ui::SystemView system_view {
context,
portapack::display.screen_rect()
2015-07-17 17:55:54 +00:00
};
2016-05-12 22:52:18 +00:00
EventDispatcher event_dispatcher { &system_view, context };
MessageHandlerRegistration message_handler_display_sleep {
Message::ID::DisplaySleep,
2016-01-31 08:34:24 +00:00
[&event_dispatcher](const Message* const) {
event_dispatcher.set_display_sleep(true);
}
};
event_dispatcher.run();
}
int main(void) {
portapack::init();
portapack::io.init();
portapack::display.init();
sdcStart(&SDCD1, nullptr);
controls_init();
lcd_frame_sync_configure();
rtc_interrupt_enable();
event_loop();
2015-07-17 17:55:54 +00:00
sdcDisconnect(&SDCD1);
sdcStop(&SDCD1);
portapack::shutdown();
m4_init(portapack::spi_flash::image_tag_hackrf, portapack::memory::map::m4_code_hackrf);
2016-02-16 19:04:35 +00:00
m0_halt();
2015-07-17 17:55:54 +00:00
return 0;
}