Next step in the ForgetMeNot project is to make the EnOcean PI board work.

As I said, my purpose is to write a C++ application, so I need the be able to cross-compile the source code to control the EnOcean Pi board and embed it into my application. Fortunately, EnOcean provides a valid library to use as a starting point

 

So, these are the steps for this round

  1. I downloaded the EnOcean link library from http://www.element14.com/community/servlet/JiveServlet/download/55295-6-118009/EnOcean+Link+%28Trial%29+V1.2.0.0.zip
  2. I extracted all the files in a directory of the host system (/home/gpavoni/rpi/EnOcean)
  3. I launched Eclipse and imported the three projects in the directory /home/gpavoni/rpi/EnOcean (namely EOLink, examples and tutorials)
  4. All the three projects does not compile out-of-the-zip. Some changes in the configurations were required. For each project, I had to open the Project Properties window and change the following settings (make the changes to all the build configuration you want to use - I'm going to use ReleaseLib)
    • C/C++ Build -> Toolchain Editor
      • Set "Cross GCC" in the "Current toolchain"

 

Settings1.png

 

    • C/C++ Build -> Settings -> Tools Settings
      • Set Prefix to arm-linux-gnueabihf-
      • Set Path to the full path of the toolchain (/home/gpavoni/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/)

 

Settings2.png

 

    • Only for EOLink project, C/C++ Build -> Settings -> Build Artifact
      • Set Artifact type to "Shared library"
      • Set Artifact extension to "a"
      • Set Output prefix to "lib"
  1. Build the EOLink library
  2. Copy libEOLink.a in /usr/lib
  3. In the "examples" project, open the Gateway_example.cpp file and change the #define SER_PORT to "/dev/ttyAMA0"

 

SourceCode1.png

 

  1. In the "examples" project, open the sandbox.cpp file and uncomment the "gatewayExample()" line and comment the "ptmExample();" line

 

SourceCode2.png

 

  1. Build the "examples" project
  2. Now you can copy the libEOLink.a file (located in /home/gpavoni/rpi/EnOcean/EOLink/ReleaseLib or /usr/lib) to usr/lib on the Raspberry board and grant execution permissions (sudo chmod +x libEOLink.a)
  3. Copy the examples executable (located in /home/gpavoni/rpi/EnOcean/examples/Release) in your home directory on the Raspberry board and grant execution permissions (sudo chmod +x examples)
  4. Next step is to free the serial port on the Raspberry board. Follow this exceptionally clear tutorial: Free Your Raspberry Pi Serial Port | Raspberry Pi Spy
  5. Now launch ./examples from you home directory
  6. Press buttons on the EnOcean sensors and you should see telegrams coming through

 

Telegrams.png