LCD implementation of our project.
Dependencies: mbed mbed-rtos MLX90614
UserInterface.h@2:fcde41900fa5, 2015-04-04 (annotated)
- Committer:
- ovidiup13
- Date:
- Sat Apr 04 18:24:21 2015 +0000
- Revision:
- 2:fcde41900fa5
- Parent:
- 0:1e597b0f8b3b
- Child:
- 3:688b62ff6474
Cleaned up interface, added buttons.
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 | 0:1e597b0f8b3b | 4 | #include <string.h> |
ovidiup13 | 0:1e597b0f8b3b | 5 | #include <assert.h> |
ovidiup13 | 0:1e597b0f8b3b | 6 | #include <stdio.h> |
ovidiup13 | 0:1e597b0f8b3b | 7 | #include <stdlib.h> |
ovidiup13 | 0:1e597b0f8b3b | 8 | #include "st7565LCD.h" |
ovidiup13 | 0:1e597b0f8b3b | 9 | #include "Header.h" |
ovidiup13 | 0:1e597b0f8b3b | 10 | #include "Item.h" |
ovidiup13 | 0:1e597b0f8b3b | 11 | #include "Menu.h" |
ovidiup13 | 0:1e597b0f8b3b | 12 | |
ovidiup13 | 0:1e597b0f8b3b | 13 | //define brightness and contrast |
ovidiup13 | 0:1e597b0f8b3b | 14 | #define _DEFAULT_BRIGHTNESS 25 |
ovidiup13 | 0:1e597b0f8b3b | 15 | #define _DEFAULT_CONTRAST 20 |
ovidiup13 | 0:1e597b0f8b3b | 16 | #define _MAX_BRIGHTNESS 200 |
ovidiup13 | 0:1e597b0f8b3b | 17 | #define _MIN_BRIGHTNESS 10 |
ovidiup13 | 0:1e597b0f8b3b | 18 | |
ovidiup13 | 0:1e597b0f8b3b | 19 | //define default color |
ovidiup13 | 0:1e597b0f8b3b | 20 | #define _DEFAULT_COLOR 20 |
ovidiup13 | 0:1e597b0f8b3b | 21 | |
ovidiup13 | 0:1e597b0f8b3b | 22 | using namespace std; |
ovidiup13 | 0:1e597b0f8b3b | 23 | |
ovidiup13 | 0:1e597b0f8b3b | 24 | class Item; |
ovidiup13 | 0:1e597b0f8b3b | 25 | |
ovidiup13 | 0:1e597b0f8b3b | 26 | class UI { |
ovidiup13 | 0:1e597b0f8b3b | 27 | public: |
ovidiup13 | 0:1e597b0f8b3b | 28 | //variables |
ovidiup13 | 0:1e597b0f8b3b | 29 | //current selected menu |
ovidiup13 | 0:1e597b0f8b3b | 30 | Item * current; |
ovidiup13 | 0:1e597b0f8b3b | 31 | //header object |
ovidiup13 | 0:1e597b0f8b3b | 32 | Header * header; |
ovidiup13 | 0:1e597b0f8b3b | 33 | //display pointer |
ovidiup13 | 0:1e597b0f8b3b | 34 | ST7565 * st7565; |
ovidiup13 | 0:1e597b0f8b3b | 35 | |
ovidiup13 | 0:1e597b0f8b3b | 36 | //functions |
ovidiup13 | 0:1e597b0f8b3b | 37 | //initialize display |
ovidiup13 | 0:1e597b0f8b3b | 38 | |
ovidiup13 | 0:1e597b0f8b3b | 39 | void init(void); |
ovidiup13 | 0:1e597b0f8b3b | 40 | //set colors |
ovidiup13 | 0:1e597b0f8b3b | 41 | void set_colors(float r, float g, float b, float aa); |
ovidiup13 | 0:1e597b0f8b3b | 42 | //update all screen |
ovidiup13 | 0:1e597b0f8b3b | 43 | void update(char c); |
ovidiup13 | 0:1e597b0f8b3b | 44 | //update header only |
ovidiup13 | 0:1e597b0f8b3b | 45 | void display(void); |
ovidiup13 | 0:1e597b0f8b3b | 46 | //update current menu |
ovidiup13 | 0:1e597b0f8b3b | 47 | void setCurrent(Item * item){ |
ovidiup13 | 0:1e597b0f8b3b | 48 | current = item; |
ovidiup13 | 0:1e597b0f8b3b | 49 | } |
ovidiup13 | 0:1e597b0f8b3b | 50 | //set header |
ovidiup13 | 0:1e597b0f8b3b | 51 | void setHeader(Header * h){ |
ovidiup13 | 0:1e597b0f8b3b | 52 | header = h; |
ovidiup13 | 0:1e597b0f8b3b | 53 | } |
ovidiup13 | 2:fcde41900fa5 | 54 | //set header title |
ovidiup13 | 2:fcde41900fa5 | 55 | void setHeaderTitle(char * title){ |
ovidiup13 | 2:fcde41900fa5 | 56 | header->title = title; |
ovidiup13 | 2:fcde41900fa5 | 57 | } |
ovidiup13 | 0:1e597b0f8b3b | 58 | |
ovidiup13 | 0:1e597b0f8b3b | 59 | UI(ST7565 *lcd){ |
ovidiup13 | 0:1e597b0f8b3b | 60 | current = NULL; |
ovidiup13 | 0:1e597b0f8b3b | 61 | header = NULL; |
ovidiup13 | 0:1e597b0f8b3b | 62 | st7565 = lcd; |
ovidiup13 | 0:1e597b0f8b3b | 63 | } |
ovidiup13 | 0:1e597b0f8b3b | 64 | }; |
ovidiup13 | 0:1e597b0f8b3b | 65 | |
ovidiup13 | 0:1e597b0f8b3b | 66 | #endif |