make astyle

pull/18/head
Jesse Vincent 9 years ago
parent 4ab71d1bfc
commit 1ce8da0b8d

@ -3,7 +3,7 @@
HARDWARE_IMPLEMENTATION KeyboardHardware; HARDWARE_IMPLEMENTATION KeyboardHardware;
// These global proxy functions are a cheap hack to avoid // These global proxy functions are a cheap hack to avoid
void led_set_crgb_at(uint8_t i, cRGB crgb) { void led_set_crgb_at(uint8_t i, cRGB crgb) {
KeyboardHardware.led_set_crgb_at(i,crgb); KeyboardHardware.led_set_crgb_at(i,crgb);
} }
void led_sync(void) { void led_sync(void) {

@ -3,21 +3,21 @@
LEDControl_::LEDControl_(void) { LEDControl_::LEDControl_(void) {
led_off.r = 0; led_off.r = 0;
led_off.g = 0; led_off.g = 0;
led_off.b = 0; led_off.b = 0;
led_steady.r = 0; led_steady.r = 0;
led_steady.g = 255; led_steady.g = 255;
led_steady.b = 0; led_steady.b = 0;
led_blue.r = 0; led_blue.r = 0;
led_blue.g = 0; led_blue.g = 0;
led_blue.b = 255; led_blue.b = 255;
led_dark_blue.r = 0; led_dark_blue.r = 0;
led_dark_blue.g = 0; led_dark_blue.g = 0;
led_dark_blue .b = 127; led_dark_blue .b = 127;
led_bright_red.r = 255; led_bright_red.r = 255;
led_bright_red.g = 0; led_bright_red.g = 0;
led_bright_red.b = 0; led_bright_red.b = 0;
} }
@ -222,8 +222,8 @@ void LEDControl_::type_letter(uint8_t letter) {
// From http://web.mit.edu/storborg/Public/hsvtorgb.c - talk to Scott about licensing // 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) { void LEDControl_::hsv_to_rgb(cRGB *cRGB, uint16_t h, uint16_t s, uint16_t v) {
/* HSV to RGB conversion function with only integer /* HSV to RGB conversion function with only integer
* math */ * math */
uint16_t region, fpart, p, q, t; uint16_t region, fpart, p, q, t;
if(s == 0) { if(s == 0) {
@ -244,18 +244,36 @@ void LEDControl_::hsv_to_rgb(cRGB *cRGB, uint16_t h, uint16_t s, uint16_t v) {
/* assign temp vars based on color cone region */ /* assign temp vars based on color cone region */
switch(region) { switch(region) {
case 0: case 0:
cRGB->r = v; cRGB->g = t; cRGB->b = p; break; cRGB->r = v;
case 1: cRGB->g = t;
cRGB->r = q; cRGB->g = v; cRGB->b = p; break; cRGB->b = p;
case 2: break;
cRGB->r = p; cRGB->g = v; cRGB->b = t; break; case 1:
case 3: cRGB->r = q;
cRGB->r = p; cRGB->g = q; cRGB->b = v; break; cRGB->g = v;
case 4: cRGB->b = p;
cRGB->r = t; cRGB->g = p; cRGB->b = v; break; break;
default: case 2:
cRGB->r = v; cRGB->g = p; cRGB->b = q; break; 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; return;

@ -1,6 +1,6 @@
#include "Model01.h" #include "Model01.h"
KeyboardioScanner Model01::leftHand(0); KeyboardioScanner Model01::leftHand(0);
KeyboardioScanner Model01::rightHand(3); KeyboardioScanner Model01::rightHand(3);
Model01::Model01(void) { Model01::Model01(void) {

@ -27,8 +27,8 @@ class Model01 {
private: private:
static KeyboardioScanner leftHand; static KeyboardioScanner leftHand;
static KeyboardioScanner rightHand; static KeyboardioScanner rightHand;
static constexpr uint8_t key_led_map[4][16] = { 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}, {3,4,11,12,19,20,26,27, 36,37,43,44,51,52,59,60},

@ -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) ) { if (mappedKey.flags & IS_MOUSE_KEY && !( mappedKey.rawKey & KEY_MOUSE_WARP) ) {
handle_mouse_key_event(switchState, mappedKey); handle_mouse_key_event(switchState, mappedKey);
} else if (! (mappedKey.flags & IS_INTERNAL) } else if (! (mappedKey.flags & IS_INTERNAL)
&& (mappedKey.rawKey == KEY_MOUSE_BTN_L && (mappedKey.rawKey == KEY_MOUSE_BTN_L
|| mappedKey.rawKey == KEY_MOUSE_BTN_M || mappedKey.rawKey == KEY_MOUSE_BTN_M
|| mappedKey.rawKey == KEY_MOUSE_BTN_R)) { || mappedKey.rawKey == KEY_MOUSE_BTN_R)) {
if (key_toggled_on (switchState)) { if (key_toggled_on (switchState)) {
MouseWrapper.press_button( MouseWrapper.press_button(
(mappedKey.rawKey == KEY_MOUSE_BTN_L ? KEY_MOUSE_BUTTON_LEFT : 0x00) | (mappedKey.rawKey == KEY_MOUSE_BTN_L ? KEY_MOUSE_BUTTON_LEFT : 0x00) |

Loading…
Cancel
Save