Embedded Systems Project Mateusz Loboda 200843098
Dependencies: N5110 SRF02-Mateusz mbed
Diff: main.h
- Revision:
- 2:0dfa60f22f07
- Parent:
- 0:3403a3415306
- Child:
- 3:ee005c9f0348
--- a/main.h Wed May 04 14:18:38 2016 +0000 +++ b/main.h Wed May 04 22:45:02 2016 +0000 @@ -1,8 +1,8 @@ /** @file main.h @brief ʜeader file declares functions and variables -@brief ʀeverse Parking Tool... -@brief ʀevision 1.0 +@brief Reverse parking and motion detection tool - Embedded Systems Project +@brief Revision 1.0. @author Mateusz Loboda @Date 02/05/16 */ @@ -12,43 +12,157 @@ #include "N5110.h" #include "SRF02.h" +/** +@namespace lcd +@brief object of the N5110 class +*/ +N5110 lcd(PTE26 , PTA0 , PTC4 , PTD0 , PTD2 , PTD1 , PTC3); -N5110 lcd(PTE26 , PTA0 , PTC4 , PTD0 , PTD2 , PTD1 , PTC3); +////////////////// SRF02 sensor(I2C_SDA,I2C_SCL); +/** +@namespace r_led +@brief output for status of red LED +*/ DigitalOut r_led(LED_RED); + +/** +@namespace g_led +@brief output for status of green LED +*/ DigitalOut g_led(LED_GREEN); + +/** +@namespace b_led +@brief output for status of blue LED +*/ DigitalOut b_led(LED_BLUE); -InterruptIn button2(PTB18); + +/** +@namespace button 1 +@brief Interrupt executes an event triggered task +*/ InterruptIn button1(PTB9); -PwmOut buzzer(PTA2); -AnalogIn rate(PTB10); -DigitalOut myled(PTC2); -Ticker ticker; // pot delay, periodic interrupt -//InterruptIn button2(PTB23); -Timeout out; // +/** +@namespace button 2 +@brief Interrupt executes an event triggered task +*/ +InterruptIn button2(PTB18); -volatile int g_button1_flag = 0; -volatile int g_button2_flag = 0; -volatile int g_ticker_flag = 0; -void units(); -void mode(); -void timeout_isr(); -void ticker_isr(); -void init_K64F(); -void initialScreen(); -void initialArray(); -void get_averageDistance(); -void redLedIndicator(); -void drawDistanceBars(); -void moveArrayElements(); -void adjacentArrayElements(); -void plotAxes(); -void plotDistancePoint(); -void modeTwo(); +/** +@namespace buzzer +@brief use PWM pin to control the volume of the buzzer, duty cycle and period +*/ +PwmOut buzzer(PTA2); + +/** +@namespace pot +@brief read value of the potentiometer from the potentiometer position +*/ +AnalogIn rate(PTB10); + +/** +@namespace myled +@brief Output for status of red LED, used as auditory alert +*/ +DigitalOut myled(PTC2); + +/** +@namespace timer +@brief Periodic interrupt executes a time triggered task +*/ +Ticker ticker; + +/** +@namespace timeout +@brief Interrupt used to call a function after a specified amount of time +*/ +Timeout out; + +//variables +volatile int g_button1_flag = 0; /*!< Set flag in ISR for button 1, event triggered interrupt */ +volatile int g_button2_flag = 0; /*!< Set flag in ISR for button 2, event triggered interrupt */ +volatile int g_ticker_flag = 0; /*!< Set ticker flag in ISR , time triggered interrupt */ +/** +The main function where the code is executed +*/ +//int main(); + +/** +setting up flag to 1 +*/ +void units(); + +/** +setting up flag to 1 +*/ +void mode(); + +/** +setting up flag to 1 +*/ +void timeout_isr(); + +/** +setting up flag to 1 +*/ +void ticker_isr(); + +/** +setting up the buttons and on board LEDs +*/ +void init_K64F(); + +/** +inital screen printed +*/ +void initialScreen(); + +/** +initialize graph array for distance points +*/ +void initialArray(); + +/** +calculate the average distance from a set number of consecutive readings +*/ +void get_averageDistance(); + +/** +Set visual and auditory alerts +*/ +void redLedIndicator(); + +/** +Creates rectangular bars +*/ +void drawDistanceBars(); + +/** +Shifts array elements by one +*/ +void moveArrayElements(); + +/** +assigning float distance to first element of graph matrix +*/ +void adjacentArrayElements(); + +/** +plots the x and y axes +*/ +void plotAxes(); + +/** +converts float distance to integer pixel and plots the point +*/ +void plotDistancePoint(); + +//void modeTwo(); float buzzerPeriod; float delay;