aboutsummaryrefslogtreecommitdiffstats
path: root/src/libsquelch/squelch.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsquelch/squelch.h')
-rw-r--r--src/libsquelch/squelch.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libsquelch/squelch.h b/src/libsquelch/squelch.h
new file mode 100644
index 0000000..45de690
--- /dev/null
+++ b/src/libsquelch/squelch.h
@@ -0,0 +1,26 @@
+
+typedef struct squelch {
+ int chan; /* channel number */
+ double threshold_db; /* threshold level to mute or loss of signal */
+ double init_count; /* duration counter for starting squelch process */
+ int auto_state; /* set if auto threshold calibration is performed */
+ double auto_count; /* duration counter for calibration process */
+ double auto_level_sum; /* sum of rf level while calibrating */
+ int auto_level_count; /* counter for rf levels that are summed */
+ double mute_time; /* time to indicate mute after being below threshold */
+ int mute_state; /* set, if we are currently at mute condition */
+ double mute_count; /* duration counter for mute condition */
+ double loss_time; /* time to indicate loss after being below threshold */
+ int loss_state; /* set, if we are currently at 'signal loss' condition */
+ double loss_count; /* duration counter for 'signal loss' condition */
+} squelch_t;
+
+enum squelch_result {
+ SQUELCH_OPEN,
+ SQUELCH_MUTE,
+ SQUELCH_LOSS,
+};
+
+void squelch_init(squelch_t *squelch, int chan, double threshold_db, double mute_time, double loss_time);
+enum squelch_result squelch(squelch_t *squelch, double rf_level_db, double duration);
+