Embedded Systems Project Mateusz Loboda 200843098
Dependencies: N5110 SRF02-Mateusz mbed
main.h
- Committer:
- el14ml
- Date:
- 2016-05-04
- Revision:
- 2:0dfa60f22f07
- Parent:
- 0:3403a3415306
- Child:
- 3:ee005c9f0348
File content as of revision 2:0dfa60f22f07:
/** @file main.h @brief ʜeader file declares functions and variables @brief Reverse parking and motion detection tool - Embedded Systems Project @brief Revision 1.0. @author Mateusz Loboda @Date 02/05/16 */ #ifndef MAIN_H #define MAIN_H #include "N5110.h" #include "SRF02.h" /** @namespace lcd @brief object of the N5110 class */ 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); /** @namespace button 1 @brief Interrupt executes an event triggered task */ InterruptIn button1(PTB9); /** @namespace button 2 @brief Interrupt executes an event triggered task */ InterruptIn button2(PTB18); /** @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; float averageDistance; float graphArray[82]; #endif