├── .gitignore ├── LICENSE ├── README.md ├── examples ├── Dockerfile ├── compass.py ├── gpio_blinking_led.py ├── gpio_dimming_led.py ├── led_clear.py ├── led_flashlight.py ├── led_multi_image.py ├── led_rotate.py ├── led_snakes.py ├── mcu_fpga_info.py ├── read_humidity.py ├── read_imu.py ├── read_pressure.py ├── read_uv.py └── requirements.txt ├── matrixio_hal ├── GPIO.py ├── __init__.py ├── bus.py ├── everloop.py ├── matrixio_cpp_hal.pyx └── sensors.py ├── setup.cfg └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | dist/ 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .coverage 43 | .coverage.* 44 | .cache 45 | nosetests.xml 46 | coverage.xml 47 | *.cover 48 | .hypothesis/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | 58 | # Flask stuff: 59 | instance/ 60 | .webassets-cache 61 | 62 | # Scrapy stuff: 63 | .scrapy 64 | 65 | # Sphinx documentation 66 | docs/_build/ 67 | 68 | # PyBuilder 69 | target/ 70 | 71 | # Jupyter Notebook 72 | .ipynb_checkpoints 73 | 74 | # pyenv 75 | .python-version 76 | 77 | # celery beat schedule file 78 | celerybeat-schedule 79 | 80 | # SageMath parsed files 81 | *.sage.py 82 | 83 | # dotenv 84 | .env 85 | 86 | # virtualenv 87 | .venv 88 | venv/ 89 | ENV/ 90 | 91 | # Spyder project settings 92 | .spyderproject 93 | .spyproject 94 | 95 | # Rope project settings 96 | .ropeproject 97 | 98 | # mkdocs documentation 99 | /site 100 | 101 | # mypy 102 | .mypy_cache/ 103 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 cmetz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # python-matrixio-hal 2 | Python driver for Matrix Creator / Voice 3 | 4 | ## Requirements installation 5 | ``` 6 | # Add repo and key 7 | curl https://apt.matrix.one/doc/apt-key.gpg | sudo apt-key add - 8 | echo "deb https://apt.matrix.one/raspbian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/matrixlabs.list 9 | 10 | # Update packages and install 11 | sudo apt-get update 12 | sudo apt-get upgrade 13 | 14 | # Installation 15 | sudo apt install matrixio-creator-init libmatrixio-creator-hal-dev 16 | 17 | # Enable SPI 18 | sudo raspi-config >> Interfacing options >> SPI >> yes >> exit and reboot 19 | 20 | # install python-matrixio-hal with pip 21 | sudo apt-get install cython (optional - to speedup build process - install cython3 for python3) 22 | pip install python-matrixio-hal 23 | ``` 24 | 25 | ## Examples 26 | 27 | Run the examples in the examples folder. 28 | 29 | ## Docker example 30 | 31 | ### Install docker if not installed 32 | ``` 33 | curl -fsSL get.docker.com -o get-docker.sh 34 | sudo CHANNEL=stable sh get-docker.sh 35 | sudo usermod -aG docker pi 36 | ``` 37 | 38 | ### Build and run led\_roate example (Dockerfile in examples) 39 | ``` 40 | # Build the docker image led_rotate (it uses the examples from the examples folder) 41 | docker build -t led_rotate . 42 | 43 | # Run led_rotate as new container led_rotate 44 | # SPI: 45 | docker run --name led_rotate -d --device=/dev/spidev0.0 led_rotate 46 | # Kernel modules: 47 | docker run --name led_rotate -d --device=/dev/matrixio_regmap led_rotate 48 | 49 | # List active containers 50 | docker ps 51 | 52 | # Stop it 53 | docker stop led_rotate 54 | 55 | # Restart it 56 | docker start led_rotate 57 | 58 | # Remove Cotainer 59 | docker stop led_roate 60 | docker rm led_roate 61 | 62 | # Auto restart cotainer after a reboot 63 | # create the cotainer with --restart always 64 | docker run --name led_rotate -d --restart always --device=/dev/spidev0.0 led_rotate 65 | ``` 66 | -------------------------------------------------------------------------------- /examples/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM resin/raspberrypi3-debian:stretch 2 | RUN apt-get update && \ 3 | apt-get dist-upgrade && \ 4 | apt-get install apt-transport-https build-essential python python-pip python-setuptools python-dev cython curl && \ 5 | curl https://apt.matrix.one/doc/apt-key.gpg | apt-key add - && \ 6 | echo "deb https://apt.matrix.one/raspbian stretch main" > /etc/apt/sources.list.d/matrixlabs.list && \ 7 | apt-get update && \ 8 | apt-get install libmatrixio-creator-hal-dev && \ 9 | rm -rf /var/lib/apt/lists/* 10 | WORKDIR /usr/src/app 11 | COPY . . 12 | RUN pip install -r requirements.txt 13 | ENTRYPOINT ["/sbin/tini", "-g", "--"] 14 | STOPSIGNAL SIGTERM 15 | CMD [ "python", "./led_rotate.py" ] 16 | -------------------------------------------------------------------------------- /examples/compass.py: -------------------------------------------------------------------------------- 1 | from matrixio_hal import sensors, everloop 2 | import math 3 | import time 4 | 5 | CALIBRATION_SAMPLES = 1500 6 | 7 | 8 | def get_heading(imu, mag_bias=[0.0, 0.0, 0.0]): 9 | imu.update() 10 | 11 | 12 | mx = -(imu.mag_x - mag_bias[0]) 13 | my = imu.mag_y - mag_bias[1] 14 | mz = -(imu.mag_z - mag_bias[2]) 15 | 16 | # tilt correction 17 | norm = 1.0 / math.sqrt(imu.accel_x ** 2 + imu.accel_y ** 2 + imu.accel_z ** 2) 18 | accel_x_norm = imu.accel_x * norm 19 | accel_y_norm = imu.accel_y * norm 20 | pitch = math.asin(accel_x_norm) 21 | roll = -1 * math.asin(accel_y_norm / math.cos(pitch)) 22 | mx = mx * math.cos(pitch) + my * math.sin(roll)*math.sin(pitch) + mz * math.cos(roll) * math.sin(pitch) 23 | my = my * math.cos(roll) - mz * math.sin(roll) 24 | 25 | # calculate heading 26 | heading = math.atan2(my, mx) * 180 / math.pi 27 | if heading < 0: 28 | heading += 360 29 | return heading 30 | 31 | 32 | def calibrate_compass(imu): 33 | # calibrate 34 | mag_bias = [0.0, 0.0, 0.0] 35 | mag_min = [0.0, 0.0, 0.0] 36 | mag_max = [0.0, 0.0, 0.0] 37 | 38 | print("Starting calibration:") 39 | print("Wave your creator in a 8 form for {} seconds.".format(CALIBRATION_SAMPLES // 100)) 40 | for sample in range(CALIBRATION_SAMPLES): 41 | imu.update() 42 | mag_min = [min(v) for v in zip(mag_min, [imu.mag_x, imu.mag_y, imu.mag_z])] 43 | mag_max = [max(v) for v in zip(mag_max, [imu.mag_x, imu.mag_y, imu.mag_z])] 44 | 45 | # comment in to check if all min / max is covered 46 | #if sample % 100 == 0: 47 | # print(mag_min, mag_max) 48 | time.sleep(0.01) 49 | 50 | mag_bias = [sum(v) / 2 for v in zip(mag_min, mag_max)] 51 | print("Calibration ended") 52 | 53 | return mag_bias 54 | 55 | 56 | if __name__ == '__main__': 57 | imu = sensors.IMU() 58 | img = everloop.Image() 59 | 60 | mag_bias = calibrate_compass(imu) 61 | 62 | while True: 63 | heading = get_heading(imu, mag_bias) 64 | blue_led = int(heading * 35 / 360) 65 | red_led = (blue_led + 17) % 34; 66 | for i, l in enumerate(img.leds): 67 | l.blue = 50 if i == blue_led else 0 68 | l.red = 50 if i == red_led else 0 69 | img.render() 70 | print(heading) 71 | time.sleep(0.1) 72 | 73 | -------------------------------------------------------------------------------- /examples/gpio_blinking_led.py: -------------------------------------------------------------------------------- 1 | from matrixio_hal import GPIO 2 | import time 3 | 4 | # new pin 0 5 | pin0 = GPIO.Pin(0) 6 | 7 | # set pin to output mode 8 | pin0.mode = GPIO.MODE_OUT 9 | 10 | while True: 11 | # toggeling high(1) and low(0) 12 | pin0.value ^= GPIO.VALUE_HIGH 13 | time.sleep(0.5) 14 | 15 | -------------------------------------------------------------------------------- /examples/gpio_dimming_led.py: -------------------------------------------------------------------------------- 1 | from matrixio_hal import GPIO 2 | import time 3 | 4 | # create new PWMBank with a frequency of 100Hz 5 | # the Matrix has 4 banks 0-3, but only Bank0 (default) works currently 6 | # each Bank can have it's own frequency 7 | bank = GPIO.PWMBank(frequency=100) 8 | 9 | # create new PWM - binding channel(pin)=0 and the bank configured above 10 | # each bank can be assigned to multiple channels (pins) with their 11 | # own duty 12 | pwm = GPIO.PWM(channel=0, bank=bank) 13 | 14 | # starting with a duty 5% 15 | pwm.start(duty=5) 16 | while True: 17 | # increase the duty by 1% restart at 50% 18 | # pwm.duty = is property with setter function 19 | # so setting the duty will have an instant effect 20 | # do not use this as a temporary caluclation variable 21 | # but you can use it to get the current duty 22 | pwm.duty = pwm.duty + 1 if pwm.duty + 1 <= 50 else 5 23 | time.sleep(0.1) 24 | 25 | # this pwm.stop() would propably never been caled, as you need to 26 | # stop this demo by using ctrl-c, but the atexit handler will 27 | # cleanup the GPIOs anyway 28 | # setting GPIO.atexit_cleanup_gpio = False would prevent this 29 | pwm.stop() 30 | -------------------------------------------------------------------------------- /examples/led_clear.py: -------------------------------------------------------------------------------- 1 | from matrixio_hal import everloop 2 | 3 | # atext_clear_everloop can be set to False 4 | # so we do not clear twice 5 | everloop.atexit_clear_everloop = False 6 | # render empty image 7 | everloop.Image().render() 8 | print('Leds cleared.') 9 | -------------------------------------------------------------------------------- /examples/led_flashlight.py: -------------------------------------------------------------------------------- 1 | from matrixio_hal import everloop 2 | 3 | # preserve the everloop on exit 4 | everloop.atexit_clear_everloop = False 5 | 6 | # create image with the proteced _flashslight color_name and render it 7 | img = everloop.Image(init_color_name='_flashlight') 8 | img.render() 9 | print('Lights on!') 10 | -------------------------------------------------------------------------------- /examples/led_multi_image.py: -------------------------------------------------------------------------------- 1 | from matrixio_hal import everloop 2 | from collections import deque 3 | import time 4 | 5 | images = [] 6 | # generating 3 images with the lengths of EVERLOOP_SIZE // 3 7 | for img in range(3): 8 | image = everloop.Image(start = everloop.EVERLOOP_SIZE // 3 * img, size = everloop.EVERLOOP_SIZE // 3) 9 | image.leds[0].red = 5 10 | cnt = 1 11 | for i in range(1, len(image.leds)): 12 | if i <= len(image.leds) // 2: 13 | image.leds[i].red = 5 14 | image.leds[i].blue = cnt // 2 15 | cnt += 1 16 | else: 17 | image.leds[i].red = 5 18 | image.leds[i].green = cnt // 2 19 | cnt -= 1 20 | images.append(image) 21 | 22 | #add additional image with only 2 leds, to fill up the 35 led array (creator) 23 | if everloop.EVERLOOP_SIZE == 35: 24 | image = everloop.Image(start = 33, size = 2) 25 | image.leds[0].blue = 3 26 | image.leds[1].red = 3 27 | images.append(image) 28 | 29 | while True: 30 | for image in images: 31 | image.render() 32 | 33 | images[0].rotate(1) 34 | images[1].rotate(-1) 35 | images[2].rotate(1) 36 | #images[3].rotate(1) 37 | time.sleep(0.1) 38 | -------------------------------------------------------------------------------- /examples/led_rotate.py: -------------------------------------------------------------------------------- 1 | from matrixio_hal import everloop 2 | from collections import deque 3 | import time 4 | 5 | image = everloop.Image() 6 | image.leds[0].red = 20 7 | cnt = 1 8 | for i in range(1, len(image.leds)): 9 | if i <= everloop.EVERLOOP_SIZE // 2: 10 | image.leds[i].red = 17 11 | image.leds[i].blue = cnt // 5 12 | cnt += 1 13 | else: 14 | image.leds[i].red = 17 15 | image.leds[i].green = cnt // 5 16 | cnt -= 1 17 | 18 | while True: 19 | image.render() 20 | image.rotate(1) 21 | time.sleep(0.03) 22 | -------------------------------------------------------------------------------- /examples/led_snakes.py: -------------------------------------------------------------------------------- 1 | from matrixio_hal import everloop 2 | import random 3 | import time 4 | 5 | cnt = 0 6 | color = everloop.Color(color_name='orange') 7 | color_clear = everloop.Color() 8 | offset = 0 9 | turn_on = True 10 | while True: 11 | if cnt >= everloop.EVERLOOP_SIZE: 12 | cnt = 0 13 | turn_on = not turn_on 14 | if turn_on: 15 | if random.randint(0, 1) == 0: 16 | # choose from COLOR_NAMES 17 | color.set_by_name(random.choice(everloop.COLOR_NAMES)) 18 | else: 19 | # completely random 20 | color.red, color.green, color.blue = [random.randint(0, 4) for _ in range(3)] 21 | offset = random.randint(0, everloop.EVERLOOP_SIZE - 1) 22 | print('R:{} G:{} B:{}'.format(color.red, color.green, color.blue)) 23 | 24 | if turn_on: 25 | everloop.set_led(cnt + offset, color) 26 | else: 27 | everloop.set_led(everloop.EVERLOOP_SIZE - 1 - cnt + offset, color_clear) 28 | time.sleep(0.05 if turn_on else 0.01) 29 | cnt += 1 30 | -------------------------------------------------------------------------------- /examples/mcu_fpga_info.py: -------------------------------------------------------------------------------- 1 | from matrixio_hal import bus 2 | 3 | # device 4 | print('Your device is a Matrix: {}'.format(bus.MATRIX_DEVICE)) 5 | 6 | # mcu firemware info 7 | print('\nMCU:') 8 | print('IDENTIFY = {}'.format(bus.MCU_IDENTIFY)) 9 | print('VERSION = {}'.format(bus.MCU_FIRMWARE_VERSION)) 10 | 11 | # fpga firmware info 12 | print('\nFPGA:') 13 | print('IDENTIFY = {}'.format(bus.FPGA_IDENTIFY)) 14 | print('VERSION = {}'.format(bus.FPGA_FIRMWARE_VERSION)) 15 | 16 | -------------------------------------------------------------------------------- /examples/read_humidity.py: -------------------------------------------------------------------------------- 1 | from matrixio_hal import sensors 2 | 3 | humidity = sensors.Humidity() 4 | 5 | print("Humidity: {}".format(humidity.humidity)) 6 | print("Temperature: {}".format(humidity.temperature)) 7 | 8 | -------------------------------------------------------------------------------- /examples/read_imu.py: -------------------------------------------------------------------------------- 1 | from matrixio_hal import sensors 2 | import time 3 | 4 | # IMU 5 | imu = sensors.IMU() 6 | while True: 7 | print("\x1B[2J") 8 | print("yaw: {}".format(imu.yaw)) 9 | print("pitch: {}".format(imu.pitch)) 10 | print("roll: {}".format(imu.roll)) 11 | print("accel_x: {}".format(imu.accel_x)) 12 | print("accel_y: {}".format(imu.accel_y)) 13 | print("accel_z: {}".format(imu.accel_z)) 14 | print("gyro_x: {}".format(imu.gyro_x)) 15 | print("gyro_y: {}".format(imu.gyro_y)) 16 | print("gyro_z: {}".format(imu.gyro_z)) 17 | print("mag_x: {}".format(imu.mag_x)) 18 | print("mag_y: {}".format(imu.mag_y)) 19 | print("mag_z: {}".format(imu.mag_z)) 20 | time.sleep(0.1) 21 | imu.update() 22 | -------------------------------------------------------------------------------- /examples/read_pressure.py: -------------------------------------------------------------------------------- 1 | from matrixio_hal import sensors 2 | 3 | pressure = sensors.Pressure() 4 | 5 | print("Altitude: {}".format(pressure.altitude)) 6 | print("Pressure: {}".format(pressure.pressure)) 7 | print("Temperature: {}".format(pressure.temperature)) 8 | 9 | -------------------------------------------------------------------------------- /examples/read_uv.py: -------------------------------------------------------------------------------- 1 | from matrixio_hal import sensors 2 | 3 | uv = sensors.UV() 4 | 5 | print("UV: {}".format(uv.uv)) 6 | 7 | -------------------------------------------------------------------------------- /examples/requirements.txt: -------------------------------------------------------------------------------- 1 | python-matrixio-hal 2 | -------------------------------------------------------------------------------- /matrixio_hal/GPIO.py: -------------------------------------------------------------------------------- 1 | from . import bus 2 | from . import matrixio_cpp_hal 3 | from functools import wraps 4 | import atexit 5 | 6 | _gpio_control = matrixio_cpp_hal.PyGPIOControl() 7 | _gpio_control.Setup(bus.bus) 8 | 9 | MODE_IN = 0 10 | MODE_OUT = 1 11 | 12 | VALUE_LOW = 0 13 | VALUE_HIGH = 1 14 | 15 | FUNCTION_NORMAL = 0 16 | FUNCTION_PWM = 1 17 | 18 | atexit_cleanup_gpio = True 19 | _gpio_used = False 20 | 21 | def _is_using_gpio(f): 22 | @wraps(f) 23 | def wrapper(*args, **kwargs): 24 | global _gpio_used 25 | _gpio_used = True 26 | return f(*args, **kwargs) 27 | return wrapper 28 | 29 | class Pin(object): 30 | def __init__(self, pin): 31 | if pin < 0 or pin > 16: 32 | raise ValueError("wrong pin {}".format(pin)) 33 | self.pin = pin 34 | self._mode = 0 35 | self._function = 0 36 | self.mode = 0 37 | self.function = 0 38 | self.value = 0 39 | 40 | @property 41 | def mode(self): 42 | return self._mode 43 | 44 | @mode.setter 45 | @_is_using_gpio 46 | def mode(self, mode): 47 | if mode not in [0, 1]: 48 | raise ValueError("Mode {} is not 0 or 1".format(mode)) 49 | self._mode = mode 50 | return _gpio_control.SetMode(self.pin, self._mode) 51 | 52 | @property 53 | def value(self): 54 | return _gpio_control.GetGPIOValue(self.pin) 55 | 56 | @value.setter 57 | @_is_using_gpio 58 | def value(self, value): 59 | if value not in [0, 1]: 60 | raise ValueError("Value {} is not 0 or 1".format(mode)) 61 | return _gpio_control.SetGPIOValue(self.pin, value) 62 | 63 | @property 64 | def function(self): 65 | return self._function 66 | 67 | @function.setter 68 | @_is_using_gpio 69 | def function(self, function): 70 | self._function = function 71 | return _gpio_control.SetFunction(self.pin, function) 72 | 73 | class PWMBank(object): 74 | def __init__(self, frequency=100, bank=0): 75 | if bank != 0: 76 | raise ValueError("Only bank 0 is supported, due to matrix bug") 77 | self._bank = bank 78 | self._frequency = 0 79 | self._prescaler = 0 80 | self._period_counter = 0 81 | self.frequency = frequency 82 | 83 | @property 84 | def frequency(self): 85 | return self._frequency 86 | 87 | @frequency.setter 88 | @_is_using_gpio 89 | def frequency(self, frequency): 90 | period = 1.0 / frequency 91 | prescaler = 0 92 | while int(period * bus.FPGA_FREQUENCY / ((1 << (prescaler)) * 2)) > 65535: 93 | prescaler += 1 94 | period_counter = int((period * bus.FPGA_FREQUENCY) / ((1 << prescaler)*2)) 95 | self._prescaler = prescaler 96 | self._period_counter = period_counter 97 | _gpio_control.SetPrescaler(self._bank, self._prescaler) 98 | _gpio_control.SetPeriod(self._bank, self._period_counter) 99 | 100 | 101 | class PWM(object): 102 | def __init__(self, channel, bank): 103 | self._bank = bank 104 | self._pin = Pin(channel) 105 | self._duty = 0 106 | self._started = False 107 | 108 | @property 109 | def duty(self): 110 | return self._duty 111 | 112 | @duty.setter 113 | def duty(self, duty): 114 | if duty < 0 or duty > 100: 115 | raise ValueError("Duty not in range of 0 - 100%") 116 | self._duty = duty 117 | if self._started: 118 | self._enable_duty() 119 | 120 | def start(self, duty = None): 121 | if duty is not None: 122 | self.duty = duty 123 | self._enable_duty() 124 | 125 | @_is_using_gpio 126 | def _enable_duty(self): 127 | if not self._started: 128 | self._started = True 129 | self._pin.mode = MODE_OUT 130 | self._pin.value = VALUE_LOW 131 | self._pin.function = FUNCTION_PWM 132 | duty_counter = int(self._bank._period_counter / 100.0 * self._duty) 133 | _gpio_control.SetDuty(self._bank._bank, self._pin.pin, duty_counter) 134 | 135 | @_is_using_gpio 136 | def stop(self): 137 | if self._started: 138 | _gpio_control.SetDuty(self._bank._bank, self._pin.pin, 0) 139 | self._pin.mode = MODE_IN 140 | self._pin.value = VALUE_LOW 141 | self._pin.function = FUNCTION_NORMAL 142 | self._stated = False 143 | 144 | 145 | @atexit.register 146 | def cleanup(): 147 | if atexit_cleanup_gpio and _gpio_used: 148 | for i in range(0, 17): 149 | _gpio_control.SetFunction(i, 0) 150 | _gpio_control.SetGPIOValue(i, 0) 151 | _gpio_control.SetMode(i, 0) 152 | -------------------------------------------------------------------------------- /matrixio_hal/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = ['sensors', 'everloop', 'GPIO'] 2 | 3 | from . import bus 4 | from . import sensors 5 | from . import everloop 6 | from . import GPIO 7 | -------------------------------------------------------------------------------- /matrixio_hal/bus.py: -------------------------------------------------------------------------------- 1 | from . import matrixio_cpp_hal 2 | import struct 3 | import signal 4 | import sys 5 | 6 | debug = False 7 | 8 | # handle SIGTERM as normal sys.exit() 9 | # e.g. docker stop send SIGTERM by default 10 | def sigterm_handler(signal, frame): 11 | sys.exit() 12 | 13 | signal.signal(signal.SIGTERM, sigterm_handler) 14 | 15 | bus = matrixio_cpp_hal.PyMatrixIOBus() 16 | bus.Init() 17 | 18 | # set some infos about the MCU and FPGA 19 | mcu_data = matrixio_cpp_hal.PyMCUData() 20 | mcu = matrixio_cpp_hal.PyMCUFirmware() 21 | mcu.Setup(bus) 22 | mcu.Read(mcu_data) 23 | MCU_IDENTIFY, MCU_FIRMWARE_VERSION = ['{:x}'.format(d) for d in [mcu_data.ID, mcu_data.version]] 24 | del mcu_data 25 | del mcu 26 | 27 | FPGA_IDENTIFY = '{:x}'.format(bus.MatrixName()) 28 | FPGA_FIRMWARE_VERSION = '{:x}'.format(bus.MatrixVersion()) 29 | 30 | MATRIX_DEVICE = 'unknown' 31 | if FPGA_IDENTIFY == '5c344e8': 32 | MATRIX_DEVICE = 'creator' 33 | elif FPGA_IDENTIFY == '6032bad2': 34 | MATRIX_DEVICE = 'voice' 35 | 36 | # set FPGA_FREQUENCY 37 | FPGA_FREQUENCY = bus.FPGAClock() 38 | 39 | -------------------------------------------------------------------------------- /matrixio_hal/everloop.py: -------------------------------------------------------------------------------- 1 | from . import matrixio_cpp_hal 2 | from . import bus 3 | from functools import wraps 4 | import atexit 5 | import time 6 | 7 | EVERLOOP_SIZE = bus.bus.MatrixLeds() 8 | 9 | COLORS = { # R G B W 10 | "black": [ 0, 0, 0, 0], 11 | "red": [ 10, 0, 0, 0], 12 | "green": [ 0, 10, 0, 0], 13 | "blue": [ 0, 0, 10, 0], 14 | "yellow": [ 10, 5, 0, 0], 15 | "purple": [ 10, 0, 5, 0], 16 | "cyan": [ 0, 10, 5, 0], 17 | "orange": [ 10, 2, 0, 0], 18 | "_flashlight": [255, 255, 255, 255] 19 | } 20 | COLOR_NAMES = [c for c in list(COLORS) if not c.startswith('_')] 21 | 22 | atexit_clear_everloop = True 23 | 24 | _everloop_used = False 25 | 26 | _cpp_ev_image = matrixio_cpp_hal.PyEverloopImage() 27 | _cpp_ev = matrixio_cpp_hal.PyEverloop() 28 | _cpp_ev.Setup(bus.bus) 29 | 30 | def _is_using_everloop(f): 31 | @wraps(f) 32 | def wrapper(*args, **kwargs): 33 | global _everloop_used 34 | _everloop_used = True 35 | return f(*args, **kwargs) 36 | return wrapper 37 | 38 | class Color(object): 39 | def __init__(self, red=0, green=0, blue=0, white=0, color_name=None): 40 | if color_name: 41 | self.set_by_name(color_name) 42 | else: 43 | self.red = red 44 | self.green = green 45 | self.blue = blue 46 | self.white = white 47 | 48 | def set_by_name(self, color_name): 49 | self.red, self.green, self.blue, self.white = COLORS[color_name] 50 | 51 | class Image(object): 52 | def __init__(self, start=0, size=EVERLOOP_SIZE, init_color_name='black'): 53 | self.start = start 54 | self.size = size 55 | self.leds = [Color(color_name=init_color_name) for _ in range(size)] 56 | self.rotate_offset = 0 57 | 58 | def rotate(self, direction=1): 59 | self.rotate_offset = (self.rotate_offset + direction) % self.size 60 | 61 | @_is_using_everloop 62 | def render(self): 63 | global _cpp_ev 64 | global _cpp_ev_image 65 | data = [] 66 | for i in range(self.size): 67 | index = (i - self.rotate_offset) % self.size 68 | ev_index = (self.start + i) % EVERLOOP_SIZE 69 | _cpp_ev_image.leds[ev_index].red = self.leds[index].red 70 | _cpp_ev_image.leds[ev_index].green = self.leds[index].green 71 | _cpp_ev_image.leds[ev_index].blue = self.leds[index].blue 72 | _cpp_ev_image.leds[ev_index].white = self.leds[index].white 73 | _cpp_ev.Write(_cpp_ev_image) 74 | 75 | @_is_using_everloop 76 | def set_led(index, color): 77 | global _cpp_ev 78 | global _cpp_ev_image 79 | index = index % EVERLOOP_SIZE 80 | _cpp_ev_image.leds[index].red = color.red 81 | _cpp_ev_image.leds[index].green = color.green 82 | _cpp_ev_image.leds[index].blue = color.blue 83 | _cpp_ev_image.leds[index].white = color.white 84 | _cpp_ev.Write(_cpp_ev_image) 85 | 86 | @atexit.register 87 | def cleanup(): 88 | if atexit_clear_everloop and _everloop_used: 89 | Image().render() 90 | 91 | -------------------------------------------------------------------------------- /matrixio_hal/matrixio_cpp_hal.pyx: -------------------------------------------------------------------------------- 1 | from libcpp cimport bool 2 | from cpython.mem cimport PyMem_Malloc, PyMem_Free 3 | from libc.stdint cimport uint16_t, uint32_t 4 | from libcpp.vector cimport vector 5 | from cython.operator cimport dereference as deref 6 | from cython.operator cimport preincrement as incr 7 | 8 | cdef extern from "matrix_hal/matrixio_bus.h" namespace "matrix_hal": 9 | cdef cppclass MatrixIOBus: 10 | MatrixIOBus() except + 11 | bool Init() 12 | bool Read(uint16_t add, unsigned char* data, int length) 13 | uint32_t FPGAClock() 14 | uint32_t MatrixName() 15 | uint32_t MatrixVersion() 16 | int MatrixLeds() 17 | bool IsDirectBus() 18 | 19 | cdef extern from "matrix_hal/matrix_driver.h" namespace "matrix_hal": 20 | cdef cppclass MatrixDriver: 21 | MatrixDriver() except + 22 | void Setup(MatrixIOBus* wishbone) 23 | 24 | cdef extern from "matrix_hal/fw_data.h" namespace "matrix_hal": 25 | cdef cppclass MCUData: 26 | uint32_t ID 27 | uint32_t version 28 | 29 | cdef extern from "matrix_hal/mcu_firmware.h" namespace "matrix_hal": 30 | cdef cppclass MCUFirmware(MatrixDriver): 31 | MCUFirmware() except + 32 | bool Read(MCUData* data) 33 | 34 | cdef extern from "matrix_hal/pressure_data.h" namespace "matrix_hal": 35 | cdef cppclass PressureData: 36 | float altitude 37 | float pressure 38 | float temperature 39 | 40 | cdef extern from "matrix_hal/pressure_sensor.h" namespace "matrix_hal": 41 | cdef cppclass PressureSensor(MatrixDriver): 42 | PressureSensor() except + 43 | bool Read(PressureData* data) 44 | 45 | cdef extern from "matrix_hal/humidity_data.h" namespace "matrix_hal": 46 | cdef cppclass HumidityData: 47 | float humidity 48 | float temperature 49 | 50 | cdef extern from "matrix_hal/humidity_sensor.h" namespace "matrix_hal": 51 | cdef cppclass HumiditySensor(MatrixDriver): 52 | HumiditySensor() except + 53 | bool Read(HumidityData* data) 54 | 55 | cdef extern from "matrix_hal/uv_data.h" namespace "matrix_hal": 56 | cdef cppclass UVData: 57 | float uv 58 | 59 | cdef extern from "matrix_hal/uv_sensor.h" namespace "matrix_hal": 60 | cdef cppclass UVSensor(MatrixDriver): 61 | UVSensor() except + 62 | bool Read(UVData* data) 63 | 64 | cdef extern from "matrix_hal/imu_data.h" namespace "matrix_hal": 65 | cdef cppclass IMUData: 66 | float yaw 67 | float pitch 68 | float roll 69 | float accel_x 70 | float accel_y 71 | float accel_z 72 | float gyro_x 73 | float gyro_y 74 | float gyro_z 75 | float mag_x 76 | float mag_y 77 | float mag_z 78 | 79 | cdef extern from "matrix_hal/imu_sensor.h" namespace "matrix_hal": 80 | cdef cppclass IMUSensor(MatrixDriver): 81 | IMUSensor() except + 82 | bool Read(IMUData* data) 83 | 84 | cdef extern from "matrix_hal/everloop_image.h" namespace "matrix_hal": 85 | const int kMatrixCreatorNLeds 86 | cdef cppclass LedValue: 87 | LedValue() except + 88 | uint32_t red 89 | uint32_t green 90 | uint32_t blue 91 | uint32_t white 92 | 93 | cdef cppclass EverloopImage: 94 | EverloopImage(int) except + 95 | vector[LedValue] leds 96 | 97 | cdef extern from "matrix_hal/everloop.h" namespace "matrix_hal": 98 | cdef cppclass Everloop(MatrixDriver): 99 | Everloop() except + 100 | bool Write(const EverloopImage* led_image) 101 | 102 | cdef extern from "matrix_hal/gpio_control.h" namespace "matrix_hal": 103 | cdef cppclass GPIOBank(MatrixDriver): 104 | GPIOBank() except + 105 | bool SetPeriod(uint16_t period) 106 | bool SetDuty(uint16_t channel, uint16_t duty) 107 | 108 | cdef cppclass GPIOControl: 109 | GPIOControl() except + 110 | void Setup(MatrixIOBus* bus) 111 | bool SetMode(uint16_t pin, uint16_t mode) 112 | bool SetFunction(uint16_t pin, uint16_t function) 113 | bool SetGPIOValue(uint16_t pin, uint16_t value) 114 | bool SetPrescaler(uint16_t bank, uint16_t prescaler) 115 | uint16_t GetGPIOValue(uint16_t pin) 116 | GPIOBank& Bank(uint16_t bank) 117 | 118 | 119 | # 120 | # Python Wrappers 121 | # 122 | 123 | cdef class PyReadData: 124 | cdef unsigned char* data 125 | cdef size_t size 126 | 127 | def __cinit__(self, size_t number): 128 | self.data = PyMem_Malloc(number * sizeof(unsigned char)) 129 | self.size = number 130 | def __dealloc__(self): 131 | PyMem_Free(self.data) 132 | 133 | def get(self): 134 | return [self.data[i] for i in range(0, self.size)] 135 | 136 | cdef class PyMatrixIOBus: 137 | cdef MatrixIOBus* thisptr 138 | def __cinit__(self): 139 | self.thisptr = new MatrixIOBus() 140 | def __dealloc__(self): 141 | del self.thisptr 142 | 143 | def Init(self): 144 | return self.thisptr.Init() 145 | 146 | def Read(self, add, PyReadData data): 147 | return self.thisptr.Read(add, data.data, data.size) 148 | 149 | def FPGAClock(self): 150 | return self.thisptr.FPGAClock() 151 | 152 | def MatrixName(self): 153 | return self.thisptr.MatrixName() 154 | 155 | def MatrixVersion(self): 156 | return self.thisptr.MatrixVersion() 157 | 158 | def MatrixLeds(self): 159 | return self.thisptr.MatrixLeds() 160 | 161 | cdef class PyMatrixDriver: 162 | cdef MatrixDriver *driverptr 163 | def __cinit__(self): 164 | if type(self) is PyMatrixDriver: 165 | self.driverptr = new MatrixDriver() 166 | def __dealloc__(self): 167 | if type(self) is PyMatrixDriver: 168 | del self.driverptr 169 | 170 | def Setup(self, PyMatrixIOBus bus): 171 | self.driverptr.Setup(bus.thisptr) 172 | 173 | 174 | cdef class PyMCUData: 175 | cdef MCUData* thisptr 176 | def __cinit__(self): 177 | self.thisptr = new MCUData() 178 | def __dealloc__(self): 179 | del self.thisptr 180 | 181 | @property 182 | def ID(self): 183 | return self.thisptr.ID 184 | 185 | @property 186 | def version(self): 187 | return self.thisptr.version 188 | 189 | cdef class PyMCUFirmware(PyMatrixDriver): 190 | cdef MCUFirmware* thisptr 191 | def __cinit__(self): 192 | self.driverptr = self.thisptr = new MCUFirmware() 193 | def __dealloc__(self): 194 | del self.thisptr 195 | 196 | def Read(self, PyMCUData data): 197 | return self.thisptr.Read(data.thisptr) 198 | 199 | cdef class PyPressureData: 200 | cdef PressureData* thisptr 201 | def __cinit__(self): 202 | self.thisptr = new PressureData() 203 | def __dealloc__(self): 204 | del self.thisptr 205 | 206 | @property 207 | def altitude(self): 208 | return self.thisptr.altitude 209 | 210 | @property 211 | def pressure(self): 212 | return self.thisptr.pressure 213 | 214 | @property 215 | def temperature(self): 216 | return self.thisptr.temperature 217 | 218 | cdef class PyPressureSensor(PyMatrixDriver): 219 | cdef PressureSensor* thisptr 220 | def __cinit__(self): 221 | self.driverptr = self.thisptr = new PressureSensor() 222 | def __dealloc__(self): 223 | del self.thisptr 224 | 225 | def Read(self, PyPressureData data): 226 | return self.thisptr.Read(data.thisptr) 227 | 228 | cdef class PyHumidityData: 229 | cdef HumidityData* thisptr 230 | def __cinit__(self): 231 | self.thisptr = new HumidityData() 232 | def __dealloc__(self): 233 | del self.thisptr 234 | 235 | @property 236 | def humidity(self): 237 | return self.thisptr.humidity 238 | 239 | @property 240 | def temperature(self): 241 | return self.thisptr.temperature 242 | 243 | cdef class PyHumiditySensor(PyMatrixDriver): 244 | cdef HumiditySensor* thisptr 245 | def __cinit__(self): 246 | self.driverptr = self.thisptr = new HumiditySensor() 247 | def __dealloc__(self): 248 | del self.thisptr 249 | 250 | def Read(self, PyHumidityData data): 251 | return self.thisptr.Read(data.thisptr) 252 | 253 | cdef class PyUVData: 254 | cdef UVData* thisptr 255 | def __cinit__(self): 256 | self.thisptr = new UVData() 257 | def __dealloc__(self): 258 | del self.thisptr 259 | 260 | @property 261 | def uv(self): 262 | return self.thisptr.uv 263 | 264 | cdef class PyUVSensor(PyMatrixDriver): 265 | cdef UVSensor* thisptr 266 | def __cinit__(self): 267 | self.driverptr = self.thisptr = new UVSensor() 268 | def __dealloc__(self): 269 | del self.thisptr 270 | 271 | def Read(self, PyUVData data): 272 | return self.thisptr.Read(data.thisptr) 273 | 274 | cdef class PyIMUData: 275 | cdef IMUData* thisptr 276 | def __cinit__(self): 277 | self.thisptr = new IMUData() 278 | def __dealloc__(self): 279 | del self.thisptr 280 | 281 | @property 282 | def yaw(self): 283 | return self.thisptr.yaw 284 | 285 | @property 286 | def pitch(self): 287 | return self.thisptr.pitch 288 | 289 | @property 290 | def roll(self): 291 | return self.thisptr.roll 292 | 293 | @property 294 | def accel_x(self): 295 | return self.thisptr.accel_x 296 | 297 | @property 298 | def accel_y(self): 299 | return self.thisptr.accel_y 300 | 301 | @property 302 | def accel_z(self): 303 | return self.thisptr.accel_z 304 | 305 | @property 306 | def gyro_x(self): 307 | return self.thisptr.gyro_x 308 | 309 | @property 310 | def gyro_y(self): 311 | return self.thisptr.gyro_y 312 | 313 | @property 314 | def gyro_z(self): 315 | return self.thisptr.gyro_z 316 | 317 | @property 318 | def mag_x(self): 319 | return self.thisptr.mag_x 320 | 321 | @property 322 | def mag_y(self): 323 | return self.thisptr.mag_y 324 | 325 | @property 326 | def mag_z(self): 327 | return self.thisptr.mag_z 328 | 329 | cdef class PyIMUSensor(PyMatrixDriver): 330 | cdef IMUSensor* thisptr 331 | def __cinit__(self): 332 | self.driverptr = self.thisptr = new IMUSensor() 333 | def __dealloc__(self): 334 | del self.thisptr 335 | 336 | def Read(self, PyIMUData data): 337 | return self.thisptr.Read(data.thisptr) 338 | 339 | cdef class PyLedValue: 340 | cdef LedValue* thisptr 341 | 342 | @property 343 | def red(self): 344 | return self.thisptr.red 345 | 346 | @red.setter 347 | def red(self, value): 348 | self.thisptr.red = value 349 | 350 | @property 351 | def green(self): 352 | return self.thisptr.green 353 | 354 | @green.setter 355 | def green(self, value): 356 | self.thisptr.green = value 357 | 358 | @property 359 | def blue(self): 360 | return self.thisptr.blue 361 | 362 | @blue.setter 363 | def blue(self, value): 364 | self.thisptr.blue = value 365 | 366 | @property 367 | def white(self): 368 | return self.thisptr.white 369 | 370 | @white.setter 371 | def white(self, value): 372 | self.thisptr.white = value 373 | 374 | cdef class PyLeds: 375 | cdef vector[LedValue]* thisptr 376 | cdef vector[LedValue].iterator it 377 | 378 | def __len__(self): 379 | return self.thisptr.size() 380 | 381 | def __getitem__(self, index): 382 | led = PyLedValue() 383 | led.thisptr = &self.thisptr.at(index) 384 | return led 385 | 386 | def __iter__(self): 387 | self.it = self.thisptr.begin() 388 | return self 389 | 390 | def __next__(self): 391 | if self.it == self.thisptr.end(): 392 | raise StopIteration() 393 | led = PyLedValue() 394 | led.thisptr = &deref(self.it) 395 | incr(self.it) 396 | return led 397 | 398 | def next(self): 399 | return self.__next__() 400 | 401 | cdef class PyEverloopImage: 402 | cdef EverloopImage* thisptr 403 | def __cinit__(self, size=kMatrixCreatorNLeds): 404 | self.thisptr = new EverloopImage(size) 405 | def __dealloc__(self): 406 | del self.thisptr 407 | 408 | @property 409 | def leds(self): 410 | leds = PyLeds() 411 | leds.thisptr = &self.thisptr.leds 412 | return leds 413 | 414 | cdef class PyEverloop(PyMatrixDriver): 415 | cdef Everloop* thisptr 416 | def __cinit__(self): 417 | self.driverptr = self.thisptr = new Everloop() 418 | def __dealloc__(self): 419 | del self.thisptr 420 | 421 | def Write(self, PyEverloopImage led_image): 422 | return self.thisptr.Write(led_image.thisptr) 423 | 424 | cdef class PyGPIOControl: 425 | cdef GPIOControl* thisptr 426 | def __cinit__(self): 427 | self.thisptr = new GPIOControl() 428 | def __dealloc__(self): 429 | del self.thisptr 430 | 431 | def Setup(self, PyMatrixIOBus bus): 432 | self.thisptr.Setup(bus.thisptr) 433 | 434 | def SetMode(self, pin, mode): 435 | return self.thisptr.SetMode(pin, mode) 436 | 437 | def SetFunction(self, pin, function): 438 | return self.thisptr.SetFunction(pin, function) 439 | 440 | def SetGPIOValue(self, pin, value): 441 | return self.thisptr.SetGPIOValue(pin, value) 442 | 443 | def GetGPIOValue(self, pin): 444 | return self.thisptr.GetGPIOValue(pin) 445 | 446 | def SetPrescaler(self, bank, prescaler): 447 | return self.thisptr.SetPrescaler(bank, prescaler) 448 | 449 | def SetPeriod(self, bank, period): 450 | return self.thisptr.Bank(bank).SetPeriod(period) 451 | 452 | def SetDuty(self, bank, pin, duty): 453 | return self.thisptr.Bank(bank).SetDuty(pin, duty) 454 | 455 | -------------------------------------------------------------------------------- /matrixio_hal/sensors.py: -------------------------------------------------------------------------------- 1 | from . import matrixio_cpp_hal 2 | from . import bus 3 | import abc 4 | 5 | class BaseSensor(object): 6 | __metaclass__ = abc.ABCMeta 7 | 8 | def __init__(self, sensor_cls, data_cls): 9 | self._data = data_cls() 10 | self._sensor = sensor_cls() 11 | self._sensor.Setup(bus.bus) 12 | 13 | def _update_sensor(self): 14 | self._sensor.Read(self._data) 15 | 16 | @abc.abstractmethod 17 | def update(self): 18 | pass 19 | 20 | class IMU(BaseSensor): 21 | def __init__(self): 22 | self.yaw = 0.0 23 | self.pitch = 0.0 24 | self.roll = 0.0 25 | self.accel_x = 0.0 26 | self.accel_y = 0.0 27 | self.accel_z = 0.0 28 | self.gyro_x = 0.0 29 | self.gyro_y = 0.0 30 | self.gyro_z = 0.0 31 | self.mag_x = 0.0 32 | self.mag_y = 0.0 33 | self.mag_z = 0.0 34 | super(IMU, self).__init__(matrixio_cpp_hal.PyIMUSensor, matrixio_cpp_hal.PyIMUData) 35 | self.update() 36 | 37 | def update(self): 38 | super(IMU, self)._update_sensor() 39 | self.yaw = self._data.yaw 40 | self.pitch = self._data.pitch 41 | self.roll = self._data.roll 42 | self.accel_x = self._data.accel_x 43 | self.accel_y = self._data.accel_y 44 | self.accel_z = self._data.accel_z 45 | self.gyro_x = self._data.gyro_x 46 | self.gyro_y = self._data.gyro_y 47 | self.gyro_z = self._data.gyro_z 48 | self.mag_x = self._data.mag_x 49 | self.mag_y = self._data.mag_y 50 | self.mag_z = self._data.mag_z 51 | 52 | class Pressure(BaseSensor): 53 | def __init__(self): 54 | self.altitude = 0.0 55 | self.pressure = 0.0 56 | self.temperature = 0.0 57 | super(Pressure, self).__init__(matrixio_cpp_hal.PyPressureSensor, matrixio_cpp_hal.PyPressureData) 58 | self.update() 59 | 60 | def update(self): 61 | super(Pressure, self)._update_sensor() 62 | self.altitude = self._data.altitude 63 | self.pressure = self._data.pressure 64 | self.temperature = self._data.temperature 65 | 66 | 67 | class UV(BaseSensor): 68 | def __init__(self): 69 | self.uv = 0.0 70 | super(UV, self).__init__(matrixio_cpp_hal.PyUVSensor, matrixio_cpp_hal.PyUVData) 71 | self.update() 72 | 73 | def update(self): 74 | super(UV, self)._update_sensor() 75 | self.uv = self._data.uv 76 | 77 | class Humidity(BaseSensor): 78 | def __init__(self): 79 | self.humidity = 0.0 80 | self.temperature = 0.0 81 | super(Humidity, self).__init__(matrixio_cpp_hal.PyHumiditySensor, matrixio_cpp_hal.PyHumidityData) 82 | self.update() 83 | 84 | def update(self): 85 | super(Humidity, self)._update_sensor() 86 | self.humidity = self._data.humidity 87 | self.temperature = self._data.temperature 88 | 89 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | description-file = README.md 3 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, Extension 2 | 3 | ext = [Extension('matrixio_hal.matrixio_cpp_hal', 4 | ['matrixio_hal/matrixio_cpp_hal.pyx'], 5 | libraries=['matrix_creator_hal'], 6 | extra_compile_args=['-std=c++11'], 7 | language='c++') 8 | ] 9 | 10 | setup( 11 | name='python-matrixio-hal', 12 | version='1.1.0', 13 | description='Python HAL for the Matrix Creator / Voice wrapping the C++ drivers', 14 | author='cmetz', 15 | author_email='christoph.metz@gulp.de', 16 | url='https://github.com/cmetz/python-matrixio-hal', 17 | license='MIT', 18 | packages=['matrixio_hal'], 19 | setup_requires=[ 20 | 'setuptools>=18.0', 21 | 'cython' 22 | ], 23 | ext_modules=ext, 24 | zip_safe=False 25 | ) 26 | --------------------------------------------------------------------------------