Inclinometer click
Inclinometer Click is a compact add-on board that offers best-in-class characteristics for inclination measurements. This board features the SCL3300, a high-performance inclinometer sensor component from Murata.
click Product page
Click library
- Author : Luka Filipovic
- Date : Jun 2021.
- Type : SPI type
Software Support
We provide a library for the Inclinometer 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 Inclinometer Click driver.
Standard key functions :
inclinometer_cfg_setup
Config Object Initialization function.
void inclinometer_cfg_setup(inclinometer_cfg_t *cfg)
Inclinometer configuration object setup function.
Inclinometer Click configuration object.
Definition inclinometer.h:180
inclinometer_init
Initialization function.
err_t inclinometer_init(inclinometer_t *ctx, inclinometer_cfg_t *cfg)
Inclinometer initialization function.
Inclinometer Click context object.
Definition inclinometer.h:164
inclinometer_default_cfg
Click Default Configuration function.
err_t inclinometer_default_cfg(inclinometer_t *ctx)
Inclinometer default configuration function.
Example key functions :
inclinometer_get_axes
Axes reading.
err_t inclinometer_get_axes(inclinometer_t *ctx, inclinometer_accel_t *axes_data)
Axes reading.
Inclinometer Click axis/angle data object.
Definition inclinometer.h:199
inclinometer_get_angle
Angle reading.
err_t inclinometer_get_angle(inclinometer_t *ctx, inclinometer_accel_t *angle_data)
Angle reading.
inclinometer_get_temperature
Temperature reading.
err_t inclinometer_get_temperature(inclinometer_t *ctx, float *temperature)
Temperature reading.
Example Description
This example showcases ability of device to configure it for
resolution and read Axis/Angle/Temperature data.
The demo application is composed of two sections :
Application Init
Initialization of the Host communication modules(UART, SPI).
Sets default configuration where powe-up sequence is done with selecting MODE1 and enabling output on Angle channels. Read status and checks WhoAmI register. In the end example type is selected( for reading Axes, Angles or Temperature data ).
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( SPI_MASTER_ERROR == init_flag )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
{
log_error( &logger, " Default configuration. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
Delay_ms ( 1000 );
log_info( &logger, " Application Task " );
}
#define INCLINOMETER_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition inclinometer.h:150
@ INCLINOMETER_ERROR
Definition inclinometer.h:213
void application_init(void)
Definition main.c:51
@ EXAMPLE_AXIS
Definition main.c:41
Application Task
Depending on the example type selected task is reading different data.
If EXAMPLE_AXIS selected it reads 3 axes values in range of -1<->1g. If EXAMPLE_ANGLE is slected it reads 3 angle values in range of -90<->90deg. EXAMPLE_TEMP reads temperature data from device in degC.
{
switch ( example_type )
{
{
log_printf( &logger,
"> ACCEL X[g]: %.2f\r\n", axes_data.
x );
log_printf( &logger,
"> ACCEL Y[g]: %.2f\r\n", axes_data.
y );
log_printf( &logger,
"> ACCEL Z[g]: %.2f\r\n", axes_data.
z );
break;
}
{
log_printf( &logger,
"> ANGLE X[deg]: %.2f\r\n", angle_data.
x );
log_printf( &logger,
"> ANGLE Y[deg]: %.2f\r\n", angle_data.
y );
log_printf( &logger,
"> ANGLE Z[deg]: %.2f\r\n", angle_data.
z );
break;
}
{
float temp_data = 0;
log_printf( &logger, "> Temperature[degC]: %.2f\r\n", temp_data );
break;
}
default:
{
log_error( &logger, " Example type." );
break;
}
}
log_printf( &logger, "*************************************\r\n" );
Delay_ms ( 100 );
}
void application_task(void)
Definition main.c:95
@ EXAMPLE_TEMP
Definition main.c:43
@ EXAMPLE_ANGLE
Definition main.c:42
float y
Definition inclinometer.h:201
float x
Definition inclinometer.h:200
float z
Definition inclinometer.h:202
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.Inclinometer
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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.