update pcspkdemo
This commit is contained in:
@ -1,6 +0,0 @@
|
|||||||
#include "user/PCSPKdemo.h"
|
|
||||||
|
|
||||||
void PCSPKdemo::run() {
|
|
||||||
pcspk.tetris();
|
|
||||||
scheduler.exit();
|
|
||||||
}
|
|
||||||
8
c_os/user/demo/PCSPKdemo.cc
Normal file
8
c_os/user/demo/PCSPKdemo.cc
Normal 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();
|
||||||
|
}
|
||||||
@ -7,9 +7,10 @@
|
|||||||
class PCSPKdemo : public Thread {
|
class PCSPKdemo : public Thread {
|
||||||
private:
|
private:
|
||||||
PCSPKdemo(const PCSPKdemo& copy) = delete;
|
PCSPKdemo(const PCSPKdemo& copy) = delete;
|
||||||
|
void (PCSPK::*melody)(void); // Allow to pass a melody to play when initializing the demo
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PCSPKdemo() {
|
PCSPKdemo(void (PCSPK::*melody)(void)) : melody(melody) {
|
||||||
kout << "Initialized PCSPKdemo" << endl;
|
kout << "Initialized PCSPKdemo" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user