mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-25 05:47:44 +00:00
Merge remote-tracking branch 'upstream/master'
# Conflicts: # firmware/application/bitmap.hpp # firmware/application/receiver_model.cpp # firmware/application/receiver_model.hpp # firmware/application/touch.hpp # firmware/application/ui_setup.cpp # firmware/baseband/proc_ais.hpp # firmware/baseband/proc_ert.hpp # firmware/bootstrap/CMakeLists.txt # firmware/common/portapack_persistent_memory.cpp # firmware/common/portapack_persistent_memory.hpp
This commit is contained in:
@@ -71,9 +71,11 @@ public:
|
||||
AFSKConfigure = 23,
|
||||
PWMRSSIConfigure = 24,
|
||||
OOKConfigure = 25,
|
||||
RDSConfigure = 26,
|
||||
AudioTXConfig = 27,
|
||||
|
||||
FIFOSignal = 26,
|
||||
FIFOData = 27,
|
||||
FIFOSignal = 28,
|
||||
FIFOData = 29,
|
||||
MAX
|
||||
};
|
||||
|
||||
@@ -516,6 +518,18 @@ public:
|
||||
const uint16_t tone_count;
|
||||
};
|
||||
|
||||
class RDSConfigureMessage : public Message {
|
||||
public:
|
||||
constexpr RDSConfigureMessage(
|
||||
const uint32_t length
|
||||
) : Message { ID::RDSConfigure },
|
||||
length(length)
|
||||
{
|
||||
}
|
||||
|
||||
const uint32_t length = 0;
|
||||
};
|
||||
|
||||
class RetuneMessage : public Message {
|
||||
public:
|
||||
constexpr RetuneMessage(
|
||||
@@ -528,6 +542,18 @@ public:
|
||||
const int64_t freq = 0;
|
||||
};
|
||||
|
||||
class AudioTXConfigMessage : public Message {
|
||||
public:
|
||||
constexpr AudioTXConfigMessage(
|
||||
const uint32_t bw
|
||||
) : Message { ID::AudioTXConfig },
|
||||
bw(bw)
|
||||
{
|
||||
}
|
||||
|
||||
const uint32_t bw;
|
||||
};
|
||||
|
||||
class AFSKConfigureMessage : public Message {
|
||||
public:
|
||||
constexpr AFSKConfigureMessage(
|
||||
@@ -576,6 +602,7 @@ public:
|
||||
const uint32_t pause_symbols;
|
||||
};
|
||||
|
||||
// TODO: use streaming buffer instead
|
||||
class FIFOSignalMessage : public Message {
|
||||
public:
|
||||
constexpr FIFOSignalMessage(
|
||||
@@ -583,7 +610,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
const char signaltype = 0;
|
||||
char signaltype = 0;
|
||||
};
|
||||
|
||||
class FIFODataMessage : public Message {
|
||||
|
@@ -36,7 +36,7 @@ using portapack::memory::map::backup_ram;
|
||||
namespace portapack {
|
||||
namespace persistent_memory {
|
||||
|
||||
constexpr rf::Frequency tuned_frequency_reset_value { 88000000 };
|
||||
constexpr rf::Frequency tuned_frequency_reset_value { 100000000 };
|
||||
|
||||
using ppb_range_t = range_t<ppb_t>;
|
||||
constexpr ppb_range_t ppb_range { -99000, 99000 };
|
||||
@@ -57,9 +57,11 @@ constexpr int32_t afsk_bw_reset_value { 15 };
|
||||
|
||||
/* struct must pack the same way on M4 and M0 cores. */
|
||||
struct data_t {
|
||||
// General config
|
||||
int64_t tuned_frequency;
|
||||
int32_t correction_ppb;
|
||||
uint32_t touch_calibration_magic;
|
||||
touch::Calibration touch_calibration;
|
||||
|
||||
|
||||
// AFSK modem
|
||||
int32_t afsk_mark_freq;
|
||||
@@ -99,6 +101,20 @@ void set_correction_ppb(const ppb_t new_value) {
|
||||
portapack::clock_manager.set_reference_ppb(clipped_value);
|
||||
}
|
||||
|
||||
static constexpr uint32_t touch_calibration_magic = 0x074af82f;
|
||||
|
||||
void set_touch_calibration(const touch::Calibration& new_value) {
|
||||
data->touch_calibration = new_value;
|
||||
data->touch_calibration_magic = touch_calibration_magic;
|
||||
}
|
||||
|
||||
const touch::Calibration& touch_calibration() {
|
||||
if( data->touch_calibration_magic != touch_calibration_magic ) {
|
||||
set_touch_calibration(touch::default_calibration());
|
||||
}
|
||||
return data->touch_calibration;
|
||||
}
|
||||
|
||||
int32_t afsk_mark_freq() {
|
||||
afsk_freq_range.reset_if_outside(data->afsk_mark_freq, afsk_mark_reset_value);
|
||||
return data->afsk_mark_freq;
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "rf_path.hpp"
|
||||
#include "touch.hpp"
|
||||
|
||||
namespace portapack {
|
||||
namespace persistent_memory {
|
||||
@@ -37,6 +38,9 @@ void set_tuned_frequency(const rf::Frequency new_value);
|
||||
ppb_t correction_ppb();
|
||||
void set_correction_ppb(const ppb_t new_value);
|
||||
|
||||
void set_touch_calibration(const touch::Calibration& new_value);
|
||||
const touch::Calibration& touch_calibration();
|
||||
|
||||
int32_t afsk_mark_freq();
|
||||
void set_afsk_mark(const int32_t new_value);
|
||||
|
||||
|
@@ -75,7 +75,6 @@ constexpr image_tag_t image_tag_jammer { 'P', 'J', 'A', 'M' };
|
||||
constexpr image_tag_t image_tag_audio_tx { 'P', 'A', 'T', 'X' };
|
||||
constexpr image_tag_t image_tag_afsk { 'P', 'A', 'F', 'S' };
|
||||
constexpr image_tag_t image_tag_epar { 'P', 'E', 'P', 'R' };
|
||||
constexpr image_tag_t image_tag_play_audio { 'P', 'P', 'A', 'U' };
|
||||
constexpr image_tag_t image_tag_xylos { 'P', 'X', 'Y', 'L' };
|
||||
constexpr image_tag_t image_tag_rds { 'P', 'R', 'D', 'S' };
|
||||
constexpr image_tag_t image_tag_ook { 'P', 'O', 'O', 'K' };
|
||||
|
43
firmware/common/thread_base.hpp
Normal file
43
firmware/common/thread_base.hpp
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __THREAD_BASE_H__
|
||||
#define __THREAD_BASE_H__
|
||||
|
||||
#include <ch.h>
|
||||
|
||||
class ThreadBase {
|
||||
public:
|
||||
virtual ~ThreadBase() = default;
|
||||
|
||||
protected:
|
||||
static msg_t fn(void* arg) {
|
||||
auto obj = static_cast<ThreadBase*>(arg);
|
||||
obj->run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void run() = 0;
|
||||
};
|
||||
|
||||
#endif/*__THREAD_BASE_H__*/
|
Reference in New Issue
Block a user