- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have done a lot of programming with the cypress fx3 and everything was created with datatypes and objects that could be passed around. I can't seem to find pass objects around with the psoc5lp. for example
void set_divider(clock_t clock, uint32_t val) {
clock.set_divider(val);
}
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you #include the right libraries you may use types like uint32_t. I am not quite sure where it is defined, might be cytypes.h. looks like a bit of searchwork which reveiled inttypes.h
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My my question is not about integer datatypes but more so objects. I cant seem to pass things like a clock or pwm into functions. I just have functions for objects like pwm_1_start() or pwm_2_start(). the only way i can think of to make a function to start them via number would be be
function change_pwm(int which_pwm) {
if( which_pwm == 1)
pwm_1_start()
elseif( which_pwm == 2)
pwm_2_start()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We are here (still) in the world of C, not C++. The components are not objects in the sense C++ understands that.
So what comes near to what you want can be arranged with pointers to functions.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thru use of function pointers ?
http://stackoverflow.com/questions/840501/how-do-function-pointers-in-c-work
http://denniskubes.com/2013/03/22/basics-of-function-pointers-in-c/
Regards, Dana.