GithubHelp home page GithubHelp logo

tatranskidravci / libev3min Goto Github PK

View Code? Open in Web Editor NEW
2.0 0.0 1.0 155 KB

(Somewhat) minimalist C/C++ EV3 API

License: The Unlicense

Makefile 6.03% C 93.97%
c ev3dev ev3dev-lang-c ev3 ev3-dev ev3-robot ev3dev-cpp

libev3min's Introduction

libev3min

(Somewhat) minimalist C/C++ EV3 API

Project structure

  • src/ - contains API source code files

    • motor.c - motor control module
    • sensor.c - sensor control module
    • shared.c - shared macros and functions
  • include/ - contains API headers

    • motor.h - motor.c header
    • sensor.h - sensor.c header
    • shared.h - shared.c header
  • config.h - configures path prefixes

  • Makefile - instructions for shared library compilation, use cc=gcc if compiling for x86_64

  • testenv/ - testing environment

    • build/ - compiled testing programs
      • test_gnu_arm - compiled for ARM architecture
      • test_gnu_x86_63 - compiled for x86_64 architecture
    • sys/class/lego-sensor/sensor0/ - lego sensor emulator
    • sys/class/tacho-motor/motor0/ - lego motor emulator
    • main.c - main testing program
    • Makefile - 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.

Configuring config.h

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 PATH_LEN 23
#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 PATH_LEN 24
#define SENSOR_PREFIX "./sys/class/lego-sensor/"
#define MOTOR_PREFIX  "./sys/class/tacho-motor/"

Notice the change in PATH_LEN. PATH_LEN describes the string lenght of both SENSOR_PREFIX and MOTOR_PREFIX. Currently there is no reason for two separate PATH_LENs as in ev3dev and in testenv, both have the same length.

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

libev3min's People

Contributors

lukasdrsman avatar

Stargazers

 avatar

Forkers

lukasdrsman

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.