summaryrefslogtreecommitdiff
path: root/gr-analog/grc/analog_sig_source_x.block.yml
blob: b0fb7b177d0b393eaee4f92e3b7806dafc644dae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
id: analog_sig_source_x
label: Signal Source
flags: [ python, cpp ]

parameters:
-   id: type
    label: Output Type
    dtype: enum
    options: [complex, float, int, short, byte]
    option_attributes:
        fcn: [c, f, i, s, b]
        offset_type: [complex, real, int, short, byte]
    hide: part
-   id: samp_rate
    label: Sample Rate
    dtype: real
    default: samp_rate
-   id: waveform
    label: Waveform
    dtype: raw
    default: analog.GR_COS_WAVE
    options: [analog.GR_CONST_WAVE, analog.GR_SIN_WAVE, analog.GR_COS_WAVE, analog.GR_SQR_WAVE,
        analog.GR_TRI_WAVE, analog.GR_SAW_WAVE]
    option_labels: [Constant, Sine, Cosine, Square, Triangle, Saw Tooth]
-   id: freq
    label: Frequency
    dtype: real
    default: '1000'
-   id: amp
    label: Amplitude
    dtype: real
    default: '1'
-   id: offset
    label: Offset
    dtype: ${ type.offset_type }
    default: '0'
-   id: phase
    label: Initial Phase (Radians)
    dtype: real
    default: '0'

inputs:
-   domain: message
    id: cmd
    optional: true

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

templates:
    imports: from gnuradio import analog
    make: analog.sig_source_${type.fcn}(${samp_rate}, ${waveform}, ${freq}, ${amp},
        ${offset}, ${phase})
    callbacks:
    - set_sampling_freq(${samp_rate})
    - set_waveform(${waveform})
    - set_frequency(${freq})
    - set_amplitude(${amp})
    - set_offset(${offset})
    - set_phase(${phase})

cpp_templates:
    includes: ['#include <gnuradio/analog/sig_source.h>']
    declarations: 'analog::sig_source_${type.fcn}::sptr ${id};'
    make: 'this->${id} = analog::sig_source_${type.fcn}::make(${samp_rate}, ${waveform}, ${freq}, ${amp}, ${offset},${phase});'
    callbacks:
    - set_sampling_freq(${samp_rate})
    - set_waveform(${waveform})
    - set_frequency(${freq})
    - set_amplitude(${amp})
    - set_offset(${offset})
    - set_phase(${phase})
    link: ['gnuradio::gnuradio-analog']
    translations:
        analog\.: 'analog::'

file_format: 1