Skip to content

Commit 217e1b8

Browse files
committed
Feat: Implemet btn_color: Toggle slidebars vissible
1 parent 9a16921 commit 217e1b8

File tree

5 files changed

+48
-28
lines changed

5 files changed

+48
-28
lines changed

TouchGFX/equalizer.touchgfx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@
250250
"ValueMax": 255,
251251
"ValueMin": 0,
252252
"InitValue": 5,
253-
"Name": "sliderB",
253+
"Name": "slider_B",
254254
"X": 64,
255255
"Y": 255,
256256
"Width": 355,
@@ -276,7 +276,7 @@
276276
"ValueMax": 255,
277277
"ValueMin": 0,
278278
"InitValue": 5,
279-
"Name": "sliderG",
279+
"Name": "slider_G",
280280
"X": 64,
281281
"Y": 238,
282282
"Width": 355,
@@ -302,7 +302,7 @@
302302
"ValueMax": 255,
303303
"ValueMin": 0,
304304
"InitValue": 255,
305-
"Name": "sliderR",
305+
"Name": "slider_R",
306306
"X": 64,
307307
"Y": 221,
308308
"Width": 355,

TouchGFX/generated/gui_generated/include/gui_generated/screen_screen/screenViewBase.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ class screenViewBase : public touchgfx::View<screenPresenter>
4747
touchgfx::PainterRGB565Bitmap vu_LPainter;
4848
touchgfx::LineProgress vu_R;
4949
touchgfx::PainterRGB565Bitmap vu_RPainter;
50-
touchgfx::Slider sliderB;
51-
touchgfx::Slider sliderG;
52-
touchgfx::Slider sliderR;
50+
touchgfx::Slider slider_B;
51+
touchgfx::Slider slider_G;
52+
touchgfx::Slider slider_R;
5353
touchgfx::Slider slider_volume;
5454

5555
private:

TouchGFX/generated/gui_generated/src/screen_screen/screenViewBase.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -466,26 +466,26 @@ screenViewBase::screenViewBase() :
466466
vu_R.setLineEndingStyle(touchgfx::Line::SQUARE_CAP_ENDING);
467467
vu_R.setValue(100);
468468

469-
sliderB.setXY(64, 255);
470-
sliderB.setBitmaps(touchgfx::Bitmap(BITMAP_BLUE_DIVIDERS_DIVIDER_SHORT_ID), touchgfx::Bitmap(BITMAP_BLUE_DIVIDERS_DIVIDER_SHORT_ID), touchgfx::Bitmap(BITMAP_SLIDER_INDICATOR_BLUE_ID));
471-
sliderB.setVisible(false);
472-
sliderB.setupHorizontalSlider(3, 7, 0, 36, 306);
473-
sliderB.setValueRange(0, 255);
474-
sliderB.setValue(5);
469+
slider_B.setXY(64, 255);
470+
slider_B.setBitmaps(touchgfx::Bitmap(BITMAP_BLUE_DIVIDERS_DIVIDER_SHORT_ID), touchgfx::Bitmap(BITMAP_BLUE_DIVIDERS_DIVIDER_SHORT_ID), touchgfx::Bitmap(BITMAP_SLIDER_INDICATOR_BLUE_ID));
471+
slider_B.setVisible(false);
472+
slider_B.setupHorizontalSlider(3, 7, 0, 36, 306);
473+
slider_B.setValueRange(0, 255);
474+
slider_B.setValue(5);
475475

476-
sliderG.setXY(64, 238);
477-
sliderG.setBitmaps(touchgfx::Bitmap(BITMAP_BLUE_DIVIDERS_DIVIDER_SHORT_ID), touchgfx::Bitmap(BITMAP_BLUE_DIVIDERS_DIVIDER_SHORT_ID), touchgfx::Bitmap(BITMAP_SLIDER_INDICATOR_GREEN_ID));
478-
sliderG.setVisible(false);
479-
sliderG.setupHorizontalSlider(3, 7, 0, 36, 306);
480-
sliderG.setValueRange(0, 255);
481-
sliderG.setValue(5);
476+
slider_G.setXY(64, 238);
477+
slider_G.setBitmaps(touchgfx::Bitmap(BITMAP_BLUE_DIVIDERS_DIVIDER_SHORT_ID), touchgfx::Bitmap(BITMAP_BLUE_DIVIDERS_DIVIDER_SHORT_ID), touchgfx::Bitmap(BITMAP_SLIDER_INDICATOR_GREEN_ID));
478+
slider_G.setVisible(false);
479+
slider_G.setupHorizontalSlider(3, 7, 0, 36, 306);
480+
slider_G.setValueRange(0, 255);
481+
slider_G.setValue(5);
482482

