proximity13 2.0.0.0
Main Page

Proximity 13 click

Proximity 13 Click based on SI1153-AB09-GMR IC from Silicon Labs that can be used as an proximity, and gesture detector with I2C digital interface and programmable-event interrupt output.

click Product page


Click library

  • Author : Luka Filipovic
  • Date : Jan 2020.
  • Type : I2C type

Software Support

We provide a library for the Proximity13 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

‍This library contains API for Proximity13 Click driver.

Standard key functions :

  • Config Object Initialization function.

    ‍void proximity13_cfg_setup ( proximity13_cfg_t *cfg );

    - Initialization function.

    ‍PROXIMITY13_RETVAL proximity13_init ( proximity13_t *ctx, proximity13_cfg_t *cfg );

  • Click Default Configuration function.

    ‍void proximity13_default_cfg ( proximity13_t *ctx );

Example key functions :

  • This function writes data to the desired register.

    ‍void proximity13_generic_write ( proximity13_t *ctx, uint8_t reg_adr, uint8_t write_data );

    - This function reads data from the desired register.

    ‍uint8_t proximity13_generic_read ( proximity13_t *ctx, uint8_t reg_adr );

  • This function reads all enabled channels.

    ‍void proximity13_read_channels ( proximity13_t *ctx, proximity13_chn_val_t *chn_val );

    Examples Description

‍This demo application shows example for measuring close distance.

The demo application is composed of two sections :

Application Init

‍Initialization of I2C module and additional pin, checks id of device, configurates device for measuring 1. channel, and then sends command to start measuring.

void application_init ( void )
{
log_cfg_t log_cfg;
uint8_t status;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init" );
// Click initialization.
PROXIMITY13_MAP_MIKROBUS( cfg, MIKROBUS_1 );
proximity13_init( &proximity13, &cfg );
status = proximity13_get_int_pin_status( &proximity13 );
while ( status != PROXIMITY13_PIN_HIGH );
status = porximity13_check_id( &proximity13 );
if ( status == PROXIMITY13_OK )
{
log_info( &logger, " Device OK" );
}
else
{
log_info( &logger, " Device Error" );
for ( ; ; );
}
log_info( &logger, " Setting default configuration" );
proximity13_default_cfg ( &proximity13 );
log_info( &logger, " Starting measurement" );
}
#define PROXIMITY13_CMD_START
Definition proximity13.h:191
#define PROXIMITY13_OK
Definition proximity13.h:78
#define PROXIMITY13_MAP_MIKROBUS(cfg, mikrobus)
Definition proximity13.h:66
#define PROXIMITY13_PIN_HIGH
Definition proximity13.h:271
uint8_t porximity13_check_id(proximity13_t *ctx)
Checks id of the device.
PROXIMITY13_RETVAL proximity13_init(proximity13_t *ctx, proximity13_cfg_t *cfg)
Initialization function.
uint8_t proximity13_get_int_pin_status(proximity13_t *ctx)
Checks status of int pin.
void proximity13_cfg_setup(proximity13_cfg_t *cfg)
Config Object Initialization function.
void proximity13_default_cfg(proximity13_t *ctx)
Click Default Configuration function.
uint8_t proximity13_send_command(proximity13_t *ctx, uint8_t cmd_val)
Sends command to command register.
void application_init(void)
Definition main.c:34
Click configuration structure definition.
Definition proximity13.h:317

Application Task

‍Appliction measures values every 100ms and logs result.

void application_task ( void )
{
proximity13_read_channels( &proximity13, &chn_val );
log_printf( &logger, " Data : %u\r\n", chn_val.channel_1 );
Delay_ms ( 100 );
}
void proximity13_read_channels(proximity13_t *ctx, proximity13_chn_val_t *chn_val)
Reads all enabled channels.
void application_task(void)
Definition main.c:80
Structure for reading values of channels.
Definition proximity13.h:349
uint32_t channel_1
Definition proximity13.h:351

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Proximity13

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.