projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Pipe_BoundEndpointNumber() has been renamed to Pipe_GetBoundEndpointAddress(), and...
[pub/USBasp.git]
/
Demos
/
Host
/
LowLevel
/
KeyboardHostWithParser
/
KeyboardHostWithParser.c
diff --git
a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
index
eb399dd
..
6ef7a96
100644
(file)
--- a/
Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
+++ b/
Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
@@
-66,9
+66,12
@@
void SetupHardware(void)
clock_prescale_set(clock_div_1);
/* Hardware Initialization */
clock_prescale_set(clock_div_1);
/* Hardware Initialization */
- Serial
Stream
_Init(9600, false);
+ Serial_Init(9600, false);
LEDs_Init();
USB_Init();
LEDs_Init();
USB_Init();
+
+ /* Create a stdio stream for the serial port for stdin and stdout */
+ Serial_CreateStream(NULL);
}
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
}
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
@@
-100,7
+103,7
@@
void EVENT_USB_Host_DeviceEnumerationComplete(void)
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
{
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
{
- USB_
ShutDown
();
+ USB_
Disable
();
printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n"
" -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode);
printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n"
" -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode);
@@
-225,7
+228,7
@@
void Keyboard_HID_Task(void)
uint8_t KeyboardReport[Pipe_BytesInPipe()];
/* Load in the keyboard report */
uint8_t KeyboardReport[Pipe_BytesInPipe()];
/* Load in the keyboard report */
- Pipe_Read_Stream_LE(KeyboardReport, Pipe_BytesInPipe());
+ Pipe_Read_Stream_LE(KeyboardReport, Pipe_BytesInPipe()
, NULL
);
/* Process the read in keyboard report from the device */
ProcessKeyboardReport(KeyboardReport);
/* Process the read in keyboard report from the device */
ProcessKeyboardReport(KeyboardReport);
@@
-284,9
+287,13
@@
void ProcessKeyboardReport(uint8_t* KeyboardReport)
PressedKey = (KeyCode - HID_KEYBOARD_SC_A) + 'A';
}
else if ((KeyCode >= HID_KEYBOARD_SC_1_AND_EXCLAMATION) &
PressedKey = (KeyCode - HID_KEYBOARD_SC_A) + 'A';
}
else if ((KeyCode >= HID_KEYBOARD_SC_1_AND_EXCLAMATION) &
- (KeyCode <= HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS))
+ (KeyCode < HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS))
+ {
+ PressedKey = (KeyCode - HID_KEYBOARD_SC_1_AND_EXCLAMATION) + '1';
+ }
+ else if (KeyCode == HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS)
{
{
- PressedKey =
(KeyCode - HID_KEYBOARD_SC_1_AND_EXCLAMATION) + '0';
+ PressedKey =
'0';
}
else if (KeyCode == HID_KEYBOARD_SC_SPACE)
{
}
else if (KeyCode == HID_KEYBOARD_SC_SPACE)
{