Mobile Security System - Revision 1.0
Dependencies:
FXOS8700Q
N5110
SDFileSystem
SRF02
mbed
« Back to documentation index
main.h File Reference
Header file containing functions prototypes, defines and global variables.
More...
Go to the source code of this file.
Detailed Description
Header file containing functions prototypes, defines and global variables.
Revision 1.0.
Author: Daniel Gibbons
Date: May 2016
Definition in file main.h .
Function Documentation
Interrupt Service Routine that triggers when accelerometer ticker fires
Definition at line 256 of file main.cpp .
void alarm_setting_buzz
(
)
Turns off buzzer one second after entering state 5
Definition at line 1141 of file main.cpp .
Interrupt Service Routine that triggers when button_0 is pressed by the user
Definition at line 232 of file main.cpp .
void button_0_protocol
(
)
Interrupt Service Routine that triggers when button_1 is pressed by the user
Definition at line 238 of file main.cpp .
void button_1_protocol
(
)
Interrupt Service Routine that triggers when button_c is pressed by the user
Definition at line 244 of file main.cpp .
void button_c_protocol
(
)
void calculate_intruder_distance
(
)
Averages the past 10 distance readings and compares this value to the initial_setting_distance to detect a potential intruder
Definition at line 1047 of file main.cpp .
void calculate_setting_distance
(
)
Averages the past 10 distance readings and stores them in the initial_setting_distance
Definition at line 1026 of file main.cpp .
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
Definition at line 1316 of file main.cpp .
Compares the entered_pin to the set_pin
Definition at line 1298 of file main.cpp .
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
Definition at line 1159 of file main.cpp .
void delete_file
(
char
filename [] )
Deletes the old pin from the SD card - taken from 2545_SD_Card Example by Dr. C.A. Evans
Definition at line 1376 of file main.cpp .
void device_tampered_protocol
(
)
If the device is moved whilst in the setting state this function is called to stop the alarm from setting
Definition at line 1221 of file main.cpp .
Pin Functions.
Prints '*' to the Nokia 5110 LCD when a pin is being entered
Definition at line 1253 of file main.cpp .
Initialisation Functions.
Hangs flashing on_board LED
Accelerometer Functions.
Gets the accelerometer data from the K64F on_board accelerometer and stores them in acc_X, acc_Y and acc_Z
Definition at line 1150 of file main.cpp .
void get_intruder_distance
(
)
Gets the distance from the SRF02 and then increments the intruder_distance_counter
Definition at line 1009 of file main.cpp .
void get_setting_distance
(
)
Read Distance Functions.
Gets the distance from the SRF02 and then increments the setting_distance_counter
Definition at line 993 of file main.cpp .
Set-up the three external buttons
Definition at line 176 of file main.cpp .
Set-up the on-board LEDs and switches
Definition at line 162 of file main.cpp .
Set-up the serial port
Definition at line 156 of file main.cpp .
Initialises all variables to zero
Definition at line 190 of file main.cpp .
void intruder_distance_isr
(
)
Prints a border to the Nokia 5110 LCD
Definition at line 762 of file main.cpp .
Interrupt Service Routine that triggers when alerts ticker fires
Definition at line 250 of file main.cpp .
Clears the screen when a pin is entered to tell the user to press button 'C' to confirm the entered pin
Definition at line 1107 of file main.cpp .
Prints a box to the Nokia 5110 LCD for the states where a pin is required
Definition at line 770 of file main.cpp .
Interrupt Service Routine that triggers when pin_timeout ticker fires
Definition at line 262 of file main.cpp .
Reads pin from the SD card to the set_pin array - adapted from 2545_SD_Card Example by Dr. C.A. Evans
Definition at line 1352 of file main.cpp .
void reset_entered_pin
(
)
Resets the entered_pin array to have elements with a value of -1
Definition at line 1286 of file main.cpp .
void screen_5_transition
(
)
Timeout Functions.
Called five seconds after the setting screen is called
Definition at line 1095 of file main.cpp .
void screen_progression
(
)
Calls check pin to see if the entered pin is correct and from there either proceed or go back
Definition at line 796 of file main.cpp .
void screen_selection
(
)
Calls the relevant state_X_screen() depending on the value of g_next_state
Definition at line 844 of file main.cpp .
void setting_animation
(
)
Screen Animation Functions.
Prints the animation on the setting screen to the Nokia 5110 LCD
Definition at line 907 of file main.cpp .
void setting_distance_isr
(
)
Interrupt Service Routines (ISRs)
Interrupt Service Routine that triggers when setting_distance ticker fires
Definition at line 220 of file main.cpp .
void setting_screen_isr
(
)
State Functions.
Sets the screen and the necessary tickers and timeouts for state 0
Definition at line 454 of file main.cpp .
Sets the screen and the necessary tickers and timeouts for state 1
Definition at line 478 of file main.cpp .
void state_1_transition
(
)
Sends the user back to state 1 if the device is tampered in the setting state
Definition at line 1129 of file main.cpp .
Sets the screen and the necessary tickers and timeouts for state 2
Definition at line 520 of file main.cpp .
Sets the screen and the necessary tickers and timeouts for state 3
Definition at line 544 of file main.cpp .
Sets the screen and the necessary tickers and timeouts for state 4
Definition at line 568 of file main.cpp .
Sets the screen and the necessary tickers and timeouts for state 5
Definition at line 620 of file main.cpp .
Sets the screen and the necessary tickers and timeouts for state 6
Definition at line 664 of file main.cpp .
Sets the screen and the necessary tickers and timeouts for state 7
Definition at line 695 of file main.cpp .
Sets the screen and the necessary tickers and timeouts for state 8
Definition at line 729 of file main.cpp .
void timeout_protocol
(
)
Prints timeout counter when the alarm is triggered
Definition at line 949 of file main.cpp .
Variable Documentation
Current x-axis reading from the accelerometer
Definition at line 142 of file main.h .
Current y-axis reading from the accelerometer
Definition at line 143 of file main.h .
Current z-axis reading from the accelerometer
Definition at line 144 of file main.h .
Stores strings that are comprised of variables that are going to be displayed on the LCD
Definition at line 174 of file main.h .
Stores 10 distance readings from SRF02
Definition at line 152 of file main.h .
Pin user enters
Definition at line 135 of file main.h .
Flag in acc_isr
Definition at line 170 of file main.h .
Flag in button_0_isr
Definition at line 166 of file main.h .
Flag in button_1_isr
Definition at line 167 of file main.h .
Flag in button_c_isr
Definition at line 168 of file main.h .
The current state of the system
Definition at line 149 of file main.h .
Flag in intruder_distance_isr
Definition at line 165 of file main.h .
Flag in led_buzzer_isr
Definition at line 169 of file main.h .
The next state of the system
Definition at line 150 of file main.h .
Flag in pin_timeout_isr
Definition at line 171 of file main.h .
Flag in setting_distance_isr
Definition at line 164 of file main.h .
Flag in setting_screen_isr
Definition at line 172 of file main.h .
If the entered pin doesn't match the set pin this flag is incremented to 1
Definition at line 140 of file main.h .
Array to index the reading from the SD card
Definition at line 137 of file main.h .
The one_second_avg_distance calculated when in the setting state (state 4)
Definition at line 155 of file main.h .
increments to 10 distance readings can be stored over 1 second
Definition at line 158 of file main.h .
Stores the length of strings that are comprised of variables that are going to be displayed on the LCD
Definition at line 175 of file main.h .
one_second_distance divided by 10
Definition at line 154 of file main.h .
The total of all 10 distance readings taken in a second
Definition at line 153 of file main.h .
File pointer
Definition at line 133 of file main.h .
Increments to store the entered pin
Definition at line 139 of file main.h .
increments to 20 to enable the 20 second timeout when the alarm is triggered
Definition at line 159 of file main.h .
21 - pin_timeout_counter
Definition at line 162 of file main.h .
Pin that is saved to SD card and this is the current pin for the system
Definition at line 136 of file main.h .
X-axis reading from the accelerometer when setting screen is initialised
Definition at line 145 of file main.h .
Y-axis reading from the accelerometer when setting screen is initialised
Definition at line 146 of file main.h .
Z-axis reading from the accelerometer when setting screen is initialised
Definition at line 147 of file main.h .
increments in steps of five and is used for the setting screen animation
Definition at line 160 of file main.h .
increments to 10 distance readings can be stored over 1 second
Definition at line 157 of file main.h .