46 lines
1.5 KiB
C++
46 lines
1.5 KiB
C++
#ifndef HANDLERS_H
|
|
#define HANDLERS_H
|
|
|
|
#include "motor.h"
|
|
#include "storage.h"
|
|
#include "ble.h"
|
|
#include "ultrasound.h"
|
|
#include "transmit.h"
|
|
#include "pid.h"
|
|
#include "ir.h"
|
|
#include "utils.h"
|
|
|
|
// 指令定义
|
|
#define CMD_GET_BT_STATUS 0x10
|
|
#define CMD_GET_SPIFFS_STATUS 0x11
|
|
#define CMD_GET_DISTANCE 0x12
|
|
|
|
#define CMD_SET_NAME 0xA1
|
|
#define CMD_SET_PID 0xA2
|
|
#define CMD_MOTOR_MOVE_CONTROL 0x20
|
|
#define CMD_MOTOR_STEER_CONTROL 0x21
|
|
#define CMD_MOTOR_SINGLE_CONTROL 0x22
|
|
#define CMD_MOTOR_ROTATE_CONTROL 0x23
|
|
#define CMD_DEMO_PID 0xf0
|
|
#define CMD_DEMO_PATH 0xf1
|
|
#define CMD_MOTOR_XYR_CONTROL 0x24 // XYR轴向控制指令
|
|
|
|
#define CMD_STATUS_MOTOR 0xE0
|
|
|
|
class Handlers
|
|
{
|
|
public:
|
|
static void getBTStatus(BLECharacteristic &characteristic);
|
|
static void getSPIFFSStatus(BLECharacteristic &characteristic);
|
|
static void getDistance(BLECharacteristic &characteristic);
|
|
static void setName(BLECharacteristic &characteristic, uint8_t *packet);
|
|
static void setPID(BLECharacteristic &characteristic, uint8_t *packet);
|
|
static void motorMoveControl(BLECharacteristic &characteristic, uint8_t *packet);
|
|
static void motorSteerControl(BLECharacteristic &characteristic, uint8_t *packet);
|
|
static void motorRotateControl(BLECharacteristic &characteristic, uint8_t *packet);
|
|
static void motorSingleControl(BLECharacteristic &characteristic, uint8_t *packet);
|
|
static void motorXYRControl(BLECharacteristic &characteristic, uint8_t *packet);
|
|
static void demoPID(BLECharacteristic &characteristic, uint8_t *packet);
|
|
};
|
|
|
|
#endif |