A board support package for the LPC4088 Display Module.

Dependencies:   DM_HttpServer DM_USBHost

Dependents:   lpc4088_displaymodule_emwin lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI ... more

Fork of DMSupport by EmbeddedArtists AB

Files at this revision

API Documentation at this revision

Comitter:
embeddedartists
Date:
Wed Dec 10 08:25:17 2014 +0000
Parent:
4:6fdcdf7aff8d
Child:
6:34a204ee7156
Commit message:
Minor changes in DMBoard

Changed in this revision

DMBoard.cpp Show annotated file Show diff for this revision Revisions of this file
DMBoard.h Show annotated file Show diff for this revision Revisions of this file
--- a/DMBoard.cpp	Mon Dec 08 12:48:44 2014 +0000
+++ b/DMBoard.cpp	Wed Dec 10 08:25:17 2014 +0000
@@ -26,6 +26,15 @@
   #include "meas.h"
 #endif        
 
+
+/******************************************************************************
+ * Configuration Compatibility Control
+ *****************************************************************************/
+
+#if defined(DM_BOARD_USE_USB_DEVICE) && defined(DM_BOARD_USE_USB_HOST)
+  #error The hardware supports either USB Device or USB Host - not both at the same time
+#endif
+
 /******************************************************************************
  * Defines and typedefs
  *****************************************************************************/
@@ -297,14 +306,18 @@
   }
 }
 
-void DMBoard::buzzer(float value)
+void DMBoard::buzzer(int frequency, int duration_ms)
 {
-  if (value < 0) {
-    value = 0;
-  } else if (value > 1) {
-    value = 1;
+  if (frequency <= 0) {
+    _buzzer = 0;
+  } else {
+    _buzzer.period_us(1000000/frequency);
+    _buzzer = 0.5;
   }
-  _buzzer = value;
+  if (duration_ms > 0) {
+    Thread::wait(duration_ms);
+    _buzzer = 0;
+  }
 }
 
 bool DMBoard::buttonPressed()
--- a/DMBoard.h	Mon Dec 08 12:48:44 2014 +0000
+++ b/DMBoard.h	Wed Dec 10 08:25:17 2014 +0000
@@ -85,7 +85,20 @@
     BoardError init();
   
     void setLED(Leds led, bool on);
-    void buzzer(float value);
+    
+    /** Controls the buzzer
+     *
+     * Examples:
+     *   buzzer()        turns it off
+     *   buzzer(440)     plays an A4 (440Hz) note forever
+     *   buzzer(200, 25) plays a 200Hz tone for 25ms and then turns it off
+     *
+     * Note that if duration_ms is >0 this is a blocking call
+     *
+     * @param frequency   the frequency of the tone (in Hz) or 0 to turn it off
+     * @param duration_ms the number of milliseconds to play or 0 for forever
+     */
+    void buzzer(int frequency=0, int duration_ms=0);
     bool buttonPressed();
     
 #if defined(DM_BOARD_USE_TOUCH)