LCD implementation of our project.
Dependencies: mbed mbed-rtos MLX90614
UserInterface.h@3:688b62ff6474, 2015-04-26 (annotated)
- Committer:
- ovidiup13
- Date:
- Sun Apr 26 16:29:53 2015 +0000
- Revision:
- 3:688b62ff6474
- Parent:
- 2:fcde41900fa5
- Child:
- 4:024e6a9c2ebf
added screens for interacting with other components. i.e. distance, thermo, gyro, compass, etc. Need to complete settings screen and create threads for interacting with other code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ovidiup13 | 0:1e597b0f8b3b | 1 | #ifndef _UI_H_ |
ovidiup13 | 0:1e597b0f8b3b | 2 | #define _UI_H_ |
ovidiup13 | 0:1e597b0f8b3b | 3 | |
ovidiup13 | 3:688b62ff6474 | 4 | //include files |
ovidiup13 | 3:688b62ff6474 | 5 | #include "st7565LCD.h" |
ovidiup13 | 3:688b62ff6474 | 6 | #include "Header.h" |
ovidiup13 | 3:688b62ff6474 | 7 | #include "Item.h" |
ovidiup13 | 3:688b62ff6474 | 8 | #include "Menu.h" |
ovidiup13 | 3:688b62ff6474 | 9 | #include "Compass.h" |
ovidiup13 | 3:688b62ff6474 | 10 | #include "LevelMeter.h" |
ovidiup13 | 3:688b62ff6474 | 11 | #include "Measure.h" |
ovidiup13 | 3:688b62ff6474 | 12 | |
ovidiup13 | 3:688b62ff6474 | 13 | //include libs |
ovidiup13 | 0:1e597b0f8b3b | 14 | #include <string.h> |
ovidiup13 | 0:1e597b0f8b3b | 15 | #include <assert.h> |
ovidiup13 | 0:1e597b0f8b3b | 16 | #include <stdio.h> |
ovidiup13 | 0:1e597b0f8b3b | 17 | #include <stdlib.h> |
ovidiup13 | 0:1e597b0f8b3b | 18 | |
ovidiup13 | 0:1e597b0f8b3b | 19 | //define brightness and contrast |
ovidiup13 | 0:1e597b0f8b3b | 20 | #define _DEFAULT_BRIGHTNESS 25 |
ovidiup13 | 0:1e597b0f8b3b | 21 | #define _DEFAULT_CONTRAST 20 |
ovidiup13 | 0:1e597b0f8b3b | 22 | #define _MAX_BRIGHTNESS 200 |
ovidiup13 | 0:1e597b0f8b3b | 23 | #define _MIN_BRIGHTNESS 10 |
ovidiup13 | 0:1e597b0f8b3b | 24 | |
ovidiup13 | 0:1e597b0f8b3b | 25 | //define default color |
ovidiup13 | 0:1e597b0f8b3b | 26 | #define _DEFAULT_COLOR 20 |
ovidiup13 | 0:1e597b0f8b3b | 27 | |
ovidiup13 | 0:1e597b0f8b3b | 28 | using namespace std; |
ovidiup13 | 0:1e597b0f8b3b | 29 | |
ovidiup13 | 0:1e597b0f8b3b | 30 | class Item; |
ovidiup13 | 0:1e597b0f8b3b | 31 | |
ovidiup13 | 0:1e597b0f8b3b | 32 | class UI { |
ovidiup13 | 0:1e597b0f8b3b | 33 | public: |
ovidiup13 | 0:1e597b0f8b3b | 34 | //variables |
ovidiup13 | 0:1e597b0f8b3b | 35 | //current selected menu |
ovidiup13 | 0:1e597b0f8b3b | 36 | Item * current; |
ovidiup13 | 0:1e597b0f8b3b | 37 | //header object |
ovidiup13 | 0:1e597b0f8b3b | 38 | Header * header; |
ovidiup13 | 0:1e597b0f8b3b | 39 | //display pointer |
ovidiup13 | 0:1e597b0f8b3b | 40 | ST7565 * st7565; |
ovidiup13 | 0:1e597b0f8b3b | 41 | |
ovidiup13 | 0:1e597b0f8b3b | 42 | //functions |
ovidiup13 | 0:1e597b0f8b3b | 43 | //initialize display |
ovidiup13 | 0:1e597b0f8b3b | 44 | |
ovidiup13 | 0:1e597b0f8b3b | 45 | void init(void); |
ovidiup13 | 0:1e597b0f8b3b | 46 | //set colors |
ovidiup13 | 0:1e597b0f8b3b | 47 | void set_colors(float r, float g, float b, float aa); |
ovidiup13 | 0:1e597b0f8b3b | 48 | //update all screen |
ovidiup13 | 0:1e597b0f8b3b | 49 | void update(char c); |
ovidiup13 | 0:1e597b0f8b3b | 50 | //update header only |
ovidiup13 | 0:1e597b0f8b3b | 51 | void display(void); |
ovidiup13 | 0:1e597b0f8b3b | 52 | //update current menu |
ovidiup13 | 0:1e597b0f8b3b | 53 | void setCurrent(Item * item){ |
ovidiup13 | 0:1e597b0f8b3b | 54 | current = item; |
ovidiup13 | 0:1e597b0f8b3b | 55 | } |
ovidiup13 | 0:1e597b0f8b3b | 56 | //set header |
ovidiup13 | 0:1e597b0f8b3b | 57 | void setHeader(Header * h){ |
ovidiup13 | 0:1e597b0f8b3b | 58 | header = h; |
ovidiup13 | 0:1e597b0f8b3b | 59 | } |
ovidiup13 | 2:fcde41900fa5 | 60 | //set header title |
ovidiup13 | 2:fcde41900fa5 | 61 | void setHeaderTitle(char * title){ |
ovidiup13 | 2:fcde41900fa5 | 62 | header->title = title; |
ovidiup13 | 2:fcde41900fa5 | 63 | } |
ovidiup13 | 0:1e597b0f8b3b | 64 | |
ovidiup13 | 0:1e597b0f8b3b | 65 | UI(ST7565 *lcd){ |
ovidiup13 | 0:1e597b0f8b3b | 66 | current = NULL; |
ovidiup13 | 0:1e597b0f8b3b | 67 | header = NULL; |
ovidiup13 | 0:1e597b0f8b3b | 68 | st7565 = lcd; |
ovidiup13 | 0:1e597b0f8b3b | 69 | } |
ovidiup13 | 0:1e597b0f8b3b | 70 | }; |
ovidiup13 | 0:1e597b0f8b3b | 71 | |
ovidiup13 | 0:1e597b0f8b3b | 72 | #endif |