Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL-uLCD-SE PinDetect mbed-rtos mbed
Fork of ScreenSaver by
Diff: main.cpp
- Revision:
- 1:76a052237fca
- Parent:
- 0:b7019deacc63
--- a/main.cpp Wed Oct 21 04:58:31 2015 +0000
+++ b/main.cpp Wed Oct 21 15:33:04 2015 +0000
@@ -16,11 +16,32 @@
//SCREENSAVER VARIABLES
int volatile counter=0; //GLOBAL COUNTER VARIABLE FOR SCREENSAVER MODE
int color[] = {RED,BLUE,GREEN}; //color to be written to screen
+//int save[128*128]; //Vector to save current screen
-// SCREENSAVER FUNCTION
+// SCREENSAVER FUNCTIONS
+/*
+void savescreen()
+{
+ for(int i=0; i<(128)&&counter!=0; i++) {
+ for(int k=0; (k<128)&&counter!=0; k++) {
+ save[k+i*128]==uLCD.read_pixel(k,i); //save current screen to memory
+ }
+ }
+}
+void recoverscreen()
+{
+ for(int i=0; i<(128)&&counter!=0; i++) {
+ for(int k=0; (k<128)&&counter!=0; k++) {
+ DAmu.lock(); //Use Mutex to decide which function writes to screen
+ uLCD.pixel(k,i,save[i+k*128]); //Randomizes color to be written to screen
+ DAmu.unlock();
+ }
+ }
+}
+*/
void screensaver(void const *args)
{
- //pc.printf("/n %d", counter);
+ // savescreen(); //store current screen before entering screensaver mode
while(counter!=0) {
uLCD.cls();
for(int i=0; i<(128)&&counter!=0; i++) {
@@ -31,6 +52,7 @@
}
}
uLCD.cls();
+ // recoverscreen(); //Call function to restore screen when exiting screensaver mode
Thread::wait(1000);
}
}
@@ -92,15 +114,15 @@
left.setSampleFrequency();
right.setSampleFrequency();
c.setSampleFrequency();
-
- //JoyStick or Pushbutton functional fall interrupts set up
+
+ //JoyStick or Pushbutton functional fall interrupts set up
up.attach_deasserted(&up_hit_callback);
down.attach_deasserted(&down_hit_callback);
left.attach_deasserted(&left_hit_callback);
right.attach_deasserted(&right_hit_callback);
c.attach_deasserted(&c_hit_callback);
- //initialize screen
+ //initialize screen
uLCD.baudrate(100000);
DAmu.lock();
uLCD.background_color(BLACK);
