2015-09-10 14:36:39 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
2016-12-09 12:21:47 -05:00
|
|
|
* Copyright (C) 2016 Furrtek
|
2015-09-10 14:36:39 -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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ui_whistle.hpp"
|
|
|
|
#include "ui_receiver.hpp"
|
|
|
|
|
|
|
|
#include "portapack.hpp"
|
|
|
|
#include "hackrf_hal.hpp"
|
|
|
|
#include "portapack_shared_memory.hpp"
|
|
|
|
#include "portapack_persistent_memory.hpp"
|
|
|
|
|
|
|
|
#include <cstring>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
using namespace hackrf::one;
|
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
void WhistleView::focus() {
|
|
|
|
button_transmit.focus();
|
|
|
|
}
|
|
|
|
|
|
|
|
WhistleView::~WhistleView() {
|
2016-12-09 12:21:47 -05:00
|
|
|
//transmitter_model.disable();
|
2015-09-10 14:36:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void WhistleView::paint(Painter& painter) {
|
2016-01-05 05:47:46 -05:00
|
|
|
(void)painter;
|
2015-09-10 14:36:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Button WhistleView::button_scan = {
|
|
|
|
{ 76, 270, 72, 32 },
|
|
|
|
"SCAN"
|
|
|
|
};
|
|
|
|
|
|
|
|
WhistleView::WhistleView(
|
2016-12-09 12:21:47 -05:00
|
|
|
NavigationView& nav
|
|
|
|
)
|
2015-09-10 14:36:39 -04:00
|
|
|
{
|
|
|
|
add_children({ {
|
|
|
|
&button_transmit,
|
|
|
|
&button_exit
|
|
|
|
} });
|
|
|
|
|
2016-12-09 12:21:47 -05:00
|
|
|
button_transmit.on_select = [this](Button&){
|
2015-09-10 14:36:39 -04:00
|
|
|
/*uint16_t c;
|
|
|
|
ui::Context context;
|
|
|
|
|
|
|
|
make_frame();
|
|
|
|
|
|
|
|
shared_memory.afsk_samples_per_bit = 228000/persistent_memory::afsk_bitrate();
|
|
|
|
shared_memory.afsk_phase_inc_mark = persistent_memory::afsk_mark_freq()*(65536*1024)/2280;
|
|
|
|
shared_memory.afsk_phase_inc_space = persistent_memory::afsk_space_freq()*(65536*1024)/2280;
|
|
|
|
|
|
|
|
for (c = 0; c < 256; c++) {
|
|
|
|
shared_memory.lcrdata[c] = this->lcrframe[c];
|
|
|
|
}
|
|
|
|
|
|
|
|
shared_memory.afsk_transmit_done = false;
|
|
|
|
shared_memory.afsk_repeat = 5; // DEFAULT
|
|
|
|
|
2015-11-12 19:19:05 -05:00
|
|
|
text_status.set("Send...");*/
|
2015-09-10 14:36:39 -04:00
|
|
|
|
2016-12-09 12:21:47 -05:00
|
|
|
//transmitter_model.enable();
|
2015-09-10 14:36:39 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
button_exit.on_select = [&nav](Button&){
|
|
|
|
nav.pop();
|
|
|
|
};
|
|
|
|
|
2015-11-12 19:19:05 -05:00
|
|
|
//static VirtualTimer vt1;
|
|
|
|
//msg_t msg, result;
|
2015-09-10 14:36:39 -04:00
|
|
|
|
|
|
|
/*static EvTimer evt;
|
|
|
|
static EventListener el0;
|
|
|
|
|
|
|
|
evtInit(&evt, MS2ST(2000));
|
|
|
|
evtStart(&evt);
|
|
|
|
chEvtRegister(&evt.et_es, &el0, 0);*/
|
|
|
|
|
|
|
|
//chVTSet(&vt1, MS2ST(2000), whistle_th, (void *)&mbox);
|
|
|
|
|
2015-11-12 19:19:05 -05:00
|
|
|
//while(1) {
|
2015-09-10 14:36:39 -04:00
|
|
|
/*result = chMBFetch(&mbox, &msg, TIME_INFINITE);
|
|
|
|
if(result == RDY_OK) {
|
|
|
|
if(msg & 1)
|
|
|
|
button_scan.set_text("POUET");
|
|
|
|
}*/
|
2015-11-12 19:19:05 -05:00
|
|
|
//chThdSleepMilliseconds(500);
|
|
|
|
//}
|
2015-09-10 14:36:39 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} /* namespace ui */
|