Reverse Parking sensor

Dependencies:   N5110 SRF02 buzzer mbed

Fork of ParkingSENSOR by Renosi Momoh

Revision:
1:775f6e8071a2
Parent:
0:e1ae1b9889a3
Child:
3:68cabac00547
diff -r e1ae1b9889a3 -r 775f6e8071a2 main.h
--- a/main.h	Thu May 05 00:29:11 2016 +0000
+++ b/main.h	Thu May 05 02:08:46 2016 +0000
@@ -3,23 +3,32 @@
 @brief Header file containg functions, variables and prototypes
 @brief Revision 1.0
 @brief Reverse Parking sensor
-@date March 2015 **/
+@Author Renosi Momoh 
+@date March 2015 
+**/
 
 
 #include "mbed.h"
 #include "N5110.h"
 #include "SRF02/SRF02.h"
 #include "buzzer.h"
-#include "SDFileSystem.h"
+
 
 /** INPUTS AND OUTPUTS  **/
 
 N5110 lcd (PTE26, PTA0, PTC4, PTD0, PTD2, PTD1, PTC3);
-/** @brief Connections for the LCD Display **/
+/**
+@namespace LCD display  
+@brief Connections for the LCD Display 
+**/
 SRF02 sensor(I2C_SDA,I2C_SCL);
-/** @brief Ultrasonic distance sensor connected in I2C mode**/
+/** 
+@namespace Ultrasonic sensor connected in I2C mode 
+@brief Ultrasonic distance sensor connected in I2C mode
+**/
 Beep buzzer(PTA2); 
 /** 
+@namespace Buzzer 
 @brief Piezo type buzzer that can produce notes and vary the frequency as well. Connected to Pwm signal 
 **/
 
@@ -27,63 +36,78 @@
 /**
 @Brief Button connected to mbed with the use of InterruptIn class**/
 InterruptIn sw2(SW2);
-
-
+/** 
+@namespace SW2 button
+@brief DigitalIn button
+**/
 InterruptIn sw3(SW3);
-DigitalOut r_led(PTC2);
-
-SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd");
- /** Defining pins for SD card file system **/
-Serial serial(USBTX, USBRX);  // for PC debugging purposes
-AnalogIn pot(PTB2);   /* Potentiometer middle pin connected to PTB3, other two ends connected to GND and 3.3V */
-
-
 
-/** Create objects for timeout using flipper **/
-Timeout flipper;
-Timeout flipper2;
-Ticker ticker;
-Ticker ticker2;
-Ticker ticker3;
-void button_isr();
-void init_serial(); /** function to activate onboard switches and LEDs **/
-void timer_isr();
-void timer2_isr();
-void timer1_isr();
-void mainProg();
-void inActiveState();
 /** 
-@namespace Main Function
-@brief The function containing the main menu to choose functions from 
-**/
-   
-void classicMode(); /**
-@Brief Allow the screen to refresh when the potentiometer is set to reflect output mode.
+@namespace SW3 button
+@brief DigitalIn button
 **/
 
-void delete_file(char filename[]); // Function to call for deletion of file.
+DigitalOut r_led(PTC2);
+/** 
+@namespace Led
+@brief Changes color depending on distance
+**/
+Serial serial(USBTX, USBRX);
+/**
+@Namespace USB connections 
+@brief Used for programming the sensor 
+**/
+AnalogIn pot(PTB2);   
+/**
+@namespace AnalogIn potentiometer 
+@brief Potentiometer middle pin connected to PTB3, other two ends connected to GND and 3.3V
+ **/
 
-/** Flags and Interrupt Service Routines **/
+/** Ticker, flags and Interrupt Service Routines**/
 
+Ticker ticker; //*!< Objects to create tickers for parking sensor in cm */
+Ticker ticker2; //*!< Objects to create tickers for radar parking sensor mode */
+Ticker ticker3; //*!< Ticker to call interrupt for parking sensor in inches */
+void button_isr();
+void init_serial();  //*!< function to activate onboard switches and LEDs */
+void timer_isr();
 volatile int g_timer_flag = 0; /** @Brief G flag makes things easier to distinguish as this is a global variable **/
 volatile int g_timer2_flag = 0;
 volatile int g_sw3_flag = 0;
-volatile int g_button_flag = 0;
+volatile int g_sw2_flag = 0;
 volatile int g_timer1_flag = 0;
 void sw2_isr();
 void sw3_isr();
 
+
+
+
+
+void delete_file(char filename[]); // Function to call for deletion of file.
+
 /** Misc **/
+
 float averageDistance(); 
 /**
 @namespace Average Distance
 @Brief This function allows us to take ten sensor readings and find the average to improve accuracy 
 **/
 float averageDistanceIn();
+/**
+@namespace Average Distance in Inches
+@Brief Converts the distance from centimetres to inches 
+**/
 
 int distance;
+/** 
+@namespace Distance
+@brief Variable for storing integer value for distance in cm(default)
+**/
 float distanceIn;
-
+/** 
+@namespace Distance
+@brief Variable for storing integer value for distance in inches
+**/
 
 /** Functions **/
 
@@ -120,8 +144,15 @@
 **/
 void active(); 
 /** 
+@namespace Active mode in centimetres 
 @Brief Main functionality that essentially reads the distance from the sensor and conveys the information via The display and buzzer
 **/
+void activeIn();
+/**
+@namespace Active Parking Mode in Inches 
+@brief Function to implement active parking mode in inches with the use of tickers and interrupts to save power
+**/
+
 void radar();
 /**
 @namespace Radar
@@ -131,6 +162,19 @@
 /** @namespace Sweep Speed
     @Brief Function that varies the rate at which the radar sweeps with the sensor distance 
 **/
+void mainProg();
+
+/** 
+@namespace Main Function
+@brief The function containing the main menu to choose functions from 
+**/
+   
+void classicMode(); 
+/**
+@namespace Screen selection 
+@Brief Allow the screen to refresh when the potentiometer is set to reflect output mode due to pot selection
+**/
+
 void sweep();
 /**@namespace Sweeping Functions
    @Brief  Each of these functions will read the distance from the sensor and set the radar arrow speed across the screen appropriately
@@ -150,16 +194,11 @@
 /** Variables **/
 
      
-float i;  /**
-@brief Variable used to vary frequency of the buzzer
- **/
+float i; 
+/*!< Variables used to control rate at which speaker goes off */
+
 float t; 
-/** 
-@brief Variable used to vary frequency of the radar sweep 
-**/
+/*!< Variable used to vary sweep speed.  */
 
 
 
-
-
-