⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 app_dongle.c

📁 Bluetooth HID emulation
💻 C
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2005-2006
Part of BlueLab 3.6.2-release

FILE NAME
    app_dongle.c
DESCRIPTION
    This file contains the HID dongle task.
NOTES

*/

/****************************************************************************
    Header files
*/
#include "hid.h"
#include "app_usb.h"
#include "app_device.h"
#include "app_led.h"
#include "app_dongle_button.h"

#include <connection.h>
#include <message.h>
#include <vm.h>
#include <stream.h>
#include <bdaddr.h>
#include <stdio.h>
#include <source.h>
#include <string.h>
#include <assert.h>
#include <panic.h>
#include <stdlib.h>
#include <ps.h>


#define SNUT_PSM  13
#ifdef APP_DEBUG
#include <stdio.h>
#define MAIN_PRINT(x) printf x
#else
#define MAIN_PRINT(x)
#endif


static void appHandler(Task task, MessageId id, Message message)
{
	return;
	
}
/*************************************************************************
NAME    
    _init
DESCRIPTION
    Extra initialisation for time critical functionality.
RETURNS
*/
extern void _init(void);
void _init(void)
{
    /* Initialise USB interface */
    UsbInitInterfaceTimeCritical();
}

/*************************************************************************
NAME    
    main
DESCRIPTION
    Main entry point.
RETURNS
    int - Should never return.
*/
extern void mouseEmulationInit(Sink, Sink);

int main(void)
{
    static  appDongleTaskData theApp;
    
   theApp.task.handler = appHandler; 
   	theApp.state = appDongleInitialising;
   
    /* Initialise buttons */
    pioInit(&theApp.pio_state, &theApp.task);
    
    /* Initialise Led */
    LedInit(&theApp.led, &theApp);
    LedUpdate(&theApp.led, 0, -1, 1);
    LedSetPriority(&theApp.led, 1);   
  

    /* Initialise devices */
    /* 谅螟 厘摹 */
	appDeviceInit(&theApp.dev_table[0], 0, HID_MAJOR_DEVICE_CLASS | HID_MINOR_MOUSE, &theApp, "0000");
	/* 快螟 厘摹*/
	appDeviceInit(&theApp.dev_table[1], 0, HID_MAJOR_DEVICE_CLASS | HID_MINOR_MOUSE, &theApp, "0000");

	
    /* Initialise the USB devices */
   	UsbInitMouseDevice(&theApp.dev_table[0]);
	UsbInitRightMouseDevice(&theApp.dev_table[1]);
	
	
	theApp.dev_table[0].ep_sink = StreamUsbEndPointSink(MOUSE_ENDPOINT_ADDRESS);
	if(!theApp.dev_table[0].ep_sink){ /* API 巩辑俊绰 俊矾俊措茄 攫鞭捞 绝澜 */		
		DEBUG(("Cannot open USB end point")); 	
	}
 
	theApp.dev_table[1].ep_sink = StreamUsbEndPointSink(KEYBOARD_ENDPOINT_ADDRESS);
	
	if(!theApp.dev_table[1].ep_sink){ /* API 巩辑俊绰 俊矾俊措茄 攫鞭捞 绝澜 */		
		DEBUG(("Cannot open USB end point")); 	
	}
 
	mouseEmulationInit(theApp.dev_table[0].ep_sink, theApp.dev_table[1].ep_sink); 
	
    /* Init the Connection Manager */
	/* ConnectionInit(&theApp.task); */

	/* Start the message scheduler loop */
    MessageLoop();
    
    /* We should never get here */
    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -