77范文网 - 专业文章范例文档资料分享平台

Designing a low cost CY7C63723 combination mouse(6)

来源:网络收集 时间:2021-01-20 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

sampled high, detect PS2. If SDATA(D-) sampledhigh, disable the USB connect resistor and Delay100uS. If D+ and D- are both 0, detect a USBinterface, else detect a PS2 interface.

void MouseTask(void) - This routine is called

every 4 msec from the main loop. It maintains theidle counter, which determines the rate at whichmouse packets are sent to the host in the

absence of a state change in the mouse itself. Italso sends a mouse packet if either of X, Y, or Zcounts or the buttons have changed state.void Suspend(void) - This routine handles theentrance/exit from suspend. If the mouse isconfigured for remote wakeup, the bus reset,wakeup, and GPIO interrupts are enabled. Theoptical inputs are sampled once. The code thenenters a loop in which the chip is suspended, andwill wake at least as often as the wakeup ISR, butperhaps due to a GPIO or a USB bus reset

interrupt. Each time the chip wakes up, the LEDdrive is re-enabled, and the switches and opticalinputs are sampled to see if a change occured,and bus activity is monitored. Any of these

conditions will cause the firmware to exit the loop.If the device is not enabled for remote wakeup, allports are put into the high-Z state, only the USBbus reset interrupt is enabled, and the part issuspended. If the resume was due to bus

activity, the firmware returns to the main loop. Ifthe resume was due to mouse movement or abutton press, a K state is driven upstream for 14milliseconds prior to returning to the main loop.void usbmain(void) – This function spins in aninfinite loop waiting for an event that needs

servicing. Main is entered from either the power-on reset or the USB bus reset. Both of these

reset routines insures that all USB variables havebeen initialized prior to calling usbmain().void HandleSetup(void) - This routine is enteredwhenever an SETUP packet has come in onendpoint 0. It performs some preliminary

validation on the packet, then parses the packetand calls the appropriate routine to handle thepacket.

void HandleIn(void) - This routine is enteredwhenever an IN packet has come in on endpoint0.

void USB_control_read(void) - This routine iscalled after a SETUP has been received that is

entry, XmtBuff has been initialized to point to thedata buffer that needs to be transmitted. Thisfunction adjusts the length of the data to be

returned if the host requested less data than theactual length of the buffer. It then loads the FIFOwith the first packet of data and prepares the SIEto ACK with the data.

char LoadEP0Fifo(void) - This routine loads theUSB endpoint 0 FIFO with data pointed to byXmtBuff. It then returns the length of dataactually loaded into the FIFO.

void SetConfiguration(void) - This routine is

entered when a SET CONFIGURATION requesthas been received from the host.

void SetAddress(void) - This routine is enteredwhenever a SET ADDRESS request has beenreceived. The address change cannot actuallytake place until after the status stage of this no-data control transaction, so we just save theaddress and set a flag to indicate that a newaddress was just received. The code that

handles IN transactions will recognize this andset the address properly.

void GetDescriptor(void) - This routine is enteredwhen a GET DESCRIPTOR request is receivedfrom the host. This function decodes the

descriptor request and initializes XmtBuff to theproper descriptor, then initiates the transfer bycalling USB_control_read().

void SetIdle(void) - This routine is entered

whenever a SET IDLE request is received. Seethe HID spec for the rules on setting idle periods.This function sets the HID idle time. See the HIDdocumentation for details on handling the idletimer.

void SetProtocol(void) - This routine is enteredwhenever an SET PROTOCOL request isreceived. This no-data control transactionenables boot or report protocol.

void GetReport(void) - This routine is enteredwhenever a GET REPORT request to get a reportis received. The most recent mouse data reportis sent to the host via a control-read transactionon endpoint 0, instead of endpoint 1.

void GetIdle(void) - This routine is entered

whenever a GET IDLE request is received. Thisfunction then initiates a control-read transaction

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库Designing a low cost CY7C63723 combination mouse(6)在线全文阅读。

Designing a low cost CY7C63723 combination mouse(6).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/jiaoyu/1180011.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: