As both Majenko and I tried to explain in Pass a member function pointer to a method of a foreign class (EDB Lib) Pass a member function pointer to a method of a foreign class (EDB Lib) you can't pass a class member function where a static function is expected.
Your error is on:
PCintPort::attachInterrupt(latest_interrupted_pin, &rising, RISING);
Error:
/home/nick/sketchbook/libraries/PPMintIn/ppmintin.cpp: In member function ‘void PPMintIn::rising()’:
/home/nick/sketchbook/libraries/PPMintIn/ppmintin.cpp:22: error: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say ‘&PPMintIn::rising’
PCintPort::attachInterrupt expects a PCIntvoidFuncPtr
variable:
int8_t PCintPort::attachInterrupt(uint8_t arduinoPin, PCIntvoidFuncPtr userFunc, int mode)
That is:
typedef void (*PCIntvoidFuncPtr)(void);
That is a static function (not a class function).
However you have it as a class function:
class PPMintIn{
public:
PPMintIn(int pin);
void begin();
void getSignal();
int _pin;
volatile int pwm_value;
volatile int prev_time;
uint8_t latest_interrupted_pin;
private:
void rising();
void falling();
};
Now you can make rising
and falling
static but now they can't access any of the class variables (eg. pwm_value, prev_time, latest_interrupted_pin).
The whole thing needs a redesign. You could try making PPMintIn a namespace rather than a class.
Regarding one of the comments:
Unless your class implements operator()
this line doesn't make sense:
chan1(15);
Please copy and paste error messages into the post, don't make people go to Imgur to find a screenshot of some text.
As both Majenko and I tried to explain in Pass a member function pointer to a method of a foreign class (EDB Lib) you can't pass a class member function where a static function is expected.
Your error is on:
PCintPort::attachInterrupt(latest_interrupted_pin, &rising, RISING);
Error:
/home/nick/sketchbook/libraries/PPMintIn/ppmintin.cpp: In member function ‘void PPMintIn::rising()’:
/home/nick/sketchbook/libraries/PPMintIn/ppmintin.cpp:22: error: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say ‘&PPMintIn::rising’
PCintPort::attachInterrupt expects a PCIntvoidFuncPtr
variable:
int8_t PCintPort::attachInterrupt(uint8_t arduinoPin, PCIntvoidFuncPtr userFunc, int mode)
That is:
typedef void (*PCIntvoidFuncPtr)(void);
That is a static function (not a class function).
However you have it as a class function:
class PPMintIn{
public:
PPMintIn(int pin);
void begin();
void getSignal();
int _pin;
volatile int pwm_value;
volatile int prev_time;
uint8_t latest_interrupted_pin;
private:
void rising();
void falling();
};
Now you can make rising
and falling
static but now they can't access any of the class variables (eg. pwm_value, prev_time, latest_interrupted_pin).
The whole thing needs a redesign. You could try making PPMintIn a namespace rather than a class.
Regarding one of the comments:
Unless your class implements operator()
this line doesn't make sense:
chan1(15);
Please copy and paste error messages into the post, don't make people go to Imgur to find a screenshot of some text.
As both Majenko and I tried to explain in Pass a member function pointer to a method of a foreign class (EDB Lib) you can't pass a class member function where a static function is expected.
Your error is on:
PCintPort::attachInterrupt(latest_interrupted_pin, &rising, RISING);
Error:
/home/nick/sketchbook/libraries/PPMintIn/ppmintin.cpp: In member function ‘void PPMintIn::rising()’:
/home/nick/sketchbook/libraries/PPMintIn/ppmintin.cpp:22: error: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say ‘&PPMintIn::rising’
PCintPort::attachInterrupt expects a PCIntvoidFuncPtr
variable:
int8_t PCintPort::attachInterrupt(uint8_t arduinoPin, PCIntvoidFuncPtr userFunc, int mode)
That is:
typedef void (*PCIntvoidFuncPtr)(void);
That is a static function (not a class function).
However you have it as a class function:
class PPMintIn{
public:
PPMintIn(int pin);
void begin();
void getSignal();
int _pin;
volatile int pwm_value;
volatile int prev_time;
uint8_t latest_interrupted_pin;
private:
void rising();
void falling();
};
Now you can make rising
and falling
static but now they can't access any of the class variables (eg. pwm_value, prev_time, latest_interrupted_pin).
The whole thing needs a redesign. You could try making PPMintIn a namespace rather than a class.
Regarding one of the comments:
Unless your class implements operator()
this line doesn't make sense:
chan1(15);
Please copy and paste error messages into the post, don't make people go to Imgur to find a screenshot of some text.
As both Majenko and I tried to explain in Pass a member function pointer to a method of a foreign class (EDB Lib) you can't pass a class member function where a static function is expected.
Your error is on:
PCintPort::attachInterrupt(latest_interrupted_pin, &rising, RISING);
Error:
/home/nick/sketchbook/libraries/PPMintIn/ppmintin.cpp: In member function ‘void PPMintIn::rising()’:
/home/nick/sketchbook/libraries/PPMintIn/ppmintin.cpp:22: error: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say ‘&PPMintIn::rising’
PCintPort::attachInterrupt expects a PCIntvoidFuncPtr
variable:
int8_t PCintPort::attachInterrupt(uint8_t arduinoPin, PCIntvoidFuncPtr userFunc, int mode)
That is:
typedef void (*PCIntvoidFuncPtr)(void);
That is a static function (not a class function).
However you have it as a class function:
class PPMintIn{
public:
PPMintIn(int pin);
void begin();
void getSignal();
int _pin;
volatile int pwm_value;
volatile int prev_time;
uint8_t latest_interrupted_pin;
private:
void rising();
void falling();
};
Now you can make rising
and falling
static but now they can't access any of the class variables (eg. pwm_value, prev_time, latest_interrupted_pin).
The whole thing needs a redesign. You could try making PPMintIn a namespace rather than a class.
Regarding one of the comments:
Unless your class implements operator()
this line doesn't make sense:
chan1(15);
Please copy and paste error messages into the post, don't make people go to Imgur to find a screenshot of some text.
As both Majenko and I tried to explain in Pass a member function pointer to a method of a foreign class (EDB Lib) you can't pass a class member function where a static function is expected.
Your error is on:
PCintPort::attachInterrupt(latest_interrupted_pin, &rising, RISING);
Error:
/home/nick/sketchbook/libraries/PPMintIn/ppmintin.cpp: In member function ‘void PPMintIn::rising()’:
/home/nick/sketchbook/libraries/PPMintIn/ppmintin.cpp:22: error: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say ‘&PPMintIn::rising’
PCintPort::attachInterrupt expects a PCIntvoidFuncPtr
variable:
int8_t PCintPort::attachInterrupt(uint8_t arduinoPin, PCIntvoidFuncPtr userFunc, int mode)
That is:
typedef void (*PCIntvoidFuncPtr)(void);
That is a static function (not a class function).
However you have it as a class function:
class PPMintIn{
public:
PPMintIn(int pin);
void begin();
void getSignal();
int _pin;
volatile int pwm_value;
volatile int prev_time;
uint8_t latest_interrupted_pin;
private:
void rising();
void falling();
};
Now you can make rising
and falling
static but now they can't access any of the class variables (eg. pwm_value, prev_time, latest_interrupted_pin).
The whole thing needs a redesign. You could try making PPMintIn a namespace rather than a class.
As both Majenko and I tried to explain in Pass a member function pointer to a method of a foreign class (EDB Lib) you can't pass a class member function where a static function is expected.
Your error is on:
PCintPort::attachInterrupt(latest_interrupted_pin, &rising, RISING);
Error:
/home/nick/sketchbook/libraries/PPMintIn/ppmintin.cpp: In member function ‘void PPMintIn::rising()’:
/home/nick/sketchbook/libraries/PPMintIn/ppmintin.cpp:22: error: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say ‘&PPMintIn::rising’
PCintPort::attachInterrupt expects a PCIntvoidFuncPtr
variable:
int8_t PCintPort::attachInterrupt(uint8_t arduinoPin, PCIntvoidFuncPtr userFunc, int mode)
That is:
typedef void (*PCIntvoidFuncPtr)(void);
That is a static function (not a class function).
However you have it as a class function:
class PPMintIn{
public:
PPMintIn(int pin);
void begin();
void getSignal();
int _pin;
volatile int pwm_value;
volatile int prev_time;
uint8_t latest_interrupted_pin;
private:
void rising();
void falling();
};
Now you can make rising
and falling
static but now they can't access any of the class variables (eg. pwm_value, prev_time, latest_interrupted_pin).
The whole thing needs a redesign. You could try making PPMintIn a namespace rather than a class.
Regarding one of the comments:
Unless your class implements operator()
this line doesn't make sense:
chan1(15);
Please copy and paste error messages into the post, don't make people go to Imgur to find a screenshot of some text.
As both Majenko and I tried to explain in Pass a member function pointer to a method of a foreign class (EDB Lib) you can't pass a class member function where a static function is expected.
Your error is on:
PCintPort::attachInterrupt(latest_interrupted_pin, &rising, RISING);
Error:
/home/nick/sketchbook/libraries/PPMintIn/ppmintin.cpp: In member function ‘void PPMintIn::rising()’:
/home/nick/sketchbook/libraries/PPMintIn/ppmintin.cpp:22: error: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say ‘&PPMintIn::rising’
PCintPort::attachInterrupt expects a PCIntvoidFuncPtr
variable:
int8_t PCintPort::attachInterrupt(uint8_t arduinoPin, PCIntvoidFuncPtr userFunc, int mode)
That is:
typedef void (*PCIntvoidFuncPtr)(void);
That is a static function (not a class function).
However you have it as a class function:
class PPMintIn{
public:
PPMintIn(int pin);
void begin();
void getSignal();
int _pin;
volatile int pwm_value;
volatile int prev_time;
uint8_t latest_interrupted_pin;
private:
void rising();
void falling();
};
Now you can make rising
and falling
static but now they can't access any of the class variables (eg. pwm_value, prev_time, latest_interrupted_pin).
The whole thing needs a redesign. You could try making PPMintIn a namespace rather than a class.