summaryrefslogtreecommitdiff
path: root/protocol/pjrc
diff options
context:
space:
mode:
Diffstat (limited to 'protocol/pjrc')
-rw-r--r--protocol/pjrc/MEMO.txt25
-rw-r--r--protocol/pjrc/main.c3
-rw-r--r--protocol/pjrc/usb.h2
-rw-r--r--protocol/pjrc/usb_keyboard.c2
-rw-r--r--protocol/pjrc/usb_mouse.h2
5 files changed, 30 insertions, 4 deletions
diff --git a/protocol/pjrc/MEMO.txt b/protocol/pjrc/MEMO.txt
new file mode 100644
index 0000000000..b0f0598313
--- /dev/null
+++ b/protocol/pjrc/MEMO.txt
@@ -0,0 +1,25 @@
+Endpoint configuration
+----------------------
+0 Control endpoint
+1 keyboard
+2 mouse
+3 debug
+4 extra key(consumer/system)
+5 nkro keyboard(supported only on ATmega32U4/16U4 and AT90USB64/128)
+
+
+ATmega32U4/16U4, AT90USB64/128
+• Endpoint 0:programmable size FIFO up to 64 bytes, default control endpoint
+• Endpoints 1 programmable size FIFO up to 256 bytes in ping-pong mode.
+• Endpoints 2 to 6: programmable size FIFO up to 64 bytes in ping-pong mode.
+
+AT90USB82/162, ATmega8U2/16U2/32U2
+• Endpoint 0:programmable size FIFO up to 64 bytes, default control endpoint
+• Endpoints 1 and 2: programmable size FIFO up to 64 bytes.
+• Endpoints 3 and 4: programmable size FIFO up to 64 bytes with ping-pong mode.
+
+ping-pong mode means double buffer feature.
+
+
+NOTE: ATmega8U2/16U2/32U2 is not supported with PJRC stack at this time.
+TODO: Macro definition for ATmega8U2/16U2/32U2 in usb.h
diff --git a/protocol/pjrc/main.c b/protocol/pjrc/main.c
index 1ef87f8651..4f87a17364 100644
--- a/protocol/pjrc/main.c
+++ b/protocol/pjrc/main.c
@@ -24,6 +24,7 @@
#include <stdbool.h>
#include <avr/io.h>
#include <avr/interrupt.h>
+#include <avr/wdt.h>
#include <util/delay.h>
#include "keyboard.h"
#include "usb.h"
@@ -60,7 +61,7 @@ int main(void)
#endif
while (1) {
while (suspend) {
- suspend_power_down();
+ suspend_power_down(WDTO_120MS);
if (remote_wakeup && suspend_wakeup_condition()) {
usb_remote_wakeup();
}
diff --git a/protocol/pjrc/usb.h b/protocol/pjrc/usb.h
index 0eb58fc395..a195b671d0 100644
--- a/protocol/pjrc/usb.h
+++ b/protocol/pjrc/usb.h
@@ -122,7 +122,7 @@ void usb_remote_wakeup(void);
#define KBD_INTERFACE 0
#define KBD_ENDPOINT 1
#define KBD_SIZE 8
-#define KBD_BUFFER EP_DOUBLE_BUFFER
+#define KBD_BUFFER EP_SINGLE_BUFFER
#define KBD_REPORT_KEYS (KBD_SIZE - 2)
// secondary keyboard
diff --git a/protocol/pjrc/usb_keyboard.c b/protocol/pjrc/usb_keyboard.c
index 758a4edc6c..4b87b5d7b5 100644
--- a/protocol/pjrc/usb_keyboard.c
+++ b/protocol/pjrc/usb_keyboard.c
@@ -74,7 +74,7 @@ void usb_keyboard_print_report(report_keyboard_t *report)
{
if (!debug_keyboard) return;
print("keys: ");
- for (int i = 0; i < REPORT_KEYS; i++) { phex(report->keys[i]); print(" "); }
+ for (int i = 0; i < KEYBOARD_REPORT_KEYS; i++) { phex(report->keys[i]); print(" "); }
print(" mods: "); phex(report->mods); print("\n");
}
diff --git a/protocol/pjrc/usb_mouse.h b/protocol/pjrc/usb_mouse.h
index eb3056126d..ce26887c9b 100644
--- a/protocol/pjrc/usb_mouse.h
+++ b/protocol/pjrc/usb_mouse.h
@@ -32,7 +32,7 @@
#define MOUSE_INTERFACE 1
#define MOUSE_ENDPOINT 2
#define MOUSE_SIZE 8
-#define MOUSE_BUFFER EP_DOUBLE_BUFFER
+#define MOUSE_BUFFER EP_SINGLE_BUFFER
#define MOUSE_BTN1 (1<<0)
#define MOUSE_BTN2 (1<<1)