Hercules
|
#include <mbed.h>
#include "LCD_DISCO_F746NG.h"
#include "TS_DISCO_F746NG.h"
#include "DHT.h"
#include "display.h"
#include <iostream>
#include "stm32746g_discovery_sd.h"
#include "stm32746g_discovery_sdram.h"
#include "rtos.h"
#include "FileSystem.h"
Go to the source code of this file.
Functions | |
Serial | usbCom (USBTX, USBRX) |
DigitalOut | led1 (LED1) |
DigitalOut | led2 (D2) |
DigitalOut | buzzer (D4) |
DHT | dhtSensor (A0, SEN51035P) |
AnalogIn | vibrationSensor (A1) |
AnalogIn | lightSensor (A2) |
AnalogIn | soundSensor (A3) |
void | counterTick () |
Increases the current count or resets when counter_max is hit. More... | |
void | clearDisplay () |
Clears the main display & sets default colors. More... | |
int | earthQuakeDetected () |
Detects earth quakes. Sets the red led to ON/OFF. More... | |
void | displayCurrentHT () |
Displays temperature & humidity (humidity) More... | |
void | displayLightStatus () |
Says "godnat" when dark, "goddag" when light. More... | |
void | noiseWarning () |
Displays a warning when the noise is too much. More... | |
void | displayEarthQuakeStatus () |
Displays current earthquake status. More... | |
void | drawButton (uint16_t xPos, u_int16_t yPos, uint8_t *Text, int dia=10, int xOffset=5, int yOffset=7) |
Draw a round button on screen. More... | |
bool | buttonHit (uint16_t xPos, uint16_t yPos, uint16_t cursor_x, uint16_t cursor_y, uint16_t hitBoxAera=20) |
Checks if a button has been hit. More... | |
void | deviceSetup () |
Initial device setup view. More... | |
void | counter_thread () |
Counter task. More... | |
void | view1 () |
View 1 logic. More... | |
void | view2 () |
View 2 logic. More... | |
void | setView (int viewNumber) |
Set the View object. More... | |
void | switchView () |
Switches the current view. More... | |
void | boot () |
Setup for app. More... | |
void | gui_thread () |
Gui Thread. More... | |
int | main () |
Application entry point. More... | |
Variables | |
LCD_DISCO_F746NG | lcd |
TS_DISCO_F746NG | ts |
int | currentView = 1 |
int | viewCount = 2 |
int | tempScale = 0 |
TS_StateTypeDef | TS_State |
uint16_t | x |
uint16_t | y |
uint8_t | text [30] |
uint8_t | status |
uint8_t | idx |
uint8_t | cleared = 0 |
uint8_t | prev_nb_touches = 0 |
int | counter_max = 9999 |
int | counter_current = 0 |
int | roomNumber |
int | buildingNumber |
Thread | noiseThread |
bool | noiseThreadStarted = false |
int | device_setup_building_no = 0 |
int | device_setup_room_no = 0 |
Thread | counterThread |
bool | counterThreadStarted = false |
Thread | guiThread |
void boot | ( | ) |
Setup for app.
Definition at line 546 of file main.cpp.
References buzzer(), clearDisplay(), lcd, and led1().
Referenced by main().
bool buttonHit | ( | uint16_t | xPos, |
uint16_t | yPos, | ||
uint16_t | cursor_x, | ||
uint16_t | cursor_y, | ||
uint16_t | hitBoxAera = 20 |
||
) |
Checks if a button has been hit.
xPos | |
yPos | |
cursor_x | |
cursor_y | |
hitBoxAera |
Definition at line 263 of file main.cpp.
Referenced by deviceSetup(), and view2().
DigitalOut buzzer | ( | D4 | ) |
void clearDisplay | ( | ) |
Clears the main display & sets default colors.
Definition at line 86 of file main.cpp.
References lcd, LCD_BACKGROUND, LCD_TEXT_BACKGROUND, and LCD_TEXT_COLOR.
Referenced by boot(), gui_thread(), and setView().
void counter_thread | ( | ) |
Counter task.
Definition at line 377 of file main.cpp.
References counterThreadStarted, and counterTick().
Referenced by view1().
void counterTick | ( | ) |
Increases the current count or resets when counter_max is hit.
Definition at line 59 of file main.cpp.
References counter_current, counter_max, currentView, and lcd.
Referenced by counter_thread().
void deviceSetup | ( | ) |
Initial device setup view.
Definition at line 283 of file main.cpp.
References buildingNumber, buttonHit(), cleared, device_setup_building_no, device_setup_room_no, drawButton(), idx, lcd, roomNumber, ts, TS_State, x, and y.
Referenced by gui_thread().
DHT dhtSensor | ( | A0 | , |
SEN51035P | |||
) |
void displayCurrentHT | ( | ) |
void displayEarthQuakeStatus | ( | ) |
Displays current earthquake status.
Definition at line 221 of file main.cpp.
References earthQuakeDetected(), and lcd.
Referenced by view1().
void displayLightStatus | ( | ) |
Says "godnat" when dark, "goddag" when light.
Definition at line 175 of file main.cpp.
References lcd, and lightSensor().
Referenced by view1().
void drawButton | ( | uint16_t | xPos, |
u_int16_t | yPos, | ||
uint8_t * | Text, | ||
int | dia = 10 , |
||
int | xOffset = 5 , |
||
int | yOffset = 7 |
||
) |
Draw a round button on screen.
xPos | |
yPos | |
Text | |
dia | |
xOffset | |
yOffset |
Definition at line 244 of file main.cpp.
References lcd, LCD_BACKGROUND, and LCD_TEXT_BACKGROUND.
Referenced by deviceSetup(), and view2().
int earthQuakeDetected | ( | ) |
Detects earth quakes. Sets the red led to ON/OFF.
Definition at line 109 of file main.cpp.
References led2(), and vibrationSensor().
Referenced by displayEarthQuakeStatus().
void gui_thread | ( | ) |
Gui Thread.
Definition at line 577 of file main.cpp.
References buildingNumber, clearDisplay(), cleared, currentView, deviceSetup(), idx, lcd, LCD_BACKGROUND, LCD_TEXT_BACKGROUND, roomNumber, setView(), switchView(), ts, TS_State, x, and y.
Referenced by main().
DigitalOut led1 | ( | LED1 | ) |
DigitalOut led2 | ( | D2 | ) |
AnalogIn lightSensor | ( | A2 | ) |
int main | ( | ) |
Application entry point.
Definition at line 662 of file main.cpp.
References boot(), gui_thread(), and guiThread.
void noiseWarning | ( | ) |
Displays a warning when the noise is too much.
Definition at line 196 of file main.cpp.
References currentView, lcd, LCD_BACKGROUND, LCD_TEXT_BACKGROUND, noiseThreadStarted, and soundSensor().
Referenced by view1().
void setView | ( | int | viewNumber | ) |
Set the View object.
viewNumber |
Definition at line 486 of file main.cpp.
References clearDisplay(), cleared, currentView, usbCom(), view1(), and view2().
Referenced by gui_thread(), and switchView().
AnalogIn soundSensor | ( | A3 | ) |
void switchView | ( | ) |
Switches the current view.
Definition at line 519 of file main.cpp.
References currentView, setView(), usbCom(), and viewCount.
Referenced by gui_thread().
Serial usbCom | ( | USBTX | , |
USBRX | |||
) |
AnalogIn vibrationSensor | ( | A1 | ) |
void view1 | ( | ) |
View 1 logic.
Definition at line 391 of file main.cpp.
References counter_thread(), counterThread, counterThreadStarted, displayCurrentHT(), displayEarthQuakeStatus(), displayLightStatus(), noiseThread, noiseThreadStarted, and noiseWarning().
Referenced by setView().
void view2 | ( | ) |
View 2 logic.
Definition at line 416 of file main.cpp.
References buttonHit(), drawButton(), idx, lcd, tempScale, ts, TS_State, usbCom(), x, and y.
Referenced by setView().
int buildingNumber |
Definition at line 53 of file main.cpp.
Referenced by deviceSetup(), and gui_thread().
uint8_t cleared = 0 |
Definition at line 45 of file main.cpp.
Referenced by deviceSetup(), gui_thread(), and setView().
int counter_current = 0 |
Definition at line 50 of file main.cpp.
Referenced by counterTick().
int counter_max = 9999 |
Definition at line 49 of file main.cpp.
Referenced by counterTick().
bool counterThreadStarted = false |
Definition at line 371 of file main.cpp.
Referenced by counter_thread(), and view1().
int currentView = 1 |
Definition at line 34 of file main.cpp.
Referenced by counterTick(), gui_thread(), noiseWarning(), setView(), and switchView().
int device_setup_building_no = 0 |
Definition at line 231 of file main.cpp.
Referenced by deviceSetup().
int device_setup_room_no = 0 |
Definition at line 232 of file main.cpp.
Referenced by deviceSetup().
uint8_t idx |
Definition at line 44 of file main.cpp.
Referenced by deviceSetup(), gui_thread(), and view2().
LCD_DISCO_F746NG lcd |
Definition at line 16 of file main.cpp.
Referenced by boot(), clearDisplay(), counterTick(), deviceSetup(), displayCurrentHT(), displayEarthQuakeStatus(), displayLightStatus(), drawButton(), gui_thread(), noiseWarning(), and view2().
bool noiseThreadStarted = false |
Definition at line 190 of file main.cpp.
Referenced by noiseWarning(), and view1().
int roomNumber |
Definition at line 52 of file main.cpp.
Referenced by deviceSetup(), and gui_thread().
int tempScale = 0 |
Definition at line 37 of file main.cpp.
Referenced by displayCurrentHT(), and view2().
uint8_t text[30] |
Definition at line 42 of file main.cpp.
Referenced by Display::String().
TS_DISCO_F746NG ts |
Definition at line 18 of file main.cpp.
Referenced by deviceSetup(), gui_thread(), and view2().
TS_StateTypeDef TS_State |
Definition at line 40 of file main.cpp.
Referenced by deviceSetup(), gui_thread(), and view2().
int viewCount = 2 |
Definition at line 35 of file main.cpp.
Referenced by switchView().
uint16_t x |
Definition at line 41 of file main.cpp.
Referenced by deviceSetup(), gui_thread(), and view2().
uint16_t y |
Definition at line 41 of file main.cpp.
Referenced by deviceSetup(), gui_thread(), and view2().