portapack-mayhem/firmware/application/rf_path.hpp

76 lines
1.8 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-27 17:46:45 -05:00
#include "utility.hpp"
2015-07-08 11:39:24 -04:00
#include <cstdint>
namespace rf {
using Frequency = int64_t;
2016-01-27 17:46:45 -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,
};
namespace path {
2016-01-27 17:46:45 -05:00
constexpr FrequencyRange band_low { 0, 2150000000 };
constexpr FrequencyRange band_high { 2750000000, 7250000000 };
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,
};
class Path {
public:
void init();
void set_direction(const Direction direction);
void set_band(const Band band);
void set_rf_amp(const bool rf_amp);
private:
Direction direction { Direction::Receive };
Band band { Band::Mid };
bool rf_amp { false };
void update();
};
} /* path */
2016-01-27 17:46:45 -05:00
constexpr FrequencyRange tuning_range { path::band_low.minimum, path::band_high.maximum };
2015-07-08 11:39:24 -04:00
} /* rf */
#endif/*__RF_PATH_H__*/