Revision 2e93ce57 Keyboard.c

View differences:

Keyboard.c
36 36
 */
37 37

  
38 38
#include "Keyboard.h"
39
#include "MatrixScan.h"
39 40

  
40 41
/** Indicates what report mode the host has requested, true for normal HID reporting mode, false for special boot
41 42
 *  protocol reporting mode.
......
53 54
 */
54 55
static uint16_t IdleMSRemaining = 0;
55 56

  
56
static uint16_t foo = 0;
57 57
/** Main program entry point. This routine configures the hardware required by the application, then
58 58
 *  enters a loop to run the application tasks in sequence.
59 59
 */
......
61 61
{
62 62
	SetupHardware();
63 63

  
64
	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
64
	//LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
65 65
	sei();
66 66

  
67 67
	for (;;)
......
82 82
	clock_prescale_set(clock_div_1);
83 83

  
84 84
	/* Hardware Initialization */
85
	LEDs_Init();
85
	//LEDs_Init();
86 86
	USB_Init();
87
	setupMatrix();
87 88
}
88 89

  
89 90
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and
......
92 93
void EVENT_USB_Device_Connect(void)
93 94
{
94 95
	/* Indicate USB enumerating */
95
	LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
96
	//LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
96 97

  
97 98
	/* Default to report protocol on connect */
98 99
	UsingReportProtocol = true;
......
104 105
void EVENT_USB_Device_Disconnect(void)
105 106
{
106 107
	/* Indicate USB not ready */
107
	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
108
	//LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
108 109
}
109 110

  
110 111
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration
......
124 125
	USB_Device_EnableSOFEvents();
125 126

  
126 127
	/* Indicate endpoint configuration success or failure */
127
	LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
128
	//LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
128 129
}
129 130

  
130 131
/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to
......
240 241
 */
241 242
void CreateKeyboardReport(USB_KeyboardReport_Data_t* const ReportData)
242 243
{
243
	uint8_t UsedKeyCodes      = 0;
244

  
245 244
	/* Clear the report contents */
246 245
	memset(ReportData, 0, sizeof(USB_KeyboardReport_Data_t));
247 246
	/* Make sent key uppercase by indicating that the left shift key is pressed */
248 247
	//ReportData->Modifier = HID_KEYBOARD_MODIFER_LEFTSHIFT;
249
	if(foo%5000){
250
		UsedKeyCodes = 2;
251
		ReportData->KeyCode[0] = HID_KEYBOARD_SC_L; 
252
		ReportData->KeyCode[1] = HID_KEYBOARD_SC_A;
253
	}
254
	foo++;
248
	setReportData(ReportData);
255 249
}
256 250

  
257 251
/** Processes a received LED report, and updates the board LEDs states to match.
......
260 254
 */
261 255
void ProcessLEDReport(const uint8_t LEDReport)
262 256
{
263
	uint8_t LEDMask = LEDS_LED2;
264

  
265
	if (LEDReport & HID_KEYBOARD_LED_NUMLOCK)
266
	  LEDMask |= LEDS_LED1;
267

  
268
	if (LEDReport & HID_KEYBOARD_LED_CAPSLOCK)
269
	  LEDMask |= LEDS_LED3;
270

  
271
	if (LEDReport & HID_KEYBOARD_LED_SCROLLLOCK)
272
	  LEDMask |= LEDS_LED4;
273

  
274
	/* Set the status LEDs to the current Keyboard LED status */
275
	LEDs_SetAllLEDs(LEDMask);
257
	return;
276 258
}
277 259

  
278 260
/** Sends the next HID report to the host, via the keyboard data endpoint. */

Also available in: Unified diff