Interfaçage NeoPixel Ring 12, LPRO MECSE, Arnaud A.
view.h
- Committer:
- Rhamao
- Date:
- 2020-06-15
- Revision:
- 1:3ce68d55dfb8
- Parent:
- 0:eccd33c01946
- Child:
- 2:fd11fb4d51f8
File content as of revision 1:3ce68d55dfb8:
#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 15 #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 #include <ESP8266.h> extern RawSerial pc; extern RawSerial wifi; class View { public: View(int width = SCREENWIDTH, int height = SCREENHEIGHT); void contain(int x, int y); void draw(); void updateLCD(); void updatePlusMinus(Button* it); ~View(); private : void initLCD(); void drawText(); int16_t m_width = SCREENWIDTH; int16_t m_height = SCREENHEIGHT; uint32_t m_bgColor = LCD_COLOR_WHITE; list<Button *> m_buttonList; ESP8266 * m_esp; TS_StateTypeDef TS_State; uint16_t x, y; uint8_t idx; bool screenReleased=false; bool cleared = false; int buffer=0; char str[10]; //LEDS buttons Button *led0 = new Button(350, 52+16, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_WHITE); Button *led1 = new Button(379, 60+16, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_WHITE); Button *led2 = new Button(403, 84+16, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_WHITE); Button *led3 = new Button(410, 112+16, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_WHITE); Button *led4 = new Button(402, 142+16, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_WHITE); Button *led5 = new Button(379, 165+16, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_WHITE); Button *led6 = new Button(350, 173+16, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_WHITE); Button *led7 = new Button(320, 165+16, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_WHITE); Button *led8 = new Button(297, 142+16, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_WHITE); Button *led9 = new Button(290, 112+16, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_WHITE); Button *led10 = new Button(297, 84+16, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_WHITE); Button *led11 = new Button(321, 60+16, LED_BUTTON_SIZE, LED_BUTTON_SIZE, LCD_COLOR_WHITE); //RGB TextView Button *redTextview = new Button(220, 38, RGB_TEXT_VIEW_WIDTH, RGB_TEXT_VIEW_HEIGHT, LCD_COLOR_WHITE); Button *greenTextview = new Button(220, 128, RGB_TEXT_VIEW_WIDTH, RGB_TEXT_VIEW_HEIGHT, LCD_COLOR_WHITE); Button *blueTextview = new Button(220, 218, RGB_TEXT_VIEW_WIDTH, RGB_TEXT_VIEW_HEIGHT, LCD_COLOR_WHITE); //RGB + and - Button *plusRED = new Button(185, 8, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); Button *minusRED = new Button(185, 53, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); Button *plusGREEN = new Button(185, 98, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); Button *minusGREEN = new Button(185, 143, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); Button *plusBLUE = new Button(185, 188, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); Button *minusBLUE = new Button(185, 233, PLUS_MINUS_BUTTON_SIZE, PLUS_MINUS_BUTTON_SIZE, LIGHT_GRAY); //SET NEW COLOR Button *setNewColor = new Button(291, 8, 100, 35, LIGHT_GRAY); //Animations Button *anim1 = new Button(20, 38, ANIMATION_BUTTON_WIDTH, ANIMATION_BUTTON_HEIGHT, LIGHT_GRAY); Button *anim2 = new Button(20, 68, ANIMATION_BUTTON_WIDTH, ANIMATION_BUTTON_HEIGHT, LIGHT_GRAY); Button *anim3 = new Button(20, 98, ANIMATION_BUTTON_WIDTH, ANIMATION_BUTTON_HEIGHT, LIGHT_GRAY); Button *start = new Button(20, 128, 140, ANIMATION_BUTTON_HEIGHT+5, LIGHT_GRAY); Button *stop = new Button(20, 163, 140, ANIMATION_BUTTON_HEIGHT+5, LIGHT_GRAY); }; #endif