Skip to content

Commit 6baf00c

Browse files
Andy FundingerAndy Fundinger
authored andcommitted
basic cython build, next need to try running on a pcduino where the actual library is present, not just the .h file.
1 parent 6499153 commit 6baf00c

5 files changed

Lines changed: 35 additions & 0 deletions

File tree

‎arduino/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__author__ = 'andriod'

‎arduino/arduino.pyx‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
cimport arduino.carduino
2+
3+
# Import some functionality from Python and the C stdlib
4+
from cpython.pycapsule cimport *
5+
6+
7+
def pinMode(unsigned short int pin, unsigned short int mode):
8+
carduino.pinMode(pin, mode)

‎arduino/carduino.pxd‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cdef extern from "Arduino.h":
2+
void pinMode(uint8_t, uint8_t)

‎build.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CFLAGS="-I../arduino/hardware/arduino/cores/arduino -I../arduino/hardware/arduino/variants/sunxi" python setup.py build_ext -i

‎setup.py‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from distutils.core import setup
2+
from Cython.Build import cythonize
3+
from distutils.extension import Extension
4+
from Cython.Distutils import build_ext
5+
6+
setup(
7+
name='pcDuino',
8+
version='',
9+
packages=['python-pcduino.Samples.blink_led.gpio', 'python-pcduino.arduino'],
10+
url='',
11+
license='',
12+
author='andriod',
13+
author_email='',
14+
description='',
15+
cmdclass = {'build_ext': build_ext},
16+
ext_modules=[Extension(
17+
'arduino',
18+
["arduino/arduino.pyx"],
19+
libraries=['Arduino'],
20+
## Not clear when this is used, seem to be specified on the command line only
21+
# library_dirs=["../arduino/hardware/arduino/cores/arduino",
22+
# "../python-pcduino/arduino"]
23+
)])

0 commit comments

Comments
 (0)