使用SAM E54的打印机示例在USB上写入USB
我试图使用Microchip https://github.com/microchip-mplab-harmony/usb_apps_device/tree/master/master/master/printer_basic#config_9 。我想收到MCU的答案。我想设置一个USB_DEVICE_PRINTER_WRITE。
我决定在app.c中修改代码如下:
case APP_STATE_SCHEDULE_WRITE:
/* Setup the write */
appData.writeTransferHandle = USB_DEVICE_PRINTER_TRANSFER_HANDLE_INVALID;
appData.state = APP_STATE_WAIT_FOR_WRITE_COMPLETE;
/* Reset Switch Pressed status */
appData.isSwitchPressed = false;
printerResult = USB_DEVICE_PRINTER_Write(USB_DEVICE_PRINTER_INDEX_0,
&appData.writeTransferHandle, (void*)&appData.prntrReadBuffer[0],
APP_READ_BUFFER_SIZE,USB_DEVICE_PRINTER_TRANSFER_FLAGS_DATA_COMPLETE);
if(printerResult== USB_DEVICE_PRINTER_RESULT_ERROR_INSTANCE_NOT_CONFIGURED)
{
LED_Toggle();
}
break;
我总是将以下结果作为打印机:usb_device_printer_rinter_error_error_error_instance_not_configured,
是否缺少某些东西?
还有其他参考吗?
I was trying to use the SAM E54 Xplained dev board to achieve printer communication using this example from Microchip https://github.com/Microchip-MPLAB-Harmony/usb_apps_device/tree/master/apps/printer_basic#config_9 . I would like to receive an answer from the MCU. I would like to set up a USB_DEVICE_PRINTER_Write.
I decided to modify the code in the app.c as following:
case APP_STATE_SCHEDULE_WRITE:
/* Setup the write */
appData.writeTransferHandle = USB_DEVICE_PRINTER_TRANSFER_HANDLE_INVALID;
appData.state = APP_STATE_WAIT_FOR_WRITE_COMPLETE;
/* Reset Switch Pressed status */
appData.isSwitchPressed = false;
printerResult = USB_DEVICE_PRINTER_Write(USB_DEVICE_PRINTER_INDEX_0,
&appData.writeTransferHandle, (void*)&appData.prntrReadBuffer[0],
APP_READ_BUFFER_SIZE,USB_DEVICE_PRINTER_TRANSFER_FLAGS_DATA_COMPLETE);
if(printerResult== USB_DEVICE_PRINTER_RESULT_ERROR_INSTANCE_NOT_CONFIGURED)
{
LED_Toggle();
}
break;
I always got the following result as printerResult: USB_DEVICE_PRINTER_RESULT_ERROR_INSTANCE_NOT_CONFIGURED
Is there something missing?
Are there other references?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论