96 lines
3.3 KiB
C
96 lines
3.3 KiB
C
|
/*
|
||
|
* Copyright (C) 2023 Daniele Lacamera <root@danielinux.net>
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||
|
* the Free Software Foundation, either version 3 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 Lesser General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Lesser General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
|
#ifndef INC_UI_H
|
||
|
#define INC_UI_H
|
||
|
#include "task.h"
|
||
|
#include <stdint.h>
|
||
|
|
||
|
#define BLACK 0
|
||
|
#define WHITE 15
|
||
|
#define RED 1
|
||
|
#define GREEN 2
|
||
|
#define YELLOW 3
|
||
|
#define BLUE 4
|
||
|
#define PURPLE 5
|
||
|
#define CYAN 6
|
||
|
#define GREY 7
|
||
|
#define BRIGHT(x) (x | 0x08)
|
||
|
#define MAGENTA BRIGHT(PURPLE)
|
||
|
#define BLOOD BRIGHT(RED)
|
||
|
#define PINK 13
|
||
|
|
||
|
#define ORANGE 220
|
||
|
|
||
|
#define BROWN 94
|
||
|
|
||
|
#define DARKRED 52
|
||
|
#define DARKGREEN 22
|
||
|
|
||
|
#define DARKBLUE 17
|
||
|
#define DARKGREY 8
|
||
|
|
||
|
extern int ui_selected_instrument;
|
||
|
extern int ui_selected_sample;
|
||
|
extern int ui_selected_octave;
|
||
|
|
||
|
|
||
|
void ui_redraw(uint16_t ev);
|
||
|
void ui_init(void);
|
||
|
|
||
|
uint8_t ui_menu_is_on(void);
|
||
|
void ui_menu(uint8_t onoff);
|
||
|
|
||
|
void ui_image_at(int layer, const uint8_t *img, uint32_t x, uint32_t y, uint32_t size_x, uint32_t size_y);
|
||
|
void ui_draw_h_segment(int layer, uint8_t color, uint32_t row, uint32_t start, uint32_t len);
|
||
|
void ui_draw_v_segment(int layer, uint8_t color, uint32_t col, uint32_t start, uint32_t len);
|
||
|
void ui_fill_area(int layer, uint8_t color, uint32_t x, uint32_t y, uint32_t x1, uint32_t y1);
|
||
|
void ui_text_at(int layer, uint8_t color, uint32_t x, uint32_t y, char *text);
|
||
|
void ui_selected_text_at(int layer, uint8_t color, uint8_t highlight, uint32_t x, uint32_t y, char *text);
|
||
|
void ui_draw_blocks(void);
|
||
|
void ui_draw_bpm(void);
|
||
|
void ui_draw_pot(int layer, uint8_t color, int x, int y, char *name, uint16_t level);
|
||
|
|
||
|
int ui_process_button_pressed(void);
|
||
|
|
||
|
#define RK043FN48H_WIDTH ((uint16_t)480) /* LCD PIXEL WIDTH */
|
||
|
#define RK043FN48H_HEIGHT ((uint16_t)272) /* LCD PIXEL HEIGHT */
|
||
|
#define RK043FN48H_HSYNC ((uint16_t)41) /* Horizontal synchronization */
|
||
|
#define RK043FN48H_HBP ((uint16_t)13) /* Horizontal back porch */
|
||
|
#define RK043FN48H_HFP ((uint16_t)32) /* Horizontal front porch */
|
||
|
#define RK043FN48H_VSYNC ((uint16_t)10) /* Vertical synchronization */
|
||
|
#define RK043FN48H_VBP ((uint16_t)2) /* Vertical back porch */
|
||
|
#define RK043FN48H_VFP ((uint16_t)2) /* Vertical front porch */
|
||
|
#define RK043FN48H_FREQUENCY_DIVIDER 5 /* LCD Frequency divider */
|
||
|
|
||
|
#define FB_WIDTH RK043FN48H_WIDTH
|
||
|
#define FB_HEIGTH RK043FN48H_HEIGHT
|
||
|
//#define FB_BPP (16) /* hardcoded RGB565 - 16 bits per pixel */
|
||
|
|
||
|
#define FB_BPP (8) /* hardcoded CLUT256 - 8 bit per pixel */
|
||
|
|
||
|
#define OVERLAY 0
|
||
|
|
||
|
#define Screen_address 0xC0000000
|
||
|
#define Overlay_address 0xC0200000
|
||
|
#define xres FB_WIDTH
|
||
|
#define yres FB_HEIGTH
|
||
|
#define bits_per_pixel FB_BPP
|
||
|
#define pixel_format LTDC_LxPFCR_L8
|
||
|
|
||
|
#endif
|