1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
53
56
57
62
69
70
75
82
83
88
95
96
101
108
109
114
117
118
123
126
127
132
135
136
141
156
157
162
163
164
169
170
171
172
173
174
175
179
183
187
191
193
194
195
196
197
198
199
200
201
206
210
211
216
220
221
226
230
231
236
240
241
246
250
251
256
/* ... */
#include "main.h"
#include "stm32f4xx_it.h"
Includes
extern PCD_HandleTypeDef hpcd_FS;
extern PCD_HandleTypeDef hpcd_HS;
extern PCD_HandleTypeDef hpcd;
extern USBD_HandleTypeDef USBD_Device_FS;
uint8_t HID_Buffer[4];
#define CURSOR_STEP 5
extern UART_HandleTypeDef UartHandle;
extern TIM_HandleTypeDef TimHandle;Private variables
static void GetPointerData(uint8_t * pbuf);
/* ... */
void NMI_Handler(void)
{
}{ ... }
/* ... */
void HardFault_Handler(void)
{
while (1)
{
}while (1) { ... }
}{ ... }
/* ... */
void MemManage_Handler(void)
{
while (1)
{
}while (1) { ... }
}{ ... }
/* ... */
void BusFault_Handler(void)
{
while (1)
{
}while (1) { ... }
}{ ... }
/* ... */
void UsageFault_Handler(void)
{
while (1)
{
}while (1) { ... }
}{ ... }
/* ... */
void SVC_Handler(void)
{
}{ ... }
/* ... */
void DebugMon_Handler(void)
{
}{ ... }
/* ... */
void PendSV_Handler(void)
{
}{ ... }
/* ... */
void SysTick_Handler(void)
{
static __IO uint32_t counter = 0;
HAL_IncTick();
if (counter++ == 10)
{
GetPointerData(HID_Buffer);
if ((HID_Buffer[1] != 0) || (HID_Buffer[2] != 0))
{
USBD_HID_SendReport(&USBD_Device_FS, HID_Buffer, 4);
}if ((HID_Buffer[1] != 0) || (HID_Buffer[2] != 0)) { ... }
counter = 0;
}if (counter++ == 10) { ... }
}{ ... }
...
...
/* ... */
static void GetPointerData(uint8_t * pbuf)
{
int8_t x = 0, y = 0;
switch (BSP_JOY_GetState())
{
case JOY_LEFT:
x -= CURSOR_STEP;
break;
case JOY_LEFT:
case JOY_RIGHT:
x += CURSOR_STEP;
break;
case JOY_RIGHT:
case JOY_UP:
y -= CURSOR_STEP;
break;
case JOY_UP:
case JOY_DOWN:
y += CURSOR_STEP;
break;
case JOY_DOWN:
default:
break;default
}switch (BSP_JOY_GetState()) { ... }
pbuf[0] = 0;
pbuf[1] = x;
pbuf[2] = y;
pbuf[3] = 0;
}{ ... }
/* ... */
void OTG_HS_IRQHandler(void)
{
HAL_PCD_IRQHandler(&hpcd_HS);
}{ ... }
/* ... */
void OTG_FS_IRQHandler(void)
{
HAL_PCD_IRQHandler(&hpcd_FS);
}{ ... }
/* ... */
void USARTx_DMA_TX_IRQHandler(void)
{
HAL_DMA_IRQHandler(UartHandle.hdmatx);
}{ ... }
/* ... */
void USARTx_IRQHandler(void)
{
HAL_UART_IRQHandler(&UartHandle);
}{ ... }
/* ... */
void TIMx_IRQHandler(void)
{
HAL_TIM_IRQHandler(&TimHandle);
}{ ... }
/* ... */
...Private functions