LCD implementation of our project.
Dependencies: mbed mbed-rtos MLX90614
UserInterface.h@7:11675c1dce4f, 2015-06-03 (annotated)
- Committer:
- ovidiup13
- Date:
- Wed Jun 03 12:22:46 2015 +0000
- Revision:
- 7:11675c1dce4f
- Parent:
- 6:49a007861c76
- Child:
- 8:81ed1135ba02
updated header, cleaned up menu, fixed controls for device
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 | 6:49a007861c76 | 28 | //define mbed pins |
ovidiup13 | 7:11675c1dce4f | 29 | #define _MOSI p5 |
ovidiup13 | 7:11675c1dce4f | 30 | #define _SCLK p7 |
ovidiup13 | 6:49a007861c76 | 31 | #define _RST p24 |
ovidiup13 | 6:49a007861c76 | 32 | #define _A0 p8 |
ovidiup13 | 7:11675c1dce4f | 33 | #define _CS p6 |
ovidiup13 | 6:49a007861c76 | 34 | |
ovidiup13 | 0:1e597b0f8b3b | 35 | using namespace std; |
ovidiup13 | 0:1e597b0f8b3b | 36 | |
ovidiup13 | 0:1e597b0f8b3b | 37 | class Item; |
ovidiup13 | 0:1e597b0f8b3b | 38 | |
ovidiup13 | 0:1e597b0f8b3b | 39 | class UI { |
ovidiup13 | 0:1e597b0f8b3b | 40 | public: |
ovidiup13 | 0:1e597b0f8b3b | 41 | |
ovidiup13 | 0:1e597b0f8b3b | 42 | //functions |
ovidiup13 | 0:1e597b0f8b3b | 43 | void init(void); |
ovidiup13 | 0:1e597b0f8b3b | 44 | //update all screen |
ovidiup13 | 0:1e597b0f8b3b | 45 | void update(char c); |
ovidiup13 | 0:1e597b0f8b3b | 46 | //update header only |
ovidiup13 | 0:1e597b0f8b3b | 47 | void display(void); |
ovidiup13 | 0:1e597b0f8b3b | 48 | //update current menu |
ovidiup13 | 0:1e597b0f8b3b | 49 | void setCurrent(Item * item){ |
ovidiup13 | 0:1e597b0f8b3b | 50 | current = item; |
ovidiup13 | 0:1e597b0f8b3b | 51 | } |
ovidiup13 | 0:1e597b0f8b3b | 52 | //set header |
ovidiup13 | 0:1e597b0f8b3b | 53 | void setHeader(Header * h){ |
ovidiup13 | 0:1e597b0f8b3b | 54 | header = h; |
ovidiup13 | 0:1e597b0f8b3b | 55 | } |
ovidiup13 | 2:fcde41900fa5 | 56 | //set header title |
ovidiup13 | 2:fcde41900fa5 | 57 | void setHeaderTitle(char * title){ |
ovidiup13 | 4:024e6a9c2ebf | 58 | header->setTitle(title); |
ovidiup13 | 2:fcde41900fa5 | 59 | } |
ovidiup13 | 0:1e597b0f8b3b | 60 | |
ovidiup13 | 0:1e597b0f8b3b | 61 | UI(ST7565 *lcd){ |
ovidiup13 | 0:1e597b0f8b3b | 62 | current = NULL; |
ovidiup13 | 0:1e597b0f8b3b | 63 | header = NULL; |
ovidiup13 | 0:1e597b0f8b3b | 64 | st7565 = lcd; |
ovidiup13 | 0:1e597b0f8b3b | 65 | } |
ovidiup13 | 4:024e6a9c2ebf | 66 | |
ovidiup13 | 4:024e6a9c2ebf | 67 | private: |
ovidiup13 | 4:024e6a9c2ebf | 68 | //variables |
ovidiup13 | 4:024e6a9c2ebf | 69 | //current selected menu |
ovidiup13 | 4:024e6a9c2ebf | 70 | Item * current; |
ovidiup13 | 4:024e6a9c2ebf | 71 | //header object |
ovidiup13 | 4:024e6a9c2ebf | 72 | Header * header; |
ovidiup13 | 4:024e6a9c2ebf | 73 | //display pointer |
ovidiup13 | 4:024e6a9c2ebf | 74 | ST7565 * st7565; |
ovidiup13 | 4:024e6a9c2ebf | 75 | //set colors |
ovidiup13 | 4:024e6a9c2ebf | 76 | void set_colors(float r, float g, float b, float aa); |
ovidiup13 | 0:1e597b0f8b3b | 77 | }; |
ovidiup13 | 0:1e597b0f8b3b | 78 | |
ovidiup13 | 0:1e597b0f8b3b | 79 | #endif |