make astyle

pull/389/head
Jesse Vincent 8 years ago
parent 9964a151ef
commit 69f244b43b
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);
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 ();
Kaleidoscope.loop ();
}

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

@ -21,32 +21,32 @@
#include <Kaleidoscope.h>
namespace KaleidoscopePlugins {
namespace HostOS {
typedef enum {
LINUX,
OSX,
WINDOWS,
OTHER,
AUTO = 0xff,
} Type;
class Base : public KaleidoscopePlugin {
public:
virtual void begin (void) final;
Type os (void);
void os (Type osType);
protected:
virtual void autoDetect (void) {};
Type osType;
private:
uint16_t eepromSlice;
bool isConfigured = false;
};
};
namespace HostOS {
typedef enum {
LINUX,
OSX,
WINDOWS,
OTHER,
AUTO = 0xff,
} Type;
class Base : public KaleidoscopePlugin {
public:
virtual void begin (void) final;
Type os (void);
void os (Type osType);
protected:
virtual void autoDetect (void) {};
Type osType;
private:
uint16_t eepromSlice;
bool isConfigured = false;
};
};
};
extern KaleidoscopePlugins::HostOS::Base HostOS;

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

@ -21,9 +21,9 @@
#include <Kaleidoscope/HostOS-Base.h>
namespace KaleidoscopePlugins {
namespace HostOS {
bool Focus (const char *command);
};
namespace HostOS {
bool Focus (const char *command);
};
};
#define FOCUS_HOOK_HOSTOS \

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

@ -21,13 +21,13 @@
#include <Kaleidoscope/HostOS-Base.h>
namespace KaleidoscopePlugins {
namespace HostOS {
class Guesser : public Base {
public:
Guesser (void);
namespace HostOS {
class Guesser : public Base {
public:
Guesser (void);
protected:
virtual void autoDetect (void) final;
};
}
protected:
virtual void autoDetect (void) final;
};
}
};

Loading…
Cancel
Save