mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-16 12:51:47 +00:00
Modified the CDC Host demos to set a default CDC Line Encoding on enumerated devices.
This commit is contained in:
parent
63a65a9598
commit
6a9d1eab2d
@ -164,6 +164,18 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VirtualSerial_CDC_Interface.State.LineEncoding.BaudRateBPS = 9600;
|
||||||
|
VirtualSerial_CDC_Interface.State.LineEncoding.CharFormat = CDC_LINEENCODING_OneStopBit;
|
||||||
|
VirtualSerial_CDC_Interface.State.LineEncoding.ParityType = CDC_PARITY_None;
|
||||||
|
VirtualSerial_CDC_Interface.State.LineEncoding.DataBits = 8;
|
||||||
|
|
||||||
|
if (CDC_Host_SetLineEncoding(&VirtualSerial_CDC_Interface))
|
||||||
|
{
|
||||||
|
puts_P(PSTR("Error Setting Device Line Encoding.\r\n"));
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
puts_P(PSTR("CDC Device Enumerated.\r\n"));
|
puts_P(PSTR("CDC Device Enumerated.\r\n"));
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||||
}
|
}
|
||||||
|
@ -126,6 +126,31 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CDC_LineEncoding_t LineEncoding = { .BaudRateBPS = 9600,
|
||||||
|
.CharFormat = CDC_LINEENCODING_OneStopBit,
|
||||||
|
.ParityType = CDC_PARITY_None,
|
||||||
|
.DataBits = 8 };
|
||||||
|
|
||||||
|
USB_ControlRequest = (USB_Request_Header_t)
|
||||||
|
{
|
||||||
|
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
|
||||||
|
.bRequest = CDC_REQ_SetLineEncoding,
|
||||||
|
.wValue = 0,
|
||||||
|
.wIndex = 0,
|
||||||
|
.wLength = sizeof(LineEncoding),
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Set the Line Encoding of the CDC interface within the device, so that it is ready to accept data */
|
||||||
|
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||||
|
if (USB_Host_SendControlRequest(&LineEncoding) != HOST_SENDCONTROL_Successful)
|
||||||
|
{
|
||||||
|
printf_P(PSTR(ESC_FG_RED "Control Error (Set Line Encoding).\r\n"
|
||||||
|
" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
|
||||||
|
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
puts_P(PSTR("CDC Device Enumerated.\r\n"));
|
puts_P(PSTR("CDC Device Enumerated.\r\n"));
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* - Core:
|
* - Core:
|
||||||
* - Added support for the BitWizard Multio and Big-Multio boards
|
* - Added support for the BitWizard Multio and Big-Multio boards
|
||||||
* - Library Applications:
|
* - Library Applications:
|
||||||
* - None
|
* - Modified the CDC Host demos to set a default CDC Line Encoding on enumerated devices
|
||||||
*
|
*
|
||||||
* <b>Changed:</b>
|
* <b>Changed:</b>
|
||||||
* - Core:
|
* - Core:
|
||||||
|
Loading…
Reference in New Issue
Block a user