C++ Instantiate class at a fixed memory location (i.e.: GPIO) using 5282

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

C++ Instantiate class at a fixed memory location (i.e.: GPIO) using 5282

1,736 Views
odnt
Contributor I
I have read a thread on creatiing variables at fixed addresses using C, though it presented multiple methods, some with corrections, etc. and was pretty hard to follow. I did not get it to work with C++. Is it not valid for C++, or did I probably not get all the pragmas and declspecs correct? I saw that different processors were used in examples, but expected the principles to be the same.

I am attempting to create an LED object for the M5282EVB. Thank you.


Labels (1)
0 Kudos
2 Replies

377 Views
mccPaul
Contributor I
If you just want to create a class that can be used to turn a LED on and off by toggling a GPIO line, there is no need to complicate matters by trying to instantiate the class at a specific location. All you need to do is to create a class that has member functions that will read/write the GPIO port that your LED is connected to.
 
Paul.
0 Kudos

377 Views
odnt
Contributor I
Thank you for your answer, and you are of course correct in this being an "overcomplicated" example. I was using this as a "hello world" type of learning experience - just to pick an arbitrary memory location to map to. The LEDs were picked only because they are visible.
0 Kudos