astyle with current project style guidelines

pull/389/head
Jesse Vincent 8 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> #include <Kaleidoscope/HostOS-select.h>
const Key keymaps[][ROWS][COLS] PROGMEM = { const Key keymaps[][ROWS][COLS] PROGMEM = {
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, 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_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_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_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift, Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
Key_skip, Key_skip,
Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, 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_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_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_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip Key_skip
), ),
}; };
void setup () { void setup() {
Serial.begin (9600); Serial.begin(9600);
Kaleidoscope.setup (KEYMAP_SIZE); Kaleidoscope.setup(KEYMAP_SIZE);
Kaleidoscope.use (&HostOS, NULL); Kaleidoscope.use(&HostOS, NULL);
Serial.print ("Host OS id is: "); Serial.print("Host OS id is: ");
Serial.println (HostOS.os (), DEC); Serial.println(HostOS.os(), DEC);
} }
void loop () { void loop() {
Kaleidoscope.loop (); Kaleidoscope.loop();
} }

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

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

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

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

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

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

Loading…
Cancel
Save