1

Committer:
benkatz
Date:
Wed May 02 18:09:14 2018 +0000
Revision:
3:9ef9b4c66648
Fixed startup bug when plugged into UP board - SPI doesn't work if initialized when chip select is pulled low

Who changed what in which revision?

UserRevisionLine numberNew contents of line
benkatz 3:9ef9b4c66648 1 #ifndef _leg_message
benkatz 3:9ef9b4c66648 2 #define _leg_message
benkatz 3:9ef9b4c66648 3
benkatz 3:9ef9b4c66648 4 #include <stdint.h>
benkatz 3:9ef9b4c66648 5
benkatz 3:9ef9b4c66648 6 // 60 bytes
benkatz 3:9ef9b4c66648 7 // 30 16-bit words
benkatz 3:9ef9b4c66648 8 struct spi_data_t
benkatz 3:9ef9b4c66648 9 {
benkatz 3:9ef9b4c66648 10 float q_abad[2];
benkatz 3:9ef9b4c66648 11 float q_hip[2];
benkatz 3:9ef9b4c66648 12 float q_knee[2];
benkatz 3:9ef9b4c66648 13 float qd_abad[2];
benkatz 3:9ef9b4c66648 14 float qd_hip[2];
benkatz 3:9ef9b4c66648 15 float qd_knee[2];
benkatz 3:9ef9b4c66648 16 int32_t flags[2];
benkatz 3:9ef9b4c66648 17 int32_t checksum;
benkatz 3:9ef9b4c66648 18 };
benkatz 3:9ef9b4c66648 19
benkatz 3:9ef9b4c66648 20 // 132 bytes
benkatz 3:9ef9b4c66648 21 // 66 16-bit words
benkatz 3:9ef9b4c66648 22 struct spi_command_t
benkatz 3:9ef9b4c66648 23 {
benkatz 3:9ef9b4c66648 24 float q_des_abad[2];
benkatz 3:9ef9b4c66648 25 float q_des_hip[2];
benkatz 3:9ef9b4c66648 26 float q_des_knee[2];
benkatz 3:9ef9b4c66648 27 float qd_des_abad[2];
benkatz 3:9ef9b4c66648 28 float qd_des_hip[2];
benkatz 3:9ef9b4c66648 29 float qd_des_knee[2];
benkatz 3:9ef9b4c66648 30 float kp_abad[2];
benkatz 3:9ef9b4c66648 31 float kp_hip[2];
benkatz 3:9ef9b4c66648 32 float kp_knee[2];
benkatz 3:9ef9b4c66648 33 float kd_abad[2];
benkatz 3:9ef9b4c66648 34 float kd_hip[2];
benkatz 3:9ef9b4c66648 35 float kd_knee[2];
benkatz 3:9ef9b4c66648 36 float tau_abad_ff[2];
benkatz 3:9ef9b4c66648 37 float tau_hip_ff[2];
benkatz 3:9ef9b4c66648 38 float tau_knee_ff[2];
benkatz 3:9ef9b4c66648 39 int32_t flags[2];
benkatz 3:9ef9b4c66648 40 int32_t checksum;
benkatz 3:9ef9b4c66648 41 };
benkatz 3:9ef9b4c66648 42
benkatz 3:9ef9b4c66648 43
benkatz 3:9ef9b4c66648 44
benkatz 3:9ef9b4c66648 45 struct joint_control{
benkatz 3:9ef9b4c66648 46 float p_des, v_des, kp, kd, t_ff;
benkatz 3:9ef9b4c66648 47 };
benkatz 3:9ef9b4c66648 48
benkatz 3:9ef9b4c66648 49 struct joint_state{
benkatz 3:9ef9b4c66648 50 float p, v, t;
benkatz 3:9ef9b4c66648 51 };
benkatz 3:9ef9b4c66648 52
benkatz 3:9ef9b4c66648 53 struct leg_state{
benkatz 3:9ef9b4c66648 54 joint_state a, h, k;
benkatz 3:9ef9b4c66648 55 };
benkatz 3:9ef9b4c66648 56 struct leg_control{
benkatz 3:9ef9b4c66648 57 joint_control a, h, k;
benkatz 3:9ef9b4c66648 58 }
benkatz 3:9ef9b4c66648 59 ;
benkatz 3:9ef9b4c66648 60 #endif