cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

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);

   

}

0 Likes
Reply
4 Replies
Esteemed Contributor II

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

0 Likes
Reply
Anonymous
Not applicable

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()    

0 Likes
Reply
Esteemed Contributor II

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

0 Likes
Reply
Esteemed Contributor

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.

0 Likes
Reply