fork/GramFirmware
git clone https://git.julia.blue/fork/GramFirmware
818d962
gram
1#include "display/RgbBrightnessMenu.hpp" 2 3#include "comms/IntegratedDisplay.hpp" 4 5RgbBrightnessMenu ::RgbBrightnessMenu (Config & config ) :_config (config ) {} 6 7DisplayModeId RgbBrightnessMenu ::GetId () { 8return DISPLAY_MODE_RGB_BRIGHTNESS ; 9} 10 11void RgbBrightnessMenu ::HandleControls ( 12IntegratedDisplay * instance , 13const DisplayControls & controls , 14Button button 15) { 16// const DisplayControls &controls = instance->_controls; 17if (button == controls .up ) { 18_config .rgb_brightness ++ ; 19 }else if (button == controls .down ) { 20_config .rgb_brightness -- ; 21 }else if (button == controls .back ) { 22instance -> SetDisplayMode (DISPLAY_MODE_CONFIG ); 23 } 24} 25 26void RgbBrightnessMenu ::UpdateDisplay (IntegratedDisplay * instance ,Adafruit_GFX & display ) { 27uint8_t font_width = instance -> font_width ; 28uint8_t font_height = instance -> font_height ; 29 30// Current brightness value. 31display .setCursor (display .width () /2 - (font_width * 3 ) /2 ,display .height () /2 ); 32display .printf ("%3d" ,_config .rgb_brightness ); 33 34// Display control hints. 35display .setCursor (5 ,display .height ()- font_height ); 36display ."Back" ); 37display .setCursor (45 ,display .getCursorY ()); 38display ."-" ); 39display .setCursor (display .width ()- 45 - font_width ,display .getCursorY ()); 40display ."+" ); 41}