483-
sliderR.setXY(64, 221);
484-
sliderR.setBitmaps(touchgfx::Bitmap(BITMAP_BLUE_DIVIDERS_DIVIDER_SHORT_ID), touchgfx::Bitmap(BITMAP_BLUE_DIVIDERS_DIVIDER_SHORT_ID), touchgfx::Bitmap(BITMAP_SLIDER_INDICATOR_RED_ID));
485-
sliderR.setVisible(false);
486-
sliderR.setupHorizontalSlider(3, 7, 0, 36, 306);
487-
sliderR.setValueRange(0, 255);
488-
sliderR.setValue(255);
483+
slider_R.setXY(64, 221);
484+
slider_R.setBitmaps(touchgfx::Bitmap(BITMAP_BLUE_DIVIDERS_DIVIDER_SHORT_ID), touchgfx::Bitmap(BITMAP_BLUE_DIVIDERS_DIVIDER_SHORT_ID), touchgfx::Bitmap(BITMAP_SLIDER_INDICATOR_RED_ID));
485+
slider_R.setVisible(false);
486+
slider_R.setupHorizontalSlider(3, 7, 0, 36, 306);
487+
slider_R.setValueRange(0, 255);
488+
slider_R.setValue(255);
489489

490490
slider_volume.setXY(144, 232);
491491
slider_volume.setBitmaps(touchgfx::Bitmap(BITMAP_DARK_SLIDER_HORIZONTAL_SMALL_SLIDER_HORIZONTAL_SMALL_ROUND_FILL_ID), touchgfx::Bitmap(BITMAP_DARK_SLIDER_HORIZONTAL_SMALL_SLIDER_HORIZONTAL_SMALL_ROUND_BACK_ID), touchgfx::Bitmap(BITMAP_DARK_ICONS_SOUND_32_ID));
@@ -499,9 +499,9 @@ screenViewBase::screenViewBase() :
499499
add(graph_t);
500500
add(vu_L);
501501
add(vu_R);
502-
add(sliderB);
503-
add(sliderG);
504-
add(sliderR);
502+
add(slider_B);
503+
add(slider_G);
504+
add(slider_R);
505505
add(slider_volume);
506506
}
507507

TouchGFX/gui/include/gui/screen_screen/screenView.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class screenView : public screenViewBase
1212
virtual void setupScreen();
1313
virtual void tearDownScreen();
1414
void handleTickEvent();
15+
void btn_color_onclick();
16+
void SliderHandler(const Slider& sli, const ClickEvent& Event);
1517

1618
protected:
1719
int tick_cnt;

TouchGFX/gui/src/screen_screen/screenView.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#include <gui/screen_screen/screenView.hpp>
2+
3+
// User include
4+
#include <../../Middlewares/ST/touchgfx/framework/include/platform/driver/lcd/LCD16bpp.hpp>
25
#include <stdio.h>
36
#include <math.h>
47
#include "stm32746g_discovery_audio.h"
@@ -17,6 +20,10 @@ screenView::screenView()
1720
tick_cnt = 0;
1821
graph_t.clear();
1922
slider_volume.setValue(volume+1);
23+
24+
slider_R.setValue( LCD16bpp::getRedFromColor( graph_tHistogram1.getColor()) );
25+
slider_G.setValue( LCD16bpp::getGreenFromColor( graph_tHistogram1.getColor()) );
26+
slider_B.setValue( LCD16bpp::getBlueFromColor( graph_tHistogram1.getColor()) );
2027
}
2128

2229
void screenView::setupScreen()
@@ -29,6 +36,17 @@ void screenView::tearDownScreen()
2936
screenViewBase::tearDownScreen();
3037
}
3138

39+
// This toggles the visibiilty of slider_volume and slider_RGB
40+
void screenView::btn_color_onclick(){
41+
slider_volume.setVisible( !slider_volume.isVisible() ); slider_volume.invalidate();
42+
slider_R.setVisible( !slider_R.isVisible() ); slider_R.invalidate();
43+
slider_G.setVisible( !slider_G.isVisible() ); slider_G.invalidate();
44+
slider_B.setVisible( !slider_B.isVisible() ); slider_B.invalidate();
45+
printf("btn clicked \r\n");
46+
}
47+
48+
49+
3250
void screenView::handleTickEvent(){
3351
static uint32_t tk_graph = 0; // ticks to update graph_t
3452
static uint32_t tk_vol_ctrl = 0; // ticks to update volume from slider_volume
@@ -52,7 +70,7 @@ void screenView::handleTickEvent(){
5270

5371
// Update volume if USB connected
5472
int usb_conn_state = hUsbDeviceFS.dev_state;
55-
printf("[Debug] usb_conn_state:%d\r\n", usb_conn_state);
73+
// printf("[Debug] usb_conn_state:%d\r\n", usb_conn_state);
5674
switch(usb_conn_state){
5775
case USBD_STATE_DEFAULT:
5876
break;

0 commit comments

Comments
 (0)