Lib for Bulme Bertl

Dependents:   BertlPingPong BertlTemplate LineSensTest MotorTest2 ... more

Files at this revision

API Documentation at this revision

Comitter:
hollegha2
Date:
Thu Mar 05 17:39:16 2015 +0000
Parent:
5:a7849d022f69
Child:
7:20c3213c3ada
Commit message:
FrontButton

Changed in this revision

Bertl14.cpp Show annotated file Show diff for this revision Revisions of this file
Bertl14.h Show annotated file Show diff for this revision Revisions of this file
--- a/Bertl14.cpp	Wed Feb 25 08:17:43 2015 +0000
+++ b/Bertl14.cpp	Thu Mar 05 17:39:16 2015 +0000
@@ -119,6 +119,21 @@
 	useISR = prev;
 }
 
+void PortEx::WaitUntilFrontButtonPressed()
+{
+	int prev = useISR;
+	useISR = 0;
+	btns = 0;
+	while(1) {
+		ReadButtons();
+		if( IsAnyFrontButton() )
+			break;
+		wait(0.01);
+	}
+	btns=btnEvent=0;
+	useISR = prev;
+}
+
 
 
 UsDistSens::UsDistSens(PinName pinTrigger, PinName pinEcho) :
--- a/Bertl14.h	Wed Feb 25 08:17:43 2015 +0000
+++ b/Bertl14.h	Thu Mar 05 17:39:16 2015 +0000
@@ -63,6 +63,7 @@
 		
 		void ReadButtons();
 		void WaitUntilButtonPressed();
+		void WaitUntilFrontButtonPressed();
 
 		bool IsButton(int aBitPattern)
 			{ return btns & aBitPattern; }