00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef BRICK_IMU_V2_H
00012 #define BRICK_IMU_V2_H
00013
00014 #include "ip_connection.h"
00015
00016 #ifdef __cplusplus
00017 extern "C" {
00018 #endif
00019
00029 typedef Device IMUV2;
00030
00034 #define IMU_V2_FUNCTION_GET_ACCELERATION 1
00035
00039 #define IMU_V2_FUNCTION_GET_MAGNETIC_FIELD 2
00040
00044 #define IMU_V2_FUNCTION_GET_ANGULAR_VELOCITY 3
00045
00049 #define IMU_V2_FUNCTION_GET_TEMPERATURE 4
00050
00054 #define IMU_V2_FUNCTION_GET_ORIENTATION 5
00055
00059 #define IMU_V2_FUNCTION_GET_LINEAR_ACCELERATION 6
00060
00064 #define IMU_V2_FUNCTION_GET_GRAVITY_VECTOR 7
00065
00069 #define IMU_V2_FUNCTION_GET_QUATERNION 8
00070
00074 #define IMU_V2_FUNCTION_GET_ALL_DATA 9
00075
00079 #define IMU_V2_FUNCTION_LEDS_ON 10
00080
00084 #define IMU_V2_FUNCTION_LEDS_OFF 11
00085
00089 #define IMU_V2_FUNCTION_ARE_LEDS_ON 12
00090
00094 #define IMU_V2_FUNCTION_SAVE_CALIBRATION 13
00095
00099 #define IMU_V2_FUNCTION_SET_ACCELERATION_PERIOD 14
00100
00104 #define IMU_V2_FUNCTION_GET_ACCELERATION_PERIOD 15
00105
00109 #define IMU_V2_FUNCTION_SET_MAGNETIC_FIELD_PERIOD 16
00110
00114 #define IMU_V2_FUNCTION_GET_MAGNETIC_FIELD_PERIOD 17
00115
00119 #define IMU_V2_FUNCTION_SET_ANGULAR_VELOCITY_PERIOD 18
00120
00124 #define IMU_V2_FUNCTION_GET_ANGULAR_VELOCITY_PERIOD 19
00125
00129 #define IMU_V2_FUNCTION_SET_TEMPERATURE_PERIOD 20
00130
00134 #define IMU_V2_FUNCTION_GET_TEMPERATURE_PERIOD 21
00135
00139 #define IMU_V2_FUNCTION_SET_ORIENTATION_PERIOD 22
00140
00144 #define IMU_V2_FUNCTION_GET_ORIENTATION_PERIOD 23
00145
00149 #define IMU_V2_FUNCTION_SET_LINEAR_ACCELERATION_PERIOD 24
00150
00154 #define IMU_V2_FUNCTION_GET_LINEAR_ACCELERATION_PERIOD 25
00155
00159 #define IMU_V2_FUNCTION_SET_GRAVITY_VECTOR_PERIOD 26
00160
00164 #define IMU_V2_FUNCTION_GET_GRAVITY_VECTOR_PERIOD 27
00165
00169 #define IMU_V2_FUNCTION_SET_QUATERNION_PERIOD 28
00170
00174 #define IMU_V2_FUNCTION_GET_QUATERNION_PERIOD 29
00175
00179 #define IMU_V2_FUNCTION_SET_ALL_DATA_PERIOD 30
00180
00184 #define IMU_V2_FUNCTION_GET_ALL_DATA_PERIOD 31
00185
00189 #define IMU_V2_FUNCTION_ENABLE_STATUS_LED 238
00190
00194 #define IMU_V2_FUNCTION_DISABLE_STATUS_LED 239
00195
00199 #define IMU_V2_FUNCTION_IS_STATUS_LED_ENABLED 240
00200
00204 #define IMU_V2_FUNCTION_GET_PROTOCOL1_BRICKLET_NAME 241
00205
00209 #define IMU_V2_FUNCTION_GET_CHIP_TEMPERATURE 242
00210
00214 #define IMU_V2_FUNCTION_RESET 243
00215
00219 #define IMU_V2_FUNCTION_GET_IDENTITY 255
00220
00230 #define IMU_V2_CALLBACK_ACCELERATION 32
00231
00241 #define IMU_V2_CALLBACK_MAGNETIC_FIELD 33
00242
00252 #define IMU_V2_CALLBACK_ANGULAR_VELOCITY 34
00253
00262 #define IMU_V2_CALLBACK_TEMPERATURE 35
00263
00273 #define IMU_V2_CALLBACK_LINEAR_ACCELERATION 36
00274
00284 #define IMU_V2_CALLBACK_GRAVITY_VECTOR 37
00285
00296 #define IMU_V2_CALLBACK_ORIENTATION 38
00297
00308 #define IMU_V2_CALLBACK_QUATERNION 39
00309
00318 #define IMU_V2_CALLBACK_ALL_DATA 40
00319
00320
00330 #define IMU_V2_DEVICE_IDENTIFIER 18
00331
00337 #define IMU_V2_DEVICE_DISPLAY_NAME "IMU Brick 2.0"
00338
00345 void imu_v2_create(IMUV2 *imu_v2, const char *uid, IPConnection *ipcon);
00346
00353 void imu_v2_destroy(IMUV2 *imu_v2);
00354
00374 int imu_v2_get_response_expected(IMUV2 *imu_v2, uint8_t function_id, bool *ret_response_expected);
00375
00391 int imu_v2_set_response_expected(IMUV2 *imu_v2, uint8_t function_id, bool response_expected);
00392
00399 int imu_v2_set_response_expected_all(IMUV2 *imu_v2, bool response_expected);
00400
00407 void imu_v2_register_callback(IMUV2 *imu_v2, uint8_t id, void *callback, void *user_data);
00408
00415 int imu_v2_get_api_version(IMUV2 *imu_v2, uint8_t ret_api_version[3]);
00416
00427 int imu_v2_get_acceleration(IMUV2 *imu_v2, int16_t *ret_x, int16_t *ret_y, int16_t *ret_z);
00428
00439 int imu_v2_get_magnetic_field(IMUV2 *imu_v2, int16_t *ret_x, int16_t *ret_y, int16_t *ret_z);
00440
00451 int imu_v2_get_angular_velocity(IMUV2 *imu_v2, int16_t *ret_x, int16_t *ret_y, int16_t *ret_z);
00452
00460 int imu_v2_get_temperature(IMUV2 *imu_v2, int8_t *ret_temperature);
00461
00481 int imu_v2_get_orientation(IMUV2 *imu_v2, int16_t *ret_heading, int16_t *ret_roll, int16_t *ret_pitch);
00482
00499 int imu_v2_get_linear_acceleration(IMUV2 *imu_v2, int16_t *ret_x, int16_t *ret_y, int16_t *ret_z);
00500
00517 int imu_v2_get_gravity_vector(IMUV2 *imu_v2, int16_t *ret_x, int16_t *ret_y, int16_t *ret_z);
00518
00532 int imu_v2_get_quaternion(IMUV2 *imu_v2, int16_t *ret_w, int16_t *ret_x, int16_t *ret_y, int16_t *ret_z);
00533
00568 int imu_v2_get_all_data(IMUV2 *imu_v2, int16_t ret_acceleration[3], int16_t ret_magnetic_field[3], int16_t ret_angular_velocity[3], int16_t ret_euler_angle[3], int16_t ret_quaternion[4], int16_t ret_linear_acceleration[3], int16_t ret_gravity_vector[3], int8_t *ret_temperature, uint8_t *ret_calibration_status);
00569
00575 int imu_v2_leds_on(IMUV2 *imu_v2);
00576
00582 int imu_v2_leds_off(IMUV2 *imu_v2);
00583
00590 int imu_v2_are_leds_on(IMUV2 *imu_v2, bool *ret_leds);
00591
00606 int imu_v2_save_calibration(IMUV2 *imu_v2, bool *ret_calibration_done);
00607
00616 int imu_v2_set_acceleration_period(IMUV2 *imu_v2, uint32_t period);
00617
00623 int imu_v2_get_acceleration_period(IMUV2 *imu_v2, uint32_t *ret_period);
00624
00631 int imu_v2_set_magnetic_field_period(IMUV2 *imu_v2, uint32_t period);
00632
00638 int imu_v2_get_magnetic_field_period(IMUV2 *imu_v2, uint32_t *ret_period);
00639
00646 int imu_v2_set_angular_velocity_period(IMUV2 *imu_v2, uint32_t period);
00647
00653 int imu_v2_get_angular_velocity_period(IMUV2 *imu_v2, uint32_t *ret_period);
00654
00661 int imu_v2_set_temperature_period(IMUV2 *imu_v2, uint32_t period);
00662
00668 int imu_v2_get_temperature_period(IMUV2 *imu_v2, uint32_t *ret_period);
00669
00676 int imu_v2_set_orientation_period(IMUV2 *imu_v2, uint32_t period);
00677
00683 int imu_v2_get_orientation_period(IMUV2 *imu_v2, uint32_t *ret_period);
00684
00691 int imu_v2_set_linear_acceleration_period(IMUV2 *imu_v2, uint32_t period);
00692
00698 int imu_v2_get_linear_acceleration_period(IMUV2 *imu_v2, uint32_t *ret_period);
00699
00706 int imu_v2_set_gravity_vector_period(IMUV2 *imu_v2, uint32_t period);
00707
00713 int imu_v2_get_gravity_vector_period(IMUV2 *imu_v2, uint32_t *ret_period);
00714
00721 int imu_v2_set_quaternion_period(IMUV2 *imu_v2, uint32_t period);
00722
00728 int imu_v2_get_quaternion_period(IMUV2 *imu_v2, uint32_t *ret_period);
00729
00736 int imu_v2_set_all_data_period(IMUV2 *imu_v2, uint32_t period);
00737
00743 int imu_v2_get_all_data_period(IMUV2 *imu_v2, uint32_t *ret_period);
00744
00755 int imu_v2_enable_status_led(IMUV2 *imu_v2);
00756
00767 int imu_v2_disable_status_led(IMUV2 *imu_v2);
00768
00774 int imu_v2_is_status_led_enabled(IMUV2 *imu_v2, bool *ret_enabled);
00775
00785 int imu_v2_get_protocol1_bricklet_name(IMUV2 *imu_v2, char port, uint8_t *ret_protocol_version, uint8_t ret_firmware_version[3], char ret_name[40]);
00786
00797 int imu_v2_get_chip_temperature(IMUV2 *imu_v2, int16_t *ret_temperature);
00798
00809 int imu_v2_reset(IMUV2 *imu_v2);
00810
00823 int imu_v2_get_identity(IMUV2 *imu_v2, char ret_uid[8], char ret_connected_uid[8], char *ret_position, uint8_t ret_hardware_version[3], uint8_t ret_firmware_version[3], uint16_t *ret_device_identifier);
00824
00825 #ifdef __cplusplus
00826 }
00827 #endif
00828
00829 #endif