AirsoftTimer software based on mbed

Dependencies:   mbed TextLCD keypad

Files at this revision

API Documentation at this revision

Comitter:
sillevl
Date:
Thu Feb 09 12:28:56 2017 +0000
Parent:
26:1c7f293ba49c
Commit message:
ARCHIVE WIP, not working (crashes, cause unknown)

Changed in this revision

games/CatchItKeepIt.cpp Show annotated file Show diff for this revision Revisions of this file
games/DummyGame.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show diff for this revision Revisions of this file
objectives/Objective.cpp Show annotated file Show diff for this revision Revisions of this file
objectives/Objective.h Show annotated file Show diff for this revision Revisions of this file
objectives/WaitForKeyObjective.cpp Show annotated file Show diff for this revision Revisions of this file
screens/Screen.cpp Show annotated file Show diff for this revision Revisions of this file
screens/Screen.h Show annotated file Show diff for this revision Revisions of this file
diff -r 1c7f293ba49c -r f29805113454 games/CatchItKeepIt.cpp
--- a/games/CatchItKeepIt.cpp	Mon May 25 20:53:28 2015 +0000
+++ b/games/CatchItKeepIt.cpp	Thu Feb 09 12:28:56 2017 +0000
@@ -27,8 +27,13 @@
 void CatchItKeepIt::run(){
     while(true){        
         // wait for code input
-        // count down
-        // beep
+        // count down and beep
+        // wait for code
+        // repeat
         // don't return from this function yet (only if the game ends);   
     }
+}
+
+void end(){
+    // show winner
 }
\ No newline at end of file
diff -r 1c7f293ba49c -r f29805113454 games/DummyGame.cpp
--- a/games/DummyGame.cpp	Mon May 25 20:53:28 2015 +0000
+++ b/games/DummyGame.cpp	Thu Feb 09 12:28:56 2017 +0000
@@ -8,8 +8,8 @@
 }
 
 void DummyGame::setup(){
-    objectives.push_back(new ObjectiveFactory->create(this, 0));
-    objectives.push_back(new ObjectiveFactory->create(this, 0));
+    objectives.push_back(ObjectiveFactory::create(this, 0));
+    objectives.push_back(ObjectiveFactory::create(this, 0));
 }
 
 void buttonEvent(char c){
diff -r 1c7f293ba49c -r f29805113454 main.cpp
--- a/main.cpp	Mon May 25 20:53:28 2015 +0000
+++ b/main.cpp	Thu Feb 09 12:28:56 2017 +0000
@@ -1,5 +1,4 @@
 #include "mbed.h"
-#include "cmsis_os.h"
 
 
 #include "Airsofttimer.h"
diff -r 1c7f293ba49c -r f29805113454 mbed-rtos.lib
--- a/mbed-rtos.lib	Mon May 25 20:53:28 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#f1ef95efa5ad
diff -r 1c7f293ba49c -r f29805113454 objectives/Objective.cpp
--- a/objectives/Objective.cpp	Mon May 25 20:53:28 2015 +0000
+++ b/objectives/Objective.cpp	Thu Feb 09 12:28:56 2017 +0000
@@ -23,10 +23,12 @@
 void Objective::start(){
     while(status != COMPLETED){
         run();
+        leds->on(Leds::LEFT);
     }
 }
 
 void Objective::complete(){
     status = COMPLETED;
+    leds->off(Leds::RIGHT);
 }
 
diff -r 1c7f293ba49c -r f29805113454 objectives/Objective.h
--- a/objectives/Objective.h	Mon May 25 20:53:28 2015 +0000
+++ b/objectives/Objective.h	Thu Feb 09 12:28:56 2017 +0000
@@ -34,7 +34,7 @@
     Buzzer* buzzer;
        
     private:
-    Status status;
+    volatile Status status;
     
 };
 
diff -r 1c7f293ba49c -r f29805113454 objectives/WaitForKeyObjective.cpp
--- a/objectives/WaitForKeyObjective.cpp	Mon May 25 20:53:28 2015 +0000
+++ b/objectives/WaitForKeyObjective.cpp	Thu Feb 09 12:28:56 2017 +0000
@@ -7,10 +7,7 @@
 }
 
 void WaitForKeyObjective::run(){  
-    lcd->cls();
-    lcd->printf("press any key");
-    lcd->locate(0,1);
-    lcd->printf("to continue...");
+
     
     //wait until completed
     while(getStatus() != COMPLETED){}
diff -r 1c7f293ba49c -r f29805113454 screens/Screen.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/screens/Screen.cpp	Thu Feb 09 12:28:56 2017 +0000
@@ -0,0 +1,16 @@
+#include "Screen.h"
+
+using namespace AirsoftTimer;
+
+Screen::Screen(Board* board){
+    this->board = board;
+    update_display = true;
+}
+
+void Screen::update(){
+    update_display = true;
+}
+
+void Screen::show(){
+    update_display = false;    
+}
\ No newline at end of file
diff -r 1c7f293ba49c -r f29805113454 screens/Screen.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/screens/Screen.h	Thu Feb 09 12:28:56 2017 +0000
@@ -0,0 +1,27 @@
+#ifndef SCREEN_H
+#define SCREEN_H
+
+#include "../board/Board.h"
+
+namespace AirsoftTimer
+{
+
+class Screen
+{
+    public:
+    Screen(Board* board);
+    
+    void show();
+    void update();
+    
+    
+    protected:
+    Board* board;
+    
+    int update_display;
+
+
+};
+}
+
+#endif
\ No newline at end of file