Mobile Security System - Revision 1.0

Dependencies:   FXOS8700Q N5110 SDFileSystem SRF02 mbed

Revision:
9:a5614f53d435
Parent:
8:8a3d1c07bdec
--- a/main.h	Tue May 03 09:51:02 2016 +0000
+++ b/main.h	Wed May 04 15:33:54 2016 +0000
@@ -3,7 +3,7 @@
 @brief Header file containing functions prototypes, defines and global variables.
 @brief Revision 1.0.
 @author Daniel Gibbons
-@date   March 2016
+@date   May 2016
 */
 
 #ifndef MAIN_H
@@ -127,7 +127,7 @@
     {5,6,5,5}, // 5 - alarm activated
     {6,6,1,5}, // 6 - deactivate without triggering (enter password)
     {7,7,1,8}, // 7 - alarm triggered (enter password)
-    {8,8,1,1}   // 8 - alarm triggered
+    {8,1,8,8}   // 8 - alarm triggered
 };
 
 FILE *pin; /*!< File pointer */
@@ -174,9 +174,9 @@
 char buffer[14]; /*!< Stores strings that are comprised of variables that are going to be displayed on the LCD */
 int length; /*!< Stores the length of strings that are comprised of variables that are going to be displayed on the LCD */
 
-
-// Initialisation Functions
-
+///
+/// Initialisation Functions
+///
 void error(); /*!< Hangs flashing on_board LED */
   
 void init_serial(); /*!< Set-up the serial port */
@@ -186,9 +186,9 @@
 void init_buttons(); /*!< Set-up the three external buttons */
 
 void init_variables(); /*!< Initialises all variables to zero */
-
-// Interrupt Service Routines (ISRs)
-
+///
+/// Interrupt Service Routines (ISRs)
+///
 void setting_distance_isr(); /*!< Interrupt Service Routine that triggers when setting_distance ticker fires */
 
 void intruder_distance_isr(); /*!< Interrupt Service Routine that triggers when intruder_distance ticker fires */
@@ -206,17 +206,17 @@
 void pin_timeout_isr(); /*!< Interrupt Service Routine that triggers when pin_timeout ticker fires */
 
 void setting_screen_isr(); /*!< Interrupt Service Routine that triggers when setting_screen ticker fires */
-
-// Button Functions
-
+///
+/// Button Functions
+///
 void button_0_protocol(); /*!< Protocol when button_0 is pressed */
 
 void button_1_protocol(); /*!< Protocol when button_1 is pressed */
 
 void button_c_protocol(); /*!< Protocol when button_c is pressed */
-
-// State Functions
-
+///
+/// State Functions
+///
 void state_0_screen(); /*!< Sets the screen and the necessary tickers and timeouts for state 0 */
 
 void state_1_screen(); /*!< Sets the screen and the necessary tickers and timeouts for state 1 */
@@ -242,15 +242,15 @@
 void screen_progression(); /*!< Calls check pin to see if the entered pin is correct and from there either proceed or go back */
 
 void screen_selection(); /*!< Calls the relevant state_X_screen() depending on the value of g_next_state */
-
-// Screen Animation Functions
-
+///
+/// Screen Animation Functions
+///
 void setting_animation(); /*!< Prints the animation on the setting screen to the Nokia 5110 LCD */
 
 void timeout_protocol(); /*!< Prints timeout counter when the alarm is triggered */
-
-// Read Distance Functions
-
+///
+/// Read Distance Functions
+///
 void get_setting_distance(); /*!< Gets the distance from the SRF02 and then increments the setting_distance_counter */
 
 void get_intruder_distance(); /*!< Gets the distance from the SRF02 and then increments the intruder_distance_counter */
@@ -258,40 +258,38 @@
 void calculate_setting_distance(); /*!< Averages the past 10 distance readings and stores them in the initial_setting_distance */
 
 void calculate_intruder_distance(); /*!< Averages the past 10 distance readings and compares this value to the initial_setting_distance to detect a potential intruder */
-
-// Timeout Functions
-
+///
+/// Timeout Functions
+///
 void screen_5_transition(); /*!< Called five seconds after the setting screen is called */
 
 void pin_confirm(); /*!< Clears the screen when a pin is entered to tell the user to press button 'C' to confirm the entered pin */
 
-void device_tampered(); /*!< Sends the user back to state 1 if the device is tampered in the setting state */
+void state_1_transition(); /*!< Sends the user back to state 1 if the device is tampered in the setting state */
 
 void alarm_setting_buzz(); /*!< Turns off buzzer one second after entering state 5 */
-
-// Accelerometer Function
-
+///
+/// Accelerometer Functions
+///
 void get_axis_data(); /*!< Gets the accelerometer data from the K64F on_board accelerometer and stores them in acc_X, acc_Y and acc_Z */
 
 void compare_axis_data(); /*!< Compares the accelerometer data from the K64F on-board accelerometer with the stored values of setting_acc_X, setting_acc_Y and setting_acc_Z */ 
 
-void device_tampered_protocol(); /*!< If the device is moved whilst in the setting state this function is called */
-
-// Pin Functions
-
-
-
+void device_tampered_protocol(); /*!< If the device is moved whilst in the setting state this function is called to stop the alarm from setting */
+///
+/// Pin Functions
+///
 void enter_pin(); /*!< Prints '*' to the Nokia 5110 LCD when a pin is being entered */
 
 void reset_entered_pin(); /*!< Resets the entered_pin array to have elements with a value of -1 */
 
 void check_pin(); /*!< Compares the entered_pin to the set_pin */
 
-void change_pin(); /*!< Writes entered_pin to the SD card when a pin is entered in state 3 - adapted from SD card program by Dr. C.A. Evans */
+void change_pin(); /*!< Writes entered_pin to the SD card when a pin is entered in state 3 - adapted from 2545_SD_Card Example by Dr. C.A. Evans */
 
-void read_pin(); /*!< Reads pin from the SD card to the set_pin array - adapted from SD card program by Dr. C.A. Evans */
+void read_pin(); /*!< Reads pin from the SD card to the set_pin array - adapted from 2545_SD_Card Example by Dr. C.A. Evans */
 
-void delete_file(char filename[]); /*!< Deletes the old pin from the SD card - taken from SD card program by Dr. C.A. Evans */
+void delete_file(char filename[]); /*!< Deletes the old pin from the SD card - taken from 2545_SD_Card Example by Dr. C.A. Evans */
 
 /**