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 __RADIO_H__
|
|
|
|
#define __RADIO_H__
|
|
|
|
|
|
|
|
#include "rf_path.hpp"
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
#include <cstddef>
|
|
|
|
|
2023-05-24 00:22:30 -04:00
|
|
|
/* Direct access to the radio. Setting values incorrectly can damage
|
|
|
|
* the device. Applications should use ReceiverModel or TransmitterModel
|
|
|
|
* instead of calling these functions directly. */
|
2015-07-08 11:39:24 -04:00
|
|
|
namespace radio {
|
|
|
|
|
2016-02-10 19:58:25 -05:00
|
|
|
struct Configuration {
|
2023-05-18 16:16:05 -04:00
|
|
|
rf::Frequency tuning_frequency;
|
|
|
|
uint32_t baseband_rate;
|
|
|
|
uint32_t baseband_filter_bandwidth;
|
|
|
|
rf::Direction direction;
|
|
|
|
bool rf_amp;
|
|
|
|
int8_t lna_gain;
|
|
|
|
int8_t vga_gain;
|
2016-02-10 19:58:25 -05:00
|
|
|
};
|
|
|
|
|
2015-07-08 11:39:24 -04:00
|
|
|
void init();
|
|
|
|
|
|
|
|
void set_direction(const rf::Direction new_direction);
|
|
|
|
bool set_tuning_frequency(const rf::Frequency frequency);
|
|
|
|
void set_rf_amp(const bool rf_amp);
|
|
|
|
void set_lna_gain(const int_fast8_t db);
|
|
|
|
void set_vga_gain(const int_fast8_t db);
|
2016-08-03 19:12:22 -04:00
|
|
|
void set_tx_gain(const int_fast8_t db);
|
2023-10-08 11:50:31 -04:00
|
|
|
void set_baseband_filter_bandwidth_rx(const uint32_t bandwidth_minimum);
|
|
|
|
void set_baseband_filter_bandwidth_tx(const uint32_t bandwidth_minimum);
|
2016-02-05 19:36:36 -05:00
|
|
|
void set_baseband_rate(const uint32_t rate);
|
2016-01-23 02:24:20 -05:00
|
|
|
void set_antenna_bias(const bool on);
|
2015-07-08 11:39:24 -04:00
|
|
|
|
2023-05-24 00:22:30 -04:00
|
|
|
/* Use ReceiverModel or TransmitterModel instead. */
|
|
|
|
// void enable(Configuration configuration);
|
|
|
|
// void configure(Configuration configuration);
|
2015-07-08 11:39:24 -04:00
|
|
|
void disable();
|
|
|
|
|
2016-02-16 13:28:13 -05:00
|
|
|
namespace debug {
|
|
|
|
|
|
|
|
namespace first_if {
|
|
|
|
|
|
|
|
uint32_t register_read(const size_t register_number);
|
|
|
|
|
|
|
|
} /* namespace first_if */
|
|
|
|
|
|
|
|
namespace second_if {
|
|
|
|
|
|
|
|
uint32_t register_read(const size_t register_number);
|
|
|
|
|
|
|
|
// TODO: This belongs somewhere else.
|
|
|
|
uint8_t temp_sense();
|
|
|
|
|
|
|
|
} /* namespace second_if */
|
|
|
|
|
|
|
|
} /* namespace debug */
|
2015-07-08 11:39:24 -04:00
|
|
|
|
|
|
|
} /* namespace radio */
|
|
|
|
|
2023-05-18 16:16:05 -04:00
|
|
|
#endif /*__RADIO_H__*/
|