ui.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * Copyright (C) 2023 Daniele Lacamera <root@danielinux.net>
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef INC_UI_H
  18. #define INC_UI_H
  19. #include "task.h"
  20. #include <stdint.h>
  21. #define BLACK 0
  22. #define WHITE 15
  23. #define RED 1
  24. #define GREEN 2
  25. #define YELLOW 3
  26. #define BLUE 4
  27. #define PURPLE 5
  28. #define CYAN 6
  29. #define GREY 7
  30. #define BRIGHT(x) (x | 0x08)
  31. #define MAGENTA BRIGHT(PURPLE)
  32. #define BLOOD BRIGHT(RED)
  33. #define PINK 13
  34. #define ORANGE 220
  35. #define BROWN 94
  36. #define DARKRED 52
  37. #define DARKGREEN 22
  38. #define DARKBLUE 17
  39. #define DARKGREY 8
  40. extern int ui_selected_instrument;
  41. extern int ui_selected_sample;
  42. extern int ui_selected_octave;
  43. void ui_redraw(uint16_t ev);
  44. void ui_init(void);
  45. uint8_t ui_menu_is_on(void);
  46. void ui_menu(uint8_t onoff);
  47. void ui_image_at(int layer, const uint8_t *img, uint32_t x, uint32_t y, uint32_t size_x, uint32_t size_y);
  48. void ui_draw_h_segment(int layer, uint8_t color, uint32_t row, uint32_t start, uint32_t len);
  49. void ui_draw_v_segment(int layer, uint8_t color, uint32_t col, uint32_t start, uint32_t len);
  50. void ui_fill_area(int layer, uint8_t color, uint32_t x, uint32_t y, uint32_t x1, uint32_t y1);
  51. void ui_text_at(int layer, uint8_t color, uint32_t x, uint32_t y, char *text);
  52. void ui_selected_text_at(int layer, uint8_t color, uint8_t highlight, uint32_t x, uint32_t y, char *text);
  53. void ui_draw_blocks(void);
  54. void ui_draw_bpm(void);
  55. void ui_draw_pot(int layer, uint8_t color, int x, int y, char *name, uint16_t level);
  56. int ui_process_button_pressed(void);
  57. #define RK043FN48H_WIDTH ((uint16_t)480) /* LCD PIXEL WIDTH */
  58. #define RK043FN48H_HEIGHT ((uint16_t)272) /* LCD PIXEL HEIGHT */
  59. #define RK043FN48H_HSYNC ((uint16_t)41) /* Horizontal synchronization */
  60. #define RK043FN48H_HBP ((uint16_t)13) /* Horizontal back porch */
  61. #define RK043FN48H_HFP ((uint16_t)32) /* Horizontal front porch */
  62. #define RK043FN48H_VSYNC ((uint16_t)10) /* Vertical synchronization */
  63. #define RK043FN48H_VBP ((uint16_t)2) /* Vertical back porch */
  64. #define RK043FN48H_VFP ((uint16_t)2) /* Vertical front porch */
  65. #define RK043FN48H_FREQUENCY_DIVIDER 5 /* LCD Frequency divider */
  66. #define FB_WIDTH RK043FN48H_WIDTH
  67. #define FB_HEIGTH RK043FN48H_HEIGHT
  68. //#define FB_BPP (16) /* hardcoded RGB565 - 16 bits per pixel */
  69. #define FB_BPP (8) /* hardcoded CLUT256 - 8 bit per pixel */
  70. #define OVERLAY 0
  71. #define Screen_address 0xC0000000
  72. #define Overlay_address 0xC0200000
  73. #define xres FB_WIDTH
  74. #define yres FB_HEIGTH
  75. #define bits_per_pixel FB_BPP
  76. #define pixel_format LTDC_LxPFCR_L8
  77. #endif