📄 usb.lst
字号:
568 2 {
569 3 Control_Data.wLength = 0; //== 发送0字节长度数据到主机做回答
570 3 Control_Data.wCount = 0;
571 3 bEPPflags.bits.control_state = USB_TRANSMIT; //== 设置为发送状态,等待in端点中断
572 3 set_endpoint_disable();
573 3 set_endpoint_enable();
574 3 bEPPflags.bits.configuration = 1;
575 3 }
576 2 else
577 2 {
578 3 stall_ep0();
579 3 }
580 2 }
581 1 return 0;
582 1 }
583
584 //===============================================================================//
585 //== 函 数 名:get_interface
586 //== 功 能:得到接口
587 //== 说 明:
588 //== 时 间:2008.8.20 创建函数
589 //== 入口参数:无
590 //== 返 回 值:0
591 //===============================================================================//
592 unsigned char get_interface(void)
593 {
594 1 #ifdef __DEBUG__ //== 打印调试信息
595 1 Print_Msg("Runing get_interface()!\r\n");
596 1 #endif
597 1 usb_transmit_buf[0] = 0;
598 1 Control_Data.pData = usb_transmit_buf;
599 1
600 1 Control_Data.wLength = 1;
601 1 Control_Data.wCount = 0;
602 1 bEPPflags.bits.control_state = USB_TRANSMIT; //== 设置为发送状态,等待in端点中断
603 1 return 0;
604 1 }
605
606 //===============================================================================//
607 //== 函 数 名:set_interface
608 //== 功 能:设置接口
609 //== 说 明:
610 //== 时 间:2008.8.20 创建函数
611 //== 入口参数:无
612 //== 返 回 值:0
613 //===============================================================================//
C51 COMPILER V7.50 USB 11/24/2008 09:12:36 PAGE 11
614 unsigned char set_interface(void)
615 {
616 1 #ifdef __DEBUG__ //== 打印调试信息
617 1 Print_Msg("Runing set_interface()!\r\n");
618 1 #endif
619 1 if (Control_Data.DeviceRequest.wValue == 0 && Control_Data.DeviceRequest.wIndex == 0)
620 1 {
621 2 Control_Data.wLength = 0; //== 发送0字节长度数据到主机做回答
622 2 Control_Data.wCount = 0;
623 2 bEPPflags.bits.control_state = USB_TRANSMIT; //== 设置为发送状态,等待in端点中断
624 2 }
625 1 else
626 1 {
627 2 stall_ep0();
628 2 }
629 1 return 0;
630 1 }
631
632 //===============================================================================//
633 //== 函 数 名:get_report
634 //== 功 能:得到报告
635 //== 说 明:
636 //== 时 间:2008.8.20 创建函数
637 //== 入口参数:无
638 //== 返 回 值:0
639 //===============================================================================//
640 unsigned char get_report(void)
641 {
642 1 #ifdef __DEBUG__ //== 打印调试信息
643 1 Print_Msg("Runing get_report()!\r\n");
644 1 #endif
645 1
646 1 #ifdef __DEBUG__ //== 打印调试信息
647 1 Print_Msg(" 获取报告................................\r\n");
648 1 #endif
649 1 return 0;
650 1 }
651
652 //===============================================================================//
653 //== 函 数 名:set_report
654 //== 功 能:设置报告
655 //== 说 明:
656 //== 时 间:2008.8.20 创建函数
657 //== 入口参数:无
658 //== 返 回 值:0
659 //===============================================================================//
660 unsigned char set_report(void)
661 {
662 1 #ifdef __DEBUG__ //== 打印调试信息
663 1 Print_Msg("Runing set_report()!\r\n");
664 1 #endif
665 1
666 1 #ifdef __DEBUG__ //== 打印调试信息
667 1 Print_Msg(" 设置报告................................\r\n");
668 1 #endif
669 1 return 0;
670 1 }
671
672 //===============================================================================//
673 //== 函 数 名:set_report
674 //== 功 能:设置报告
675 //== 说 明:
C51 COMPILER V7.50 USB 11/24/2008 09:12:36 PAGE 12
676 //== 时 间:2008.8.20 创建函数
677 //== 入口参数:无
678 //== 返 回 值:0
679 //===============================================================================//
680 unsigned char get_idle(void)
681 {
682 1 #ifdef __DEBUG__ //== 打印调试信息
683 1 Print_Msg("Runing get_idle()!\r\n");
684 1 #endif
685 1
686 1 #ifdef __DEBUG__ //== 打印调试信息
687 1 Print_Msg(" 获取空闲................................\r\n");
688 1 #endif
689 1
690 1 Control_Data.pData = &hid_idle;
691 1 Control_Data.wLength = 1;
692 1 Control_Data.wCount = 0;
693 1 bEPPflags.bits.control_state = USB_TRANSMIT; //== 设置为发送状态,等待in端点中断
694 1 return 0;
695 1 }
696
697 //===============================================================================//
698 //== 函 数 名:set_idle
699 //== 功 能:设置报告
700 //== 说 明:
701 //== 时 间:2008.8.20 创建函数
702 //== 入口参数:无
703 //== 返 回 值:0
704 //===============================================================================//
705 unsigned char set_idle(void)
706 {
707 1 #ifdef __DEBUG__ //== 打印调试信息
708 1 Print_Msg("Runing set_idle()!\r\n");
709 1 #endif
710 1 hid_idle = Control_Data.DeviceRequest.wValue;
711 1 Control_Data.wLength = 0; //== 发送0字节长度数据到主机做回答
712 1 Control_Data.wCount = 0;
713 1 bEPPflags.bits.control_state = USB_TRANSMIT; //== 设置为发送状态,等待in端点中断
714 1 return 0;
715 1 }
716
717 //===============================================================================//
718 //== 函 数 名:get_protocol
719 //== 功 能:获得协议
720 //== 说 明:
721 //== 时 间:2008.8.20 创建函数
722 //== 入口参数:无
723 //== 返 回 值:0
724 //===============================================================================//
725 unsigned char get_protocol(void)
726 {
727 1 #ifdef __DEBUG__ //== 打印调试信息
728 1 Print_Msg("Runing get_protocol()!\r\n");
729 1 #endif
730 1
731 1 #ifdef __DEBUG__ //== 打印调试信息
732 1 Print_Msg(" 获取协议................................\r\n");
733 1 #endif
734 1
735 1 Control_Data.pData = &hid_protocol;
736 1 Control_Data.wLength = 1;
737 1 Control_Data.wCount = 0;
C51 COMPILER V7.50 USB 11/24/2008 09:12:36 PAGE 13
738 1 bEPPflags.bits.control_state = USB_TRANSMIT; //== 设置为发送状态,等待in端点中断
739 1 return 0;
740 1 }
741
742 //===============================================================================//
743 //== 函 数 名:set_protocol
744 //== 功 能:设置协议
745 //== 说 明:
746 //== 时 间:2008.8.20 创建函数
747 //== 入口参数:无
748 //== 返 回 值:0
749 //===============================================================================//
750 unsigned char set_protocol(void)
751 {
752 1 #ifdef __DEBUG__ //== 打印调试信息
753 1 Print_Msg("Runing set_protocol()!\r\n");
754 1 #endif
755 1
756 1 #ifdef __DEBUG__ //== 打印调试信息
757 1 Print_Msg("设置协议................................\r\n");
758 1 #endif
759 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -