ev3dev-clib-min
(Somewhat) minimalist C/C++ EV3 API
Project structure
src/
- contains API .c and .h filesmotor(.c, .h)
- motor control modulesensor(.c, .h)
- sensor control moduleshared(.c, .h)
- shared macros and functionsconfig.h
- configures path prefixes
testenv/
- testing environmentbuild/
- compiled testing programstest_gnu_arm
- compiled for ARM architecturetest_gnu_x86_63
- compiled for x86_64 architecture
sys/class/lego-sensor/sensor0/
- lego sensor emulatorsys/class/tacho-motor/motor0/
- lego motor emulatormain.c
- main testing programMakefile
- instructions for GNU-ARM and GNU-x86_64 compilation
Using testenv
Testenv allows for debugging and testing of API functionality on x86_64 machines without the need for an ARM processor or arm-linux-gnueabi toolchain.
config.h
Configuring When using ev3dev-clib-min on a lego robot, path prefixes in config.h
should be absolute, as the /sys/
directory is located in /
#define SENSOR_PREFIX "/sys/class/lego-sensor/"
#define MOTOR_PREFIX "/sys/class/tacho-motor/"
When using ev3dev-clib-min in testenv, however, path prefixes must be relative to the current directory, ./
(if the program is ran in testenv/
director, that is)
#define SENSOR_PREFIX "./sys/class/lego-sensor/"
#define MOTOR_PREFIX "./sys/class/tacho-motor/"
Building and executing
(Assuming the testing code is situated in main.c
) To build a testing program, execute
make GNU-x86_64
The resulting executable binary can then be found in build/
and will be named test_gnu_x86_64
and can be executed using
./build/test_gnu_x86_64