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: mbed
Fork of PsiSwarm-BeaconDemo_Bluetooth by
Diff: PsiSwarm/pic.cpp
- Revision:
- 4:25039ea5eb09
- Child:
- 6:ff3c66f7372b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/PsiSwarm/pic.cpp Mon Oct 12 12:39:35 2015 +0000
@@ -0,0 +1,47 @@
+/* University of York Robotics Laboratory PsiSwarm Library: PIC and Audio Driver Source File
+ *
+ * File: pic.cpp
+ *
+ * (C) Dr James Hilder, Dept. Electronics & Computer Science, University of York
+ *
+ * PsiSwarm Library Version: 0.2
+ *
+ * October 2015
+ *
+ */
+
+
+#include "psiswarm.h"
+
+
+void play_audio_string(char * tune){
+ char length = strlen(tune);
+ play_tune(tune,length);
+}
+
+void play_tune(char * tune, char length){
+ char to_send [length+3];
+ char start_array[2];
+ start_array [0] = 'S';
+ start_array [1] = length;
+ strcpy(to_send,start_array);
+ strncat(to_send,tune,length);
+ debug(to_send);
+ primary_i2c.write(PIC_ADDRESS,to_send,length+2,false);
+}
+
+
+char IF_check_pic_firmware(){
+ char buffer[6];
+ buffer[0] = 0;
+ primary_i2c.write(PIC_ADDRESS,"I",1,false);
+ wait(0.1);
+ primary_i2c.read(PIC_ADDRESS,buffer,6);
+ debug(buffer);
+ if(buffer[0] != 'F' || buffer[1] != 'W'){
+ debug("WARNING: Cannot read information from PIC microcontroller");
+ return 1;
+ }
+ debug(buffer);
+ return 0;
+}
\ No newline at end of file
