Blank program code for the Psi Swarm robot (PCB 1.5) using API version 0.7

Dependencies:   PsiSwarmV7 mbed

Files at this revision

API Documentation at this revision

Comitter:
jah128
Date:
Sat Oct 15 13:52:26 2016 +0000
Commit message:
Initial commit of blank program code

Changed in this revision

PsiSwarmV7.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
main.h Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 9c0ccd879613 PsiSwarmV7.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PsiSwarmV7.lib	Sat Oct 15 13:52:26 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/Psi-Swarm-Robot/code/PsiSwarmV7/#b340a527add9
diff -r 000000000000 -r 9c0ccd879613 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Oct 15 13:52:26 2016 +0000
@@ -0,0 +1,76 @@
+/***********************************************************************
+**  ██████╗ ███████╗██╗███████╗██╗    ██╗ █████╗ ██████╗ ███╗   ███╗  **
+**  ██╔══██╗██╔════╝██║██╔════╝██║    ██║██╔══██╗██╔══██╗████╗ ████║  **
+**  ██████╔╝███████╗██║███████╗██║ █╗ ██║███████║██████╔╝██╔████╔██║  **
+**  ██╔═══╝ ╚════██║██║╚════██║██║███╗██║██╔══██║██╔══██╗██║╚██╔╝██║  **
+**  ██║     ███████║██║███████║╚███╔███╔╝██║  ██║██║  ██║██║ ╚═╝ ██║  **
+**  ╚═╝     ╚══════╝╚═╝╚══════╝ ╚══╝╚══╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝  **
+************************************************************************
+** Copyright 2016 University of York                                  **
+**                                                                    **
+** Licensed under the Apache License, Version 2.0 (the "License")     **
+** You may not use this file except in compliance with the License.   **
+** You may obtain a copy of the License at                            **
+** http://www.apache.org/licenses/LICENSE-2.0   Unless required by    **
+** applicable law or agreed to in writing, software distributed under **
+** under the License is distributed on an "AS IS" BASIS WITHOUT       **  
+** WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   ** 
+** See the License for the specific language governing permissions    ** 
+** and limitations under the License.                                 **
+***********************************************************************/
+
+/// PsiSwarm Blank Example Code
+/// Version 0.7
+/// James Hilder, Alan Millard, Alexander Horsfield, Homero Elizondo, Jon Timmis
+/// University of York
+
+/// Include main.h - this includes psiswarm.h all the other necessary core files
+#include "main.h"
+
+char * program_name = "Blank";
+char * author_name  = "YRL";
+char * version_name = "0.41";
+
+void user_code_loop()
+{
+    wait(1);   
+}
+
+///Place user code here that should be run after initialisation but before the main loop
+void user_code_setup()
+{
+    wait(1);
+    display.clear_display();
+    display.set_position(0,0);
+    display.write_string("No Code");  
+}
+
+/// Code goes here to handle what should happen when the user switch is pressed
+void handle_switch_event(char switch_state)
+{
+    /// Switch_state = 1 if up is pressed, 2 if down is pressed, 4 if left is pressed, 8 if right is pressed and 16 if the center button is pressed
+    /// NB For maximum compatability it is recommended to minimise reliance on center button press
+
+}
+
+void handle_user_serial_message(char * message, char length, char interface)
+{
+    // This is where user code for handling a (non-system) serial message should go
+    //
+    // message = pointer to message char array
+    // length = length of message
+    // interface = 0 for PC serial connection, 1 for Bluetooth
+    
+}
+
+/// The main routine: it is recommended to leave this function alone and add user code to the above functions
+int main()
+{
+    ///init() in psiswarm.cpp sets up the robot
+    init();
+    user_code_setup();
+    user_code_running = 1;
+    while(1) {
+        user_code_loop();
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 9c0ccd879613 main.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.h	Sat Oct 15 13:52:26 2016 +0000
@@ -0,0 +1,38 @@
+/***********************************************************************
+**  ██████╗ ███████╗██╗███████╗██╗    ██╗ █████╗ ██████╗ ███╗   ███╗  **
+**  ██╔══██╗██╔════╝██║██╔════╝██║    ██║██╔══██╗██╔══██╗████╗ ████║  **
+**  ██████╔╝███████╗██║███████╗██║ █╗ ██║███████║██████╔╝██╔████╔██║  **
+**  ██╔═══╝ ╚════██║██║╚════██║██║███╗██║██╔══██║██╔══██╗██║╚██╔╝██║  **
+**  ██║     ███████║██║███████║╚███╔███╔╝██║  ██║██║  ██║██║ ╚═╝ ██║  **
+**  ╚═╝     ╚══════╝╚═╝╚══════╝ ╚══╝╚══╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝  **
+************************************************************************
+** Copyright 2016 University of York                                  **
+**                                                                    **
+** Licensed under the Apache License, Version 2.0 (the "License")     **
+** You may not use this file except in compliance with the License.   **
+** You may obtain a copy of the License at                            **
+** http://www.apache.org/licenses/LICENSE-2.0   Unless required by    **
+** applicable law or agreed to in writing, software distributed under **
+** under the License is distributed on an "AS IS" BASIS WITHOUT       **  
+** WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   ** 
+** See the License for the specific language governing permissions    ** 
+** and limitations under the License.                                 **
+***********************************************************************/
+
+/// PsiSwarm Blank Example Code
+/// Version 0.7
+/// James Hilder, Alan Millard, Alexander Horsfield, Homero Elizondo, Jon Timmis
+/// University of York
+
+#ifndef MAIN_H
+#define MAIN_H
+
+#include "psiswarm.h"
+
+int main(void);
+void user_code_setup(void);
+void user_code_loop(void);
+void handle_switch_event(char switch_state); 
+void handle_user_serial_message(char * message, char length, char interface);
+
+#endif
\ No newline at end of file
diff -r 000000000000 -r 9c0ccd879613 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Oct 15 13:52:26 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3
\ No newline at end of file