Skip to content

Commit

Permalink
Clean up style with clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
nqbit committed Jun 28, 2019
1 parent c660618 commit 0473f60
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/goesrecv/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ struct Config {
uint32_t frequency = 0;
uint32_t sampleRate = 0;

// Applies to the tuner IF gain setting
uint8_t gain = 8;
// Applies to the tuner gain setting
uint8_t gain = 30;

// Enable/disable bias tee
bool bias_tee = 0;
Expand Down
22 changes: 10 additions & 12 deletions src/goesrecv/hackrf_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ std::unique_ptr<HackRf> HackRf::open(uint32_t index) {
std::cout << "Is open?" << std::endl;

if (rv < 0) {
std::cerr << "Unable to open Hackrf device: " << hackrf_error_name((enum hackrf_error) rv) << std::endl;
std::cerr << "Unable to open Hackrf device: "
<< hackrf_error_name((enum hackrf_error)rv) << std::endl;
exit(1);
}

Expand Down Expand Up @@ -55,9 +56,7 @@ void HackRf::setSampleRate(uint32_t rate) {
sampleRate_ = rate;
}

uint32_t HackRf::getSampleRate() const {
return sampleRate_;
}
uint32_t HackRf::getSampleRate() const { return sampleRate_; }

void HackRf::setIfGain(int gain) {
ASSERT(dev_ != nullptr);
Expand All @@ -80,8 +79,6 @@ void HackRf::setBbGain(int gain) {
ASSERT(rv_amp >= 0);
}



void HackRf::setBiasTee(bool on) {
ASSERT(dev_ != nullptr);
auto rv = hackrf_set_antenna_enable(dev_, on ? 1 : 0);
Expand All @@ -98,9 +95,9 @@ void HackRf::start(const std::shared_ptr<Queue<Samples> >& queue) {
ASSERT(dev_ != nullptr);
queue_ = queue;
thread_ = std::thread([&] {
auto rv = hackrf_start_rx(dev_, &hackrf_callback, this);
ASSERT(rv == 0);
});
auto rv = hackrf_start_rx(dev_, &hackrf_callback, this);
ASSERT(rv == 0);
});
#ifdef __APPLE__
pthread_setname_np("hackrf");
#else
Expand All @@ -123,10 +120,11 @@ void HackRf::stop() {
queue_.reset();
}

void HackRf::process(size_t nsamples, unsigned char* buf, std::complex<float>* fo) {
void HackRf::process(size_t nsamples, unsigned char* buf,
std::complex<float>* fo) {
for (uint32_t i = 0; i < nsamples; i++) {
fo[i].real((static_cast<int8_t>(buf[i*2+0]) / 128.0f));
fo[i].imag((static_cast<int8_t>(buf[i*2+1]) / 128.0f));
fo[i].real((static_cast<int8_t>(buf[i * 2 + 0]) / 128.0f));
fo[i].imag((static_cast<int8_t>(buf[i * 2 + 1]) / 128.0f));
}
}

Expand Down
8 changes: 3 additions & 5 deletions src/goesrecv/hackrf_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
#include "source.h"

class HackRf : public Source {
public:
public:
static std::unique_ptr<HackRf> open(uint32_t index = 0);

explicit HackRf(struct hackrf_device* dev);
~HackRf();

std::vector<uint32_t> getSampleRates() const {
return sampleRates_;
}
std::vector<uint32_t> getSampleRates() const { return sampleRates_; }

void setFrequency(uint32_t freq);

Expand All @@ -45,7 +43,7 @@ class HackRf : public Source {

void handle(const hackrf_transfer* transfer);

protected:
protected:
struct hackrf_device* dev_;

std::vector<uint32_t> loadSampleRates();
Expand Down

0 comments on commit 0473f60

Please sign in to comment.