Last active
August 29, 2015 13:56
-
-
Save cmaglie/9324412 to your computer and use it in GitHub Desktop.
Pluggable modules draft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "PKeyboard.h" | |
PKeyboardClass::PKeyboardClass() { | |
add("Keyboard"); | |
} | |
void PKeyboardClass::begin() { | |
} | |
PKeyboardClass PKeyboard; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef PKEYBOARD_H | |
#define PKEYBOARD_H | |
#include "Pluggable.h" | |
class PKeyboardClass { | |
public: | |
PKeyboardClass(); | |
void begin(); | |
void inlinedBegin() { }; | |
}; | |
extern PKeyboardClass PKeyboard; | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Pluggable.h" | |
#include <Arduino.h> | |
static const int MAXBLOCKS = 5; | |
const char *blocks[MAXBLOCKS]; | |
uint8_t blocksCount; | |
void add(const char *data) { | |
if (blocksCount >= MAXBLOCKS) | |
return; | |
blocks[blocksCount] = data; | |
blocksCount++; | |
} | |
void output() { | |
Serial.println(); | |
Serial.println(); | |
Serial.println(); | |
Serial.println("Plugged modules"); | |
for (uint8_t i=0; i<blocksCount; i++) { | |
Serial.print(i); | |
Serial.print(": "); | |
Serial.println(blocks[i]); | |
} | |
Serial.println("End of list"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef PLUGGABLE_H | |
#define PLUGGABLE_H | |
#include "PKeyboard.h" | |
#include "PMouse.h" | |
void add(const char *data); | |
void output(); | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Pluggable.h> | |
void setup() { | |
Serial.begin(115200); | |
output(); | |
//PKeyboard.begin(); | |
//PMouse.begin(); | |
} | |
void loop() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "PMouse.h" | |
PMouseClass::PMouseClass() { | |
add("Mouse"); | |
} | |
void PMouseClass::begin() { | |
} | |
PMouseClass PMouse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef PMOUSE_H | |
#define PMOUSE_H | |
#include "Pluggable.h" | |
class PMouseClass { | |
public: | |
PMouseClass(); | |
void begin(); | |
void inlinedBegin() { }; | |
}; | |
extern PMouseClass PMouse; | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment