SPQR-Team1-2020/include/status_vector.h

35 lines
904 B
C
Raw Normal View History

2020-02-05 18:57:11 +01:00
#pragma once
2020-02-05 19:46:57 +01:00
2020-02-05 18:57:11 +01:00
#include <Arduino.h>
2020-02-05 19:46:57 +01:00
#ifdef STATUS_VECTOR_CPP
#define sv_extr
#else
#define sv_extr extern
#endif
#define dim 20
#define CURRENT_DATA_READ (datas[(currentSVIndex-1) % dim])
#define CURRENT_DATA_WRITE (datas[(currentSVIndex) % dim])
#define CURRENT_INPUT_READ (inputs[(currentSVIndex-1) % dim])
#define CURRENT_INPUT_WRITE (inputs[(currentSVIndex) % dim])
2020-02-05 18:57:11 +01:00
typedef struct input{
int IMUAngle, USfr, USsx, USdx, USrr, BT;
byte ballByte, cameraByte, lineByte;
bool SW_DX, SW_SX;
}input;
typedef struct data{
int IMUAngle, ballAngle, ballDistance, cameraAngle, cameraDistance,
speed, tilt, dir, USfr, USsx, USdx, USrr, lineOutDir, matePos, role;
byte xb, yb, xy, yy, lineSeen, lineActive;
bool mate, ATKgoal, DEFgoal;
}data;
2020-02-05 19:46:57 +01:00
sv_extr input inputs[dim];
sv_extr data datas[dim];
sv_extr int currentSVIndex;
void initStatusVector();
void updateStatusVector();