astyle with current project style guidelines

pull/389/head
Jesse Vincent 7 years ago
parent 69f244b43b
commit e597957ab9
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -20,36 +20,36 @@
#include <Kaleidoscope/HostOS-select.h>
const Key keymaps[][ROWS][COLS] PROGMEM = {
[0] = KEYMAP_STACKED
(
Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey,
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G,
Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
Key_skip,
Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip,
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals,
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
Key_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip
),
[0] = KEYMAP_STACKED
(
Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey,
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G,
Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
Key_skip,
Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip,
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals,
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
Key_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip
),
};
void setup () {
Serial.begin (9600);
void setup() {
Serial.begin(9600);
Kaleidoscope.setup (KEYMAP_SIZE);
Kaleidoscope.use (&HostOS, NULL);
Kaleidoscope.setup(KEYMAP_SIZE);
Kaleidoscope.use(&HostOS, NULL);
Serial.print ("Host OS id is: ");
Serial.println (HostOS.os (), DEC);
Serial.print("Host OS id is: ");
Serial.println(HostOS.os(), DEC);
}
void loop () {
Kaleidoscope.loop ();
void loop() {
Kaleidoscope.loop();
}

@ -24,36 +24,36 @@
namespace KaleidoscopePlugins {
namespace HostOS {
void
Base::begin (void) {
if (isConfigured)
return;
Base::begin(void) {
if (isConfigured)
return;
eepromSlice = ::EEPROMSettings.requestSlice (sizeof (osType));
eepromSlice = ::EEPROMSettings.requestSlice(sizeof(osType));
isConfigured = true;
isConfigured = true;
if (osType != AUTO) {
return;
}
if (osType != AUTO) {
return;
}
if ((osType = (Type)EEPROM.read (eepromSlice)) != AUTO)
return;
if ((osType = (Type)EEPROM.read(eepromSlice)) != AUTO)
return;
autoDetect ();
autoDetect();
}
HostOS::Type
Base::os (void) {
if (osType == AUTO)
autoDetect ();
Base::os(void) {
if (osType == AUTO)
autoDetect();
return osType;
return osType;
}
void
Base::os (HostOS::Type osType_) {
osType = osType_;
EEPROM.update (eepromSlice, osType);
Base::os(HostOS::Type osType_) {
osType = osType_;
EEPROM.update(eepromSlice, osType);
}
};
};

@ -23,28 +23,28 @@
namespace KaleidoscopePlugins {
namespace HostOS {
typedef enum {
LINUX,
OSX,
WINDOWS,
OTHER,
LINUX,
OSX,
WINDOWS,
OTHER,
AUTO = 0xff,
AUTO = 0xff,
} Type;
class Base : public KaleidoscopePlugin {
public:
virtual void begin (void) final;
public:
virtual void begin(void) final;
Type os (void);
void os (Type osType);
Type os(void);
void os(Type osType);
protected:
virtual void autoDetect (void) {};
Type osType;
protected:
virtual void autoDetect(void) {};
Type osType;
private:
uint16_t eepromSlice;
bool isConfigured = false;
private:
uint16_t eepromSlice;
bool isConfigured = false;
};
};
};

@ -22,19 +22,19 @@
namespace KaleidoscopePlugins {
namespace HostOS {
bool
Focus (const char *command) {
if (strcmp_P (command, PSTR ("hostos.type")) != 0)
return false;
Focus(const char *command) {
if (strcmp_P(command, PSTR("hostos.type")) != 0)
return false;
if (Serial.peek () == '\n') {
Serial.println (::HostOS.os ());
} else {
uint8_t os = Serial.parseInt ();
::HostOS.os ((KaleidoscopePlugins::HostOS::Type) os);
}
if (Serial.peek() == '\n') {
Serial.println(::HostOS.os());
} else {
uint8_t os = Serial.parseInt();
::HostOS.os((KaleidoscopePlugins::HostOS::Type) os);
}
Serial.read ();
return true;
Serial.read();
return true;
}
}
}

@ -22,7 +22,7 @@
namespace KaleidoscopePlugins {
namespace HostOS {
bool Focus (const char *command);
bool Focus(const char *command);
};
};

@ -22,29 +22,29 @@
namespace KaleidoscopePlugins {
namespace HostOS {
Guesser::Guesser (void) {
Guesser::Guesser(void) {
}
void
Guesser::autoDetect (void) {
Serial.begin (9600);
Guesser::autoDetect(void) {
Serial.begin(9600);
delay (15000);
delay(15000);
switch (FingerprintUSBHost.guessHostOS ()) {
case GuessedHost::WINDOWS:
osType = WINDOWS;
break;
case GuessedHost::LINUX:
osType = LINUX;
break;
case GuessedHost::MACOS:
osType = OSX;
break;
default:
osType = OTHER;
break;
}
switch (FingerprintUSBHost.guessHostOS()) {
case GuessedHost::WINDOWS:
osType = WINDOWS;
break;
case GuessedHost::LINUX:
osType = LINUX;
break;
case GuessedHost::MACOS:
osType = OSX;
break;
default:
osType = OTHER;
break;
}
}
};
};

@ -23,11 +23,11 @@
namespace KaleidoscopePlugins {
namespace HostOS {
class Guesser : public Base {
public:
Guesser (void);
public:
Guesser(void);
protected:
virtual void autoDetect (void) final;
protected:
virtual void autoDetect(void) final;
};
}
};

Loading…
Cancel
Save