I am trying to setup the pwm outputs, i've used a constructor to assign the hardware as there's a few variations of pin assignments and a few generic input functions being used. here's the code:
in .h file
 
\#include "mbed.h"
class SC_Encoder : public Encoder
{
    private:
    ..
    ..
    /* output hardware */
    PwmOut* channel_s;
    PwmOut* channel_c;
    ..
 
    ..
     void reset();
};
in .cpp file
 
#include "mbed.h"
#define pwmperiod 0.000125
SC_Encoder::SC_Encoder()
{
    /*
        Set up the hardware for this encoder
    */  
    channel_s = new PwmOut(p24);
    channel_c = new PwmOut(p25);
    reset();
}
void SC_Encoder::reset()
{  
    /*
        Reset internal variables to default states
    */
    ..
    ..
    channel_s.period(pwmperiod);
     
}
The problem is that that the period function is returning an error on compile.
expression must have a class type(E153)
The PWM outputs can be set using the = operator when the period function is commented out and i can compile the code.
any ideas as to what I'm doing wrong?
Thanks,
  Chris 
                    
                 
                
             
        
I am trying to setup the pwm outputs, i've used a constructor to assign the hardware as there's a few variations of pin assignments and a few generic input functions being used. here's the code:
in .h file
\#include "mbed.h" class SC_Encoder : public Encoder { private: .. .. /* output hardware */ PwmOut* channel_s; PwmOut* channel_c; .. .. void reset(); };in .cpp file
#include "mbed.h" #define pwmperiod 0.000125 SC_Encoder::SC_Encoder() { /* Set up the hardware for this encoder */ channel_s = new PwmOut(p24); channel_c = new PwmOut(p25); reset(); } void SC_Encoder::reset() { /* Reset internal variables to default states */ .. .. channel_s.period(pwmperiod); }The problem is that that the period function is returning an error on compile.
expression must have a class type(E153)
The PWM outputs can be set using the = operator when the period function is commented out and i can compile the code.
any ideas as to what I'm doing wrong?
Thanks, Chris