Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Code/Stimulator/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## The python wrapper is coming from: the [Human Computer Integration Lab, Chicago](https://github.com/humancomputerintegration/rehamove-integration-lib)
# please read the license and limitations

## Notes:
- had to disable USB sleep in power settings on a windows laptop to keep the rehastim working reliably
- one of the usb port is not working reliably, even with the new power settings (need to use the left port on ABD's laptop)
- the pre-compiled python library for windows that is available on github requires python 3.7 (otherwise recompile)
- keep using the low-level mode, to send individual pulses
Binary file added Code/Stimulator/libs/linux/_rehamovelib.so
Binary file not shown.
File renamed without changes.
210 changes: 210 additions & 0 deletions Code/Stimulator/libs/linux/rehamovelib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.

from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_import_helper():
import importlib
pkg = __name__.rpartition('.')[0]
mname = '.'.join((pkg, '_rehamovelib')).lstrip('.')
try:
return importlib.import_module(mname)
except ImportError:
return importlib.import_module('_rehamovelib')
_rehamovelib = swig_import_helper()
del swig_import_helper
elif _swig_python_version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_rehamovelib', [dirname(__file__)])
except ImportError:
import _rehamovelib
return _rehamovelib
try:
_mod = imp.load_module('_rehamovelib', fp, pathname, description)
finally:
if fp is not None:
fp.close()
return _mod
_rehamovelib = swig_import_helper()
del swig_import_helper
else:
import _rehamovelib
del _swig_python_version_info

try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.

try:
import builtins as __builtin__
except ImportError:
import __builtin__

def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name, None)
if method:
return method(self, value)
if (not static):
if _newclass:
object.__setattr__(self, name, value)
else:
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)


def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)


def _swig_getattr(self, class_type, name):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))


def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except __builtin__.Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)

try:
_object = object
_newclass = 1
except __builtin__.Exception:
class _object:
pass
_newclass = 0

class RehamoveDevice(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, RehamoveDevice, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, RehamoveDevice, name)
__repr__ = _swig_repr
__swig_setmethods__["device"] = _rehamovelib.RehamoveDevice_device_set
__swig_getmethods__["device"] = _rehamovelib.RehamoveDevice_device_get
if _newclass:
device = _swig_property(_rehamovelib.RehamoveDevice_device_get, _rehamovelib.RehamoveDevice_device_set)
__swig_setmethods__["battery"] = _rehamovelib.RehamoveDevice_battery_set
__swig_getmethods__["battery"] = _rehamovelib.RehamoveDevice_battery_get
if _newclass:
battery = _swig_property(_rehamovelib.RehamoveDevice_battery_get, _rehamovelib.RehamoveDevice_battery_set)
__swig_setmethods__["mode"] = _rehamovelib.RehamoveDevice_mode_set
__swig_getmethods__["mode"] = _rehamovelib.RehamoveDevice_mode_get
if _newclass:
mode = _swig_property(_rehamovelib.RehamoveDevice_mode_get, _rehamovelib.RehamoveDevice_mode_set)
__swig_setmethods__["current"] = _rehamovelib.RehamoveDevice_current_set
__swig_getmethods__["current"] = _rehamovelib.RehamoveDevice_current_get
if _newclass:
current = _swig_property(_rehamovelib.RehamoveDevice_current_get, _rehamovelib.RehamoveDevice_current_set)
__swig_setmethods__["pulse_width"] = _rehamovelib.RehamoveDevice_pulse_width_set
__swig_getmethods__["pulse_width"] = _rehamovelib.RehamoveDevice_pulse_width_get
if _newclass:
pulse_width = _swig_property(_rehamovelib.RehamoveDevice_pulse_width_get, _rehamovelib.RehamoveDevice_pulse_width_set)

def __init__(self):
this = _rehamovelib.new_RehamoveDevice()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _rehamovelib.delete_RehamoveDevice
__del__ = lambda self: None
RehamoveDevice_swigregister = _rehamovelib.RehamoveDevice_swigregister
RehamoveDevice_swigregister(RehamoveDevice)


def open_port(port_name):
return _rehamovelib.open_port(port_name)
open_port = _rehamovelib.open_port

def close_port(r):
return _rehamovelib.close_port(r)
close_port = _rehamovelib.close_port

def initialize_low_level(r):
return _rehamovelib.initialize_low_level(r)
initialize_low_level = _rehamovelib.initialize_low_level

def stop_low_level(r):
return _rehamovelib.stop_low_level(r)
stop_low_level = _rehamovelib.stop_low_level

def pulse(r, channel, current, pulse_width):
return _rehamovelib.pulse(r, channel, current, pulse_width)
pulse = _rehamovelib.pulse

def custom_pulse(r, channel, num_points, c0, w0, c1, w1, c2, w2, c3, w3, c4, w4, c5, w5, c6, w6, c7, w7, c8, w8, c9, w9, c10, w10, c11, w11, c12, w12, c13, w13, c14, w14, c15, w15):
return _rehamovelib.custom_pulse(r, channel, num_points, c0, w0, c1, w1, c2, w2, c3, w3, c4, w4, c5, w5, c6, w6, c7, w7, c8, w8, c9, w9, c10, w10, c11, w11, c12, w12, c13, w13, c14, w14, c15, w15)
custom_pulse = _rehamovelib.custom_pulse

def change_mode(r, mode):
return _rehamovelib.change_mode(r, mode)
change_mode = _rehamovelib.change_mode

def set_pulse_data(r, current, pulse_width):
return _rehamovelib.set_pulse_data(r, current, pulse_width)
set_pulse_data = _rehamovelib.set_pulse_data

def run(r, channel, period, total_milliseconds):
return _rehamovelib.run(r, channel, period, total_milliseconds)
run = _rehamovelib.run

def midlevel_start(r, channel, period):
return _rehamovelib.midlevel_start(r, channel, period)
midlevel_start = _rehamovelib.midlevel_start

def midlevel_update(r):
return _rehamovelib.midlevel_update(r)
midlevel_update = _rehamovelib.midlevel_update

def midlevel_end(r):
return _rehamovelib.midlevel_end(r)
midlevel_end = _rehamovelib.midlevel_end

def get_version():
return _rehamovelib.get_version()
get_version = _rehamovelib.get_version

def get_battery(r):
return _rehamovelib.get_battery(r)
get_battery = _rehamovelib.get_battery

def get_mode(r):
return _rehamovelib.get_mode(r)
get_mode = _rehamovelib.get_mode

def get_current(r):
return _rehamovelib.get_current(r)
get_current = _rehamovelib.get_current

def get_pulse_width(r):
return _rehamovelib.get_pulse_width(r)
get_pulse_width = _rehamovelib.get_pulse_width

def battery_request(r):
return _rehamovelib.battery_request(r)
battery_request = _rehamovelib.battery_request
# This file is compatible with both classic and new-style classes.


Loading