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

📄 keyboard.h

📁 hid_keyboard
💻 H
字号:
/****************************************************************************

  Copyright (C) Cambridge Silicon Radio October 2001

FILE
        hid_keyboard.h - defines for hid_keyboard

MODIFICATION HISTORY


*****************************************************************************/

/*
	The possible states of the keyboard
*/
typedef enum
{
	init,
	unconnected,
	discoverable,
	connecting,
	connected,
	disconnecting
}
state_t;

/*
	Keyboard's internal data
*/
typedef struct
{	
	state_t		state;			/* current state */
	BD_ADDR_T	host_addr;
	uint8		protocol;
	uint8		idle;
	bool_t		virtual_cable;
	
	/* flag to indicate user pressed the connect button, but we were unable to process
	   it immediately.  As we change state, we should check for this. */
	bool_t		button_press_pending;

	/* the current powermode in the powerstate table we are using */
	uint8_t		power_mode;

	/* save last received led state from Host, so we can return it
	   in GET_REPORT */
	uint8_t		led_state;
}
DEVICE_STATE_T;


/*
	The PIO mask that defines the connect button.
*/
#define CONNECT_BUTTON (1<<7)

/*
	The PIO lines for the keyboard LEDs
*/
#define NUM_LOCK	(1<<0)
#define CAPS_LOCK	(1<<1)
#define SCROLL_LOCK	(1<<2)

/*
	Signal to external micro that we are in idle mode.
*/
#define IDLE_MODE	(1<<3)

/*
	Time in seconds between reading the battery.
	(Note that this number should be a multiple of 4 because battery monitor
	takes 4 samples before returning average).
*/
#define BATTERY_SAMPLE_RATE (4*60) /* every 4 minutes */


/*
	Function prototypes
*/
void connect(connect_type_t con_type);
void cancelConnect(void);
void disconnect(bool_t unplug);
void removeVirtualCable(void);
void sendBatteryReport(uint16_t battery_level);

void handleSetProtocol(const HID_SET_PROTOCOL_IND_T *prim);
void handleGetProtocol(const HID_GET_PROTOCOL_IND_T *prim);
void handleSetIdle(const HID_SET_IDLE_IND_T *prim);
void handleGetIdle(const HID_GET_IDLE_IND_T *prim);
void handleGetReport(const HID_GET_REPORT_IND_T *prim);
void handleControl(const HID_CONTROL_IND_T *prim);
void handleSetReport(const HID_SET_REPORT_IND_T *prim);

⌨️ 快捷键说明

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