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: DM_FATFileSystem DM_HttpServer DM_USBHost EthernetInterface USBDevice mbed-rpc mbed-rtos mbed-src
Fork of DMSupport by
Diff: DMBoard.cpp
- Revision:
- 5:c77fdb6e3438
- Parent:
- 4:6fdcdf7aff8d
- Child:
- 9:a33326afd686
--- 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()
