A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 165 lines 6.5 kB view raw
1/*************************************************************************** 2 * __________ __ ___. 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 * \/ \/ \/ \/ \/ 8 * $Id$ 9 * 10 * Copyright (c) 2010 Michael Sevakis 11 * 12 * Helper defines for writing code for pgfx, grey and color targets. 13 * 14 * This program is free software; you can redistribute it and/or 15 * modify it under the terms of the GNU General Public License 16 * as published by the Free Software Foundation; either version 2 17 * of the License, or (at your option) any later version. 18 * 19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 20 * KIND, either express or implied. 21 * 22 ****************************************************************************/ 23#ifndef MYLCD_H 24#define MYLCD_H 25 26/*** 27 * Most functions are, other than color depth, equivalent between pgfx, grey, 28 * lcd and xlcd and most of the time the caller need not be concerned with 29 * which is actually called, making code nicer to read and maintain. 30 * 31 * Unbuffered routines revert to standard rb->lcd_XXXX funtions on color 32 * targets. On color, mylcd_ub_update_XXXX refer to the proper update 33 * functions, otherwise they are no-ops. 34 * 35 * lib/grey.h should be included before including this 36 * header. For bitmap LCD's, defaults to rb->lcd_XXXX otherwise. 37 */ 38#if (LCD_DEPTH < 4) && defined(__GREY_H__) 39#define MYLCD_CFG_GREYLIB /* using greylib */ 40#define mylcd_(fn) grey_##fn 41#define myxlcd_(fn) grey_##fn 42#define mylcd_ub_(fn) grey_ub_##fn 43#define myxlcd_ub_(fn) grey_ub_##fn 44#define mylcd_viewport_(fn) grey_viewport_##fn 45 46/* Common colors */ 47#define MYLCD_BLACK GREY_BLACK 48#define MYLCD_DARKGRAY GREY_DARKGRAY 49#define MYLCD_LIGHTGRAY GREY_LIGHTGRAY 50#define MYLCD_WHITE GREY_WHITE 51#define MYLCD_DEFAULT_FG GREY_BLACK 52#define MYLCD_DEFAULT_BG GREY_WHITE 53 54#else 55 56#define MYLCD_CFG_RB_XLCD /* using standard (X)LCD routines */ 57#define mylcd_(fn) rb->lcd_##fn 58#define myxlcd_(fn) xlcd_##fn 59#define mylcd_ub_(fn) rb->lcd_##fn 60#define myxlcd_ub_(fn) xlcd_##fn 61#define mylcd_viewport_(fn) rb->viewport_##fn 62 63/* Common colors */ 64#define MYLCD_BLACK LCD_BLACK 65#define MYLCD_DARKGRAY LCD_DARKGRAY 66#define MYLCD_LIGHTGRAY LCD_LIGHTGRAY 67#define MYLCD_WHITE LCD_WHITE 68#define MYLCD_DEFAULT_FG LCD_DEFAULT_FG 69#define MYLCD_DEFAULT_BG LCD_DEFAULT_BG 70 71#endif /* end LCD type selection */ 72 73/* Update functions */ 74#define mylcd_update mylcd_(update) 75#define mylcd_update_rect mylcd_(update_rect) 76 77/* Update functions - unbuffered : special handling for these 78 * It is desirable to still evaluate arguments even if there will 79 * be no function call, just in case they have side-effects. 80 */ 81#if defined (MYLCD_CFG_PGFX) 82#define mylcd_ub_update pgfx_update 83static inline void mylcd_ub_update_rect(int x, int y, int w, int h) 84 { (void)x; (void)y; (void)w; (void)h; pgfx_update(); } 85 86#elif defined (MYLCD_CFG_GREYLIB) 87static inline void mylcd_ub_update(void) 88 {} 89static inline void mylcd_ub_update_rect(int x, int y, int w, int h) 90 { (void)x; (void)y; (void)w; (void)h; } 91 92#else /* color or RB default */ 93#define mylcd_ub_update rb->lcd_update 94#define mylcd_ub_update_rect rb->lcd_update_rect 95#endif 96 97/* Parameter handling */ 98#define mylcd_set_drawmode mylcd_(set_drawmode) 99#define mylcd_get_drawmode mylcd_(get_drawmode) 100 101#define mylcd_set_foreground mylcd_(set_foreground) 102#define mylcd_get_foreground mylcd_(get_foreground) 103#define mylcd_set_background mylcd_(set_background) 104#define mylcd_get_background mylcd_(get_background) 105#define mylcd_set_drawinfo mylcd_(set_drawinfo) 106#define mylcd_setfont mylcd_(setfont) 107#define mylcd_getstringsize mylcd_(getstringsize) 108 109/* Whole display */ 110#define mylcd_clear_display mylcd_(clear_display) 111 112/* Whole display - unbuffered */ 113#define mylcd_ub_clear_display mylcd_ub_(clear_display) 114 115/* Pixel */ 116#define mylcd_drawpixel mylcd_(drawpixel) 117 118/* Lines */ 119#define mylcd_drawline mylcd_(drawline) 120#define mylcd_hline mylcd_(hline) 121#define mylcd_vline mylcd_(vline) 122#define mylcd_drawrect mylcd_(drawrect) 123 124/* Filled Primitives */ 125#define mylcd_fillrect mylcd_(fillrect) 126#define mylcd_filltriangle myxlcd_(filltriangle) 127 128/* Bitmaps */ 129#define mylcd_mono_bitmap_part mylcd_(mono_bitmap_part) 130#define mylcd_mono_bitmap mylcd_(mono_bitmap) 131 132#define mylcd_gray_bitmap_part myxlcd_(gray_bitmap_part) 133#define mylcd_gray_bitmap myxlcd_(gray_bitmap) 134#if 0 /* possible, but not implemented in greylib */ 135#define mylcd_color_bitmap_part myxlcd_(color_bitmap_part) 136#define mylcd_color_bitmap myxlcd_(color_bitmap) 137#endif 138 139/* Bitmaps - unbuffered */ 140#define mylcd_ub_gray_bitmap_part myxlcd_ub_(gray_bitmap_part) 141#define mylcd_ub_gray_bitmap myxlcd_ub_(gray_bitmap) 142 143/* Text */ 144/* lcd_putsxyofs is static'ed in the core for now on color */ 145#define mylcd_putsxyofs mylcd_(putsxyofs) 146#define mylcd_putsxy mylcd_(putsxy) 147 148/* Scrolling */ 149#define mylcd_scroll_left myxlcd_(scroll_left) 150#define mylcd_scroll_right myxlcd_(scroll_right) 151#define mylcd_scroll_up myxlcd_(scroll_up) 152#define mylcd_scroll_down myxlcd_(scroll_down) 153 154/* Scrolling - unbuffered */ 155#define mylcd_ub_scroll_left myxlcd_ub_(scroll_left) 156#define mylcd_ub_scroll_right myxlcd_ub_(scroll_right) 157#define mylcd_ub_scroll_up myxlcd_ub_(scroll_up) 158#define mylcd_ub_scroll_down myxlcd_ub_(scroll_down) 159 160/* Viewports */ 161#define mylcd_clear_viewport mylcd_(clear_viewport) 162#define mylcd_set_viewport mylcd_(set_viewport) 163#define mylcd_viewport_set_fullscreen mylcd_viewport_(set_fullscreen) 164 165#endif /* MYLCD_H */