aboutsummaryrefslogtreecommitdiffstats
path: root/host/examples/rfnoc-example/python/pyrfnoc-example.cpp
blob: 9dc69cb2c071ee5553394411f57ad3a9d21b6767 (plain) (blame)
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
//
// Copyright 2024 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: GPL-3.0-or-later
//

// NOTE: Most of these includes, as well as the numpy support, are not required
// for rfnoc-example, but are commonly required
#include <pybind11/complex.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>

namespace py = pybind11;

#include "gain_block_control_python.hpp"

// We need this hack because import_array() returns NULL
// for newer Python versions.
// This function is also necessary because it ensures access to the C API
// and removes a warning.
void* init_numpy()
{
    import_array();
    return NULL;
}

PYBIND11_MODULE(rfnoc_example_python, m)
{
    // Initialize the numpy C API
    // (otherwise we will see segmentation faults)
    init_numpy();

    // uhd::rfnoc::python::export_noc_block_base(m);
    export_gain_block_control(m);
}