JuReceiver/system_general/rc_data.h

23 lines
463 B
C
Raw Normal View History

2023-09-10 15:33:34 +02:00
#define jType_RC 0
#ifndef _J_RC_DATA_H
#define _J_RC_DATA_H
typedef struct {
byte type = 0;
byte command;
uint16_t btns;
int16_t analog[14];
} nrfRC;
nrfRC RCdata;
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