Functions¶
|
Check if the application firmware is started. |
|
Starts the application firmware on the selected devices and banks. |
|
Identifies the chain. |
|
Checks if the chain is currently identified. |
neoradio2_clear_calibration(handle, device, bank) |
|
|
Closes the handle for the device. |
|
Starts the bootloader firmware on the selected devices and banks. |
|
Finds all neoRAD-IO2 Devices. |
|
Check if calibration is Valid. |
|
Get the chain count of the selected devices. |
get_device_type(handle, device, bank) |
|
|
Get the firmware version of the selected devices and banks. |
|
Get the hardware revision of the selected devices and banks. |
|
Get the manufacturing date of the selected devices and banks. |
|
Get the PCB serial number of the selected devices and banks. |
|
Gets the serial number (base10) on the selected devices and banks. |
|
Get the status of commands. |
is_blocking() |
|
|
Verifies calibration is stored on the selected devices and banks. |
|
Checks if the handle is currently closed. |
|
Checks if the handle is currently open. |
|
Open a neoRAD-IO2 Device |
|
Reads calibration on the selected devices and banks. |
|
Verifies calibration is stored on the selected devices and banks. |
read_calibration_points_array(handle, device, bank, header) |
|
|
Get the sensor data of the selected devices and banks. |
|
Get the sensor data of the selected devices and banks. |
|
Read the settings of the selected devices and bank. |
TODO |
|
|
Requests calibration on the selected devices and banks. |
|
Requests calibration info on the selected devices and banks. |
request_calibration_points(handle, device, bank, header) |
|
|
Request the PCB serial number of the selected devices and banks. |
|
Request the sensor data of the selected devices and banks. |
request_settings(handle, device, bank) |
|
TODO |
|
|
Sets the API to blocking or non-blocking mode. |
|
Stores calibration on the selected devices and banks. |
|
Toggle the leds on the selected devices and banks. |
|
Checks if toggle_led was successful in non-blocking mode. |
|
Writes calibration on the selected devices and banks. |
|
Writes calibration points on the selected devices and banks. |
|
Checks to see if write_calibration_points was successful in non-blocking mode. |
|
Checks to see if write_calibration was successful in non-blocking mode. |
neoradio2_write_default_settings(handle, device, bank) |
|
|
Get the sensor data of the selected devices and banks. |
|
Checks to see if write_sensor was successful for non-blocking mode. |
|
Request the settings of the selected devices and banks. |
|
Checks to see if write_settings was successful in non-blocking mode. |
- 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.chain_identify(handle) ... neoradio2.app_is_started(handle, 0, 0) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-TC IAPP03'> True True >>>
- 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) ... neoradio2.chain_identify(handle) ... # 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 True >>>
- 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 >>>
- 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'> >>>
- clear_calibration()¶
neoradio2_clear_calibration(handle, device, bank)
clears calibration on the selected devices and banks. This sets calibration back to firmware defaults. NOTE: When in doubt, do NOT uses this function as it will clear factory calibrated values.
- 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) ... bank = 0 ... handle = neoradio2.open(device) ... header = neoradio2.neoRADIO2frame_calHeader() ... header.channel = 0 ... header.range = 0 ... neoradio2.clear_calibration(handle, 0, (1 << bank)) ... neoradio2.request_calibration(handle, 0, (1 << bank), header) ... cal_values = neoradio2.read_calibration_array(handle, 0, bank) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True >>>
- 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'> >>>
- 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) ... neoradio2.chain_identify(handle) ... # 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 True >>>
- find()¶
Finds all neoRAD-IO2 Devices.
- Raises:
neoradio2.Exception on error –
- Returns:
Returns a list of neoradio2.Neoradio2DeviceInfo
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-AOUT IC0009'> >>>
- get_calibration_is_valid(handle, device, bank)¶
Check if calibration is Valid.
- Parameters:
- Raises:
neoradio2.Exception on error –
- Returns:
Returns True on success.
Example
>>> import neoradio2 >>> import time >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... bank = 0 ... 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 << bank), header, points) ... neoradio2.write_calibration(handle, 0, (1 << bank), header, values) ... neoradio2.get_calibration_is_valid(handle, 0, bank) ... neoradio2.store_calibration(handle, 0, (1 << bank), header) ... time.sleep(0.5) ... neoradio2.is_calibration_stored(handle, 0, 1) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True True True True True >>>
- 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 >>>
- get_device_type()¶
get_device_type(handle, device, bank)
TODO
Returns integer, otherwise exception is thrown.
- 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) ... neoradio2.chain_identify(handle) ... # 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) >>>
- 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) ... neoradio2.chain_identify(handle) ... # 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) >>>
- 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) ... neoradio2.chain_identify(handle) ... # 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'> True (2019, 4, 26) >>>
- 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) ... neoradio2.chain_identify(handle) ... neoradio2.app_start(handle, 0, 0xFF) ... # 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 True True R2TC050031902002 >>>
- 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) ... neoradio2.chain_identify(handle) ... # Get serial number of Bank 1 ... neoradio2.app_start(handle, 0, 1) ... neoradio2.get_serial_number(handle, 0 , 1) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-AOUT IC0009'> True True 1108546569 >>>
- 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 >>>
- is_blocking()¶
is_blocking()
Check if API is blocking
- Raises:
None
- Returns:
True/False.
- 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 >>> import time >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... bank = 0 ... 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 << bank), header, points) ... neoradio2.write_calibration(handle, 0, (1 << bank), header, values) ... neoradio2.store_calibration(handle, 0, (1 << bank), header) ... time.sleep(0.5) ... neoradio2.is_calibration_stored(handle, 0, bank) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True True True True >>>
- 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'> >>>
- 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'> >>>
- 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)
- 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) ... bank = 0 ... handle = neoradio2.open(device) ... header = neoradio2.neoRADIO2frame_calHeader() ... header.channel = 0 ... header.range = 0 ... neoradio2.request_calibration(handle, 0, (1 << bank), header) ... cal_values = neoradio2.read_calibration_array(handle, 0, bank) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True >>>
- 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) ... bank = 0 ... handle = neoradio2.open(device) ... neoradio2.request_calibration_info(handle, 0, (1 << bank)) ... header = neoradio2.read_calibration_info(handle, 0, bank) ... 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 >>>
- read_calibration_points_array()¶
read_calibration_points_array(handle, device, bank, header)
Reads calibration points on the selected devices and banks.
- Args:
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) ... bank = 0 ... handle = neoradio2.open(device) ... header = neoradio2.neoRADIO2frame_calHeader() ... header.channel = 0 ... header.range = 0 ... neoradio2.request_calibration_points(handle, 0, (1 << bank), header) ... cal_points = neoradio2.read_calibration_points_array(handle, 0, bank)
- … print(“Calibration Points: {}”.format(cal_points))
… neoradio2.close(handle) … <neoradio2.Neoradio2DeviceInfo ‘neoRAD-IO2-Badge IG0001’> True >>>
- read_sensor_array(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 array on success.
Example
TODO
- 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) ... neoradio2.chain_identify(handle) ... # 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 >>>
- 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(handle, 0, 1) ... neoradio2.read_settings(handle, 0, 1) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True <neoradio2.neoRADIO2_settings object at 0x02C11D40> >>>
- read_statistics()¶
TODO
- 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) ... bank = 0 ... handle = neoradio2.open(device) ... header = neoradio2.neoRADIO2frame_calHeader() ... header.channel = 0 ... header.range = 0 ... neoradio2.request_calibration(handle, 0, (1 << bank), header) ... cal_values = neoradio2.read_calibration_array(handle, 0, bank) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True >>>
- request_calibration_info(handle, device, bank)¶
Requests calibration info 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) ... bank = 0 ... handle = neoradio2.open(device) ... neoradio2.request_calibration_info(handle, 0, (1 << bank)) ... header = neoradio2.read_calibration_info(handle, 0, bank) ... 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 >>>
- request_calibration_points()¶
request_calibration_points(handle, device, bank, header)
Requests calibration points on the selected devices and banks.
- Args:
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) ... bank = 0 ... handle = neoradio2.open(device) ... header = neoradio2.neoRADIO2frame_calHeader() ... header.channel = 0 ... header.range = 0 ... neoradio2.request_calibration_points(handle, 0, (1 << bank), header) ... cal_points = neoradio2.read_calibration_points_array(handle, 0, bank)
- … print(“Calibration Points: {}”.format(cal_points))
… neoradio2.close(handle) … <neoradio2.Neoradio2DeviceInfo ‘neoRAD-IO2-Badge IG0001’> True >>>
- 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) ... neoradio2.chain_identify(handle) ... neoradio2.app_start(handle, 0, 0xFF) ... # 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 True True R2TC050031902002 >>>
- 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. CalType.ENABLED: Reads raw sensor value with using calibration values. Use this if unsure. CalType.NOCAL: Reads sensor value without calibration applied CalType.NOCAL_ENHANCED: Same as CALTYPE_NOCAL but with slower sample rate. Ignores setting poll rate.
- 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) ... neoradio2.chain_identify(handle) ... # Request/Get the sensor data on bank 8 for device 0 ... neoradio2.request_sensor_data(handle, 0, 0xFF, neoradio2.CalType.ENABLED) ... neoradio2.read_sensor_float(handle, 0, 7) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True 4.953075885772705 >>>
- request_settings()¶
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.
- Args:
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).
- 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)
- … bank = 0
… handle = neoradio2.open(device) … neoradio2.request_settings(h, 0, (1 << bank)) … neoradio2.read_settings(h, 0, 1) … neoradio2.close(handle) … <neoradio2.Neoradio2DeviceInfo ‘neoRAD-IO2-Badge IG0001’> True <neoradio2.neoRADIO2_settings object at 0x02C11D40> >>>
- request_statistics()¶
TODO
- set_blocking(blocking, ms_timeout)¶
Sets the API to blocking or non-blocking mode.
- store_calibration(handle, device, bank)¶
Stores calibration on the selected devices and banks. You must wait 500 ms so that the calibration values can be stored in flash. Otherwise messages will be lost.
- 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) ... bank = 0 ... 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 << bank), header, points) ... neoradio2.write_calibration(handle, 0, (1 << bank), header, values) ... neoradio2.store_calibration(handle, 0, (1 << bank), header) ... time.sleep(0.5) ... neoradio2.is_calibration_stored(handle, 0, (1 << bank)) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True True True True >>>
- toggle_led(handle, device, bank, mode, led_enables, 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).
mode (LEDMode) – Selects the LED mode to send to the LED.
led_enables (int) – LED of the bank to communicate with. This is a bitmask (0b00001001 - 0x09 = LED 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(handle, 0, 1, neoradio2.LEDMode.ON, 1, 250) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True >>>
- 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.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... neoradio2.toggle_led(handle, 0, 1, neoradio2.LEDMode.ON, 1, 250) ... neoradio2.toggle_led_successful(handle, 0, 1) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True >>>
- 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) ... bank = 0 ... 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 << bank), header, points) ... neoradio2.write_calibration(handle, 0, (1 << bank), header, values) ... neoradio2.store_calibration(handle, 0, (1 << bank), header) ... neoradio2.is_calibration_stored(handle, 0, bank) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True True True >>>
- 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 >>> import time >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... bank = 0 ... 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<<bank), header, points) ... neoradio2.write_calibration(handle, 0, (1<<bank), header, values) ... neoradio2.store_calibration(handle, 0, (1<<bank), header) ... time.sleep(0.5) ... neoradio2.is_calibration_stored(handle, 0, 0) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True True True >>>
- 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.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... bank = 0 ... handle = neoradio2.open(device) ... points = [-50.0, 0.0, 75.0, 650.0] ... header = neoradio2.neoRADIO2frame_calHeader() ... header.channel = 0 ... header.range = 0 ... header.num_of_pts = len(points) ... neoradio2.write_calibration_points(handle, 0, (1 << bank), header, points) ... neoradio2.write_calibration_points_successful(handle, 0, (1 << bank)) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True True >>>
- 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.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... bank = 0 ... handle = neoradio2.open(device) ... 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(handle, 0, (1<<bank), header, values) ... neoradio2.write_calibration_successful(handle, 0, (1<<bank), header) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True True True >>>
- write_default_settings()¶
neoradio2_write_default_settings(handle, device, bank)
Request to load default 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.write_default_settings(h, 0, 1) ... 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> >>>
- 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
- RADIO2 Series:
- AOUT:
Channel 1 = 0x01 Channel 2 = 0x02 Channel 3 = 0x04
Buffer = [(Channel_1 Data Byte 0), (Channel_1 Data Byte 1), (Channel_2 Data Byte 0), (Channel_2 Data Byte 1), (Channel_3 Data Byte 0), (Channel_3 Data Byte 1)]
- DIO:
Channel 1 = 0x01 Channel 2 = 0x02 Channel 3 = 0x04
- 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) – channel of the bank to send data to. This is a bitmask (0b00000101 - 0x05 = Channel 1 and 3).
value (int) – Buffer to send to the bank. Different structer for each 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) ... bank = 0 ... handle = neoradio2.open(device) ... neoradio2.chain_identify(handle) ... mask = 0x10 | 0x20 # Which channels do we want to modify ... values = [0xFF, 0xFF] #Put channels to 5V (65535.0f / 5.0f) * desired_voltage(5V) ... neoradio2.write_sensor(handle, 0, (1 << bank), mask, values) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-AOUT IC0009'> True True
>>>
- 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.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... bank = 0 ... handle = neoradio2.open(device) ... neoradio2.chain_identify(handle) ... mask = 0x10 | 0x20 # Which channels do we want to modify ... values = [0xFF, 0xFF] #Put channels to 5V (65535.0f / 5.0f) * desired_voltage(5V) ... neoradio2.write_sensor(handle, 0, (1 << bank), mask, values) ... neoraido2.write_sensor_successful(handle, 0, (1 << bank)) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-AOUT IC0009'> True True True
>>>
- 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) ... settings = neoradio2.read_settings(h, 0, 1) ... neoradio2.write_settings(h, 0, 1, settings) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True True >>>
- 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.
Example
>>> import neoradio2 >>> devices = neoradio2.find() >>> for device in devices: ... print(device) ... handle = neoradio2.open(device) ... neoradio2.request_settings(h, 0, 1) ... settings = neoradio2.read_settings(h, 0, 1) ... neoradio2.write_settings(h, 0, 1, settings) ... neoradio2.write_settings_successful(handle, 0 ,1) ... neoradio2.close(handle) ... <neoradio2.Neoradio2DeviceInfo 'neoRAD-IO2-Badge IG0001'> True True True >>>