JuReceiver/system_general/rc_data.h
2023-09-24 16:42:23 +02:00

25 lines
No EOL
555 B
C

#define jType_RC 0
#ifndef _J_RC_DATA_H
#define _J_RC_DATA_H
typedef struct {
byte type = 0;
byte command = 0;
uint16_t btns = 0;
int16_t analog[14] = {
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
};
} nrfRC;
nrfRC RCdata = nrfRC();
void RCdataradioTask() {
memmove(&RCdata, &jRCbuff, sizeof(RCdata));
if (_j_on_data != nullptr) _j_on_data();
}
bool RCgetBTN(byte i) { return (RCdata.btns >> min(16 - 1, (int)i)) & 1; }
int16_t RCgetAnalog(byte i) { return RCdata.analog[min(14 - 1, (int)i)]; }
#endif