Klassenfunktion kann nicht in den Timer geladen werden

Gast #4009292
Lesenswert?

header-file:
1
class ReadADCValues {
2
    public:
3
        bool is_active;         
4
        bool error;             
5
        
6
        void init  ();
7
        void start ();          
8
        void stopp ();          
9
        void set_sampling_rate (uint16_t value);  
10
    
11
    private:
12
        bool check;                     
13
        void tickerfunction (); 
14
        uint16_t sampling_rate;
15
};


cpp-file:
1
void ReadADCValues::init() {
2
    is_active     = false;             
3
    error         = false;             
4
    check         = false;             
5
    sampling_rate = 100;
6
}
7

8
void ReadADCValues::start() {
9
    timer.attach(&ReadADCValues::tickerfunction, sampling_rate);
10
}
11

12
void ReadADCValues::stopp() {
13
    timer.detach();    
14
}
15

16
void ReadADCValues::set_sampling_rate(uint16_t value) {
17
    sampling_rate = value;
18
}
19

20
void ReadADCValues::tickerfunction() {
21
    if (check == true) {
22
        error = true;
23
    }
24
    check = true;
25
    // tu was...
26
    
27
    check = false;    
28
}

Der Teil aus dem C-Programm macht Probleme:
1
void ReadADCValues::start() {
2
    timer.attach(&ReadADCValues::tickerfunction, sampling_rate);
3
}

Fehlermeldung: "no instance of overloaded function"

Was mache ich falsch?

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren