diff options
| author | Fred Sundvik <fsundvik@gmail.com> | 2017-04-01 16:37:31 +0300 |
|---|---|---|
| committer | Fred Sundvik <fsundvik@gmail.com> | 2017-04-09 18:34:59 +0300 |
| commit | e6f7a8a47a82258725683980b83e215c8323aef2 (patch) | |
| tree | 465e1df510ad5eb6a673efe137f3bc66549b413c | |
| parent | a8f5897b976ee9f16b1798db38fb0ee4b8981c9e (diff) | |
| download | qmk_firmware-e6f7a8a47a82258725683980b83e215c8323aef2.tar.gz qmk_firmware-e6f7a8a47a82258725683980b83e215c8323aef2.zip | |
Display QMK logo at startup of Infinity Ergodox
| -rw-r--r-- | keyboards/ergodox/infinity/lcd_logo.png | bin | 0 -> 490 bytes | |||
| -rw-r--r-- | keyboards/ergodox/infinity/visualizer.c | 89 |
2 files changed, 65 insertions, 24 deletions
diff --git a/keyboards/ergodox/infinity/lcd_logo.png b/keyboards/ergodox/infinity/lcd_logo.png new file mode 100644 index 000000000..6cf26fc67 --- /dev/null +++ b/keyboards/ergodox/infinity/lcd_logo.png | |||
| Binary files differ | |||
diff --git a/keyboards/ergodox/infinity/visualizer.c b/keyboards/ergodox/infinity/visualizer.c index c0d335ce6..0ce1d4ae4 100644 --- a/keyboards/ergodox/infinity/visualizer.c +++ b/keyboards/ergodox/infinity/visualizer.c | |||
| @@ -29,25 +29,68 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 29 | #include "visualizer.h" | 29 | #include "visualizer.h" |
| 30 | #include "led_test.h" | 30 | #include "led_test.h" |
| 31 | 31 | ||
| 32 | static const char* welcome_text[] = {"TMK", "Infinity Ergodox"}; | 32 | // To generate an image array like this |
| 33 | // Ensure the image is 128 x 32 or smaller | ||
| 34 | // Convert the bitmap to a C array using a program like http://www.riuson.com/lcd-image-converter/ | ||
| 35 | // Ensure the the conversion process produces a monochrome format array - 1 bit/pixel, left to right, top to bottom | ||
| 36 | // Update array in the source code with the C array produced by the conversion program | ||
| 37 | |||
| 38 | // The image below is generated from lcd_logo.png | ||
| 39 | static const uint8_t image_data_lcd_logo[512] = { | ||
| 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 42 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 43 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 44 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 45 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 46 | 0x00, 0xf8, 0xfe, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 47 | 0x00, 0x38, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 48 | 0x00, 0x38, 0x38, 0x38, 0x06, 0x29, 0x41, 0x24, 0x52, 0x24, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 49 | 0x00, 0x38, 0x38, 0x38, 0x09, 0x55, 0x42, 0xaa, 0xaa, 0xaa, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 50 | 0x00, 0x38, 0x38, 0x38, 0x09, 0x55, 0x82, 0x28, 0xaa, 0xae, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 51 | 0x00, 0x38, 0x38, 0x38, 0x09, 0x55, 0x43, 0x28, 0xaa, 0xaa, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 52 | 0x00, 0x38, 0x38, 0x38, 0x0a, 0x55, 0x42, 0x28, 0xaa, 0xaa, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 53 | 0x00, 0x38, 0x38, 0x38, 0x05, 0x45, 0x42, 0x28, 0x89, 0x4a, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 54 | 0x00, 0x18, 0x38, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 55 | 0x00, 0x1c, 0x38, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 56 | 0x00, 0x0e, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 57 | 0x00, 0x03, 0xff, 0x80, 0x04, 0x45, 0x14, 0xa4, 0x92, 0x83, 0x52, 0x22, 0x22, 0x36, 0x00, 0x00, | ||
| 58 | 0x00, 0x00, 0x38, 0x00, 0x0a, 0xaa, 0xaa, 0xaa, 0xba, 0x84, 0x55, 0x55, 0x57, 0x45, 0x00, 0x00, | ||
| 59 | 0x00, 0x00, 0x38, 0x00, 0x08, 0xaa, 0xaa, 0xaa, 0x92, 0xb2, 0x55, 0x55, 0x42, 0x65, 0x00, 0x00, | ||
| 60 | 0x00, 0x00, 0x38, 0x00, 0x08, 0xaa, 0xaa, 0xaa, 0x92, 0x81, 0x56, 0x65, 0x42, 0x45, 0x00, 0x00, | ||
| 61 | 0x00, 0x00, 0x38, 0x00, 0x0a, 0xaa, 0xaa, 0xaa, 0x92, 0x81, 0x54, 0x45, 0x42, 0x45, 0x00, 0x00, | ||
| 62 | 0x00, 0x00, 0x38, 0x00, 0x04, 0x48, 0xa2, 0x4a, 0x89, 0x06, 0x24, 0x42, 0x41, 0x36, 0x00, 0x00, | ||
| 63 | 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 64 | 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 65 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 66 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 67 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 68 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 69 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 70 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 71 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 72 | }; | ||
| 73 | |||
| 74 | static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0x80); | ||
| 75 | static const uint32_t initial_color = LCD_COLOR(0, 0, 0xFF); | ||
| 33 | 76 | ||
| 34 | // Just an example how to write custom keyframe functions, we could have moved | 77 | bool display_logo(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 35 | // all this into the init function | 78 | (void)state; |
| 36 | bool display_welcome(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 37 | (void)animation; | 79 | (void)animation; |
| 80 | (void)state; | ||
| 38 | // Read the uGFX documentation for information how to use the displays | 81 | // Read the uGFX documentation for information how to use the displays |
| 39 | // http://wiki.ugfx.org/index.php/Main_Page | 82 | // http://wiki.ugfx.org/index.php/Main_Page |
| 40 | gdispClear(White); | 83 | gdispClear(White); |
| 84 | |||
| 41 | // You can use static variables for things that can't be found in the animation | 85 | // You can use static variables for things that can't be found in the animation |
| 42 | // or state structs | 86 | // or state structs, here we use the image |
| 43 | gdispDrawString(0, 3, welcome_text[0], state->font_dejavusansbold12, Black); | 87 | |
| 44 | gdispDrawString(0, 15, welcome_text[1], state->font_dejavusansbold12, Black); | 88 | //gdispGBlitArea is a tricky function to use since it supports blitting part of the image |
| 89 | // if you have full screen image, then just use 128 and 32 for both source and target dimensions | ||
| 90 | gdispGBlitArea(GDISP, 0, 0, 128, 32, 0, 0, 128, (pixel_t*)image_data_lcd_logo); | ||
| 91 | |||
| 45 | // Always remember to flush the display | 92 | // Always remember to flush the display |
| 46 | gdispFlush(); | 93 | gdispFlush(); |
| 47 | // you could set the backlight color as well, but we won't do it here, since | ||
| 48 | // it's part of the following animation | ||
| 49 | // lcd_backlight_color(hue, saturation, intensity); | ||
| 50 | // We don't need constant updates, just drawing the screen once is enough | ||
| 51 | return false; | 94 | return false; |
| 52 | } | 95 | } |
| 53 | 96 | ||
| @@ -56,13 +99,12 @@ bool display_welcome(keyframe_animation_t* animation, visualizer_state_t* state) | |||
| 56 | // Don't worry, if the startup animation is long, you can use the keyboard like normal | 99 | // Don't worry, if the startup animation is long, you can use the keyboard like normal |
| 57 | // during that time | 100 | // during that time |
| 58 | static keyframe_animation_t startup_animation = { | 101 | static keyframe_animation_t startup_animation = { |
| 59 | .num_frames = 4, | 102 | .num_frames = 3, |
| 60 | .loop = false, | 103 | .loop = false, |
| 61 | .frame_lengths = {0, gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(5000), 0}, | 104 | .frame_lengths = {0, gfxMillisecondsToTicks(10000), 0}, |
| 62 | .frame_functions = { | 105 | .frame_functions = { |
| 63 | display_welcome, | 106 | display_logo, |
| 64 | keyframe_animate_backlight_color, | 107 | keyframe_animate_backlight_color, |
| 65 | keyframe_no_operation, | ||
| 66 | enable_visualization | 108 | enable_visualization |
| 67 | }, | 109 | }, |
| 68 | }; | 110 | }; |
| @@ -78,6 +120,7 @@ static keyframe_animation_t color_animation = { | |||
| 78 | .frame_functions = {keyframe_no_operation, keyframe_animate_backlight_color}, | 120 | .frame_functions = {keyframe_no_operation, keyframe_animate_backlight_color}, |
| 79 | }; | 121 | }; |
| 80 | 122 | ||
| 123 | |||
| 81 | // The LCD animation alternates between the layer name display and a | 124 | // The LCD animation alternates between the layer name display and a |
| 82 | // bitmap that displays all active layers | 125 | // bitmap that displays all active layers |
| 83 | static keyframe_animation_t lcd_animation = { | 126 | static keyframe_animation_t lcd_animation = { |
| @@ -99,14 +142,13 @@ static keyframe_animation_t suspend_animation = { | |||
| 99 | }; | 142 | }; |
| 100 | 143 | ||
| 101 | static keyframe_animation_t resume_animation = { | 144 | static keyframe_animation_t resume_animation = { |
| 102 | .num_frames = 5, | 145 | .num_frames = 4, |
| 103 | .loop = false, | 146 | .loop = false, |
| 104 | .frame_lengths = {0, 0, gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(5000), 0}, | 147 | .frame_lengths = {0, 0, gfxMillisecondsToTicks(10000), 0}, |
| 105 | .frame_functions = { | 148 | .frame_functions = { |
| 106 | keyframe_enable_lcd_and_backlight, | 149 | keyframe_enable_lcd_and_backlight, |
| 107 | display_welcome, | 150 | display_logo, |
| 108 | keyframe_animate_backlight_color, | 151 | keyframe_animate_backlight_color, |
| 109 | keyframe_no_operation, | ||
| 110 | enable_visualization, | 152 | enable_visualization, |
| 111 | }, | 153 | }, |
| 112 | }; | 154 | }; |
| @@ -115,10 +157,9 @@ void initialize_user_visualizer(visualizer_state_t* state) { | |||
| 115 | // The brightness will be dynamically adjustable in the future | 157 | // The brightness will be dynamically adjustable in the future |
| 116 | // But for now, change it here. | 158 | // But for now, change it here. |
| 117 | lcd_backlight_brightness(0x50); | 159 | lcd_backlight_brightness(0x50); |
| 118 | state->current_lcd_color = LCD_COLOR(0x00, 0x00, 0xFF); | 160 | state->current_lcd_color = initial_color; |
| 119 | state->target_lcd_color = LCD_COLOR(0x10, 0xFF, 0xFF); | 161 | state->target_lcd_color = logo_background_color; |
| 120 | start_keyframe_animation(&startup_animation); | 162 | start_keyframe_animation(&startup_animation); |
| 121 | start_keyframe_animation(&led_test_animation); | ||
| 122 | } | 163 | } |
| 123 | 164 | ||
| 124 | void update_user_visualizer_state(visualizer_state_t* state) { | 165 | void update_user_visualizer_state(visualizer_state_t* state) { |
| @@ -161,8 +202,8 @@ void user_visualizer_suspend(visualizer_state_t* state) { | |||
| 161 | } | 202 | } |
| 162 | 203 | ||
| 163 | void user_visualizer_resume(visualizer_state_t* state) { | 204 | void user_visualizer_resume(visualizer_state_t* state) { |
| 164 | state->current_lcd_color = LCD_COLOR(0x00, 0x00, 0x00); | 205 | state->current_lcd_color = initial_color; |
| 165 | state->target_lcd_color = LCD_COLOR(0x10, 0xFF, 0xFF); | 206 | state->target_lcd_color = logo_background_color; |
| 166 | start_keyframe_animation(&resume_animation); | 207 | start_keyframe_animation(&resume_animation); |
| 167 | start_keyframe_animation(&led_test_animation); | 208 | start_keyframe_animation(&led_test_animation); |
| 168 | } | 209 | } |
