Add blaster fire message

This commit is contained in:
2023-05-23 10:15:34 -05:00
parent f2918b441d
commit 90552382db
9 changed files with 96 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#pragma once
#include "message.h"
#include <stdbool.h>
#include <stdint.h>
static const uint8_t BLASTER_HOST = 23;
static const uint8_t BLASTER_INDEX = 0;
#define BLASTER_FIRE_CMD 0x513F
enum FIRETYPE {
FIRETYPE_WATER = 0,
FIRETYPE_INFRARED = 1
};
enum FIRETIMES {
ONE = 1,
TWO = 2,
THREE = 3,
FOUR = 4,
FIVE = 5
};
void
blaster_fire (
union Request* req,
uint16_t seq,
bool ack,
enum FIRETYPE type,
enum FIRETIMES times );
+17
View File
@@ -248,6 +248,21 @@ struct PACKED SetSdkConnectionResp {
struct Footer footer;
};
struct PACKED BlasterFireReq {
struct Header header;
struct {
uint8_t type : 4;
uint8_t times : 4;
};
struct Footer footer;
};
struct PACKED BlasterFireResp {
struct Header header;
uint8_t retcode;
struct Footer footer;
};
union Request {
struct Header header;
struct SetSdkConnectionReq sdkconn;
@@ -261,6 +276,7 @@ union Request {
struct SubNodeResetReq subnodereset;
struct SubscribeAddNodeReq subnodeadd;
struct GimbalCtrlSpeedReq gimbspeed;
struct BlasterFireReq blaster;
};
union Response {
struct Header header;
@@ -275,6 +291,7 @@ union Response {
struct SubNodeResetResp subnodereset;
struct SubscribeAddNodeResp subnodeadd;
struct GimbalCtrlSpeedResp gimbspeed;
struct BlasterFireResp blaster;
};
union Message {
struct Header header;
+2
View File
@@ -65,6 +65,8 @@ int robot_drive(Robot, float x, float y, float r);
*/
int robot_led(Robot, unsigned char r, unsigned char g, unsigned char b);
int robot_blast(Robot);
/*
* If the robot is in ready mode, this makes the robot send a heartbeat in
* the next tick of the work function. The work function will not do anything
+1
View File
@@ -8,6 +8,7 @@ typedef struct Client* Client;
#include "chassis.h"
#include "sdk.h"
#include "gimbal.h"
#include "blaster.h"
Client client_new();
void client_connect(Client client);