Science Memeseum / Mbed 2 deprecated BeaconDemo_RobotCode

Dependencies:   mbed

Fork of PsiSwarm-BeaconDemo_Bluetooth by James Wilson

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.h Source File

main.h

00001 /*********************************************************************** 
00002 **  ██████╗ ███████╗██╗███████╗██╗    ██╗ █████╗ ██████╗ ███╗   ███╗  **
00003 **  ██╔══██╗██╔════╝██║██╔════╝██║    ██║██╔══██╗██╔══██╗████╗ ████║  **
00004 **  ██████╔╝███████╗██║███████╗██║ █╗ ██║███████║██████╔╝██╔████╔██║  **
00005 **  ██╔═══╝ ╚════██║██║╚════██║██║███╗██║██╔══██║██╔══██╗██║╚██╔╝██║  **
00006 **  ██║     ███████║██║███████║╚███╔███╔╝██║  ██║██║  ██║██║ ╚═╝ ██║  **
00007 **  ╚═╝     ╚══════╝╚═╝╚══════╝ ╚══╝╚══╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝  **
00008 ************************************************************************
00009 **(C) Dr James Hilder - York Robotics Laboratory - University of York **
00010 ***********************************************************************/
00011 
00012 /// PsiSwarm Beautiful Meme Project Source Code
00013 /// Version 0.2
00014 /// James Hilder, Alan Millard, Homero Elizondo, Jon Timmis
00015 /// University of York
00016 
00017 #ifndef MAIN_H
00018 #define MAIN_H
00019 
00020 #include "psiswarm.h"
00021 #include "beacon.h"
00022 #include "programs.h"
00023 #include "vector.h"
00024 
00025 // Define the on-period for a IR pulse in microseconds (eg 50000 for 2Hz system, 25000 for a 4Hz system or 20000 for a 5Hz system)
00026 #define BEACON_PERIOD 25000        
00027 
00028 extern char beacon_found;                       // This will be a 1 if beacon is detected, 0 if it isn't 
00029 extern int beacon_heading;                      // The heading from the last time the beacon was detected
00030 extern char robots_found[8];                    // These will be a 1 when the respective robot [excluding self] was detected during the previous 500ms window
00031 extern int robots_heading[8];                   // These are the headings from the last time the respective robots were detected
00032 extern unsigned short robots_distance[8];       // This is the maximum sensor value from the last time the respective robot was detected
00033 extern unsigned short reflected_sensor_data[8]; // The reflected IR values when this robots emitters are on
00034 extern unsigned short background_sensor_data[8];// The raw IR values when no robot (or beacon) should have its IR on
00035 extern char disable_ir_emitters; 
00036 extern char step_cycle;
00037 extern char target_reached;
00038 extern char recharging_state;
00039 extern char prog_name [17];
00040 extern char prog_info [17];
00041 extern char main_program_state;
00042 extern char program_changed;   
00043 extern char program_run_init;
00044 extern float battery_low_threshold;      
00045 extern float battery_high_threshold; 
00046 
00047 
00048 char * get_program_name(int index);
00049 void set_program(int index);
00050 void set_program_info(char * info);
00051 
00052 void update_display(void);
00053 void toggle_program(void);
00054 void display_debug_info(void);
00055 
00056 void user_code_setup(void);
00057 void user_code_loop(void);
00058 void handle_switch_event(char switch_state);
00059 void handle_user_serial_message(char * message, char length, char interface);
00060 
00061 int main(void);
00062 
00063 
00064 
00065 void display_ir_readings(void);
00066 void out(const char* format, ...) ;
00067 
00068 #endif