Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
When I heard about PSoC 4 and the board being compatible with Arduino shields, I was wondering how I can port al the C++ files of arduino library to be ported to PSoC Creator. Can I write any code in C++. Is it possible?
If at all if I were to compile C++ files in PSoC Creator, how do I change the physical layer of that library.
Hi, This article introduce the way to use c++ in PSoC, Might help for you. http://www.psocdeveloper.com/forums/viewtopic.php?f=43&t=8086 Anyway, Even in this way has some problems, because PSoC is using user module's code wrote by C. Someone want to use c++ who have to add wrapping software for the user modules. Do you do that?
Getting PSoC Creator to compile C++ is the first step, you will still have to do things like convert non-standard data types and port any code the accesses hardware peripherals, system features (the PSoC and ATmega are different).
If you want to go to C, then Google porting Arduino code to C, there are many resources on this, and it doesn't matter if they were not doing it to go to a PSoC, most of it will be same, thanks to the portability to C (and C++) code. However, if you do this, you will loose all the nice stuff you could do with the Arduino, like for example,
LiquidCrystal lcd(12, 13, ..)
You can of course create structures in C which emulate the classes in C++, but you will have to pass in the structure to the member functions, and associating functions with the structures (to emulate member functions in C++), will mean having to use function pointers and consequentially functions pointers to call them. In other words, not nice, and I reckon it's better to try the C++ way first, and then fall back to C if you have to.