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
- 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
- I extracted all the files in a directory of the host system (/home/gpavoni/rpi/EnOcean)
- I launched Eclipse and imported the three projects in the directory /home/gpavoni/rpi/EnOcean (namely EOLink, examples and tutorials)
- 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"
- C/C++ Build -> Toolchain Editor
- 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/)
- C/C++ Build -> Settings -> Tools Settings
- 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"
- Only for EOLink project, C/C++ Build -> Settings -> Build Artifact
- Build the EOLink library
- Copy libEOLink.a in /usr/lib
- In the "examples" project, open the Gateway_example.cpp file and change the #define SER_PORT to "/dev/ttyAMA0"
- In the "examples" project, open the sandbox.cpp file and uncomment the "gatewayExample()" line and comment the "ptmExample();" line
- Build the "examples" project
- 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)
- 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)
- 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
- Now launch ./examples from you home directory
- Press buttons on the EnOcean sensors and you should see telegrams coming through