Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
QMK Bot 2022-01-03 00:21:07 +00:00
commit bfc8539d68
3 changed files with 32 additions and 24 deletions

View File

@ -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/>. 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 //comment that out if your trackball is on the left side
#define TRACKBALL_RIGHT #define TRACKBALL_RIGHT
#ifdef TRACKBALL_RIGHT #ifdef TRACKBALL_RIGHT
#define PIMORONI_TRACKBALL_INVERT_X #define POINTING_DEVICE_INVERT_X
#define PIMORONI_TRACKBALL_INVERT_Y #define POINTING_DEVICE_INVERT_Y
#endif #endif

View File

@ -16,8 +16,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
#include "drivers/sensors/pimoroni_trackball.h"
#include "pointing_device.h"
enum layer_number { enum layer_number {
@ -29,7 +27,7 @@ enum layer_number {
}; };
enum custom_keycodes { enum custom_keycodes {
BALL_HUI,//cycles hue BALL_HUI = SAFE_RANGE, //cycles hue
BALL_WHT, //cycles white BALL_WHT, //cycles white
BALL_DEC, //decreased color BALL_DEC, //decreased color
BALL_SCR, //scrolls BALL_SCR, //scrolls
@ -78,8 +76,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef OLED_ENABLE #ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (is_keyboard_master()) { if (is_keyboard_master()) {
@ -209,13 +205,23 @@ bool oled_task_user(void) {
return false; return false;
} }
#endif #endif //OLED_ENABLE
uint8_t white = 0; uint8_t white = 0;
uint8_t red = 255; uint8_t red = 255;
uint8_t green = 0; uint8_t green = 0;
uint8_t blue = 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){ void ball_increase_hue(void){
if(red!=255&&green!=255&&blue!=255){ if(red!=255&&green!=255&&blue!=255){
red =255; red =255;
@ -233,7 +239,7 @@ void ball_increase_hue(void){
} else if(green ==0&&blue>0&&red==255){ } else if(green ==0&&blue>0&&red==255){
blue -=15; blue -=15;
} }
trackball_set_rgbw(red,green,blue,white); pimoroni_trackball_set_rgbw(red,green,blue,white);
} }
void decrease_color(void){ void decrease_color(void){
@ -246,7 +252,7 @@ void decrease_color(void){
if (blue>0){ if (blue>0){
blue-=15; blue-=15;
} }
trackball_set_rgbw(red,green,blue,white); pimoroni_trackball_set_rgbw(red,green,blue,white);
} }
void cycle_white(void){ void cycle_white(void){
@ -255,7 +261,7 @@ void cycle_white(void){
} else{ } else{
white=0; 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){ 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: case BALL_SCR:
if(record->event.pressed){ if(record->event.pressed){
trackball_set_scrolling(true); set_scrolling = true;
} else{ } else{
trackball_set_scrolling(false); set_scrolling = false;
} }
break; break;
@ -298,6 +304,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record){
} }
return true; return true;
} }
#ifdef ENCODER_ENABLE #ifdef ENCODER_ENABLE
bool encoder_update_user(uint8_t index, bool clockwise) { bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { 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 // the missing ones are encoder 1 on the right side and encoder 3 on the left side
return true; return true;
} }
#endif #endif // ENCODER_ENABLE

View File

@ -1,7 +1,6 @@
# only uncomment on the side you have your trackball on # only uncomment on the side you have your trackball on
POINTING_DEVICE_ENABLE = yes POINTING_DEVICE_ENABLE = yes
SRC += drivers/sensors/pimoroni_trackball.c POINTING_DEVICE_DRIVER = pimoroni_trackball
QUANTUM_LIB_SRC += i2c_master.c
OLED_ENABLE = yes OLED_ENABLE = yes
OLED_DRIVER = SSD1306 OLED_DRIVER = SSD1306
MOUSEKEY_ENABLE = no MOUSEKEY_ENABLE = yes