forked from 48productions/piuio-pico
-
Notifications
You must be signed in to change notification settings - Fork 1
/
xinput_driver.h
43 lines (36 loc) · 1.57 KB
/
xinput_driver.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
/******************************************************************************/
/* SPDX-License-Identifier: MIT */
/* SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) */
/* https://github.com/sugoku/piuio-pico-brokeIO */
/******************************************************************************/
#ifndef _XINPUT_DRIVER
#define _XINPUT_DRIVER
#include <stdint.h>
#include "tusb.h"
#include "device/usbd_pvt.h"
#define XINPUT_OUT_SIZE 32
typedef enum
{
XINPUT_PLED_OFF = 0x00, // All off
XINPUT_PLED_BLINKALL = 0x01, // All blinking
XINPUT_PLED_FLASH1 = 0x02, // 1 flashes, then on
XINPUT_PLED_FLASH2 = 0x03, // 2 flashes, then on
XINPUT_PLED_FLASH3 = 0x04, // 3 flashes, then on
XINPUT_PLED_FLASH4 = 0x05, // 4 flashes, then on
XINPUT_PLED_ON1 = 0x06, // 1 on
XINPUT_PLED_ON2 = 0x07, // 2 on
XINPUT_PLED_ON3 = 0x08, // 3 on
XINPUT_PLED_ON4 = 0x09, // 4 on
XINPUT_PLED_ROTATE = 0x0A, // Rotating (e.g. 1-2-4-3)
XINPUT_PLED_BLINK = 0x0B, // Blinking*
XINPUT_PLED_SLOWBLINK = 0x0C, // Slow blinking*
XINPUT_PLED_ALTERNATE = 0x0D, // Alternating (e.g. 1+4-2+3), then back to previous*
} XInputPLEDPattern;
// USB endpoint state vars
extern uint8_t endpoint_in;
extern uint8_t endpoint_out;
extern uint8_t xinput_out_buffer[XINPUT_OUT_SIZE];
extern const usbd_class_driver_t xinput_driver;
void receive_xinput_report(void);
bool send_xinput_report(void *report, uint8_t report_size);
#endif