~ruther/qmk_firmware

838b214a2e4d791479a4ce67e508576293202516 — Mango The Fourth 3 years ago 6f043c5
Fix DracuLad keymap to accomodate for breaking changes. (#15713)

Co-authored-by: MangoIV <mangoiv@outlook.com>
M keyboards/draculad/keymaps/pimoroni/config.h => keyboards/draculad/keymaps/pimoroni/config.h +5 -3
@@ 15,11 15,13 @@ You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#define POINTING_DEVICE_ROTATION_90

//comment that out if your trackball is on the left side
#define TRACKBALL_RIGHT

#ifdef TRACKBALL_RIGHT
    #define PIMORONI_TRACKBALL_INVERT_X
    #define PIMORONI_TRACKBALL_INVERT_Y
#ifdef TRACKBALL_RIGHT 
    #define POINTING_DEVICE_INVERT_X
    #define POINTING_DEVICE_INVERT_Y
#endif


M keyboards/draculad/keymaps/pimoroni/keymap.c => keyboards/draculad/keymaps/pimoroni/keymap.c +25 -18
@@ 16,8 16,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include QMK_KEYBOARD_H
#include "drivers/sensors/pimoroni_trackball.h"
#include "pointing_device.h"


enum layer_number {


@@ 29,13 27,13 @@ enum layer_number {
};

enum custom_keycodes {
  BALL_HUI,//cycles hue
  BALL_WHT,//cycles white
  BALL_DEC,//decreased color
  BALL_SCR,//scrolls
  BALL_NCL,//left click
  BALL_RCL,//right click
  BALL_MCL,//middle click
  BALL_HUI = SAFE_RANGE, //cycles hue
  BALL_WHT,              //cycles white
  BALL_DEC,              //decreased color
  BALL_SCR,              //scrolls
  BALL_NCL,              //left click
  BALL_RCL,              //right click
  BALL_MCL,              //middle click
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {


@@ 78,8 76,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {


#ifdef OLED_ENABLE


oled_rotation_t oled_init_user(oled_rotation_t rotation) {

 if (is_keyboard_master()) {


@@ 209,13 205,23 @@ bool oled_task_user(void) {
    return false;
}

#endif
#endif //OLED_ENABLE

uint8_t white = 0;
uint8_t red = 255;
uint8_t green = 0;
uint8_t blue = 0;

bool set_scrolling = false;
report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) {
    if (set_scrolling) {
        mouse_report.h = mouse_report.x;
        mouse_report.v = mouse_report.y;
        mouse_report.x = mouse_report.y = 0; 
    }
    return mouse_report;
}

void ball_increase_hue(void){
      if(red!=255&&green!=255&&blue!=255){
        red =255;


@@ 233,7 239,7 @@ void ball_increase_hue(void){
      } else if(green ==0&&blue>0&&red==255){
        blue -=15;
      }
      trackball_set_rgbw(red,green,blue,white);
      pimoroni_trackball_set_rgbw(red,green,blue,white);
}

void decrease_color(void){


@@ 246,7 252,7 @@ void decrease_color(void){
  if (blue>0){
    blue-=15;
  }
  trackball_set_rgbw(red,green,blue,white);
  pimoroni_trackball_set_rgbw(red,green,blue,white);
}

void cycle_white(void){


@@ 255,7 261,7 @@ void cycle_white(void){
  } else{
    white=0;
  }
  trackball_set_rgbw(red,green,blue,white);
  pimoroni_trackball_set_rgbw(red,green,blue,white);
}

bool process_record_user(uint16_t keycode, keyrecord_t *record){


@@ 280,9 286,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record){

  case BALL_SCR:
   if(record->event.pressed){
     trackball_set_scrolling(true);
     set_scrolling = true;
   } else{
     trackball_set_scrolling(false);
     set_scrolling = false;
   }
   break;



@@ 298,6 304,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record){
  }
  return true;
}

#ifdef ENCODER_ENABLE
bool encoder_update_user(uint8_t index, bool clockwise) {
    if (index == 0) {


@@ 325,4 332,4 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
    // the missing ones are encoder 1 on the right side and encoder 3 on the left side
    return true;
}
#endif
#endif // ENCODER_ENABLE

M keyboards/draculad/keymaps/pimoroni/rules.mk => keyboards/draculad/keymaps/pimoroni/rules.mk +2 -3
@@ 1,7 1,6 @@
# only uncomment on the side you have your trackball on
POINTING_DEVICE_ENABLE = yes
SRC += drivers/sensors/pimoroni_trackball.c
QUANTUM_LIB_SRC += i2c_master.c
POINTING_DEVICE_DRIVER = pimoroni_trackball
OLED_ENABLE = yes
OLED_DRIVER = SSD1306
MOUSEKEY_ENABLE = no
MOUSEKEY_ENABLE = yes