-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathginput_lld_mouse.c
69 lines (58 loc) · 1.59 KB
/
ginput_lld_mouse.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* This file is subject to the terms of the GFX License. If a copy of
* the license was not distributed with this file, you can obtain one at:
*
* http://ugfx.org/license.html
*/
/**
* @file drivers/ginput/touch/MCU/ginput_lld_mouse.c
* @brief GINPUT Touch low level driver source for the MCU.
*
* @defgroup Mouse Mouse
* @ingroup GINPUT
*
* @{
*/
#include "gfx.h"
#if (GFX_USE_GINPUT && GINPUT_NEED_MOUSE) /*|| defined(__DOXYGEN__)*/
#include "src/ginput/driver_mouse.h"
#include "stm32f429i_discovery_ioe.h"
/*===========================================================================*/
/* Driver local functions. */
/*===========================================================================*/
static inline void init_board(void) {
IOE_Config();
}
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
/**
* @brief Initialise the mouse/touch.
*
* @notapi
*/
void ginput_lld_mouse_init(void) {
init_board();
}
/**
* @brief Read the mouse/touch position.
*
* @param[in] pt A pointer to the structure to fill
*
* @notapi
*/
void ginput_lld_mouse_get_reading(MouseReading *pt) {
TP_STATE* tps;
tps = IOE_TP_GetState();
if (tps->TouchDetected) {
pt->buttons = GINPUT_TOUCH_PRESSED;
pt->x = tps->X;
pt->y = tps->Y;
pt->z = tps->Z;
}
else {
pt->buttons = 0;
}
}
#endif /* GFX_USE_GINPUT && GINPUT_NEED_MOUSE */
/** @} */