portapack-mayhem/firmware/application/rf_path.hpp

76 lines
1.9 KiB
C++
Raw Normal View History

2015-07-08 11:39:24 -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.
*/
#ifndef __RF_PATH_H__
#define __RF_PATH_H__
2016-01-31 03:34:24 -05:00
#include "utility.hpp"
2015-07-08 11:39:24 -04:00
#include <cstdint>
namespace rf {
using Frequency = int64_t;
2016-01-31 03:34:24 -05:00
using FrequencyRange = range_t<Frequency>;
2015-07-08 11:39:24 -04:00
enum class Direction {
/* Zero-based, used as index into table */
Receive = 0,
Transmit = 1,
2015-07-08 11:39:24 -04:00
};
namespace path {
constexpr FrequencyRange band_low{0, 2170'000'000};
constexpr FrequencyRange band_high{2740'000'000, 7250'000'000};
constexpr FrequencyRange band_mid{band_low.maximum, band_high.minimum};
2015-07-08 11:39:24 -04:00
enum class Band {
/* Zero-based, used as index into frequency_bands table */
Low = 0,
Mid = 1,
High = 2,
2015-07-08 11:39:24 -04:00
};
class Path {
public:
void init();
2015-07-08 11:39:24 -04:00
void set_direction(const Direction direction);
void set_band(const Band band);
void set_rf_amp(const bool rf_amp);
2015-07-08 11:39:24 -04:00
private:
Direction direction{Direction::Receive};
Band band{Band::Mid};
bool rf_amp{false};
2015-07-08 11:39:24 -04:00
void update();
2015-07-08 11:39:24 -04:00
};
} // namespace path
2015-07-08 11:39:24 -04:00
constexpr FrequencyRange tuning_range{path::band_low.minimum, path::band_high.maximum};
2015-07-08 11:39:24 -04:00
} // namespace rf
2015-07-08 11:39:24 -04:00
#endif /*__RF_PATH_H__*/