Skip to content

Commit

Permalink
Organising Display Thread class
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronCollins1999 committed Mar 21, 2022
1 parent e990ff8 commit 8643702
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 13 deletions.
17 changes: 13 additions & 4 deletions src/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,24 @@ void Display::setParam(unsigned int param, bool redraw) {
if (redraw) flush();
}

void Display::ccToDisplay(unsigned int address, unsigned int value){
//Display::~Display(){

// End Display

// DisplayThread


void DisplayThread::ccToDisplay(unsigned int address, unsigned int value){
if (currentParam != address){
setParam(address, true);
display-> setParam(address, true);
currentParam = address;
}
setVal(value, true);
display-> setVal(value, true);

}

//Display::~Display(){




//}
35 changes: 26 additions & 9 deletions src/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/spi/spidev.h>
#include <thread>
#include <linux/spi/spidev.h>
#include <string>
#include <vector>
#include <stdio.h>
Expand All @@ -19,13 +18,6 @@
namespace SYNTHPI{


// struct MAX7219settings {
// /**
// * The SPI device in /dev used.
// **/
// std::string spiDevice = "/dev/spidev0.0";
// };

class MAX7219 {

public:
Expand Down Expand Up @@ -243,6 +235,31 @@ class Display: public MAX7219 {

};

class DisplayThread: public Thread{

protected:

Display *display;
bool isPLaying;

public:

DisplayThread(Display *display); // Constructor

~DisplayThread(); //Destructor

virtual void run();

void ccToDisplay(unsigned int address, unsigned int value);







}

} //close namespace

#endif

0 comments on commit 8643702

Please sign in to comment.