2013年12月1日 星期日

raspberry pi projects case study

1.  airplay remote audio player
http://gsyan888.blogspot.tw/2013/04/raspberry-pi-shairport-airplay-receiver.html

1.1 implement
http://www.instructables.com/id/raspbAIRy-the-RaspberryPi-based-Airplay-speaker/step3/Installation/

2 wifi adaptor
http://learn.adafruit.com/adafruits-raspberry-pi-lesson-3-network-setup/overview

3. game player
http://pimame.org/

4. media center by xbmc + navi = free movie + airplay media
http://www.instructables.com/id/How-to-Make-a-Raspberry-Pi-Media-Panel-fka-Digita/step2/Order-an-LCD-Controller-Board/
http://www.instructables.com/id/XBMC-Media-Center-with-Raspberry-Pi/
https://www.youtube.com/watch?v=rjcu3eYvlMY

5. microcontroller i2c python
http://www.instructables.com/id/Raspberry-Pi-I2C-Python/
http://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c

6. microcontroller gpio
http://www.instructables.com/id/Web-Control-of-Raspberry-Pi-GPIO/

7. small web server
http://www.instructables.com/id/Raspberry-Pi-Web-Server/step5/SSH-Login/

8.Running Minecraft on a Raspberry Pi
http://learn.adafruit.com/running-minecraft-on-a-raspberry-pi

9. IDE debug
http://learn.adafruit.com/webide/installation

10 ATX power controller
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=40&t=59919

2013年11月18日 星期一

python microcontroller case study

arm raspberrypi
http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf

pymcu
http://www.pymcu.com/index.html

python microcontroller
http://www.kickstarter.com/projects/214379695/micro-python-python-for-microcontrollers

real time warning message broadcast system
bluetooth microphone
android usb


brain wave monitor

brain wave product 

bike LED 風火輪

風阻訓練台

arduino (openhardware)

openhardware

beagleboard source code


benchmark arm vs x86

power profile

bike fit

bike fit calculate

2013年10月14日 星期一

llvmpy = JIT python via llvm keynotes

  • llvmpy
    • a jit python interpreter via llvm
    • a  wrapper interface between llvm c/c++ function calls and python interface
  • flow
    • wrapper c/c++ code to shared lib, such as pass, target, VM...
    • explore the shared lib to python import path
    • import it
  • example
  • original c/c++ code
    #include "dpi.h"
    
    /* c_add */
    int
    c_add(int a, int b) {
      return a+b;
    }
    
    wrapper it via c/c++ python extend
    #include <Python/Python.h>
    #include <numpy/arrayobject.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include "dpi.h"
    
    /* wrapper add, ref count definition */
    static PyObject *
    dpi_add_wrapper(PyObject *self, PyObject *args)
    {
      int a, b, c;
    
      // parse arguments
      if (!PyArg_ParseTuple(args, "ii", &a, &b)) {
        return NULL;
      }
    
      // run the actual function
      c = c_add(a, b);
    
      // build the result to a Python object.
      return Py_BuildValue("i", c);
    }
    
    /* register methods */
    static PyMethodDef DPIMethods[] =
    {
          {"dpi_add", dpi_add_wrapper, METH_VARARGS, "Calculate the sum of two integers."},
          {NULL, NULL, 0, NULL}
    };
    
    
    register to python search path
    from distutils.core import setup, Extension
    
    
    # ref : http://docs.python.org/2/extending/building.html
    # the c++ extension module
    extension_mod = Extension("dpi", ["moduledpi.c", "dpi.c"], include_dirs=['/var/root/anaconda/lib/python2.7/site-packages/numpy/core/include'],
    library_dirs=['/var/root/anaconda/lib/python2.7/site-packages/numpy/core/lib', '/var/root/anaconda/lib/python2.7/site-packages/numpy/lib'])
    
    setup(name = "dpi", ext_modules=[extension_mod])
    
    run it
    >>> python
    >>> import dpi
    >>> dpi.dpi_add(1,2)