Luke Cartwright / Mbed 2 deprecated ELEC2645_Project_el18loc_nearlythere

Dependencies:   mbed

Revision:
2:07cef563acdf
Parent:
1:766a293c9b07
Child:
3:b7df72682b81
--- a/Gamepad2/Gamepad.cpp	Thu Feb 06 12:59:16 2020 +0000
+++ b/Gamepad2/Gamepad.cpp	Mon Mar 30 15:03:36 2020 +0000
@@ -414,6 +414,17 @@
     dac->write(val);
 }
 
+//writes DAC value in int format
+void Gamepad::write_u16(int val)
+{
+    if (val < 0) {
+        val = 0;
+    } else if (val > 65535) {
+        val = 65535;
+    }
+    dac->write_u16(val);
+}
+
 
 void Gamepad::play_next_note()
 {