@@ -14,6 +14,7 @@ extern USBD_HandleTypeDef hUsbDeviceFS; // forwarded from usb_device.c
14
14
extern SAI_HandleTypeDef haudio_out_sai; // forwarded from stm32746g_discovery.c
15
15
16
16
static int volume = 0 ; // from slider_volume to to BSP_Out_SetVolume. 0~100
17
+ static colortype color_graph_t ; // Store the previous color of graph_tHistogram1
17
18
18
19
screenView::screenView ()
19
20
{
@@ -24,6 +25,7 @@ screenView::screenView()
24
25
slider_R.setValue ( LCD16bpp::getRedFromColor ( graph_tHistogram1.getColor ()) );
25
26
slider_G.setValue ( LCD16bpp::getGreenFromColor ( graph_tHistogram1.getColor ()) );
26
27
slider_B.setValue ( LCD16bpp::getBlueFromColor ( graph_tHistogram1.getColor ()) );
28
+ color_graph_t .color = graph_tHistogram1.getColor ().color ;
27
29
}
28
30
29
31
void screenView::setupScreen ()
@@ -51,6 +53,7 @@ void screenView::handleTickEvent(){
51
53
static uint32_t tk_graph = 0 ; // ticks to update graph_t
52
54
static uint32_t tk_vol_ctrl = 0 ; // ticks to update volume from slider_volume
53
55
static uint32_t tk_vu = 0 ; // ticks to update vu_L and vu_R
56
+ static uint32_t tk_color = 0 ; // ticks to update color to graph_tHistogram1
54
57
55
58
if (uwTick - tk_graph > 50 ){
56
59
tk_graph = uwTick;
@@ -122,4 +125,15 @@ void screenView::handleTickEvent(){
122
125
vu_R.invalidate ();
123
126
}
124
127
128
+ if (uwTick - tk_color > 50 ){
129
+ tk_color = uwTick;
130
+ color_graph_t .color = touchgfx::Color::getColorFrom24BitRGB (
131
+ slider_R.getValue (),
132
+ slider_G.getValue (),
133
+ slider_B.getValue () ).color ;
134
+
135
+ // Only update color if color changed for graphics performance
136
+ if (graph_tHistogram1.getColor ().color != color_graph_t .color )
137
+ graph_tHistogram1.setColor (color_graph_t );
138
+ }
125
139
}
0 commit comments