Fixes (again)
It didn't build but now it does Fixed the USB def for switching between 32U4/328P Fixes indents on all files
This commit is contained in:
+13
-12
@@ -1,5 +1,6 @@
|
||||
#ifdef USB
|
||||
#include "PinConfig.h"
|
||||
|
||||
#ifdef USB
|
||||
#include "USBOutput.h"
|
||||
|
||||
char bottomRow[] = {'a', 'z', 's', 'x', 'd', 'c', 'f', 'v', 'g', 'b', 'h', 'n', 'j', 'm', 'k', ','};
|
||||
@@ -7,15 +8,15 @@ char topRow[] = {'1', 'q', '2', 'w', '3', 'e', '4', 'r', '5', 't', '6', 'y', '7'
|
||||
|
||||
void USBOutput::sendKeyEvent(int key, bool pressed, bool doublePressed)
|
||||
{
|
||||
if(pressed){
|
||||
if(doublePressed){
|
||||
if (pressed) {
|
||||
if (doublePressed) {
|
||||
NKROKeyboard.write(topRow[key]);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
NKROKeyboard.press(bottomRow[key]);
|
||||
}
|
||||
}
|
||||
else{
|
||||
else {
|
||||
NKROKeyboard.release(bottomRow[key]);
|
||||
}
|
||||
}
|
||||
@@ -23,29 +24,29 @@ void USBOutput::sendKeyEvent(int key, bool pressed, bool doublePressed)
|
||||
void USBOutput::sendSensorEvent(float position)
|
||||
{
|
||||
// Send hand up / hand down key
|
||||
if(position > lastPosition){
|
||||
if (position > lastPosition) {
|
||||
NKROKeyboard.write(KEY_PAGE_UP);
|
||||
}
|
||||
if(position < lastPosition){
|
||||
if (position < lastPosition) {
|
||||
NKROKeyboard.write(KEY_PAGE_DOWN);
|
||||
}
|
||||
|
||||
// Send hand seen / unseen key
|
||||
if(position > 0.05f){
|
||||
if (position > 0.05f) {
|
||||
NKROKeyboard.press(KEY_HOME);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
NKROKeyboard.release(KEY_HOME);
|
||||
}
|
||||
|
||||
// Send hand moved key
|
||||
NKROKeyboard.write(KEY_END);
|
||||
|
||||
|
||||
}
|
||||
|
||||
USBOutput::USBOutput(){
|
||||
USBOutput::USBOutput() {
|
||||
NKROKeyboard.begin();
|
||||
lastPosition = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user