2021-12-14 13:34:31 +08:00
|
|
|
/**
|
|
|
|
|
**************************************************************************
|
|
|
|
|
* @file mouse_class.h
|
|
|
|
|
* @brief usb hid mouse header file
|
|
|
|
|
**************************************************************************
|
|
|
|
|
* Copyright notice & Disclaimer
|
|
|
|
|
*
|
2022-04-11 19:32:28 +08:00
|
|
|
* The software Board Support Package (BSP) that is made available to
|
|
|
|
|
* download from Artery official website is the copyrighted work of Artery.
|
|
|
|
|
* Artery authorizes customers to use, copy, and distribute the BSP
|
|
|
|
|
* software and its related documentation for the purpose of design and
|
|
|
|
|
* development in conjunction with Artery microcontrollers. Use of the
|
2021-12-14 13:34:31 +08:00
|
|
|
* software is governed by this copyright notice and the following disclaimer.
|
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
|
|
|
|
|
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
|
|
|
|
|
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
|
|
|
|
|
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
|
|
|
|
|
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
|
|
|
|
|
*
|
|
|
|
|
**************************************************************************
|
|
|
|
|
*/
|
2022-04-11 19:32:28 +08:00
|
|
|
|
2021-12-14 13:34:31 +08:00
|
|
|
/* define to prevent recursive inclusion -------------------------------------*/
|
|
|
|
|
#ifndef __MOUSE_CLASS_H
|
|
|
|
|
#define __MOUSE_CLASS_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
2022-04-11 19:32:28 +08:00
|
|
|
|
2021-12-14 13:34:31 +08:00
|
|
|
#include "usb_std.h"
|
|
|
|
|
#include "usbd_core.h"
|
|
|
|
|
|
|
|
|
|
/** @addtogroup AT32F415_middlewares_usbd_class
|
|
|
|
|
* @{
|
|
|
|
|
*/
|
2022-04-11 19:32:28 +08:00
|
|
|
|
2021-12-14 13:34:31 +08:00
|
|
|
/** @addtogroup USB_mouse_class
|
|
|
|
|
* @{
|
|
|
|
|
*/
|
|
|
|
|
|
2022-04-11 19:32:28 +08:00
|
|
|
/** @defgroup USB_mouse_class_endpoint_definition
|
2021-12-14 13:34:31 +08:00
|
|
|
* @{
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief usb hid use endpoint define
|
|
|
|
|
*/
|
2022-03-03 19:38:35 +08:00
|
|
|
#define USBD_MOUSE_IN_EPT 0x81
|
2021-12-14 13:34:31 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief usb hid in and out max packet size define
|
|
|
|
|
*/
|
2022-03-03 19:38:35 +08:00
|
|
|
#define USBD_MOUSE_IN_MAXPACKET_SIZE 0x40
|
2021-12-14 13:34:31 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @}
|
|
|
|
|
*/
|
|
|
|
|
|
2022-04-11 19:32:28 +08:00
|
|
|
/** @defgroup USB_mouse_class_request_code_definition
|
2021-12-14 13:34:31 +08:00
|
|
|
* @{
|
|
|
|
|
*/
|
2022-04-11 19:32:28 +08:00
|
|
|
|
2021-12-14 13:34:31 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief usb hid mouse operation
|
|
|
|
|
*/
|
|
|
|
|
#define MOVE_STEP 20
|
|
|
|
|
|
|
|
|
|
#define BUTTON_RELEASE 0
|
|
|
|
|
#define LEFT_BUTTON 1
|
|
|
|
|
#define RIGHT_BUTTON 2
|
|
|
|
|
#define LEFT_MOVE 3
|
|
|
|
|
#define RIGHT_MOVE 4
|
|
|
|
|
#define UP_MOVE 5
|
|
|
|
|
#define DOWN_MOVE 6
|
|
|
|
|
|
2022-03-03 19:38:35 +08:00
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
uint32_t hid_protocol;
|
|
|
|
|
uint32_t hid_set_idle;
|
|
|
|
|
uint32_t alt_setting;
|
2022-04-11 19:32:28 +08:00
|
|
|
|
2022-03-03 19:38:35 +08:00
|
|
|
uint8_t hid_set_report[64];
|
|
|
|
|
uint8_t mouse_buffer[4];
|
|
|
|
|
uint8_t hid_state;
|
|
|
|
|
__IO uint8_t hid_suspend_flag;
|
|
|
|
|
}mouse_type;
|
|
|
|
|
|
2021-12-14 13:34:31 +08:00
|
|
|
/**
|
|
|
|
|
* @}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** @defgroup USB_hid_class_exported_functions
|
|
|
|
|
* @{
|
|
|
|
|
*/
|
|
|
|
|
extern usbd_class_handler mouse_class_handler;
|
2022-03-03 19:38:35 +08:00
|
|
|
usb_sts_type usb_mouse_class_send_report(void *udev, uint8_t *report, uint16_t len);
|
2021-12-14 13:34:31 +08:00
|
|
|
void usb_hid_mouse_send(void *udev, uint8_t op);
|
|
|
|
|
/**
|
|
|
|
|
* @}
|
|
|
|
|
*/
|
2022-04-11 19:32:28 +08:00
|
|
|
|
2021-12-14 13:34:31 +08:00
|
|
|
/**
|
|
|
|
|
* @}
|
|
|
|
|
*/
|
2022-04-11 19:32:28 +08:00
|
|
|
|
2021-12-14 13:34:31 +08:00
|
|
|
/**
|
|
|
|
|
* @}
|
|
|
|
|
*/
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|