-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgc_bt_hid.h
99 lines (82 loc) · 3.19 KB
/
gc_bt_hid.h
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/******************************************************************************
* File Name: gc_bt_hid.h
*
* AUTHOR: Matthias Ernst
*
* Infineon Technologies AG
*
*****************************************************************************
* Copyright (C) 2024 Infineon Technologies AG. All rights reserved.
*
* Infineon Technologies AG (INFINEON) is supplying this file for use
* exclusively with Infineon's products. This file can be freely
* distributed within development tools and software supporting such microcontroller
* products.
*
* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
* INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR DIRECT, INDIRECT, INCIDENTAL,
* ASPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
*
*
*******************************************************************************/
#ifndef GC_BT_HID_H_
#define GC_BT_HID_H_
/*******************************************************************************
* Header Files
*******************************************************************************/
#include "wiced_bt_stack.h"
#include "cybsp.h"
#include "cyhal.h"
#include "cycfg_bt_settings.h"
#include <FreeRTOS.h>
#include <task.h>
#include <queue.h>
#include "semphr.h"
/******************************************************************************
* MACROS
******************************************************************************/
/*TODO: own task for gc scan, separated from ble task; hand over scan by messages and queues*/
/*Differentiate message types gamecontroller_report and battery message*/
#define GAMECONTROLLER_MSG_TYPE (1U)
#define BATT_MSG_TYPE (2U)
//#define DISPLAY_MSG_TYPE (3U)
/******************************************************************************
* Global variables
******************************************************************************/
extern TaskHandle_t gameControllerScan_task_h;
/*TODO: own task for gc scan, separated from ble task; hand over scan by messages and queues*/
extern QueueHandle_t hid_rpt_q;
/*Game Controller report*/
typedef struct
{
/* Button state in bitmap */
uint16_t buttonState;
/* X motion joystick left 8 bits */
int8_t xMotion;
/* Y motion joystick left 8 bits */
int8_t yMotion;
/* X motion joystick right 8 bits */
int8_t zMotion;
/* Y motion joystick right 8 bits */
int8_t rxMotion;
} gamecontroller_rpt_t;
/*TODO: own task for gc scan, separated from ble task; hand over scan by messages and queues*/
/* HID Message type : Keyscan Message or Battery level */
union msg
{
gamecontroller_rpt_t gc_report;
uint8_t batt_level;
};
/*TODO: own task for gc scan, separated from ble task; hand over scan by messages and queues*/
struct hid_rpt_msg
{
uint8_t msg_type; //GAMECONTROLLER_MSG_TYPE, BATT_MSG_TYPE
union msg data;
};
/****************************************************************************
* FUNCTION DECLARATIONS
***************************************************************************/
void app_ble_task(void *pvParameters);
#endif /* GC_BT_HID_H_ */