DJI NAZA-M controller (multi copter side) see: https://developer.mbed.org/users/okini3939/notebook/drone/

Dependencies:   FutabaSBUS NECnfc mbed

Committer:
okini3939
Date:
Thu May 19 08:59:45 2016 +0000
Revision:
1:32cd1cf5d5b1
Parent:
0:4a37291f07ca
1st build;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okini3939 0:4a37291f07ca 1
okini3939 0:4a37291f07ca 2 #define DATA_TYPE_AIR 1
okini3939 0:4a37291f07ca 3 #define DATA_TYPE_GROUND 2
okini3939 0:4a37291f07ca 4
okini3939 0:4a37291f07ca 5 struct AirData {
okini3939 0:4a37291f07ca 6 uint8_t magic[4];
okini3939 0:4a37291f07ca 7 int16_t seq;
okini3939 0:4a37291f07ca 8 int16_t type;
okini3939 0:4a37291f07ca 9 int16_t aileron; // Right stick/L-R
okini3939 0:4a37291f07ca 10 int16_t elevator; // Left stick/D-U
okini3939 0:4a37291f07ca 11 int16_t throttle; // Right stick/D-U
okini3939 0:4a37291f07ca 12 int16_t rudder; // Left stick/L-R
okini3939 0:4a37291f07ca 13 int16_t analog1;
okini3939 0:4a37291f07ca 14 int16_t analog2;
okini3939 0:4a37291f07ca 15 int16_t sw1;
okini3939 0:4a37291f07ca 16 int16_t sw2;
okini3939 0:4a37291f07ca 17 int16_t flags;
okini3939 0:4a37291f07ca 18 uint8_t sum;
okini3939 0:4a37291f07ca 19 } __attribute__((packed));
okini3939 0:4a37291f07ca 20
okini3939 0:4a37291f07ca 21 struct GroundData {
okini3939 0:4a37291f07ca 22 uint8_t magic[4];
okini3939 0:4a37291f07ca 23 int16_t seq;
okini3939 0:4a37291f07ca 24 int16_t type;
okini3939 0:4a37291f07ca 25 int16_t uptime;
okini3939 0:4a37291f07ca 26 int16_t battery;
okini3939 0:4a37291f07ca 27 int16_t current;
okini3939 0:4a37291f07ca 28 int32_t amphour;
okini3939 0:4a37291f07ca 29 int16_t distance1, distance2;
okini3939 0:4a37291f07ca 30 uint8_t gps[60];
okini3939 0:4a37291f07ca 31 uint8_t compass[10];
okini3939 0:4a37291f07ca 32 uint8_t sum;
okini3939 0:4a37291f07ca 33 } __attribute__((packed));
okini3939 0:4a37291f07ca 34
okini3939 0:4a37291f07ca 35 struct Status {
okini3939 0:4a37291f07ca 36 int gps_date, gps_time, gps_lat, gps_lng, gps_h;
okini3939 0:4a37291f07ca 37 int gps_sat, gps_type, gps_flg, gps_lost;
okini3939 0:4a37291f07ca 38 int compass_x, compass_y, compass_z, compass;
okini3939 0:4a37291f07ca 39 int uptime, battery, current, amphour;
okini3939 0:4a37291f07ca 40 int distance1, distance2;
okini3939 0:4a37291f07ca 41 int current_sum, current_count;
okini3939 0:4a37291f07ca 42 };
okini3939 0:4a37291f07ca 43
okini3939 0:4a37291f07ca 44 void recvRf (struct AirData *recv_data, int rssi);
okini3939 0:4a37291f07ca 45 int sendRf (struct GroundData *send_data);
okini3939 0:4a37291f07ca 46 void pollRf ();
okini3939 0:4a37291f07ca 47 int initRf ();
okini3939 0:4a37291f07ca 48
okini3939 0:4a37291f07ca 49 void initCan ();
okini3939 0:4a37291f07ca 50
okini3939 0:4a37291f07ca 51 void setFailsafeSBus (int flg);
okini3939 0:4a37291f07ca 52 void setSBus (int ch, int num);
okini3939 0:4a37291f07ca 53 void initSBus ();
okini3939 0:4a37291f07ca 54
okini3939 0:4a37291f07ca 55 void initI2c ();
okini3939 0:4a37291f07ca 56 void pollI2c ();
okini3939 0:4a37291f07ca 57 int sendI2c (struct GroundData *send_data);