Files
ACD528xx_Test_Project/source/mouse.h
T

86 lines
1.8 KiB
C

/**
* @file mouse.h
* @author Odri (odri@aconno.de)
* @brief USB HID Mouse header file
* @version 0.1
* @date 2019-05-09
*
* @copyright Copyright (c) 2019
*
*/
#ifndef __MOUSE_H__
#define __MOUSE_H__
//------------------------------ INCLUDES -------------------------------------
#ifdef NRF52840_XXAA
#include "app_timer.h"
#include "app_usbd.h"
#include "app_usbd_core.h"
#include "app_usbd_hid_generic.h"
extern "C"
{
#include "app_usbd_hid_mouse.h"
}
#include "app_error.h"
//----------------------------- DATA TYPES ------------------------------------
/**
* @brief GPIO pull-up/down configuration
*
*/
enum class USB_DIR : uint8_t
{
LEFT = 0, //!< 0
RIGHT = 1, //!< 1
DOWN = 2, //!< 2
UP = 3 //!< 3
};
//-------------------------- CONSTANTS & MACROS -------------------------------
/**
* @brief Enable HID mouse class
*/
#define CONFIG_HAS_MOUSE 1
/**
* @brief Mouse button count
*/
#define CONFIG_MOUSE_BUTTON_COUNT 2
/**
* @brief Mouse speed (value sent via HID when board button is pressed).
*/
#define CONFIG_MOUSE_MOVE_STEP (3)
/**
* @brief Mouse move repeat time in milliseconds
*/
#define CONFIG_MOUSE_MOVE_TIME_MS (20)
/* HID report layout */
#define BTN_MOUSE_X_POS 0
#define BTN_MOUSE_Y_POS 1
/**
* @brief USB composite interfaces
*/
#define APP_USBD_INTERFACE_MOUSE 0
//----------------------------PUBLIC PROTOTYPES -------------------------------
/**
* @brief Setup USB HID Mouse
* @note It is assumed that the softdevice handler is enabled
*
*/
void usbSetup();
/**
* @brief Process the state of the mouse movement
*
* @param direction Direction of the mouse movement
*/
void hid_generic_mouse_process_state(USB_DIR direction);
/**
* @brief Stop mouse activity
*
*/
void hid_generic_mouse_stop_state(void);
#endif
#endif // __MOUSE_H__