1

update pcspkdemo

This commit is contained in:
2022-07-11 18:32:39 +02:00
parent 24c418eb0a
commit 304eadc959
3 changed files with 10 additions and 7 deletions

View File

@ -1,6 +0,0 @@
#include "user/PCSPKdemo.h"
void PCSPKdemo::run() {
pcspk.tetris();
scheduler.exit();
}

View File

@ -0,0 +1,8 @@
#include "user/demo/PCSPKdemo.h"
void PCSPKdemo::run() {
(pcspk.*this->melody)(); // This syntax is confusing as hell
pcspk.off();
scheduler.exit();
}

View File

@ -7,9 +7,10 @@
class PCSPKdemo : public Thread {
private:
PCSPKdemo(const PCSPKdemo& copy) = delete;
void (PCSPK::*melody)(void); // Allow to pass a melody to play when initializing the demo
public:
PCSPKdemo() {
PCSPKdemo(void (PCSPK::*melody)(void)) : melody(melody) {
kout << "Initialized PCSPKdemo" << endl;
}