Any luck figuring this out?
Posts made by OSO Bear
RE: SparkFun SX1509 - byte data type on Omega2
@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.
SparkFun SX1509 - byte data type on Omega2
Since I already have a couple SX1509 GPIO expanders, I decided to make use of them with my Omega2 and wanted to port the Ardunio library over to work with the Omega to supporting all the board's features. (https://github.com/sparkfun/SX1509_IO-Expander)
I started on basically rerouting the read/write commands to the Omega's i2c_read/write functions but came across an issue I hadn't thought about. The Ardunio platform uses 'byte' (uint8_t) types which the omega doesnt. (unless I'm missing something?) I could try to find a way to continuously convert types back and forth, or, I was thinking just switching the code to replace 'byte' with 'int'
My question: if I switched everything to 'int' (like the onion_i2c libraries use), will I get unexpected behavior out of the code? Aside from memory size, does an int behave differently than the Ardunio's byte? Why does Arduino use bytes?
Omega2+ cross-compile C++ and customer headers/lib
I'm new to this so please bear with me! (sorry I dont know how to insert code, help?)
I want to use the Omega2+ to compile C++ code and will be wanting to use (fast) GPIO read and write on the chip, i2c devices to control GPIO expanders (e.g.: MCP23017-E/SP) and an OLED. However I'm stuck at the 'Start' square.
I've followed the instruction set in the docs.onion.../cross-compiling and was able to get the (C) gpio example working - but will note, it was not mentioned you need to manually find, download and copy the header files into the appropriate directory.
Then, I tried the simplest possible 'hello world' C++ program. Ultimately, i was able to compile with the makefile below. Note: adding gpp vs. gcc, removing -l$(LIB) since I have no libraries. Copied the compiled file over to the Omega, chmod, ./helloworld,... and got something similar to:
/asd: line 1: syntax error: unexpected "(" (expecting ")")
So,.. is the Omega trying to interpret my compiled c++ code? why did this not work? Do I need to change some settings to have a different compiler run it (gpp vs gcc)? I've been bashing my head on this for so long I'm starting to get worried I'm over looking the obvious. Any help would be MUCH appreciated!!! Besides, I think having something well documented for how to run c++ would be very beneficial to the community
- I will need to compile C++ code with customer headers for peripherals (e.g. sparkfun...)
- I am running Linux Mint
- Using Omega2+ v0.1.10
- I've gone through cross-compile set up tutorial and can successfully run the example gpio C program.
. # main compiler
CXX := gpp #gpp for C++ or gcc for 'C'
CC := gcc #gpp for C++ or gcc for 'C'
.# Input (and) Output File name ("exe")
TARGET1 := Omega2_Test_GPIO
.# What does this do?
@echo "Compiling C program"
$(CXX) $(CFLAGS) $(TARGET1).cpp -o $(TARGET1) $(LDFLAGS)
#$(CC) $(CFLAGS) $(TARGET1).cpp -o $(TARGET1) $(LDFLAGS) #-l$(LIB)
@rm -rf $(TARGET1) $(TARGET2)