/* hid_keybd.c
*
* This uses a ATtiny45
- * +----------+
+ * +----------+
* reset -| RST VCC|- 5V
* Key_A -| PB3 PB2|- D+ / SCK
* Key_B -| PB4 PB1|- LED / MISO
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/interrupt.h> /* for sei() */
-#include <util/delay.h> /* for _delay_ms() */
+#include <util/delay.h> /* for _delay_ms() */
#include <avr/eeprom.h>
#include <avr/pgmspace.h> /* required by usbdrv.h */
#include "usbdrv.h"
-#include "oddebug.h" /* This is also an example for using debug macros */
+#include "oddebug.h" /* This is also an example for using debug macros */
#include "osccal.h" /* attiny calibration */
#include "descriptor.c"
Key_B = 5,
Key_CapsLock = 57,
Key_NumLock = 83,
+ Key_Execute = 116,
Key_VolUp = 128,
Key_VolDown = 129,
};
}
}
}
-
if (!(pin_state & (1 << PB4))) {
Global.led_limit = Led_Quick;
if (Global.state == State_Default) {
if (Global.key_down_counter == 255) {
Global.state = State_KeyReady;
Global.keyboard_report.modifier = 0;
- Global.keyboard_report.keycode[0] = Key_NumLock;
+ Global.keyboard_report.keycode[0] = Key_Execute;
Global.key_down_counter = 0;
} else {
++Global.key_down_counter;
}
}
if (pin_state & ((1<<PB3)|(1<<PB4)) && Global.state == State_Default) {
- Global.led_limit = (Global.LED_state & Led_CapsLock) ? Led_Fast : Led_Slow;
+ Global.led_limit = (Global.LED_state & Led_CapsLock)
+ ? Led_Fast : Led_Slow;
}
-
/* called after every poll of the interrupt endpoint */
if (usbInterruptIsReady() && Global.LED_state != 0xff) {
if (Global.state != State_Default) {
Global.state = State_Default;
break;
}
- usbSetInterrupt((uchar *)&Global.keyboard_report, sizeof(Global.keyboard_report));
+ usbSetInterrupt((uchar *)&Global.keyboard_report,
+ sizeof(Global.keyboard_report));
}
}
}