Interfaçage NeoPixel Ring 12, LPRO MECSE, Arnaud A.
Diff: view.h
- Revision:
- 1:9bcbc2be6d52
- Parent:
- 0:ebadb4efd479
--- a/view.h Wed Jun 17 16:33:34 2020 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -#ifndef VIEW_H -#define VIEW_H -#include "mbed.h" -#include "button.h" -#include "stm32746g_discovery_lcd.h" -#include "stm32746g_discovery_ts.h" -#include <list> -#include <stdlib.h> -#define SCREENWIDTH 480 -#define SCREENHEIGHT 272 -#define LED_BUTTON_SIZE 40 -#define RGB_TEXT_VIEW_WIDTH 30 -#define RGB_TEXT_VIEW_HEIGHT 15 -#define PLUS_MINUS_BUTTON_SIZE 30 -#define ANIMATION_BUTTON_WIDTH 80 -#define ANIMATION_BUTTON_HEIGHT 15 -#define LIGHT_GRAY (uint32_t)0xFFe0e0d1 - - -class View -{ -public: - View(int width = SCREENWIDTH, int height = SCREENHEIGHT); - void contain(int x, int y); - void draw(); - void updateLCD(); - bool updatePlusMinus(Button* button); - bool updateLEDS(Button* button); - bool updateSetNewColorAndCancel(Button* button); - void initView(); - ~View(); - - -private : - void drawText(); - int16_t m_width = SCREENWIDTH; - int16_t m_height = SCREENHEIGHT; - uint32_t m_bgColor = LCD_COLOR_WHITE; - list<Button *> m_buttonList; - TS_StateTypeDef TS_State; - uint16_t x, y; - uint8_t idx; - bool screenReleased=false; - bool cleared = false; - uint8_t RGB[3]={0x00, 0x00, 0x00}; - char str[10]; - bool ledSelected[12]={false, false, false, false, - false, false, false, false, - false, false, false, false}; - //LEDS buttons - Button *led0 = new Button(300, 5, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_BLACK, LCD_COLOR_WHITE); - Button *led1 = new Button(353, 20, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_BLACK, LCD_COLOR_WHITE); - Button *led2 = new Button(397, 65, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_BLACK, LCD_COLOR_WHITE); - Button *led3 = new Button(410, 118, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_BLACK, LCD_COLOR_WHITE); - Button *led4 = new Button(396, 170, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_BLACK, LCD_COLOR_WHITE); - Button *led5 = new Button(354, 212, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_BLACK, LCD_COLOR_WHITE); - Button *led6 = new Button(300, 227, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_BLACK, LCD_COLOR_WHITE); - Button *led7 = new Button(245, 212, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_BLACK, LCD_COLOR_WHITE); - Button *led8 = new Button(204, 170, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_BLACK, LCD_COLOR_WHITE); - Button *led9 = new Button(190, 118, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_BLACK, LCD_COLOR_WHITE); - Button *led10 = new Button(203, 62, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_BLACK, LCD_COLOR_WHITE); - Button *led11 = new Button(245, 20, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_BLACK, LCD_COLOR_WHITE); - //RGB TextView - Button *redTextview = new Button(90, 38, RGB_TEXT_VIEW_WIDTH, RGB_TEXT_VIEW_HEIGHT, LCD_COLOR_RED); - Button *greenTextview = new Button(90, 128, RGB_TEXT_VIEW_WIDTH, RGB_TEXT_VIEW_HEIGHT, LCD_COLOR_GREEN); - Button *blueTextview = new Button(90, 218, RGB_TEXT_VIEW_WIDTH, RGB_TEXT_VIEW_HEIGHT, LCD_COLOR_BLUE); - //RGB + and - - Button *plusRED = new Button(185-130, 8, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); - Button *minusRED = new Button(185-130, 53, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); - Button *plusGREEN = new Button(185-130, 98, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); - Button *minusGREEN = new Button(185-130, 143, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); - Button *plusBLUE = new Button(185-130, 188, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); - Button *minusBLUE = new Button(185-130, 233, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); - Button *plus10RED = new Button(185-35-130, 8, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); - Button *minus10RED = new Button(185-35-130, 53, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); - Button *plus10GREEN = new Button(185-35-130, 98, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); - Button *minus10GREEN = new Button(185-35-130, 143, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); - Button *plus10BLUE = new Button(185-35-130, 188, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); - Button *minus10BLUE = new Button(185-35-130, 233, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); - //SET NEW COLOR - Button *setNewColor = new Button(270, 100, 100, 25, LIGHT_GRAY); - Button *cancel = new Button(270, 150, 100, 25, LIGHT_GRAY); - //Animations tab - Button *animations = new Button(397, 0, 83, 25, LCD_COLOR_BLACK, LCD_COLOR_WHITE); - Button *hideTop = new Button(397, 0, 82, 1, LCD_COLOR_BLACK, LCD_COLOR_BLACK); - Button *hideRight = new Button(479, 0, 1, 24, LCD_COLOR_BLACK, LCD_COLOR_BLACK); - -}; - -#endif