Qt and wiringPiISR
Verfasst: 3. März 2026 07:57
private:
Ui::MainWindow *ui;
static void positiveFlanke(void);
int kwh=0;
MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
wiringPiISR(19,1,&positiveFlanke)
}
void MainWindow::positiveFlanke(void)
{
ui->label->setText(QString::number(kwh)); ERROR invalid use of member 'ui' in static member function
kwh++;
}
Hello, I'd like to monitor the rising edge of my Raspberry Pi using an interrupt.
Each pulse should be incremented and displayed on a label.
The problem is that the values are static and non-static. Is there a way to cast this?
Or is there another solution?
Thanks.
Ui::MainWindow *ui;
static void positiveFlanke(void);
int kwh=0;
MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
wiringPiISR(19,1,&positiveFlanke)
}
void MainWindow::positiveFlanke(void)
{
ui->label->setText(QString::number(kwh)); ERROR invalid use of member 'ui' in static member function
kwh++;
}
Hello, I'd like to monitor the rising edge of my Raspberry Pi using an interrupt.
Each pulse should be incremented and displayed on a label.
The problem is that the values are static and non-static. Is there a way to cast this?
Or is there another solution?
Thanks.