23 lines
463 B
C
23 lines
463 B
C
|
#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
|