
Version1
Dependencies: BSP_DISCO_F746NG DHT22
gauge.h@0:d60753bdf6d7, 2020-06-22 (annotated)
- Committer:
- antoinnneee
- Date:
- Mon Jun 22 15:16:28 2020 +0000
- Revision:
- 0:d60753bdf6d7
FirstCommit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
antoinnneee | 0:d60753bdf6d7 | 1 | #ifndef GAUGE_H |
antoinnneee | 0:d60753bdf6d7 | 2 | #define GAUGE_H |
antoinnneee | 0:d60753bdf6d7 | 3 | #include "mbed.h" |
antoinnneee | 0:d60753bdf6d7 | 4 | #include "stm32746g_discovery_lcd.h" |
antoinnneee | 0:d60753bdf6d7 | 5 | #include <list> |
antoinnneee | 0:d60753bdf6d7 | 6 | |
antoinnneee | 0:d60753bdf6d7 | 7 | class Gauge |
antoinnneee | 0:d60753bdf6d7 | 8 | { |
antoinnneee | 0:d60753bdf6d7 | 9 | public: |
antoinnneee | 0:d60753bdf6d7 | 10 | Gauge(int x = 50, int y = 50, int width = 25, int height = 100, uint32_t bgColor = LCD_COLOR_LIGHTGRAY, uint32_t borderWidth = 1); |
antoinnneee | 0:d60753bdf6d7 | 11 | void setLimit(int low, int high); |
antoinnneee | 0:d60753bdf6d7 | 12 | void setText(const char *str); |
antoinnneee | 0:d60753bdf6d7 | 13 | void setColorType(uint8_t type); |
antoinnneee | 0:d60753bdf6d7 | 14 | void setValue(int value); |
antoinnneee | 0:d60753bdf6d7 | 15 | |
antoinnneee | 0:d60753bdf6d7 | 16 | uint32_t getColor(uint32_t position); |
antoinnneee | 0:d60753bdf6d7 | 17 | int8_t getGaugePercentValue(int value); |
antoinnneee | 0:d60753bdf6d7 | 18 | int8_t getGaugePercentPosition(int value); |
antoinnneee | 0:d60753bdf6d7 | 19 | int16_t getValue(){return m_value;} |
antoinnneee | 0:d60753bdf6d7 | 20 | |
antoinnneee | 0:d60753bdf6d7 | 21 | void draw(); |
antoinnneee | 0:d60753bdf6d7 | 22 | void drawBorder(); |
antoinnneee | 0:d60753bdf6d7 | 23 | |
antoinnneee | 0:d60753bdf6d7 | 24 | void printValue(); |
antoinnneee | 0:d60753bdf6d7 | 25 | void printText(); |
antoinnneee | 0:d60753bdf6d7 | 26 | void printRange(); |
antoinnneee | 0:d60753bdf6d7 | 27 | |
antoinnneee | 0:d60753bdf6d7 | 28 | int strlen(uint8_t *str); |
antoinnneee | 0:d60753bdf6d7 | 29 | |
antoinnneee | 0:d60753bdf6d7 | 30 | void contain(int x, int y); |
antoinnneee | 0:d60753bdf6d7 | 31 | |
antoinnneee | 0:d60753bdf6d7 | 32 | private : |
antoinnneee | 0:d60753bdf6d7 | 33 | uint32_t m_bgColor = LCD_COLOR_LIGHTGRAY; |
antoinnneee | 0:d60753bdf6d7 | 34 | uint32_t m_borderColor = LCD_COLOR_GRAY; |
antoinnneee | 0:d60753bdf6d7 | 35 | uint32_t m_borderWidth = 1; |
antoinnneee | 0:d60753bdf6d7 | 36 | int16_t m_x = 0; |
antoinnneee | 0:d60753bdf6d7 | 37 | int16_t m_y = 0; |
antoinnneee | 0:d60753bdf6d7 | 38 | int16_t m_width = 25; |
antoinnneee | 0:d60753bdf6d7 | 39 | int16_t m_height = 150; |
antoinnneee | 0:d60753bdf6d7 | 40 | int16_t m_value = 20; |
antoinnneee | 0:d60753bdf6d7 | 41 | int16_t m_limLow = 10; |
antoinnneee | 0:d60753bdf6d7 | 42 | int16_t m_limHigh = 35; |
antoinnneee | 0:d60753bdf6d7 | 43 | int16_t m_delta = 0; |
antoinnneee | 0:d60753bdf6d7 | 44 | int16_t m_offset = 0; |
antoinnneee | 0:d60753bdf6d7 | 45 | char textValue[6]; |
antoinnneee | 0:d60753bdf6d7 | 46 | char tValue[6]; |
antoinnneee | 0:d60753bdf6d7 | 47 | uint8_t m_text[30]; |
antoinnneee | 0:d60753bdf6d7 | 48 | uint8_t m_colorType = 0; |
antoinnneee | 0:d60753bdf6d7 | 49 | }; |
antoinnneee | 0:d60753bdf6d7 | 50 | |
antoinnneee | 0:d60753bdf6d7 | 51 | #endif |