From 1ce8da0b8db3569368abe15cfd787621a8af4fe2 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 2 May 2016 10:19:26 -0700 Subject: [PATCH] make astyle --- KeyboardConfig.cpp | 4 +- KeyboardConfig.h | 4 +- LEDControl.cpp | 86 +++++++++++++++++++++++--------------- implementation/Model01.cpp | 4 +- implementation/Model01.h | 4 +- key_events.cpp | 6 +-- 6 files changed, 63 insertions(+), 45 deletions(-) diff --git a/KeyboardConfig.cpp b/KeyboardConfig.cpp index 36e3d94c..77074dab 100644 --- a/KeyboardConfig.cpp +++ b/KeyboardConfig.cpp @@ -2,8 +2,8 @@ HARDWARE_IMPLEMENTATION KeyboardHardware; -// These global proxy functions are a cheap hack to avoid - void led_set_crgb_at(uint8_t i, cRGB crgb) { +// These global proxy functions are a cheap hack to avoid +void led_set_crgb_at(uint8_t i, cRGB crgb) { KeyboardHardware.led_set_crgb_at(i,crgb); } void led_sync(void) { diff --git a/KeyboardConfig.h b/KeyboardConfig.h index da65789a..2f96f123 100644 --- a/KeyboardConfig.h +++ b/KeyboardConfig.h @@ -1,11 +1,11 @@ -#pragma once +#pragma once #include "implementation/Model01Beta.h" -// These global proxy functions are a cheap hack to avoid +// These global proxy functions are a cheap hack to avoid // a circular dependency between the keyboard hardware class // and the 'userspace' LED implementation. If my C++ were stronger, there woudl // certainly be a better way -JV 2016-02-01 diff --git a/LEDControl.cpp b/LEDControl.cpp index d1a81f77..6e70ee3e 100644 --- a/LEDControl.cpp +++ b/LEDControl.cpp @@ -3,21 +3,21 @@ LEDControl_::LEDControl_(void) { - led_off.r = 0; - led_off.g = 0; - led_off.b = 0; - led_steady.r = 0; - led_steady.g = 255; - led_steady.b = 0; - led_blue.r = 0; - led_blue.g = 0; - led_blue.b = 255; - led_dark_blue.r = 0; - led_dark_blue.g = 0; - led_dark_blue .b = 127; - led_bright_red.r = 255; - led_bright_red.g = 0; - led_bright_red.b = 0; + led_off.r = 0; + led_off.g = 0; + led_off.b = 0; + led_steady.r = 0; + led_steady.g = 255; + led_steady.b = 0; + led_blue.r = 0; + led_blue.g = 0; + led_blue.b = 255; + led_dark_blue.r = 0; + led_dark_blue.g = 0; + led_dark_blue .b = 127; + led_bright_red.r = 255; + led_bright_red.g = 0; + led_bright_red.b = 0; } @@ -222,42 +222,60 @@ void LEDControl_::type_letter(uint8_t letter) { // From http://web.mit.edu/storborg/Public/hsvtorgb.c - talk to Scott about licensing void LEDControl_::hsv_to_rgb(cRGB *cRGB, uint16_t h, uint16_t s, uint16_t v) { -/* HSV to RGB conversion function with only integer - * math */ + /* HSV to RGB conversion function with only integer + * math */ uint16_t region, fpart, p, q, t; - + if(s == 0) { /* color is grayscale */ cRGB->r = cRGB->g = cRGB->b = v; return; } - + /* make hue 0-5 */ region = h / 43; /* find remainder part, make it from 0-255 */ fpart = (h - (region * 43)) * 6; - + /* calculate temp vars, doing integer multiplication */ p = (v * (255 - s)) >> 8; q = (v * (255 - ((s * fpart) >> 8))) >> 8; t = (v * (255 - ((s * (255 - fpart)) >> 8))) >> 8; - + /* assign temp vars based on color cone region */ switch(region) { - case 0: - cRGB->r = v; cRGB->g = t; cRGB->b = p; break; - case 1: - cRGB->r = q; cRGB->g = v; cRGB->b = p; break; - case 2: - cRGB->r = p; cRGB->g = v; cRGB->b = t; break; - case 3: - cRGB->r = p; cRGB->g = q; cRGB->b = v; break; - case 4: - cRGB->r = t; cRGB->g = p; cRGB->b = v; break; - default: - cRGB->r = v; cRGB->g = p; cRGB->b = q; break; + case 0: + cRGB->r = v; + cRGB->g = t; + cRGB->b = p; + break; + case 1: + cRGB->r = q; + cRGB->g = v; + cRGB->b = p; + break; + case 2: + cRGB->r = p; + cRGB->g = v; + cRGB->b = t; + break; + case 3: + cRGB->r = p; + cRGB->g = q; + cRGB->b = v; + break; + case 4: + cRGB->r = t; + cRGB->g = p; + cRGB->b = v; + break; + default: + cRGB->r = v; + cRGB->g = p; + cRGB->b = q; + break; } - + return; } diff --git a/implementation/Model01.cpp b/implementation/Model01.cpp index 463d614f..98cfb4c6 100644 --- a/implementation/Model01.cpp +++ b/implementation/Model01.cpp @@ -1,6 +1,6 @@ #include "Model01.h" - KeyboardioScanner Model01::leftHand(0); - KeyboardioScanner Model01::rightHand(3); +KeyboardioScanner Model01::leftHand(0); +KeyboardioScanner Model01::rightHand(3); Model01::Model01(void) { diff --git a/implementation/Model01.h b/implementation/Model01.h index ad856f8a..3390ef80 100644 --- a/implementation/Model01.h +++ b/implementation/Model01.h @@ -27,8 +27,8 @@ class Model01 { private: - static KeyboardioScanner leftHand; - static KeyboardioScanner rightHand; + static KeyboardioScanner leftHand; + static KeyboardioScanner rightHand; static constexpr uint8_t key_led_map[4][16] = { {3,4,11,12,19,20,26,27, 36,37,43,44,51,52,59,60}, diff --git a/key_events.cpp b/key_events.cpp index 1010adcf..41adf125 100644 --- a/key_events.cpp +++ b/key_events.cpp @@ -6,9 +6,9 @@ void handle_synthetic_key_event(uint8_t switchState, Key mappedKey) { if (mappedKey.flags & IS_MOUSE_KEY && !( mappedKey.rawKey & KEY_MOUSE_WARP) ) { handle_mouse_key_event(switchState, mappedKey); } else if (! (mappedKey.flags & IS_INTERNAL) - && (mappedKey.rawKey == KEY_MOUSE_BTN_L - || mappedKey.rawKey == KEY_MOUSE_BTN_M - || mappedKey.rawKey == KEY_MOUSE_BTN_R)) { + && (mappedKey.rawKey == KEY_MOUSE_BTN_L + || mappedKey.rawKey == KEY_MOUSE_BTN_M + || mappedKey.rawKey == KEY_MOUSE_BTN_R)) { if (key_toggled_on (switchState)) { MouseWrapper.press_button( (mappedKey.rawKey == KEY_MOUSE_BTN_L ? KEY_MOUSE_BUTTON_LEFT : 0x00) |