Add Signal for per-second tick callbacks.

This commit is contained in:
Jared Boone 2016-04-27 12:02:17 -07:00
parent 7430e31578
commit 8188b44439
4 changed files with 71 additions and 0 deletions

View File

@ -181,6 +181,7 @@ CPPSRC = main.cpp \
../common/ert_packet.cpp \
capture_app.cpp \
sd_card.cpp \
time.cpp \
file.cpp \
log_file.cpp \
png_writer.cpp \

View File

@ -24,6 +24,7 @@
#include "portapack.hpp"
#include "sd_card.hpp"
#include "time.hpp"
#include "message.hpp"
#include "message_queue.hpp"
@ -145,6 +146,8 @@ void EventDispatcher::handle_rtc_tick() {
sd_card::poll_inserted();
portapack::temperature_logger.second_tick();
time::on_tick_second();
}
ui::Widget* EventDispatcher::touch_widget(ui::Widget* const w, ui::TouchEvent event) {

View File

@ -0,0 +1,32 @@
/*
* Copyright (C) 2015 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.
*/
#include "time.hpp"
namespace time {
Signal<> signal_tick_second;
void on_tick_second() {
signal_tick_second.emit();
}
} /* namespace time */

View File

@ -0,0 +1,35 @@
/*
* Copyright (C) 2015 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.
*/
#ifndef __TIME_H__
#define __TIME_H__
#include "signal.hpp"
namespace time {
extern Signal<> signal_tick_second;
void on_tick_second();
} /* namespace time */
#endif/*__TIME_H__*/