
Version1
Dependencies: BSP_DISCO_F746NG DHT22
button.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 BUTTON_H |
antoinnneee | 0:d60753bdf6d7 | 2 | #define BUTTON_H |
antoinnneee | 0:d60753bdf6d7 | 3 | #include "stm32746g_discovery_lcd.h" |
antoinnneee | 0:d60753bdf6d7 | 4 | |
antoinnneee | 0:d60753bdf6d7 | 5 | |
antoinnneee | 0:d60753bdf6d7 | 6 | /* |
antoinnneee | 0:d60753bdf6d7 | 7 | Class de bouton customisable en position, taille, fond du bouton et texte |
antoinnneee | 0:d60753bdf6d7 | 8 | */ |
antoinnneee | 0:d60753bdf6d7 | 9 | class Button |
antoinnneee | 0:d60753bdf6d7 | 10 | { |
antoinnneee | 0:d60753bdf6d7 | 11 | |
antoinnneee | 0:d60753bdf6d7 | 12 | public: |
antoinnneee | 0:d60753bdf6d7 | 13 | Button(int x = 50, int y = 50, int width = 50, int height = 30, uint32_t bgColor = LCD_COLOR_LIGHTGRAY, uint32_t borderWidth = 1); |
antoinnneee | 0:d60753bdf6d7 | 14 | void setText(const char *str, uint32_t textColor = LCD_COLOR_BLACK); |
antoinnneee | 0:d60753bdf6d7 | 15 | bool contain(int x, int y); |
antoinnneee | 0:d60753bdf6d7 | 16 | void draw(); |
antoinnneee | 0:d60753bdf6d7 | 17 | int strlen(uint8_t *str); |
antoinnneee | 0:d60753bdf6d7 | 18 | |
antoinnneee | 0:d60753bdf6d7 | 19 | private : |
antoinnneee | 0:d60753bdf6d7 | 20 | int16_t m_x = 0; |
antoinnneee | 0:d60753bdf6d7 | 21 | int16_t m_y = 0; |
antoinnneee | 0:d60753bdf6d7 | 22 | int16_t m_width = 50; |
antoinnneee | 0:d60753bdf6d7 | 23 | int16_t m_height = 30; |
antoinnneee | 0:d60753bdf6d7 | 24 | uint32_t m_bgColor = LCD_COLOR_LIGHTGRAY; |
antoinnneee | 0:d60753bdf6d7 | 25 | uint32_t m_borderColor = LCD_COLOR_GRAY; |
antoinnneee | 0:d60753bdf6d7 | 26 | uint32_t m_textColor = LCD_COLOR_BLACK; |
antoinnneee | 0:d60753bdf6d7 | 27 | uint32_t m_borderWidth = 1; |
antoinnneee | 0:d60753bdf6d7 | 28 | uint8_t m_text[30]; |
antoinnneee | 0:d60753bdf6d7 | 29 | }; |
antoinnneee | 0:d60753bdf6d7 | 30 | #endif |