id: high_pass_filter
label: High Pass Filter
flags: [ python, cpp ]

parameters:
-   id: type
    label: FIR Type
    dtype: enum
    options: [fir_filter_ccf, interp_fir_filter_ccf, fir_filter_fff, interp_fir_filter_fff]
    option_labels: [Complex->Complex (Decimating), Complex->Complex (Interpolating),
        Float->Float (Decimating), Float->Float (Interpolating)]
    option_attributes:
        input: [complex, complex, float, float]
        output: [complex, complex, float, float]
    hide: part
-   id: decim
    label: Decimation
    dtype: int
    default: '1'
    hide: ${ ('all' if str(type).startswith('interp') else 'none') }
-   id: interp
    label: Interpolation
    dtype: int
    default: '1'
    hide: ${ ('none' if str(type).startswith('interp') else 'all') }
-   id: gain
    label: Gain
    dtype: real
    default: '1'
-   id: samp_rate
    label: Sample Rate
    dtype: real
    default: samp_rate
-   id: cutoff_freq
    label: Cutoff Freq
    dtype: real
-   id: width
    label: Transition Width
    dtype: real
-   id: win
    label: Window
    dtype: enum
    default: window.WIN_HAMMING
    options: [window.WIN_HAMMING, window.WIN_HANN, window.WIN_BLACKMAN, window.WIN_RECTANGULAR,
        window.WIN_KAISER]
    option_labels: [Hamming, Hann, Blackman, Rectangular, Kaiser]
    option_attributes:
        cpp_opts: [fft::window::WIN_HAMMING, fft::window::WIN_HANN, fft::window::WIN_BLACKMAN, 
        fft::window::WIN_RECTANGULAR, fft::window::WIN_KAISER]
-   id: beta
    label: Beta
    dtype: real
    default: '6.76'
    hide: ${ ('part' if (win == "window.WIN_KAISER") else 'all') }

inputs:
-   domain: stream
    dtype: ${ type.input }

outputs:
-   domain: stream
    dtype: ${ type.output }

templates:
    imports: |-
        from gnuradio import filter
        from gnuradio.filter import firdes
    make: |-
        filter.${type}(
            ${ interp if str(type).startswith('interp') else decim },
            firdes.high_pass(
                ${gain},
                ${samp_rate},
                ${cutoff_freq},
                ${width},
                ${win},
                ${beta}))
    callbacks:
    - set_taps(firdes.high_pass(${gain}, ${samp_rate}, ${cutoff_freq}, ${width}, ${win},
        ${beta}))

cpp_templates:
    includes: ['#include <gnuradio/filter/firdes.h>', '#include <gnuradio/fft/window.h>', '#include <gnuradio/filter/fir_filter_blk.h>', '#include <gnuradio/filter/interp_fir_filter.h>']
    declarations: 'filter::${type}::sptr ${id};'
    make: |-
        this->${id} = filter::${type}::make(
            ${ interp if str(type).startswith('interp') else decim },
            filter::firdes::high_pass(
                ${gain},
                ${samp_rate},
                ${cutoff_freq},
                ${width},
                ${win.cpp_opts},
                ${beta}));
    link: ['gnuradio::gnuradio-filter']
    callbacks:
    - set_taps(filter::firdes::high_pass(${gain}, ${samp_rate}, ${cutoff_freq}, ${width}, ${win.cpp_opts},
        ${beta}))

documentation: |-
    This filter is a convenience wrapper for an fir filter and a firdes taps generating function.

    Sample rate, cutoff frequency, and transition width are in Hertz.

    The beta parameter only applies to the Kaiser window.

file_format: 1
