diff --git a/bldc_interface.cpp b/bldc_interface.cpp index b192e94d7b11c9f624aa362d04a84bb0ed75da50..f63d310135221e74df86c333b5775060dd1097bd 100644 --- a/bldc_interface.cpp +++ b/bldc_interface.cpp @@ -659,7 +659,22 @@ void bldc_interface_set_servo_pos(float pos) { buffer_append_float16(send_buffer, pos, 1000.0, &send_index); send_packet_no_fwd(send_buffer, send_index); } - +*/ +void bldc_interface_set_uartchuck_data(const chuck_data *chuck_d_remote) { + uint8_t send_buffer[13]; + int send_index = 0; + fwd_can_append(send_buffer, &send_index); + send_buffer[send_index++] = COMM_CUSTOM_APP_DATA; + send_buffer[send_index++] = (uint8_t) chuck_d_remote->js_x; + send_buffer[send_index++] = (uint8_t) chuck_d_remote->js_y; + send_buffer[send_index++] = (uint8_t) chuck_d_remote->bt_c; + send_buffer[send_index++] = (uint8_t) chuck_d_remote->bt_z; + buffer_append_int16(send_buffer, chuck_d_remote->acc_x, &send_index); + buffer_append_int16(send_buffer, chuck_d_remote->acc_y, &send_index); + buffer_append_int16(send_buffer, chuck_d_remote->acc_z, &send_index); + send_packet_no_fwd(send_buffer, send_index); +} +/* void bldc_interface_set_mcconf(const mc_configuration *mcconf) { int send_index = 0; fwd_can_append(send_buffer, &send_index); diff --git a/bldc_interface.h b/bldc_interface.h index f49ee2501c81071700cad1e1f500a2f7e0d3dc09..e80316e3df433248b35f8e60a1345d87bead2792 100644 --- a/bldc_interface.h +++ b/bldc_interface.h @@ -52,6 +52,7 @@ void bldc_interface_set_current_brake(float current); void bldc_interface_set_rpm(int rpm); void bldc_interface_set_pos(float pos); void bldc_interface_set_servo_pos(float pos); +void bldc_interface_set_uartchuck_data(const chuck_data *chuck_d_remote); // JL void bldc_interface_set_mcconf(const mc_configuration *mcconf); void bldc_interface_set_appconf(const app_configuration *appconf); diff --git a/comm_uart_arduino.cpp b/comm_uart_arduino.cpp index c8bd371b0e4be896e6a6c36781a6c1671be70dd0..d88085f6f35438b987f421d9bd75ec69b2fe1f76 100644 --- a/comm_uart_arduino.cpp +++ b/comm_uart_arduino.cpp @@ -27,7 +27,7 @@ // Settings -#define __CUA_UART_BAUDRATE 9600 //115200 +#define __CUA_UART_BAUDRATE 115200 // 9600 // Private functions static void send_packet(unsigned char *data, int len); diff --git a/datatypes.h b/datatypes.h index 09c99a36e7c2378cd67a91383cc8076143c3ad5e..4969bdb8e131c20f273a0ac3223002d6a93d733f 100644 --- a/datatypes.h +++ b/datatypes.h @@ -268,6 +268,16 @@ typedef struct { float tc_max_diff; } chuk_config; +typedef struct { + int js_x; + int js_y; + int acc_x; + int acc_y; + int acc_z; + bool bt_c; + bool bt_z; +} chuck_data; + // NRF Datatypes typedef enum { NRF_SPEED_250K = 0,