Add blaster fire message
							parent
							
								
									f2918b441d
								
							
						
					
					
						commit
						90552382db
					
				| @ -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 ); | ||||
| 
 | ||||
| @ -0,0 +1,16 @@ | ||||
| #include "message.h" | ||||
| #include "connection.h" | ||||
| #include "robomaster.h" | ||||
| 
 | ||||
| void | ||||
| blaster_fire ( | ||||
| 		union Request* req, | ||||
|         uint16_t seq, | ||||
|         bool ack, | ||||
| 		enum FIRETYPE type, | ||||
| 		enum FIRETIMES times ) { | ||||
|     req->blaster.type = type; | ||||
|     req->blaster.times = times; | ||||
|     req_finalize(seq, BLASTER_FIRE_CMD, ack, req); | ||||
| } | ||||
| 
 | ||||
					Loading…
					
					
				
		Reference in New Issue