@larry-biscuits I'd be happy to look over the code. The major difference between C++ and Python is arbitrary integer length. Your suddenly negative number could arrise from you having an integer overflow, e.g. when storing something an in int8_t.
Do you have an example of a register value which yields two different values when decoded with the C++ and the Python problem? That way the problem can be found very quickly.
The jist of it is that you'll need to use the Build System to do your cross compiling. If you need a separate library for your program, it will first have to be built by the build system before you can include it in your program.
@Maximilian-Gerhardt wow! Thank you very much for your response, at least I don't have the feeling like I'm shouting into an empty cave!
I'm surprised at how beta the i2c library is for something that's been out for ~years. I feel like the first feature for boards like this (after GPIO control on its own pins) should be a matured and robust i2c library. Since, almost anything you want to do with them will require i2c communication...
Again, thank you for the heads up with known issues. I'll try to keep stumbling through this and if I succeed I'll make it available.
@OSO-Bear Judging by the output of the program and your makefile, it looks like your program was compiled for x86 (your computer). You'll have to use an xCompile.sh script like the example to cross compile your C program.
PS it's three backticks to open a code block, and three to close it. See this link for more markdown syntax.
@Unbioctian take a look at /usr/lib where the library shared objects are kept and /usr/include where the header files are kept. You'd notice some library objects do not have corresponded header files. The i2c C library is available for you and is called libonioni2c. The source code can be found in our GitHub repo. For more info on compiling C/C++ on the Omega please refer to our official documentation and i2c C Library
There are a few missing steps in the Onion How To
Once you have used git, open a terminal window in the source folder.
You then need to download the packages as configured in the feeds.conf folder. This is done by
/scripts/feeds update -a
You can then install all the packages
/scripts/feeds update -a
When you execute make menuconfig, you will now find the libugpio option in Library, select it to be included in the build
@Alessandro-Floris the link you're following is for the Omega 1, which is based on OpenWRT. The Omega 2 makes use of LEDE, which is a branch/fork of OpenWRT. Ergo, you need to use the LEDE toolchain. Searching this forum should reveal some light on the matter.
@Luciano-S @WereCatf told here that the devs of the Omega2 forgot to enable CONFIG_DEVMEM in the newer firmware. The last working one is 0.1.6 b137
So my guess is that it is fixed in the next release if it is indeed just a forgotten flag.
@Costas-Costas the approach chosen by Kit and now Travis won't work on standard firmware until the /dev/mem issue is fixed.
Yes, one of the many reasons that I am holding off upgrading the code to Omega2
The other main constraint (other than time availability) is that the endianess differs on the Omega1 and Omega2 and I need to check out the places where this is significant in the code (I know of at least one place)