logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

keymap.c (1396B)


  1. // Copyright 2022 Jose Pablo Ramirez (@jpe230)
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include QMK_KEYBOARD_H
  4. #include "qp.h"
  5. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  6. LAYOUT_ortho_1x1(JS_0)
  7. };
  8. painter_device_t lcd;
  9. void lv_example_arc_2(void);
  10. void keyboard_post_init_user(void) {
  11. lcd = qp_gc9a01_make_spi_device(240, 240, LCD_CS_PIN, LCD_DC_PIN, LCD_RST_PIN, 4, 0);
  12. qp_init(lcd, QP_ROTATION_0);
  13. qp_rect(lcd, 0, 0, 239, 319, 0, 255, 255, true);
  14. if (qp_lvgl_attach(lcd)) {
  15. lv_example_arc_2();
  16. }
  17. }
  18. static void set_angle(void* obj, int32_t v) {
  19. lv_arc_set_value(obj, v);
  20. }
  21. /**
  22. * Create an arc which acts as a loader.
  23. */
  24. void lv_example_arc_2(void) {
  25. /*Create an Arc*/
  26. lv_obj_t* arc = lv_arc_create(lv_scr_act());
  27. lv_arc_set_rotation(arc, 270);
  28. lv_arc_set_bg_angles(arc, 0, 360);
  29. lv_obj_remove_style(arc, NULL, LV_PART_KNOB); /*Be sure the knob is not displayed*/
  30. lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE); /*To not allow adjusting by click*/
  31. lv_obj_center(arc);
  32. static lv_anim_t a;
  33. lv_anim_init(&a);
  34. lv_anim_set_var(&a, arc);
  35. lv_anim_set_exec_cb(&a, set_angle);
  36. lv_anim_set_time(&a, 1000);
  37. lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); /*Just for the demo*/
  38. lv_anim_set_repeat_delay(&a, 500);
  39. lv_anim_set_values(&a, 0, 100);
  40. lv_anim_start(&a);
  41. }