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;
|
2023-09-24 16:42:23 +02:00
|
|
|
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.,
|
|
|
|
};
|
2023-09-10 15:33:34 +02:00
|
|
|
} nrfRC;
|
|
|
|
|
2023-09-24 16:42:23 +02:00
|
|
|
nrfRC RCdata = nrfRC();
|
2023-09-10 15:33:34 +02:00
|
|
|
|
|
|
|
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
|