Difference between revisions of "AsDevices"

From ArmadeusWiki
Jump to: navigation, search
(In Python)
(Development planning)
Line 81: Line 81:
 
{| border="1" cellpadding="5" cellspacing="0" summary="put summary here"
 
{| border="1" cellpadding="5" cellspacing="0" summary="put summary here"
 
|- style="background:#efefef;" align="center"
 
|- style="background:#efefef;" align="center"
! Name !!  C functions !! C++ wrapper !! Python wrapper !! Python class !!
+
! Name !!  C functions !! C++ wrapper !! Python wrapper !! Python class !! LUA wrapper !!description  
description  
+
 
|- align="center"
 
|- align="center"
| apf27_pwm || bgcolor=#60FF00 |  TESTED  ||  bgcolor=#60FF00 |  TESTED  || bgcolor=#60FF00 |  TESTED  ||  bgcolor=#60FF00 |  TESTED || Drive imx27 pwm
+
| apf27_pwm || bgcolor=#60FF00 |  TESTED  ||  bgcolor=#60FF00 |  TESTED  || bgcolor=#60FF00 |  TESTED  ||  bgcolor=#60FF00 |  TESTED ||bgcolor=#FF0000| NOK|| Drive imx27 pwm
 
|- align="center"
 
|- align="center"
| i2c || bgcolor="yellow"| Compile || bgcolor="yellow"| Compile ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || Drive I2C
+
| i2c || bgcolor="yellow"| Compile || bgcolor="yellow"| Compile ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || Drive I2C
 
|- align="center"
 
|- align="center"
| apf27_gpio || bgcolor="yellow"| Compile || bgcolor="yellow"| Compile ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || Drive imx27 GPIO
+
| apf27_gpio || bgcolor="yellow"| Compile || bgcolor="yellow"| Compile ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || Drive imx27 GPIO
 
|- align="center"
 
|- align="center"
| ad5258 || bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK  || Drive Digital potentiometer [http://www.analog.com/en/digital-to-analog-converters/digital-potentiometers/AD5258/products/product.html AD5258]
+
| ad5258 || bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK||bgcolor=#FF0000| NOK  || Drive Digital potentiometer [http://www.analog.com/en/digital-to-analog-converters/digital-potentiometers/AD5258/products/product.html AD5258]
 
|- align="center"
 
|- align="center"
| ds1374 || bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || Drive RTC chip [http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3806 DS1374]
+
| ds1374 || bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || Drive RTC chip [http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3806 DS1374]
 
|- align="center"
 
|- align="center"
| max1027 || bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || Drive Analog to Digital chip [http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3872/t/al MAX1027]
+
| max1027 || bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || Drive Analog to Digital chip [http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3872/t/al MAX1027]
 
|- align="center"
 
|- align="center"
| max5821 || bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || Drive Digital to Analog chip [http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3288/t/al MAX5821]
+
| max5821 || bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || Drive Digital to Analog chip [http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3288/t/al MAX5821]
 
|}
 
|}

Revision as of 12:00, 5 November 2009

Page under construction... Construction.png Informations on this page are not guaranteed !!

AsDevices is an ARMadeus specific library that simplify APF-board devices usages for developer. This library is written to be used with C, C++ and Python languages.

Install AsDevices on target

The library is included in Buildroot menu, to use it just select it in «make menuconfig» :

Package Selection for the target  --->
    *** Armadeus specific packages ***   
    [*] as_devices 
    [*]   wrapper C++
    [*]   wrapper Python

The base library is in C, to use it with C++ or Python, select the wrapper you want.

Use library in an application

In C

To use AsDevices library in a C program, include the header of the device needed (all C headers are under ${ARMADEUS_PATH}/target/package/as_devices/c/ directory ). For example with apf27_pwm :

#include "as_apf27_pwm.h"

And compile with following command :

arm-linux-gcc prog.c ${ARMADEUS_PATH}/buildroot/build_arm5vt/as_devices-1.0/c/libas_devices.so -o prog -I${ARMADEUS_PATH}/buildroot/build_arm5vt/as_devices-1.0/c/

An example of code can be found in ${ARMADEUS_PATH}/target/package/as_devices/ directory, take a look of test_c.h and main.c.

In C++

To use AsDevices library in a C++ program, include the header of the class needed (all C++ headers are under ${ARMADEUS_PATH}/target/package/as_devices/cpp/ directory). For example with apf27 pwm :

#include "as_apf27_pwm.hpp"

And compile with following command :

	${CXX} ${CFLAGS} prog.cpp ${C_LIB} ${CPP_LIB} -I${C_INCLUDE} -I${CPP_INCLUDE} -o prog

An example of code canbe found in ${ARMADEUS_PATH}/target/package/as_devices/ directory, take a look at test_cpp.h and main.c.

In Python

To use AsDevices library with python, select the Python wrapper in menuconfig then, on platform, import the module :

>>> import AsDevices

All python classes available in the module can be found with the dir() function :

>>> dir(AsDevices)
['Apf27Pwm', 'Apf27PwmError', 'NUMBER_OF_PWM', '__author__', '__builtins__', '__doc__', '__file__', '__name__', '__path__', '__versionTime__', '__version__', 'wrappers']

In LUA

TODO

Devices supported by library

PWM

Development planning

AsDevices is not finished, following table indicates the remaining work:

Name C functions C++ wrapper Python wrapper Python class LUA wrapper description
apf27_pwm TESTED TESTED TESTED TESTED NOK Drive imx27 pwm
i2c Compile Compile NOK NOK NOK Drive I2C
apf27_gpio Compile Compile NOK NOK NOK Drive imx27 GPIO
ad5258 NOK NOK NOK NOK NOK Drive Digital potentiometer AD5258
ds1374 NOK NOK NOK NOK NOK Drive RTC chip DS1374
max1027 NOK NOK NOK NOK NOK Drive Analog to Digital chip MAX1027
max5821 NOK NOK NOK NOK NOK Drive Digital to Analog chip MAX5821