aboutsummaryrefslogtreecommitdiffstats
path: root/quantum/visualizer/lcd_keyframes.h
blob: 6346c8643b49e9fddf08fc5a4764c93a7cc2db91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* Copyright 2017 Fred Sundvik
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef QUANTUM_VISUALIZER_LCD_KEYFRAMES_H_
#define QUANTUM_VISUALIZER_LCD_KEYFRAMES_H_

#include "visualizer.h"

// Displays the layer text centered vertically on the screen
bool lcd_keyframe_display_layer_text(keyframe_animation_t* animation, visualizer_state_t* state);
// Displays a bitmap (0/1) of all the currently active layers
bool lcd_keyframe_display_layer_bitmap(keyframe_animation_t* animation, visualizer_state_t* state);
// Displays a bitmap (0/1) of all the currently active mods
bool lcd_keyframe_display_mods_bitmap(keyframe_animation_t* animation, visualizer_state_t* state);
// Displays the keyboard led states (CAPS (Caps lock), NUM (Num lock), SCRL (Scroll lock), COMP (Compose), KANA)
bool lcd_keyframe_display_led_states(keyframe_animation_t* animation, visualizer_state_t* state);
// Displays both the layer text and the led states
bool lcd_keyframe_display_layer_and_led_states(keyframe_animation_t* animation, visualizer_state_t* state);
// Displays the QMK logo on the LCD screen
bool lcd_keyframe_draw_logo(keyframe_animation_t* animation, visualizer_state_t* state);

bool lcd_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
bool lcd_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);

#endif /* QUANTUM_VISUALIZER_LCD_KEYFRAMES_H_ */
an class="n">string_free(IOStream *io); /** Methods for a string stream. */ static IOMethods string_methods = { //print: string_print, //getc: string_getc, error: string_error, close: string_close, free: string_free, }; /** Get the string stream state. * * @param io string stream * @return state */ static inline StringData *get_string_data(IOStream *io){ return (StringData*)io->data; } /** Test if a string stream has an error. * * @param io string stream * @return 0 if ok, error code otherwise */ static int string_error(IOStream *io){ StringData *data = get_string_data(io); return data->out == NULL; } /** Close a string stream. * * @param io string stream * @return 0 */ static int string_close(IOStream *io){ StringData *data = get_string_data(io); data->in = NULL; data->out = NULL; return 0; } /** Free a string stream. * The stream must have been allocated, not statically created. * The stream state is freed, but the underlying string is not. * * @param io string stream */ static void string_free(IOStream *io){ StringData *data = get_string_data(io); memzero(data, sizeof(*data)); deallocate(data); } /** Get the methods to use for a string stream. * * @return methods */ IOMethods *string_stream_get_methods(void){ return &string_methods; } /** Initialise a string stream, usually from static data. * * @param io address of IOStream to fill in * @param data address of StringData to fill in * @param s string to use * @param n length of the string */ void string_stream_init(IOStream *io, StringData *data, char *s, int n){ if(data && io){ memzero(data, sizeof(*data)); data->string = (char*)s; data->in = data->string; data->out = data->string; data->size = n; data->end = data->string + n; memzero(io, sizeof(*io)); io->methods = &string_methods; io->data = data; } } /** Allocate and initialise a string stream. * * @param s string to use * @param n length of the string * @return new stream (free using IOStream_free) */ IOStream *string_stream_new(char *s, int n){ int ok = 0; StringData *data = ALLOCATE(StringData); IOStream *io = ALLOCATE(IOStream); if(data && io){ ok = 1; string_stream_init(io, data, s, n); } if(!ok){ deallocate(data); deallocate(io); io = NULL; } return io; }