Make it possible again to choose between variants

Fixes #1.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/389/head
Gergely Nagy 8 years ago
parent 0f6f095be2
commit 6230a331c4

@ -39,6 +39,7 @@ the `HostOS` library header.
#include <Kaleidoscope.h>
#include <Kaleidoscope-HostOS.h>
#include <Kaleidoscope/HostOS-select.h>
void someFunction (void) {
if (HostOS.os() == Kaleidoscope::HostOS::LINUX) {
@ -55,6 +56,9 @@ void setup (void) {
}
```
To be able to choose between the two variants, one must also include the
`Kaleidoscope/HostOS-select.h` header.
## Extension methods
The extension provides the following methods on the `HostOS` singleton:

@ -17,6 +17,7 @@
*/
#include <Kaleidoscope-HostOS.h>
#include <Kaleidoscope/HostOS-select.h>
const Key keymaps[][ROWS][COLS] PROGMEM = {
[0] = KEYMAP_STACKED

@ -18,12 +18,7 @@
#pragma once
#include <Kaleidoscope/HostOS.h>
#include <Kaleidoscope/HostOS-Tracker.h>
#include <Kaleidoscope/HostOS-Base.h>
#include <Kaleidoscope/HostOS-Guesser.h>
#ifdef KALEIDOSCOPE_HOSTOS_GUESSER
extern KaleidoscopePlugins::HostOS::Guesser HostOS;
#else
extern KaleidoscopePlugins::HostOS::Tracker HostOS;
#endif
extern KaleidoscopePlugins::HostOS::Base HostOS;

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Kaleidoscope/HostOS.h>
#include <Kaleidoscope/HostOS-Base.h>
#include <Kaleidoscope-EEPROM-Settings.h>
#include <EEPROM.h>

@ -39,7 +39,7 @@ namespace KaleidoscopePlugins {
void os (Type osType);
protected:
virtual void autoDetect (void) = 0;
virtual void autoDetect (void) {};
Type osType;
private:

@ -48,5 +48,3 @@ namespace KaleidoscopePlugins {
}
};
};
KaleidoscopePlugins::HostOS::Guesser HostOS;

@ -18,7 +18,7 @@
#pragma once
#include <Kaleidoscope/HostOS.h>
#include <Kaleidoscope/HostOS-Base.h>
namespace KaleidoscopePlugins {
namespace HostOS {

@ -1,21 +0,0 @@
/* -*- mode: c++ -*-
* Kaleidoscope-HostOS -- Host OS detection and tracking for Kaleidoscope
* Copyright (C) 2016, 2017 Gergely Nagy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Kaleidoscope/HostOS-Tracker.h>
KaleidoscopePlugins::HostOS::Tracker HostOS;

@ -18,16 +18,11 @@
#pragma once
#include <Kaleidoscope/HostOS.h>
#include <Kaleidoscope/HostOS-Base.h>
#include <Kaleidoscope/HostOS-Guesser.h>
namespace KaleidoscopePlugins {
namespace HostOS {
class Tracker : public Base {
public:
Tracker (void) {};
protected:
virtual void autoDetect (void) final {};
};
};
};
#if KALEIDOSCOPE_HOSTOS_GUESSER
KaleidoscopePlugins::HostOS::Base HostOS = KaleidoscopePlugins::HostOS::Guesser();
#else
KaleidoscopePlugins::HostOS::Base HostOS;
#endif
Loading…
Cancel
Save