Dependencies:
N5110-JDB
SRF02
SoftPWM-JDB
TMP102
mbed
« Back to documentation index
main.cpp File Reference
Program Implementation.
More...
Go to the source code of this file.
Functions
void clearAll ()
Function clears the buffer - Any text or set pixels on the screen.
void init_K64F ()
Initialises the Nokia Screen by setting various parameters (i.e Button Pull-Ups/Downs and RGB LEDs).
void init_buzzer ()
Initialises the Piezo Buzzer by setting various parameters (i.e Initial Period and Duty Cycle).
void init_program ()
Initialises all other aspects surrounding the programme.
void welcomeScreen ()
Contains strings which display an introductory message on the screen before the programme begins.
int getCursorPosition ()
Reads value of Potentiometer ('controller') and assigns it to a Bank (0-5) through Multiplication.
void printCursorPositionMain (int cursor)
Prints the Position of the Cursor - Used in the Main and Sensor Menus Only.
void printCursorPositionOptions (int cursor, int stateOfLED , int stateOfSound )
Prints the Position of the Cursor - Used in the OptionsOnly.
void mainMenu ()
Function for displaying text and navigating around the Main Menu (Sensors/Options).
void sensorMenu ()
Function for displaying text and navigating around the Sensor Menu (Distance/Temperature).
void optionsMenu ()
Function for displaying text and navigating around the Options Menu (LEDs/Sound/Colour).
void distanceDisplay ()
Function for displaying the output from the distance sensor numerically and graphically.
void temperatureDisplay ()
Function for displaying the output from the temperature sensor numerically and graphically.
bool toggleLEDs ()
After the 'forward' Button is pressed - Checks the status of a 'Trigger' (triggerLEDs).
bool toggleSound ()
After the 'forward' Button is pressed - Checks the status of a 'Trigger' (triggerSound).
void toggleColour ()
After the 'forward' Button is pressed - Checks the status of a 'Trigger' (triggerColour).
void allLEDOn ()
Turns all LEDs ON.
void allLEDOff ()
Turns all LEDs OFF.
void LEDs_Flashing ()
Uses Software PWM to cause the Red/Yellow/Green LEDs to flash at a specified period.
void cancel_LEDs_Flashing ()
Uses Software PWM to cause the Red/Yellow/Green LEDs to stop flashing.
void LEDs_Distance (int d)
Function for turning ON/OFF LEDs depending on the distance from the SRF02 Sensor.
void LEDs_Temperature (int t)
Function for turning ON/OFF LEDs depending on the temperature from the TMP102 Sensor.
void buzzerOn ()
Turns ON the Piezo and its outputs a constant noise.
void buzzerClose ()
Turns ON the Piezo and uses a period that simulates being 'close' to an object - Highly freqeuent bleeps.
void buzzerNormal ()
Turns ON the Piezo and uses a period that simulates being a 'safe, normal' distance - Moderately frequent bleeps.
void buzzerFar ()
Turns ON the Piezo and uses a period that simulates being 'far away' - Less frequent bleeps.
void returnToMenu ()
Returns the programme back to the Main Menu from any screen when the 'backward' Button is pressed.
void system_isr ()
ISR Function for the 'systemTicker' Flag (ISR = Interrupt Service Routine).
void forward_isr ()
ISR Function for the 'forward' Button InterruptIn (ISR = Interrupt Service Routine).
void backward_isr ()
ISR Function for the 'backward' Button InterruptIn (ISR = Interrupt Service Routine).
Detailed Description
Program Implementation.
Definition in file main.cpp .
Function Documentation
Turns all LEDs OFF.
Definition at line 514 of file main.cpp .
Turns all LEDs ON.
Definition at line 506 of file main.cpp .
ISR Function for the 'backward' Button InterruptIn (ISR = Interrupt Service Routine).
Definition at line 671 of file main.cpp .
Turns ON the Piezo and uses a period that simulates being 'close' to an object - Highly freqeuent bleeps.
Definition at line 618 of file main.cpp .
Turns ON the Piezo and uses a period that simulates being 'far away' - Less frequent bleeps.
Definition at line 634 of file main.cpp .
Turns ON the Piezo and uses a period that simulates being a 'safe, normal' distance - Moderately frequent bleeps.
Definition at line 626 of file main.cpp .
Turns ON the Piezo and its outputs a constant noise.
Definition at line 611 of file main.cpp .
void cancel_LEDs_Flashing
(
)
Uses Software PWM to cause the Red/Yellow/Green LEDs to stop flashing.
Called in order to explicitly tell the K64F to stop using SoftPWM.
Definition at line 534 of file main.cpp .
Function clears the buffer - Any text or set pixels on the screen.
Definition at line 71 of file main.cpp .
Function for displaying the output from the distance sensor numerically and graphically.
Definition at line 344 of file main.cpp .
ISR Function for the 'forward' Button InterruptIn (ISR = Interrupt Service Routine).
Definition at line 665 of file main.cpp .
int getCursorPosition
(
)
Reads value of Potentiometer ('controller') and assigns it to a Bank (0-5) through Multiplication.
Ensures that cursor is always set to a Bank - Anything greater than 5 is set to Bank 5.
Definition at line 155 of file main.cpp .
Initialises the Piezo Buzzer by setting various parameters (i.e Initial Period and Duty Cycle).
Definition at line 99 of file main.cpp .
Initialises the Nokia Screen by setting various parameters (i.e Button Pull-Ups/Downs and RGB LEDs).
Definition at line 82 of file main.cpp .
Initialises all other aspects surrounding the programme.
Definition at line 106 of file main.cpp .
void LEDs_Distance
(
int
d )
Function for turning ON/OFF LEDs depending on the distance from the SRF02 Sensor.
Definition at line 546 of file main.cpp .
Uses Software PWM to cause the Red/Yellow/Green LEDs to flash at a specified period.
Used with the Distance Sensor when the distance value is below 15 cm.
Returns: Bank - Value of Bank (0-5)
Definition at line 522 of file main.cpp .
void LEDs_Temperature
(
int
t )
Function for turning ON/OFF LEDs depending on the temperature from the TMP102 Sensor.
Definition at line 580 of file main.cpp .
Function for displaying text and navigating around the Main Menu (Sensors/Options).
Definition at line 195 of file main.cpp .
Function for displaying text and navigating around the Options Menu (LEDs/Sound/Colour).
Definition at line 289 of file main.cpp .
void printCursorPositionMain
(
int
cursor )
Prints the Position of the Cursor - Used in the Main and Sensor Menus Only.
The function must be used in conjuction with 'getCursorPosition'.
Parameters:
cursor - The 'Bank' Number (0-5) is written to it
Definition at line 168 of file main.cpp .
void printCursorPositionOptions
(
int
cursor ,
int
stateOfLEDTrigger ,
int
stateOfSoundTrigger
)
Prints the Position of the Cursor - Used in the OptionsOnly.
The function must be used in conjuction with 'getCursorPosition'.
Parameters:
cursor - The 'Bank' Number (0-5) is written to it
stateOfLEDTrigger - Check LED Trigger for 1 or 0
stateOfSoundTrigger - Check Sound Trigger for 1 or 0
Definition at line 182 of file main.cpp .
Returns the programme back to the Main Menu from any screen when the 'backward' Button is pressed.
Definition at line 644 of file main.cpp .
Function for displaying text and navigating around the Sensor Menu (Distance/Temperature).
Definition at line 243 of file main.cpp .
ISR Function for the 'systemTicker' Flag (ISR = Interrupt Service Routine).
Definition at line 659 of file main.cpp .
void temperatureDisplay
(
)
Function for displaying the output from the temperature sensor numerically and graphically.
Definition at line 420 of file main.cpp .
After the 'forward' Button is pressed - Checks the status of a 'Trigger' (triggerColour).
Depending on Trigger status, it changes the colour of the screen: Black-on-White or White-on-Black
Definition at line 492 of file main.cpp .
After the 'forward' Button is pressed - Checks the status of a 'Trigger' (triggerLEDs).
Depending on Trigger status, it prevents or enables the LEDs from illuminating in the programme.
Returns: 'stateOfLED' - A 1 or 0 which is used to either fill or unfill the Cursor.
Definition at line 461 of file main.cpp .
After the 'forward' Button is pressed - Checks the status of a 'Trigger' (triggerSound).
Depending on Trigger status, it prevents or enables the Piezo from sounding in the programme.
Returns: 'stateOfSound' - A 1 or 0 which is used to either fill or unfill the Cursor.
Definition at line 476 of file main.cpp .
Contains strings which display an introductory message on the screen before the programme begins.
Definition at line 115 of file main.cpp .