neoRAD-IO2 Product Line¶
The neoRAD-IO2 series is a family of ruggedized products that provide an isolated analog, digital or temperature interface to a PC via the PC’s USB port. These tools can also be paired with Intrepid products that include a USB port such as neoVI ION, neoVI FIRE 2, RAD-Galaxy, and RAD-Gigalog. In addition, the neoRAD-IO2-CANHUB can power and convert the native UART signal to CAN or CAN FD for use in any CAN device.
The neoRAD-IO2 family communicates on an open source UART based serial communication protocol. Up to eight devices can be daisy chained. The chain length is limited by current supplied to the chain through USB. All neoRAD-IO2 devices have input to output isolation, and 2.5kV isolation between each of the eight banks. Bank to bank isolation is important because it allows the common mode voltage of each input signal to be different than the other channels in other banks. (This is a major source of measurement error and can damage to the product.) Additionally, noise on one channel will not affect other channels. For more details please visit https://www.intrepidcs.com/products/analog-daq-devices/rad-io2-series/
Installation¶
module can be installed by simply running the following command:
pip install neoradio2
Windows Note: pip.exe is usually located under the Scripts directory under the Python installation directory.
Linux Note: A lot of distributions have Python 2 and 3 installed side by side. As of this writing without a version suffix the commands still default to version 2 of the Python binaries. In order to utilize the Python 3 binaries you must append a 3 after the binary names (python3 and pip3 instead of just python and pip).
Examples¶
Please see https://github.com/intrepidcs/libneoradio2/tree/master/python/example for example code.
Function List¶
neoradio2.app_is_started
(handle, device, bank)Check if the application firmware is started. neoradio2.app_start
(handle, device, bank)Starts the application firmware on the selected devices and banks. neoradio2.chain_identify
(handle)Identifies the chain. neoradio2.chain_is_identified
(handle)Checks if the chain is currently identified. neoradio2.close
(handle)Closes the handle for the device. neoradio2.enter_bootloader
(handle, device, bank)Starts the bootloader firmware on the selected devices and banks. neoradio2.find
()Finds all neoRAD-IO2 Devices. neoradio2.get_calibration_is_valid
(handle, ...)Check if calibration is Valid. neoradio2.get_chain_count
(handle, identify)Get the chain count of the selected devices. neoradio2.get_device_type
get_device_type(handle, device, bank) neoradio2.get_firmware_version
(handle, ...)Get the firmware version of the selected devices and banks. neoradio2.get_hardware_revision
(handle, ...)Get the hardware revision of the selected devices and banks. neoradio2.get_manufacturer_date
(handle, ...)Get the manufacturing date of the selected devices and banks. neoradio2.get_pcbsn
(handle, device, bank)Get the PCB serial number of the selected devices and banks. neoradio2.get_serial_number
(handle, device, bank)Gets the serial number (base10) on the selected devices and banks. neoradio2.get_status
(handle, device, bank, ...)Get the status of commands. neoradio2.is_blocking
is_blocking() neoradio2.is_calibration_stored
(handle, ...)Verifies calibration is stored on the selected devices and banks. neoradio2.is_closed
(handle)Checks if the handle is currently closed. neoradio2.is_opened
(handle)Checks if the handle is currently open. neoradio2.open
(device)Open a neoRAD-IO2 Device neoradio2.read_calibration_array
(handle, ...)Reads calibration on the selected devices and banks. neoradio2.read_calibration_info
(handle, ...)Verifies calibration is stored on the selected devices and banks. neoradio2.read_calibration_points_array
(...)Reads calibration points on the selected devices and banks. neoradio2.read_sensor_float
(handle, device, bank)Get the sensor data of the selected devices and banks. neoradio2.read_settings
(handle, device, bank)Read the settings of the selected devices and bank. neoradio2.request_calibration
(handle, ...)Requests calibration on the selected devices and banks. neoradio2.request_calibration_info
(handle, ...)Verifies calibration is stored on the selected devices and banks. neoradio2.request_calibration_points
(handle, ...)Requests calibration points on the selected devices and banks. neoradio2.request_pcbsn
(handle, device, bank)Request the PCB serial number of the selected devices and banks. neoradio2.request_sensor_data
(handle, ...)Request the sensor data of the selected devices and banks. neoradio2.request_settings
(handle, device, bank)Request the settings of the selected devices and banks. neoradio2.set_blocking
(blocking, ms_timeout)Sets the API to blocking or non-blocking mode. neoradio2.store_calibration
(handle, device, bank)Stores calibration on the selected devices and banks. neoradio2.toggle_led
(handle, device, bank, ms)Toggle the leds on the selected devices and banks. neoradio2.toggle_led_successful
(handle, ...)Checks if toggle_led was successful in non-blocking mode. neoradio2.write_calibration
(handle, device, ...)Writes calibration on the selected devices and banks. neoradio2.write_calibration_points
(handle, ...)Writes calibration points on the selected devices and banks. neoradio2.write_calibration_points_successful
(...)Checks to see if write_calibration_points was successful in non-blocking mode. neoradio2.write_calibration_successful
(...)Checks to see if write_calibration was successful in non-blocking mode. neoradio2.write_sensor
(handle, device, bank, ...)Get the sensor data of the selected devices and banks. neoradio2.write_sensor_successful
(handle, ...)Checks to see if write_sensor was successful for non-blocking mode. neoradio2.write_settings
(handle, device, ...)Request the settings of the selected devices and banks. neoradio2.write_settings_successful
(handle, ...)Checks to see if write_settings was successful in non-blocking mode. neoRADIO2 Python Library¶
TODO
- class
neoradio2.
CommandStateType
¶Bases:
pybind11_builtins.pybind11_object
CommandStateDevice
= CommandStateType.CommandStateDevice¶
CommandStateHost
= CommandStateType.CommandStateHost¶
- class
neoradio2.
CommandStatus
¶Bases:
pybind11_builtins.pybind11_object
StatusError
= CommandStatus.StatusError¶
StatusFinished
= CommandStatus.StatusFinished¶
StatusInProgress
= CommandStatus.StatusInProgress¶
- class
neoradio2.
Neoradio2DeviceInfo
¶Bases:
pybind11_builtins.pybind11_object
name
¶
product_id
¶
serial_str
¶
vendor_id
¶
- class
neoradio2.
StatusType
¶Bases:
pybind11_builtins.pybind11_object
StatusAppStart
= StatusType.StatusAppStart¶
StatusCalibration
= StatusType.StatusCalibration¶
StatusCalibrationInfo
= StatusType.StatusCalibrationInfo¶
StatusCalibrationPoints
= StatusType.StatusCalibrationPoints¶
StatusCalibrationStored
= StatusType.StatusCalibrationStored¶
StatusChain
= StatusType.StatusChain¶
StatusLedToggle
= StatusType.StatusLedToggle¶
StatusPCBSN
= StatusType.StatusPCBSN¶
StatusSensorRead
= StatusType.StatusSensorRead¶
StatusSensorWrite
= StatusType.StatusSensorWrite¶
StatusSettingsRead
= StatusType.StatusSettingsRead¶
StatusSettingsWrite
= StatusType.StatusSettingsWrite¶
neoradio2.
app_is_started
(handle, device, bank)¶Check if the application firmware is started. Chain needs to be identified first.
Parameters: Raises: neoradio2.Exception on error
Returns: Returns True/False. True = Application Level, False = Bootloader Level.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... neoradio2.app_is_started(handle, 0, 0) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-TC IAPP03'> True >>>
neoradio2.
app_start
(handle, device, bank)¶Starts the application firmware on the selected devices and banks. Chain needs to be identified first. The neoRAD-IO2 device sits in bootloader for up to 10 seconds when first powered up.
Parameters: Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns True
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... # Start application firmware on all banks for device 0 ... neoradio2.app_start(handle, 0, 0xFF) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-TC IAPP03'> True >>>
neoradio2.
chain_identify
(handle)¶Identifies the chain. Chain needs to be identified before other commands will be successful. Each bank needs to be identified by the host before it can start receiving commands.
Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns True/False
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... neoradio2.neoradio2_chain_identify(handle) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-TC IAPP03'> True >>>
neoradio2.
chain_is_identified
(handle)¶Checks if the chain is currently identified. Chain needs to be identified before other commands will be successful.
Raises: neoradio2.Exception on error Returns: Returns True/False Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... neoradio2.chain_is_identified(handle) ... neoradio2.close(handle) ... False <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-TC IAPP03'> >>>
neoradio2.
close
(handle)¶Closes the handle for the device.
Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns True on success, Exception otherwise
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-TC IAPP03'> >>>
neoradio2.
enter_bootloader
(handle, device, bank)¶Starts the bootloader firmware on the selected devices and banks. Chain needs to be identified first. The neoRAD-IO2 device sits in bootloader for up to 10 seconds when first powered up.
Parameters: Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns True
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... # Start application firmware on all banks for device 0 ... neoradio2.enter_bootloader(handle, 0, 0xFF) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-TC IAPP03'> True >>>
neoradio2.
find
()¶Finds all neoRAD-IO2 Devices.
Raises: neoradio2.Exception on error Returns: Returns a tuple of neoradio2.Neoradio2DeviceInfo Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-TC IAPP03'> >>>
neoradio2.
get_calibration_is_valid
(handle, device, bank)¶Check if calibration is Valid.
TODO
neoradio2.
get_chain_count
(handle, identify)¶Get the chain count of the selected devices. Non-blocking mode expects chain to be identified first.
Parameters: Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns (int) How many devices are in the chain.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... neoradio2.get_chain_count(handle, True) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> 2 >>>
neoradio2.
get_device_type
()¶get_device_type(handle, device, bank)
TODO
Returns integer, otherwise exception is thrown.
neoradio2.
get_firmware_version
(handle, device, bank)¶Get the firmware version of the selected devices and banks. Chain needs to be identified first.
Parameters: Raises: neoradio2.Exception on error
Returns: Returns a Tuple (Major, Minor)
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... # Get the manufacturing date on bank 1 for device 0 ... neoradio2.get_firmware_version(handle, 0, 0x01) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> (2, 26) >>>
neoradio2.
get_hardware_revision
(handle, device, bank)¶Get the hardware revision of the selected devices and banks. Chain needs to be identified first.
Parameters: Raises: neoradio2.Exception on error
Returns: Returns a Tuple (Major, Minor)
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... # Get the hardware revision on bank 1 for device 0 ... neoradio2.get_hardware_revision(handle, 0, 0x01) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> (2, 0) >>>
neoradio2.
get_manufacturer_date
(handle, device, bank)¶Get the manufacturing date of the selected devices and banks. Chain needs to be identified first.
Parameters: Raises: neoradio2.Exception on error
Returns: Returns a Tuple (Year, Month, Day)
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... # Get the manufacturing date on bank 1 for device 0 ... neoradio2.get_manufacturer_date(handle, 0, 0x01) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-TC IAPP03'> (2019, 4, 26) >>>
neoradio2.
get_pcbsn
(handle, device, bank)¶Get the PCB serial number of the selected devices and banks. Chain needs to be identified first. Must be in application firmware.
Parameters: Raises: neoradio2.Exception on error
Returns: Returns True on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... # Request/Get the PCB SN on bank 1 for device 0 ... neoradio2.request_pcb_sn(handle, 0, 0xFF) ... neoradio2.get_pcbsn(handle, 0, 1) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True R2TC050031902002 >>>
neoradio2.
get_serial_number
(handle, device, bank)¶Gets the serial number (base10) on the selected devices and banks. Chain needs to be identified first. The serial number is generally displayed in base36.
Parameters: Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns True
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... # Get serial number of Bank 1 ... neoradio2.app_start(handle, 0, 1) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-TC IAPP03'> 1106386131 >>>
neoradio2.
get_status
(handle, device, bank, bitfield, type)¶Get the status of commands. This is primarly used for checking states for non-blocking mode.
Parameters:
- handle (int) – handle to the neoRAD-IO2 Device.
- device (int) – device number in the chain to communicate with. First device is 0.
- bank (int) – bank of the device to communicate with. This is an index or a bitmask depending on bitfield argument.
- bitfield (bool) – True = bank is a bitfield, False = bank is an index.
- type (StatusType) – Status Type to get.
Raises: neoradio2.Exception on error
Returns: Returns StatusType.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... # Request/Get the sensor data on bank 8 for device 0 ... neoradio2.set_blocking(0, 0) ... try: ... neoradio2.request_sensor_data(handle, 0, 0xFF, 1) ... except neoradio2.ExceptionWouldBlock as ex: ... pass ... while neoradio2.get_status(handle, 0, 0xFF, True, neoradio2.StatusType.StatusSensorRead) != neoradio2.CommandStatus.StatusFinished: ... time.sleep(0.001) # Execute other code here ... neoradio2.read_sensor_float(handle, 0, 7) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True 4.953075885772705 >>>
neoradio2.
is_blocking
()¶ is_blocking()Check if API is blocking
- Raises:
- None
- Returns:
- True/False.
neoradio2.
is_calibration_stored
(handle, device, bank, header, data)¶Verifies calibration is stored on the selected devices and banks.
Parameters: Raises: neoradio2.Exception on error
Returns: Returns True on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... points = [-50.0, 0.0, 75.0, 650.0] ... values = [-49.8, 2.1, 68.0, 590.0] ... header = neoradio2.neoRADIO2frame_calHeader() ... header.channel = 0 ... header.range = 0 ... header.num_of_pts = len(points) ... neoradio2.write_calibration_points(handle, 0, 1, header, points) ... neoradio2.write_calibration(handle, 0, 1, header, values) ... neoradio2.store_calibration(handle, 0, 1, header) ... neoradio2.is_calibration_stored(handle, 0, 1,) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True True True >>>
neoradio2.
is_closed
(handle)¶Checks if the handle is currently closed.
Raises: neoradio2.Exception on error Returns: Returns True/False Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... neoradio2.is_closed(handle) ... neoradio2.close(handle) ... False <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-TC IAPP03'> >>>
neoradio2.
is_opened
(handle)¶Checks if the handle is currently open.
Raises: neoradio2.Exception on error Returns: Returns True/False Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... neoradio2.is_opened(handle) ... neoradio2.close(handle) ... True <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-TC IAPP03'> >>>
- class
neoradio2.
neoRADIO2Settings_ChannelName
¶Bases:
pybind11_builtins.pybind11_object
charSize
¶
chars
¶
length
¶
- class
neoradio2.
neoRADIO2_deviceSettings
¶Bases:
pybind11_builtins.pybind11_object
channel_1_config
¶
channel_2_config
¶
channel_3_config
¶
poll_rate_ms
¶
- class
neoradio2.
neoRADIO2_settings
¶Bases:
pybind11_builtins.pybind11_object
can
¶
config
¶
name1
¶
name2
¶
name3
¶
- class
neoradio2.
neoRADIO2frame_calHeader
¶Bases:
pybind11_builtins.pybind11_object
cal_is_valid
¶
channel
¶
num_of_pts
¶
range
¶
- class
neoradio2.
neoRADIO2settings_CAN
¶Bases:
pybind11_builtins.pybind11_object
Arbid
¶
Location
¶
msgType
¶
neoradio2.
open
(device)¶Open a neoRAD-IO2 Device
Parameters: device (neoradio2.Neoradio2DeviceInfo) – specified device to open, typically from neoradio2.find()
Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: A handle to the device.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> len(devices) 1 >>> handle = neoradio2.open(devices[0]) >>> neoradio2.close(handle)
neoradio2.
read_calibration_array
(handle, device, bank, header)¶Reads calibration on the selected devices and banks.
Parameters:
- handle (int) – handle to the neoRAD-IO2 Device.
- device (int) – device number in the chain to communicate with. First device is 0.
- bank (int) – bank of the device to communicate with. This is an index and not a bitmask.
- header (neoRADIO2frame_calHeader) – Used to specify which channel and range to request.
Raises: neoradio2.Exception on error
Returns: Returns Array of values on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... header = neoradio2.neoRADIO2frame_calHeader() ... header.channel = 0 ... header.range = 0 ... neoradio2.request_calibration(handle, 0, 1, header) ... cal_values = neoradio2.read_calibration_array(handle, 0, 1) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True >>>
neoradio2.
read_calibration_info
(handle, device, bank)¶Verifies calibration is stored on the selected devices and banks.
Parameters: Raises: neoradio2.Exception on error
Returns: Returns neoRADIO2frame_calHeader on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... neoradio2.request_calibration_info(handle, 0, 1) ... header = neoradio2.read_calibration_info(handle, 0, 1) ... print(header.channel) ... print(header.range) ... print(header.num_of_pts) ... print(header.cal_is_valid) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True 0 0 4 1 >>>
neoradio2.
read_calibration_points_array
(handle, device, bank, header)¶Reads calibration points on the selected devices and banks.
Parameters:
- handle (int) – handle to the neoRAD-IO2 Device.
- device (int) – device number in the chain to communicate with. First device is 0.
- bank (int) – bank of the device to communicate with. This is an index and not a bitmask.
- header (neoRADIO2frame_calHeader) – Used to specify which channel and range to request.
Raises: neoradio2.Exception on error
Returns: Returns Array of values on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... header = neoradio2.neoRADIO2frame_calHeader() ... header.channel = 0 ... header.range = 0 ... neoradio2.request_calibration_points(handle, 0, 1, header) ... cal_points = neoradio2.read_calibration_points_array(handle, 0, 1) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True >>>
neoradio2.
read_sensor_float
(handle, device, bank)¶Get the sensor data of the selected devices and banks. Chain needs to be identified first. Must be in application firmware.
Parameters: Raises: neoradio2.Exception on error
Returns: Returns float on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... # Request/Get the sensor data on bank 8 for device 0 ... neoradio2.request_sensor_data(handle, 0, 0xFF, True) ... neoradio2.read_sensor_float(handle, 0, 7) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True 4.953075885772705 >>>
neoradio2.
read_settings
(handle, device, bank)¶Read the settings of the selected devices and bank. Chain needs to be identified first. Must be in application firmware.
Parameters: Raises: neoradio2.Exception on error
Returns: Returns True on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... neoradio2.request_settings(h, 0, 1) ... neoradio2.read_settings(h, 0, 1) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True <neoradio2.neoRADIO2_settings object at 0x02C11D40> >>>
neoradio2.
request_calibration
(handle, device, bank, header)¶Requests calibration on the selected devices and banks.
Parameters:
- handle (int) – handle to the neoRAD-IO2 Device.
- device (int) – device number in the chain to communicate with. First device is 0.
- bank (int) – bank of the device to communicate with. This is a bitmask (0b00001001 - 0x09 = Bank 1 and 4).
- header (neoRADIO2frame_calHeader) – Used to specify which channel and range to request.
Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns True on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... header = neoradio2.neoRADIO2frame_calHeader() ... header.channel = 0 ... header.range = 0 ... neoradio2.request_calibration(handle, 0, 1, header) ... cal_values = neoradio2.read_calibration_array(handle, 0, 1) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True >>>
neoradio2.
request_calibration_info
(handle, device, bank)¶Verifies calibration is stored on the selected devices and banks.
Parameters: Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns True on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... neoradio2.request_calibration_info(handle, 0, 1) ... header = neoradio2.read_calibration_info(handle, 0, 1) ... print(header.channel) ... print(header.range) ... print(header.num_of_pts) ... print(header.cal_is_valid) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True 0 0 4 1 >>>
neoradio2.
request_calibration_points
(handle, device, bank, header)¶Requests calibration points on the selected devices and banks.
Parameters:
- handle (int) – handle to the neoRAD-IO2 Device.
- device (int) – device number in the chain to communicate with. First device is 0.
- bank (int) – bank of the device to communicate with. This is a bitmask (0b00001001 - 0x09 = Bank 1 and 4).
- header (neoRADIO2frame_calHeader) – Used to specify which channel and range to request.
Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns Array of values on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... header = neoradio2.neoRADIO2frame_calHeader() ... header.channel = 0 ... header.range = 0 ... neoradio2.request_calibration_points(handle, 0, 1, header) ... cal_points = neoradio2.read_calibration_points_array(handle, 0, 1) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True >>>
neoradio2.
request_pcbsn
(handle, device, bank)¶Request the PCB serial number of the selected devices and banks. Chain needs to be identified first. Must be in application firmware.
Parameters: Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns True on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... # Request/Get the PCB SN on bank 1 for device 0 ... neoradio2.request_pcb_sn(handle, 0, 0xFF) ... neoradio2.get_pcbsn(handle, 0, 1) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True R2TC050031902002 >>>
neoradio2.
request_sensor_data
(handle, device, bank, enable_cal)¶Request the sensor data of the selected devices and banks. Chain needs to be identified first. Must be in application firmware.
Parameters:
- handle (int) – handle to the neoRAD-IO2 Device.
- device (int) – device number in the chain to communicate with. First device is 0.
- bank (int) – bank of the device to communicate with. This is a bitmask (0b00001001 - 0x09 = Bank 1 and 4).
- enable_cal (int) – Enable reading based on calibration inside the unit. 0 = raw, 1 = use calibration.
Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns float on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... # Request/Get the sensor data on bank 8 for device 0 ... neoradio2.request_sensor_data(handle, 0, 0xFF, True) ... neoradio2.read_sensor_float(handle, 0, 7) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True 4.953075885772705 >>>
neoradio2.
request_settings
(handle, device, bank)¶Request the settings of the selected devices and banks. Chain needs to be identified first. Must be in application firmware.
Parameters: Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns True on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... neoradio2.request_settings(h, 0, 1) ... neoradio2.read_settings(h, 0, 1) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True <neoradio2.neoRADIO2_settings object at 0x02C11D40> >>>
neoradio2.
set_blocking
(blocking, ms_timeout)¶Sets the API to blocking or non-blocking mode.
Raises:
None
Parameters: Returns: Returns None.
neoradio2.
store_calibration
(handle, device, bank)¶Stores calibration on the selected devices and banks.
Parameters: Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns True on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... points = [-50.0, 0.0, 75.0, 650.0] ... values = [-49.8, 2.1, 68.0, 590.0] ... header = neoradio2.neoRADIO2frame_calHeader() ... header.channel = 0 ... header.range = 0 ... header.num_of_pts = len(points) ... neoradio2.write_calibration_points(handle, 0, 1, header, points) ... neoradio2.write_calibration(handle, 0, 1, header, values) ... neoradio2.store_calibration(handle, 0, 1, header) ... neoradio2.is_calibration_stored(handle, 0, 1,) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True True True >>>
neoradio2.
toggle_led
(handle, device, bank, ms)¶Toggle the leds on the selected devices and banks.
Parameters:
- handle (int) – handle to the neoRAD-IO2 Device.
- device (int) – device number in the chain to communicate with. First device is 0.
- bank (int) – bank of the device to communicate with. This is a bitmask (0b00001001 - 0x09 = Bank 1 and 4).
- ms (int) – Time in milliseconds to keep the led illuminated for.
Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns True on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... neoradio2.toggle_led(h, 0, 1, 250) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True >>>
neoradio2.
toggle_led_successful
(handle, device, bank)¶Checks if toggle_led was successful in non-blocking mode.
Parameters: Raises: neoradio2.Exception on error
Returns: Returns True on success.
neoradio2.
write_calibration
(handle, device, bank, header, data)¶Writes calibration on the selected devices and banks.
Parameters:
- handle (int) – handle to the neoRAD-IO2 Device.
- device (int) – device number in the chain to communicate with. First device is 0.
- bank (int) – bank of the device to communicate with. This is a bitmask (0b00001001 - 0x09 = Bank 1 and 4).
- header (neoRADIO2frame_calHeader) – Used to specify which channel and range to request.
- data (List) – Container of calibration values to store in the device.
Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns True on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... points = [-50.0, 0.0, 75.0, 650.0] ... values = [-49.8, 2.1, 68.0, 590.0] ... header = neoradio2.neoRADIO2frame_calHeader() ... header.channel = 0 ... header.range = 0 ... header.num_of_pts = len(points) ... neoradio2.write_calibration_points(handle, 0, 1, header, points) ... neoradio2.write_calibration(handle, 0, 1, header, values) ... neoradio2.store_calibration(handle, 0, 1, header) ... neoradio2.is_calibration_stored(handle, 0, 1,) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True True True >>>
neoradio2.
write_calibration_points
(handle, device, bank, header, data)¶Writes calibration points on the selected devices and banks.
Parameters:
- handle (int) – handle to the neoRAD-IO2 Device.
- device (int) – device number in the chain to communicate with. First device is 0.
- bank (int) – bank of the device to communicate with. This is a bitmask (0b00001001 - 0x09 = Bank 1 and 4).
- header (neoRADIO2frame_calHeader) – Used to specify which channel and range to request.
- data (List) – Container of calibration values to store in the device.
Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns True on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... points = [-50.0, 0.0, 75.0, 650.0] ... values = [-49.8, 2.1, 68.0, 590.0] ... header = neoradio2.neoRADIO2frame_calHeader() ... header.channel = 0 ... header.range = 0 ... header.num_of_pts = len(points) ... neoradio2.write_calibration_points(handle, 0, 1, header, points) ... neoradio2.write_calibration(handle, 0, 1, header, values) ... neoradio2.store_calibration(handle, 0, 1, header) ... neoradio2.is_calibration_stored(handle, 0, 1,) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True True True >>>
neoradio2.
write_calibration_points_successful
(handle, device, bank, header, data)¶Checks to see if write_calibration_points was successful in non-blocking mode.
Parameters: Raises: neoradio2.Exception on error
Returns: Returns True on success.
neoradio2.
write_calibration_successful
(handle, device, bank)¶Checks to see if write_calibration was successful in non-blocking mode.
Parameters: Raises: neoradio2.Exception on error
Returns: Returns True on success.
neoradio2.
write_sensor
(handle, device, bank, mask, value)¶Get the sensor data of the selected devices and banks. Chain needs to be identified first. This is generally used to control Relays on either neoRAD-IO2-PWRRLY or neoRAD-IO2-Badge. Must be in application firmware.
- Badge:
- Device 1:
- LED1 = 0x10 LED2 = 0x20 LED3 = 0x40 LED4 = 0x80 DIO1 = 0x01 DIO2 = 0x02 DIO3 = 0x04 DIO4 = 0x08
Parameters:
- handle (int) – handle to the neoRAD-IO2 Device.
- device (int) – device number in the chain to communicate with. First device is 0.
- bank (int) – bank of the device to communicate with. This is a bitmask (0b00001001 - 0x09 = Bank 1 and 4).
- mask (int) – bank of the device to communicate with. This is a bitmask.
- value (int) – bank of the device to communicate with. This is a bitmask.
Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns True on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... # Write the sensor data for device 1 (neoRAD-IO2-Badge) ... mask = 0x10 | 0x20 # Which channels do we want to modify ... value = 0x10 | 0x20 # Which channels do we want enabled ... neoradio2.write_sensor(handle, 1, 0, mask, value) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True >>>
neoradio2.
write_sensor_successful
(handle, device, bank)¶Checks to see if write_sensor was successful for non-blocking mode.
Parameters: Raises: neoradio2.Exception on error
Returns: Returns True on success.
neoradio2.
write_settings
(handle, device, bank, settings)¶Request the settings of the selected devices and banks. Chain needs to be identified first. Must be in application firmware.
Parameters:
- handle (int) – handle to the neoRAD-IO2 Device.
- device (int) – device number in the chain to communicate with. First device is 0.
- bank (int) – bank of the device to communicate with. This is a bitmask (0b00001001 - 0x09 = Bank 1 and 4).
- settings (neoRADIO2_settings) – Settings object.
Raises:
- neoradio2.Exception on error
- neoradio2.ExceptionWouldBlock on blocking error in non-blocking mode.
Returns: Returns True on success.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... neoradio2.request_settings(h, 0, 1) ... neoradio2.read_settings(h, 0, 1) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True <neoradio2.neoRADIO2_settings object at 0x02C11D40> >>>
neoradio2.
write_settings_successful
(handle, device, bank)¶Checks to see if write_settings was successful in non-blocking mode.
Parameters: Raises: neoradio2.Exception on error
Returns: Returns True on success.