Barometer 12 click
Barometer 12 Click is a compact add-on board that measures air pressure in a specific environment. This board features the ICP-10125, a high-accuracy, low-power, 10-atm waterproof barometric pressure and temperature sensor from TDK InvenSense.
click Product page
Click library
- Author : Stefan Ilic
- Date : May 2023.
- Type : I2C type
Software Support
We provide a library for the Barometer 12 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 Barometer 12 Click driver.
Standard key functions :
barometer12_cfg_setup
Config Object Initialization function.
void barometer12_cfg_setup(barometer12_cfg_t *cfg)
Barometer 12 configuration object setup function.
Barometer 12 Click configuration object.
Definition barometer12.h:165
barometer12_init
Initialization function.
err_t barometer12_init(barometer12_t *ctx, barometer12_cfg_t *cfg)
Barometer 12 initialization function.
Barometer 12 Click context object.
Definition barometer12.h:151
barometer12_default_cfg
Click Default Configuration function.
err_t barometer12_default_cfg(barometer12_t *ctx)
Barometer 12 default configuration function.
Example key functions :
barometer12_inv_invpres_calib
Barometer 12 inverse process data function.
err_t barometer12_inv_invpres_calib(barometer12_t *ctx, barometer12_invpres_t *cfg_data)
Barometer 12 inverse process data function.
Barometer 12 Click structure to hold pressure sensor related parameters object.
Definition barometer12.h:181
barometer12_get_raw_data
Barometer 12 get RAW data function.
err_t barometer12_get_raw_data(barometer12_t *ctx, uint16_t measurement_comd, uint32_t *pressure, uint16_t *temperature)
Barometer 12 get RAW data function.
barometer12_get_press_and_temp
Barometer 12 get pressure and temperature function.
err_t barometer12_get_press_and_temp(barometer12_t *ctx, float *pressure, float *temperature)
Barometer 12 get pressure and temperature function.
Example Description
This library contains API for the Barometer 12 Click driver. The library initializes and defines the I2C bus drivers to write and read data from registers. This demo application shows an example of atmospheric pressure and temperature measurement.
The demo application is composed of two sections :
Application Init
The initialization of the I2C module and log UART. After driver initialization and default settings, the app display device ID.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
static uint16_t device_id;
{
log_error( &logger, " Communication Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
log_printf( &logger, " Device ID : 0x%.4X \r\n", device_id );
log_printf( &logger, "----------------------------\r\n" );
Delay_ms ( 1000 );
log_info( &logger, " Application Task " );
}
@ BAROMETER12_ERROR
Definition barometer12.h:199
#define BAROMETER12_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition barometer12.h:139
err_t barometer12_get_device_id(barometer12_t *ctx, uint16_t *device_id)
Barometer 12 get device ID function.
void application_init(void)
Definition main.c:35
Application Task
This is an example that shows the use of a Barometer 12 Click boardâ„¢. Logs the atmospheric pressure [ Pa ] and temperature [ degree Celsius ] data. Results are being sent to the Usart Terminal where you can track their changes.
{
float pressure;
float temperature;
log_printf( &logger, " Pressure : %.2f Pa\r\n", pressure );
log_printf( &logger, " Temperature : %.2f C\r\n", temperature );
log_printf( &logger, "----------------------------\r\n" );
Delay_ms ( 1000 );
}
void application_task(void)
Definition main.c:85
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.Barometer12
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.