SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
devicextrxshared.cpp
Go to the documentation of this file.
1 // Copyright (C) 2017 Sergey Kostanbaev, Fairwaves Inc. //
3 // //
4 // This program is free software; you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation as version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // This program is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License V3 for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
17 
18 #include <QDebug>
19 
20 #include "devicextrxshared.h"
21 #include "devicextrx.h"
22 
26 
28 const int DeviceXTRXShared::m_sampleFifoMinSize = 48000; // 192kS/s knee
29 
31  m_dev(0),
32  m_channel(-1),
33  m_source(0),
34  m_sink(0),
35  m_thread(0),
36  m_threadWasRunning(false),
37  m_first_1pps_count(true),
38  m_last_1pps_count(0),
39  m_no_1pps_count_change_counter(0)
40 {}
41 
43 {}
44 
46 {
47  uint64_t val = 0;
48 
49  int res = xtrx_val_get(m_dev->getDevice(), XTRX_TRX, XTRX_CH_AB, XTRX_BOARD_TEMP, &val);
50 
51  if (res) {
52  return 0;
53  }
54 
55  return val;
56 }
57 
59 {
60  uint64_t val = 0;
61 
62  int res = xtrx_val_get(m_dev->getDevice(), (xtrx_direction_t) 0, XTRX_CH_AB, XTRX_OSC_LATCH_1PPS, &val);
63 
64  if (res)
65  {
66  return false;
67  }
68  else
69  {
71  {
72  m_last_1pps_count = val;
73  m_first_1pps_count = false;
74  }
75  else
76  {
77  if (m_last_1pps_count != val)
78  {
80  m_last_1pps_count = val;
81  }
82  else if (m_no_1pps_count_change_counter != 0)
83  {
85  }
86 
87  }
88 
89  //qDebug("DeviceXTRXShared::get_gps_status: XTRX_OSC_LATCH_1PPS: %lu %u", val, m_no_1pps_count_change_counter);
91  }
92 }
struct xtrx_dev * getDevice()
Definition: devicextrx.h:35
#define MESSAGE_CLASS_DEFINITION(Name, BaseClass)
Definition: message.h:52
static const int m_sampleFifoMinSize
double get_board_temperature()
uint64_t m_last_1pps_count
DeviceXTRX * m_dev
uint32_t m_no_1pps_count_change_counter
static const float m_sampleFifoLengthInSeconds
unsigned __int64 uint64_t
Definition: rtptypes_win.h:48