📄 hid_keyboard.h
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2005-2006
Part of BlueLab 3.5.2-release
FILE NAME
hid_keyboard.h
DESCRIPTION
*/
#ifndef _HID_KEYBOARD_H_
#define _HID_KEYBOARD_H_
/****************************************************************************
Header files
*/
#include <hid.h>
#include <connection.h>
#include <message.h>
#include <stream.h>
#include <bdaddr.h>
#include <stdio.h>
#include <source.h>
#include <stdlib.h>
#include <pio.h>
#include <app/vm/vm_if.h>
#include "hid_keyboard_led.h"
#include "hid_keyboard_button.h"
#ifndef HW_CASIRA_UART
#define HW_CASIRA_UART
#endif
#ifndef APP_FIXED_PIN
#define APP_FIXED_PIN
#endif
#ifdef APP_DEBUG
#define MAIN_PRINT(x) printf x
#else
#define MAIN_PRINT(x)
#endif
/***********PSKEY DEFINE***********************************************/
#define PSKEY_FIX_DYN_PIN_CODE (8)
#ifdef HW_CASIRA_UART
/*Define which PIOs are used for pairing status LED*/
#define PIO_LED_BLUE (1<<6)
#define PIO_LED_RED (1<<7)
/* Defines which PIOs are used for status LEDs */
#define LED_PIO_NUM_LOCK (10)/*2*/
#define LED_PIO_CAPS_LOCK (11)/*3*/
#define LED_PIO_SCROLL_LOCK (12)/*7*/
/*#define LED_PIO_SCROLL2_LOCK (6)*/
#define LED_MASK_NUM_LOCK (1 << LED_PIO_NUM_LOCK)
#define LED_MASK_CAPS_LOCK (1 << LED_PIO_CAPS_LOCK)
#define LED_MASK_SCROLL_LOCK (1 << LED_PIO_SCROLL_LOCK)
/*#define LED_MASK_SCROLL2_LOCK (1 << LED_PIO_SCROLL2_LOCK)*/
/* PIO to control idle mode (Must match PSKEY_HIDIO_UART) */
#define HID_PIO_IDLE_MODE (7)/*6*/
#define HID_MASK_IDLE_MODE (1 << HID_PIO_IDLE_MODE)
#endif
#ifdef HW_DEV_1163A
/* Defines which PIOs are used for status LEDs */
#define LED_PIO_CAPS_LOCK (10)
#define LED_PIO_SCROLL_LOCK (12)
#define LED_MASK_NUM_LOCK (0) /* Aux DAC */
#define LED_MASK_CAPS_LOCK (1 << LED_PIO_SCROLL_LOCK)
/* #define LED_MASK_SCROLL_LOCK (1 << LED_PIO_SCROLL_LOCK) */
#define LED_MASK_SCROLL_LOCK (1 << LED_PIO_SCROLL_LOCK)
/*#define LED_MASK_SCROLL2_LOCK (1 << LED_PIO_SCROLL2_LOCK)*/
/* Use Aux DAC for status LED */
#define LED_AUX_DAC
/* PIO to control idle mode (Not used) */
#define HID_MASK_IDLE_MODE (0)
#endif
/* Persistent store base for device attributes */
#define APP_KEYBOARD_ATTR_PS_BASE (0)
/* Internal messages */
enum
{
APP_INTERNAL_PIN_CODE_TIMEOUT_IND = 100,
APP_INTERNAL_IDLE_TIMEOUT_IND,
APP_INTERNAL_UNPLUG_TIMEOUT_IND,
APP_INTERNAL_DISCOVERABLE_TIMEOUT_IND,
APP_PAIRMODE_LED_UPDATE
};
/* Inactivity timeout */
#define APP_IDLE_TIMEOUT (1200)
/* Virtual unplug timeout */
#define APP_UNPLUG_TIMEOUT (600)
/* Pin code timeout */
#define APP_PIN_CODE_TIMEOUT (600)
/* Discoverable timeout */
#define APP_DISCOVERABLE_TIMEOUT (600)
/* Application states */
typedef enum
{
appInitialising,
appDiscoverable,
appDiscoverableConnecting,
appDiscoverableConnected,
appCabledConnecting,
appCabledConnected,
appCabledDisconnecting,
appCabledDisconnected,
appIdle
} app_state;
/* Authentication states */
typedef enum
{
appAuthIdle,
appAuthPinCode,
appAuthTrusted
} app_auth_state;
/* Application task data */
typedef struct
{
TaskData task;
HID_LIB *hid_lib;
HID *hid;
unsigned int trusted_device_index:4;
unsigned int unplug_pending:1;
app_state state;
app_auth_state auth_state;
appLedTaskData led;
PioState pioState;
unsigned int keyboard_led_state:3;
unsigned int keyboard_idle_rate:8;
uint8 aux_keys_state;
hid_protocol keyboard_protocol;
hid_pin hid_pin;
bdaddr host_bd_addr;
bdaddr auth_bd_addr;
Sink interrupt_sink;
bool Dyn_Fix_Pin_Code;/*dynamic or fix pin_code flag,
0 dyn pin code by hujie in 2007-06-18*/
} appTaskData;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -