aboutsummaryrefslogtreecommitdiffstats
path: root/lib/receiver
diff options
context:
space:
mode:
authorptrkrysik <ptrkrysik@gmail.com>2015-08-06 10:09:43 +0200
committerptrkrysik <ptrkrysik@gmail.com>2015-08-06 10:09:43 +0200
commit202788ec37989d07b0848590089227428265a3c9 (patch)
treeb665172f4201ad319013b652c349ef57af0e2762 /lib/receiver
parent5e37674adf71f3de20b8da536c992ad4ae02f4b8 (diff)
Added function for subtraction of timeslots from bursts counter
Diffstat (limited to 'lib/receiver')
-rw-r--r--lib/receiver/receiver_config.cc27
-rw-r--r--lib/receiver/receiver_config.h4
2 files changed, 30 insertions, 1 deletions
diff --git a/lib/receiver/receiver_config.cc b/lib/receiver/receiver_config.cc
index c8b85c7..0abf200 100644
--- a/lib/receiver/receiver_config.cc
+++ b/lib/receiver/receiver_config.cc
@@ -46,6 +46,33 @@ burst_counter & burst_counter::operator++(int)
return (*this);
}
+burst_counter burst_counter::subtract_timeslots(unsigned int number_of_timeslots)
+{
+ int timeslot_nr = (int)d_timeslot_nr - (int)number_of_timeslots;
+ int t1,t2,t3;
+ if (timeslot_nr < 0) {
+ timeslot_nr = timeslot_nr + 8;
+
+ t2 = (d_t2 - 1) % 26;
+ t3 = (d_t3 - 1) % 51;
+
+ if ((d_t2 == 0) && (d_t3 == 0)) {
+ t1 = (d_t1 - 1) % (1 << 11);
+ } else
+ {
+ t1 = d_t1;
+ }
+ }
+ else
+ {
+ t1 = d_t1;
+ t2 = d_t2;
+ t3 = d_t3;
+ }
+
+ return burst_counter(d_OSR, t1, t2, t3, timeslot_nr);
+}
+
void burst_counter::set(uint32_t t1, uint32_t t2, uint32_t t3, uint32_t timeslot_nr)
{
d_t1 = t1;
diff --git a/lib/receiver/receiver_config.h b/lib/receiver/receiver_config.h
index 496e1fe..17b98c8 100644
--- a/lib/receiver/receiver_config.h
+++ b/lib/receiver/receiver_config.h
@@ -89,12 +89,14 @@ class burst_counter
d_t3(t3),
d_timeslot_nr(timeslot_nr),
d_offset_fractional(0.0),
- d_offset_integer(0.0) {
+ d_offset_integer(0.0)
+ {
d_offset_integer = 0;
d_offset_fractional = 0;
}
burst_counter & operator++(int);
+ burst_counter subtract_timeslots(unsigned int number_of_timeslots);
void set(uint32_t t1, uint32_t t2, uint32_t t3, uint32_t timeslot_nr);
uint32_t get_t1() {