6DOF IMU 18 click
PRVIH_PAR_RECENICA_SA_PRODUCT_PAGE_DA_ISPRATE_CELINU
[click Product page](CLICK_PRODUCT_PAGE_LINK)
Click library
- Author : Stefan Ilic
- Date : Jan 2023.
- Type : I2C/SPI type
Software Support
We provide a library for the 6DOF IMU 18 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for 6DOF IMU 18 Click driver.
Standard key functions :
c6dofimu18_cfg_setup
Config Object Initialization function.
void c6dofimu18_cfg_setup(c6dofimu18_cfg_t *cfg)
6DOF IMU 18 configuration object setup function.
6DOF IMU 18 Click configuration object.
Definition: c6dofimu18.h:795
c6dofimu18_init
Initialization function.
err_t c6dofimu18_init(c6dofimu18_t *ctx, c6dofimu18_cfg_t *cfg)
6DOF IMU 18 initialization function.
6DOF IMU 18 Click context object.
Definition: c6dofimu18.h:772
c6dofimu18_default_cfg
Click Default Configuration function.
err_t c6dofimu18_default_cfg(c6dofimu18_t *ctx)
6DOF IMU 18 default configuration function.
Example key functions :
c6dofimu18_set_reg_bank
6DOF IMU 18 set register bank function.
err_t c6dofimu18_set_reg_bank(c6dofimu18_t *ctx, uint8_t bank)
6DOF IMU 18 set register bank function.
c6dofimu18_get_int1_state
6DOF IMU 18 read INT1 pin state function.
uint8_t c6dofimu18_get_int1_state(c6dofimu18_t *ctx)
6DOF IMU 18 read INT1 pin state function.
c6dofimu18_get_data_from_register
6DOF IMU 18 read data function.
err_t c6dofimu18_get_data_from_register(c6dofimu18_t *ctx, float *temperature_data, c6dofimu18_data_t *accel_data, c6dofimu18_data_t *gyro_data, uint32_t *tmst_data)
6DOF IMU 18 read data function.
6DOF IMU 18 data object.
Definition: c6dofimu18.h:821
Example Description
This library contains API for 6DOF IMU 18 Click driver. The library initializes and defines the I2C and SPI bus drivers to
write and read data from registers, as well as the default configuration for reading gyroscope and accelerator data, and temperature.
The demo application is composed of two sections :
Application Init
Initializes the driver after that resets the device and performs default configuration and reads the device id.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
uint8_t id = 0;
log_printf( &logger, " WHO AM I = 0X%.2X\r\n", (uint16_t)id );
log_info( &logger, " Application Task " );
}
@ C6DOFIMU18_OK
Definition: c6dofimu18.h:834
#define C6DOFIMU18_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: c6dofimu18.h:737
#define C6DOFIMU18_WHO_AM_I
Definition: c6dofimu18.h:123
#define C6DOFIMU18_BANK0_SEL
6DOF IMU 18 description setting.
Definition: c6dofimu18.h:209
err_t c6dofimu18_reg_read(c6dofimu18_t *ctx, uint8_t reg_bank, uint8_t reg, uint8_t *data_out, uint8_t len)
6DOF IMU 18 data reading function.
void application_init(void)
Definition: main.c:33
Application Task
This example demonstrates the use of the 6DOF IMU 18 Click board by
measuring and displaying acceleration and gyroscope data for X-axis, Y-axis, and Z-axis as well as temperature in degrees Celsius.
{
{
float temp_data;
uint32_t tmst_data;
log_printf( &logger, " TEMP: %.2f \r\n", temp_data );
log_printf( &logger,
" GYRO: x:%d y:%d z:%d \r\n", gyro_data.
data_x,gyro_data.
data_y,gyro_data.
data_z );
log_printf( &logger,
" ACCEL: x:%d y:%d z:%d \r\n", accel_data.
data_x,accel_data.
data_y,accel_data.
data_z );
log_printf( &logger, "========================== \r\n" );
Delay_ms( 1000 );
}
}
void application_task(void)
Definition: main.c:74
int16_t data_y
Definition: c6dofimu18.h:823
int16_t data_z
Definition: c6dofimu18.h:824
int16_t data_x
Definition: c6dofimu18.h:822
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.6DOFIMU18
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.