@@ -41,7 +41,6 @@ PY_HACKRF_OPERACAKE_MAX_BOARDS = chackrf.HACKRF_OPERACAKE_MAX_BOARDS
4141PY_HACKRF_OPERACAKE_MAX_DWELL_TIMES = chackrf.HACKRF_OPERACAKE_MAX_DWELL_TIMES
4242PY_HACKRF_OPERACAKE_MAX_FREQ_RANGES = chackrf.HACKRF_OPERACAKE_MAX_FREQ_RANGES
4343
44-
4544class py_rf_path_filter (IntEnum ):
4645 RF_PATH_FILTER_BYPASS = chackrf.rf_path_filter.RF_PATH_FILTER_BYPASS
4746 RF_PATH_FILTER_LOW_PASS = chackrf.rf_path_filter.RF_PATH_FILTER_LOW_PASS
@@ -50,15 +49,13 @@ class py_rf_path_filter(IntEnum):
5049 def __str__ (self ) -> str:
5150 return self.name
5251
53-
5452class py_sweep_style(IntEnum ):
5553 LINEAR = chackrf.sweep_style.LINEAR
5654 INTERLEAVED = chackrf.sweep_style.INTERLEAVED
5755
5856 def __str__ (self ) -> str:
5957 return self.name
6058
61-
6259class py_operacake_switching_mode(IntEnum ):
6360 OPERACAKE_MODE_MANUAL = chackrf.operacake_switching_mode.OPERACAKE_MODE_MANUAL
6461 OPERACAKE_MODE_FREQUENCY = chackrf.operacake_switching_mode.OPERACAKE_MODE_FREQUENCY
@@ -67,7 +64,6 @@ class py_operacake_switching_mode(IntEnum):
6764 def __str__ (self ) -> str:
6865 return self.name
6966
70-
7167class py_operacake_ports(IntEnum ):
7268 A1: 0
7369 A2: 1
@@ -89,7 +85,6 @@ class py_operacake_ports(IntEnum):
8985 return item in cls
9086 return False
9187
92-
9388@ cython.boundscheck (False )
9489@ cython.wraparound (False )
9590cdef int __rx_callback(chackrf.hackrf_transfer * transfer) nogil:
@@ -113,7 +108,6 @@ cdef int __rx_callback(chackrf.hackrf_transfer *transfer) nogil:
113108
114109 return result
115110
116-
117111@ cython.boundscheck (False )
118112@ cython.wraparound (False )
119113cdef int __tx_callback(chackrf.hackrf_transfer * transfer) nogil:
@@ -141,7 +135,6 @@ cdef int __tx_callback(chackrf.hackrf_transfer *transfer) nogil:
141135
142136 return result
143137
144-
145138@ cython.boundscheck (False )
146139@ cython.wraparound (False )
147140cdef int __sweep_callback(chackrf.hackrf_transfer * transfer) nogil:
@@ -165,7 +158,6 @@ cdef int __sweep_callback(chackrf.hackrf_transfer *transfer) nogil:
165158
166159 return result
167160
168-
169161@ cython.boundscheck (False )
170162@ cython.wraparound (False )
171163cdef void __tx_complete_callback(chackrf.hackrf_transfer * transfer, int success) nogil:
@@ -186,7 +178,6 @@ cdef void __tx_complete_callback(chackrf.hackrf_transfer *transfer, int success)
186178 if global_callbacks[< size_t> transfer.device][' __tx_complete_callback' ] is not None :
187179 global_callbacks[< size_t> transfer.device][' __tx_complete_callback' ](global_callbacks[< size_t> transfer.device][' device' ], np_buffer, transfer.buffer_length, transfer.valid_length, success)
188180
189-
190181cdef void __tx_flush_callback(void * flush_ctx, int success) noexcept nogil:
191182 global global_callbacks
192183 cdef size_t device_ptr = < size_t> flush_ctx
@@ -195,7 +186,6 @@ cdef void __tx_flush_callback(void *flush_ctx, int success) noexcept nogil:
195186 if global_callbacks[device_ptr][' __tx_flush_callback' ] is not None :
196187 global_callbacks[device_ptr][' __tx_flush_callback' ](global_callbacks[device_ptr][' device' ], success)
197188
198-
199189cdef class PyHackRFDeviceList:
200190 cdef chackrf.hackrf_device_list_t * __hackrf_device_list
201191
@@ -227,7 +217,6 @@ cdef class PyHackRFDeviceList:
227217 if self.__hackrf_device_list is not NULL:
228218 return chackrf.hackrf_board_id_name(self.__hackrf_device_list[0].usb_board_ids[index]).decode('utf-8')
229219
230-
231220cdef class PyHackrfDevice:
232221
233222 cdef chackrf.hackrf_device *__hackrf_device
@@ -716,38 +705,31 @@ cdef class PyHackrfDevice:
716705 raise RuntimeError(f'pyhackrf_operacake_gpio_test() failed: {chackrf.hackrf_error_name(result ).decode("utf-8")} ({result})')
717706 return test_result
718707
719-
720708# ---- initialization and exit ---- #
721709def pyhackrf_init() -> None:
722710 result = chackrf.hackrf_init()
723711 if result != chackrf.hackrf_error.HACKRF_SUCCESS:
724712 raise RuntimeError(f'pyhackrf_init() failed: {chackrf.hackrf_error_name(result ).decode("utf-8")} ({result})')
725713
726-
727714def pyhackrf_exit() -> None:
728715 result = chackrf.hackrf_exit()
729716 if result != chackrf.hackrf_error.HACKRF_SUCCESS:
730717 raise RuntimeError(f'pyhackrf_exit() failed: {chackrf.hackrf_error_name(result ).decode("utf-8")} ({result})')
731718
732-
733719# ---- version ---- #
734720def python_hackrf_library_version() -> str:
735721 return __version__
736722
737-
738723def pyhackrf_library_version() -> str:
739724 return chackrf.hackrf_library_version().decode('utf-8')
740725
741-
742726def pyhackrf_library_release() -> str:
743727 return chackrf.hackrf_library_release().decode('utf-8')
744728
745-
746729# ---- device ---- #
747730def pyhackrf_device_list() -> PyHackRFDeviceList:
748731 return PyHackRFDeviceList()
749732
750-
751733def pyhackrf_device_list_open(pyhackrf_device_list: PyHackRFDeviceList , index: int ) -> PyHackrfDevice | None:
752734 pyhackrf_device = PyHackrfDevice()
753735 result = chackrf.hackrf_device_list_open(pyhackrf_device_list.get_hackrf_device_list_ptr(), index, pyhackrf_device.get_hackrf_device_double_ptr())
@@ -758,7 +740,6 @@ def pyhackrf_device_list_open(pyhackrf_device_list: PyHackRFDeviceList, index: i
758740
759741 raise RuntimeError(f'pyhackrf_device_list_open() failed: {chackrf.hackrf_error_name(result ).decode("utf-8")} ({result})')
760742
761-
762743def pyhackrf_open() -> PyHackrfDevice | None:
763744 pyhackrf_device = PyHackrfDevice()
764745
@@ -770,7 +751,6 @@ def pyhackrf_open() -> PyHackrfDevice | None:
770751
771752 raise RuntimeError(f'pyhackrf_open() failed: {chackrf.hackrf_error_name(result ).decode("utf-8")} ({result})')
772753
773-
774754def pyhackrf_open_by_serial(desired_serial_number: str ) -> PyHackrfDevice | None:
775755 if desired_serial_number in (None , ''):
776756 return pyhackrf_open()
@@ -784,11 +764,9 @@ def pyhackrf_open_by_serial(desired_serial_number: str) -> PyHackrfDevice | None
784764
785765 raise RuntimeError (f' pyhackrf_open_by_serial() failed: {chackrf.hackrf_error_name(result).decode("utf-8")} ({result})' )
786766
787-
788767# ---- baseband filter bandwidth ---- #
789768def pyhackrf_compute_baseband_filter_bw_round_down_lt (bandwidth_hz: int ) -> int:
790769 return chackrf.hackrf_compute_baseband_filter_bw_round_down_lt(<uint32_t> bandwidth_hz )
791770
792-
793771def pyhackrf_compute_baseband_filter_bw(bandwidth_hz: int ) -> int:
794772 return chackrf.hackrf_compute_baseband_filter_bw(<uint32_t> bandwidth_hz )
0 commit comments