9DOF 3 Click
9DOF 3 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Click Library
- Author : MikroE Team
- Date : jun 2020.
- Type : I2C/SPI type
Software Support
Example Description
This Click introduces a small-scale absolute orientation sensor in the class of low-noise 9-axis measurement units. It comprises the full functionality of a triaxial, low-g acceleration sensor, a triaxial angular rate sensor and a triaxial geomagnetic sensor. All three sensor components can be operated and addressed independently from each other. 9DOF 3 Click offers both SPI and I2C digital interfaces
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.9Dof3
Example Key Functions
- c9dof3_cfg_setup Config Object Initialization function.
void c9dof3_cfg_setup(c9dof3_cfg_t *cfg)
Config Object Initialization function.
Click configuration structure definition.
Definition c9dof3.h:491
- c9dof3_init Initialization function.
C9DOF3_RETVAL c9dof3_init(c9dof3_t *ctx, c9dof3_cfg_t *cfg)
Initialization function.
struct c9dof3_s c9dof3_t
Click ctx object definition.
- c9dof3_default_cfg Click Default Configuration function.
void c9dof3_default_cfg(c9dof3_t *ctx)
Click Default Configuration function.
- c9dof3_check_communication The function check device ID for accelerometer, gyroscope and magnetometer.
uint8_t c9dof3_check_communication(c9dof3_t *ctx)
Check communication function.
- c9dof3_get_data Function read Accel, Gyro and Mag X-axis, Y-axis data and Z-axis data.
void c9dof3_get_data(c9dof3_t *ctx, c9dof3_accel_t *accel_data, c9dof3_gyro_t *gyro_data, c9dof3_mag_t *mag_data)
Read Accel, Gyro and Mag data function.
c9dof3_gyro_t gyro_data
Definition main.c:39
c9dof3_mag_t mag_data
Definition main.c:40
c9dof3_accel_t accel_data
Definition main.c:38
- c9dof3_generic_read This function reads data from the desired register.
void c9dof3_generic_read(c9dof3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
Application Init
Initialization driver enables - I2C or SPI, check communication, set default configuration for accelerometer, gyroscope and magnetometer, also write log.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
Delay_ms ( 100 );
{
log_printf( &logger, " Communication OK \r\n" );
}
else
{
log_printf( &logger, " Communication ERROR \r\n" );
log_printf( &logger, " Reset the device \r\n" );
log_printf( &logger, "-------------------------\r\n" );
for ( ; ; );
}
log_printf( &logger, "-------------------------\r\n" );
Delay_ms ( 100 );
}
#define C9DOF3_ACC_COMM_SUCCESS
Definition c9dof3.h:407
#define C9DOF3_GYRO_COMM_SUCCESS
Definition c9dof3.h:409
#define C9DOF3_MAG_COMM_SUCCESS
Definition c9dof3.h:411
#define C9DOF3_MAP_MIKROBUS(cfg, mikrobus)
Definition c9dof3.h:68
void application_init(void)
Definition main.c:44
Application Task
This is an example which demonstrates the use of 9DOF 3 Click board. Measures and displays Accel, Gyroscope and Magnetometer values for X-axis, Y-axis and Z-axis. Results are being sent to the Usart Terminal where you can track their changes. All data logs write on USB uart changes for every 1 sec.
{
log_printf( &logger, "------------------------------------------\r\n" );
Delay_ms ( 1000 );
}
void application_task(void)
Definition main.c:88
Application Output
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Additional Notes and Information
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.