v1.2版本改为通过xbox系列手柄进行遥控,并增加智能模式和手动模式
This commit is contained in:
1 parent
76603d3c31
commit
1a97bc32c3
1839 files changed
+478852
-3
No files matched your search
@@ -0,0 +1,36 @@
|
||||
#ifndef __XBOX_CONTROLLER_NOTIFICATION_PARSER_H__
|
||||
#define __XBOX_CONTROLLER_NOTIFICATION_PARSER_H__
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#define XBOX_CONTROLLER_ERROR_INVALID_LENGTH 1
|
||||
|
||||
class XboxControllerNotificationParser {
|
||||
public:
|
||||
XboxControllerNotificationParser();
|
||||
|
||||
bool btnA, btnB, btnX, btnY;
|
||||
bool btnShare, btnStart, btnSelect, btnXbox;
|
||||
// side top button
|
||||
bool btnLB, btnRB;
|
||||
// button on joy stick
|
||||
bool btnLS, btnRS;
|
||||
bool btnDirUp, btnDirLeft, btnDirRight, btnDirDown;
|
||||
uint16_t joyLHori = maxJoy / 2;
|
||||
uint16_t joyLVert = maxJoy / 2;
|
||||
uint16_t joyRHori = maxJoy / 2;
|
||||
uint16_t joyRVert = maxJoy / 2;
|
||||
uint16_t trigLT, trigRT;
|
||||
uint8_t update(uint8_t* data, size_t length);
|
||||
uint8_t toArr(uint8_t* data, size_t length);
|
||||
String toString();
|
||||
|
||||
static const size_t expectedDataLen = 16;
|
||||
static const uint16_t maxJoy = 0xffff;
|
||||
static const uint16_t maxTrig = 0x3ff;
|
||||
uint8_t rx_buf[expectedDataLen];
|
||||
private:
|
||||
static void convertU16TU8Arr(uint16_t vU16, uint8_t* data);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user